I want to refer to a revision just before head or n-revisions before HEAD or something like that.
Asked
Active
Viewed 3,145 times
13
-
In what context - to provide to a check-in hook, or just in general? – synthesizerpatel Feb 22 '12 at 12:08
-
@synthesizerpatelIn the context of day-to-day use with svn client. I dunno nothing about check-in hooks ;) – Ashkan Kh. Nazary Feb 22 '12 at 12:22
3 Answers
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 beforeBASE
.PREV
: This is the last changed revision fromBASE
. It's pretty much COMMITTED-1.
For everything else, you'll need to do a calculation as synthesizeerpatel showed you.
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