ng.
ng.

Reputation: 7189

How to find the source branch for a tag

I have a tag in subversion that has been made some time in the past. I would like to know what branch it was created from. Is there a way to do this. I have tried

svn log --stop-on-copy

But this only gives me the revision number, not the branch path. I need the branch path so I can check it out. Any ideas, preferably a SVN command line method here would be appreciated.

Upvotes: 15

Views: 7299

Answers (3)

Master Azazel
Master Azazel

Reputation: 600

This may be a little late, but I happened to stumble upon this while developing some PowerShell scripts

If you can use PowerShell, this may output the path which the tag/branch was copied from directly:

([Xml](svn log -v -r0:HEAD --stop-on-copy --limit 1 URL-HERE --xml)).log.logentry.paths.path.'copyfrom-path'

What happens here? The svn command is invoked with the --xml flag, so i can cast the returned value to [Xml], which in turn allows me to access the XML-Nodes of the svn-output.

Upvotes: 0

VonC
VonC

Reputation: 1323343

To get directly the right revision:

svn log -v -r0:HEAD --stop-on-copy --limit 1 <url-of-the-tag>

It will only print the revision from which a branch is created:

rxxx | Author | 2013-01-25 11:43:55 +0100 (fri., 2013, jan. 25) | 1 line
Changed paths:
   A /project/branches/branch (from /project/trunk/folder:ryyy)

The revision and path you are looking are: /project/trunk/folder:ryyy.

Upvotes: 12

Raghuram
Raghuram

Reputation: 52635

svn log -v --stop-on-copy <url-of-the-tag> should give you this information as documented here.

Relevant excerpt:

In addition to the action codes which precede the changed paths, svn log with the
--verbose (-v) option will note whether a path was added or replaced as the result of 
a copy operation. It does so by printing (from COPY-FROM-PATH:COPY-FROM-REV) after such 
paths.

Upvotes: 23

Related Questions