13

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

Ashkan Kh. Nazary
  • 21,844
  • 13
  • 44
  • 68

3 Answers3

9

There's are a few built in revision key words in Subversion which may solve most of your problems:

  • BASE: This is the revision used in your current working directory.
  • HEAD: This is the current tip of the branch.
  • COMMITTED: This is the last committed revision of a file before BASE.
  • PREV: This is the last changed revision from BASE. It's pretty much COMMITTED-1.

For everything else, you'll need to do a calculation as synthesizeerpatel showed you.

Community
  • 1
  • 1
David W.
  • 105,218
  • 39
  • 216
  • 337
5

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}')
synthesizerpatel
  • 27,321
  • 5
  • 74
  • 91
0

@David W. provided part of the asnwer, but for people lazy like me. Just use

svn up -r PREV

etiennejcharles
  • 359
  • 2
  • 10