Setting the SVN "execute" bit in a Subversion repository using TortoiseSVN or command line SVN

SvnVersion ControlTortoisesvn

Svn Problem Overview


I've got an open-source app that is hosted at code.google.com. It is cross platform ( Linux / Windows / Mac ). I uploaded the code initially from a WinXP machine using TortoiseSVN and it seems that none of the "configure" batch files that are used for the linux build have their "execute" bits set.

What would be the easiest way to set these for the files that need them? Using TortoiseSVN would be easier, I suppose, but if that can't be used, then I could also use the command line SVN on my linux machine.

Svn Solutions


Solution 1 - Svn

Here's how to do it on the command line:

for file in `find . -name configure`; do
  svn ps svn:executable yes ${file}
done

Or for just one file (configure is the filename here):

svn ps svn:executable yes configure

Solution 2 - Svn

With tortoise SVN, it's quite easy: you can select several files (may be from search results, so they don't have to be in the same directory), select "properties" in the TortoiseSVN menu, add the needed property (there is a drop-down list of the mostly used properties, in this case "svn:executable") and set the value (in this case "*"). If committing the changed files and checking them out under linux, the executable bit will be set.

If you want to set more than one property at once, it may be more secure (in case of mistakes) to first set the properties correctly for one file, export them into a file, select all needed files, select the "properties" menu and import the previously saved properties.

Solution 3 - Svn

On Unix use {} to adress resulset:

find . -type f -name "*.bat" -exec svn propset svn:executable yes '{}' \;

Does anyone know why this property requires "yes" as valid argument? Found another example with '' instead of yes, works too...

Solution 4 - Svn

find . -type f -name "*.bat" -exec svn propset svn:executable yes "${}" \;

Of course the same goes for .exe, etc.

Solution 5 - Svn

Method for restoring executable permissions that are lost during svn import:

copy permissions from your original source that you used during svn import (current dir to version1):

find . -type f | xargs -I {} chmod --reference {} ../version1/{}

then set svn:executable for all executables using the following shell script:

for file in `find . -executable -type f`; do
  svn ps svn:executable yes ${file}
done

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKPexEAView Question on Stackoverflow
Solution 1 - SvnbmdhacksView Answer on Stackoverflow
Solution 2 - SvnAndreasView Answer on Stackoverflow
Solution 3 - SvnErikView Answer on Stackoverflow
Solution 4 - SvnTim OttingerView Answer on Stackoverflow
Solution 5 - SvnldgormanView Answer on Stackoverflow