How to get a checkout-able revision info from subversion?

Posted by zhongshu on Stack Overflow See other posts from Stack Overflow or by zhongshu
Published on 2010-03-12T07:32:26Z Indexed on 2010/03/12 7:37 UTC
Read the original article Hit count: 200

Filed under:

I want to check a svn url and to get the latest revision, then checkout it, I don't want to use HEAD because I will compare the latest revision to others.

so I use "svn info" to get the "Last Changed Rev" for the url like this:

D:\Project>svn info svn://.../branches/.../path
Path: ...
URL: svn://.../branches/.../path
Repository Root: svn://yt-file-srv/
Repository UUID: 9ed5ffd7-7585-a14e-96b2-4aab7121bb21
Revision: 2400
Node Kind: directory
Last Changed Author: xxx
Last Changed Rev: 2396
Last Changed Date: 2010-03-12 09:31:52 +0800 

but, I found the 2396 revision is not checkout-able, because this path is in a branch copied from trunk, and the 2396 is the revision modified in the trunk. so when I use svn checkout -r 2396, I will get a workcopy for the path in the trunk, then I can not do checkin for the branch.

D:\Project>svn checkout svn://.../branches/.../path -r 2396 workcopy
.....
.....
D:\Project>svn info workcopy
Path: workcopy
URL: svn://.../trunk/.../path
Repository Root: svn://yt-file-srv/
Repository UUID: 9ed5ffd7-7585-a14e-96b2-4aab7121bb21
Revision: 2396
Node Kind: directory
Schedule: normal
Last Changed Author: xxx
Last Changed Rev: 2396
Last Changed Date: 2010-03-12 09:31:52 +0800

So, my question is how to get a checkout-able revision for the branch path, for this example, I want to get 2397 (because 2397 is the revision which copy occur).

And I know "svn log" can get the info, but "svn log" output maybe very long and parse it will be difficult than "svn info". I just want know which revision is the latest checkout-able revision for the path.

© Stack Overflow or respective owner

Related posts about subversion