Search code examples
svnrevision

How do I say something like HEAD-1 in svn?


I want to refer to a revision just before head or n-revisions before HEAD or something like that.


Solution

  • Long story short - you can't without running a command. With check-in hooks you can get access to 'the version before this one', otherwise you need to query it dynamically. Here's an example that populates a shell variable with the revision of the current head, minus one.

    HEAD_MINUS_ONE=$(svn info http://svn/path/to/head | grep ^Revision | awk '{print $2-1}')