Michael Norrish
Michael Norrish

Reputation: 412

How to get a list of to-be-added files that don't have svn:mime-type property set?

I am trying to perform a big checkin of a lot of semi-automatically generated files, and they should all have svn:mime-type properties. I've set a lot using find, but how do I now find all those remaining files that are to be added and which haven't had a MIME type assigned?

Upvotes: 1

Views: 98

Answers (2)

seth
seth

Reputation: 37267

You could do something like this.

Have a script like this:

 #!/bin/sh

 for x do
    mt=`svn propget svn:mime-type $x`
     if [ -z $mt ]; then
        echo "setting mime-type for $x"
        svn propset svn:mime-type MIME_TYPE_HERE $x
    fi
 done

Then you could call it via xargs and find

find . -type f -name "newfile*" -print | xargs my_check_script.sh

Upvotes: 1

Michael Norrish
Michael Norrish

Reputation: 412

Following Seth's basic idea, I did

for x do
  mt=$(svn pg svn:mime-type $x 2> /dev/null)
  if [ -z $mt ]
  then
    echo $x
  fi
done

in the file no-mime-type.sh (made executable etc etc). Then

find . -type f \! -regex '.*\.svn.*' | xargs no-mime-type.sh

There's probably a better way to avoid the .svn directories that are lying around.

Upvotes: 0

Related Questions