Showing posts with label subversion. Show all posts
Showing posts with label subversion. Show all posts

Sunday, September 5, 2010

The Subversion svn:executable property

Set the Subversion executable property with ...

svn propset svn:executable script_that_does_something.py

... to teach Subversion that script_that_does_something.py should be executable.

(If you ask for svn propset --help Subversion will tell you that there are two different command forms of propset. But the one given here is usually the one we want.)

The benefit here is that future check-outs of the repository that contains script_that_does_something.py will have the executability permission bits set on the file from the moment it is checked out. This means that you'll be able to check out and then execute the script immediately afterwards without having to first chmod 755 the script.

Interesting potential side-effect of using svn:executable is that you may occasionally find a non-executable file listed as executable in the output of ls -l:

$ ls -l
total 29056
-rwxr-xr-x 1 foo foo 1473 Jun 17 10:52 simple-text-file.rtf

Two things could be going on here.

It could be that you manually set simple-text-file.rtf to executable with a call to chmod 755 simple-text-file.rtf or equivalent at some point. If that's the case then chmod 644 simple-text-file.rtf will unset the executability bits on the file.

Alternatively, it could be that the svn:executable property is set on simple-text-file.rtf in the repository that houses the file. If that's the case then chmod 644 simple-text-file.rtf will not do what you think. The command will instead set simple-text-file.rtf to nonexecutable only until the next check-in. After next check-in simple-text-file.rtf will again be marked as executable. The reason for this is that changing permissions on your local copy of the file does nothing to remove the svn:executable property from the copy of the file in the repository. The solution here is to remove svn:executable with svn propdel svn:executable simple-text-file.rtf.

Thursday, May 8, 2008

Subversion global-ignores

The subversion book documents properties here and config files here. You need to read both to figure out how to tell subversion to, for example, ignore files ending in .pyc. The secret directory ~/.subversion houses the appropriate config file.

$ cd ~/.subversion
$ vi config

Then search for the global-ignores property. And edit accordingly.

global-ignores = *.pyc *.skl *.pkl *.swp *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .

Subversion quick reference

To get HELP on subversion:
  1. svn help <command>
  2. the svn manual is at http://svnbook.red-bean.com/

To REVERT uncommitted changes inside a branch:
  1. cp <file> to another location as a precaution
  2. svn revert <file> or svn revert -R to recursively revert all files

To RESOLVE merge conflicts:

  1. svn status to display C€ in first column for conflicted files
  2. manually fix each file and replace old binary files with new ones
  3. type svn resolved <file>€ for each file or type svn -R resolved€ to resolve all files recursively
  4. svn commit

To CREATE <branch>:

  1. svn copy svn://svn/<repository>/trunk svn://svn//branches/<branch>
  2. <branch> creates within the repository and does not create locally
  3. auto-commit will follow

To CREATE <new branch> from <old branch>:

  1. svn copy svn://svn/<repository>/branches/<old branch> svn://svn/<repository>/branches/<new branch>
  2. <branch> creates within the repository and does not create locally
  3. auto-commit will follow

to DELETE <branch>:

  1. svn delete svn://svn/<repository>/branches/<branch>
  2. <branch> removes within the repository; careful!
  3. auto-commit will follow

To MERGE <branch> to <trunk>:

  1. cd to local copy of <branch>
  2. get the rev. number where the branch was created, or where it was last merged: svn log --stop-on-copy
  3. cd to local copy of <trunk>
  4. make sure it's the latest & greatest: svn update
  5. do the actual merge; plug in <rev> and <branch>: svn merge -r <rev>:HEAD svn://svn/<repository>/branches/<branch>
  6. resolve conflicts
  7. svn commit

To MERGE from <trunk> to <branch>

  1. cd to local copy of <branch>
  2. get the rev. number where <branch> was created: svn log --stop-on-copy
  3. svn merge -r <rev>:HEAD svn://svn/<repository>/trunk <branch>
  4. resolve conflicts
  5. svn commit

To MERGE from <new branch> to <old branch>

  1. cd to local copy of <old branch>
  2. get the rev. number where the old branch was created: svn log --stop-on-copy
  3. cd to local copy of <new branch>
  4. svn merge -r <rev>:HEAD svn://svn/<repository>/branches/<old branch>
  5. resolve conflicts
  6. svn commit

Bill authored this last week for the guys at work.