[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Efficient way to get the previous revision number

From: Giulio Troccoli <Giulio.Troccoli_at_uk.linedata.com>
Date: Fri, 2 May 2008 15:10:03 +0100

Given a revision number I need to find out the revision of the previous
commit in a particular directory. For example, with revision 100 I
committed some change to src/dir1. Then, with revision 101 to 104 I
committed changes to src/dir2. Now, with revision 105 I committed
changes again in src/dir1. So given revision 103, and the directory
src/dir1 of course, I need to find the previous revision, i.e. 100.

What I am doing at the moment is something like

svn --quiet log [dir1 URL] 103:1 | head -2 | tail -1 | cut -d" " -f1 |
cut -dr -f2

I thought about using the --limit option but that would give me 105 (in
the example above) which is not what I'm after.

My script works just fine, but I think that getting the log from
revision 1 is a bit too much, since I just need the last one.

Does anybody think of a better, more efficient, way to achieve this?

I'm using SVN 1.4.4 and ksh for the script.

Thanks
Giulio
 
 
Linedata Services (UK) Ltd
Registered Office: Bishopsgate Court, 4-12 Norton Folgate, London, E1 6DB
Registered in England and Wales No 3027851 VAT Reg No 778499447

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-05-02 16:09:46 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.