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

RE: Efficient way to get the previous revision number

From: Reedick, Andrew <jr9445_at_ATT.COM>
Date: Fri, 2 May 2008 12:01:09 -0500

> -----Original Message-----
> From: Giulio Troccoli [mailto:Giulio.Troccoli_at_uk.linedata.com]
> Sent: Friday, May 02, 2008 10:10 AM
> To: users_at_subversion.tigris.org
> Subject: Efficient way to get the previous revision number
>
> 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.
>

--limit does work. (I'm using 1.4.5.)
        svn log -q -r 103:1 --limit 1 URL | ...

Using a peg revision should also work:
        svn log -q --limit 1 URL_at_103 | ...

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

        It should give you 100, not 105. Svn log goes down, not up.

*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA625

---------------------------------------------------------------------
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 19:02:04 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.