68
votes

I am trying to merge the latest changes from trunk into a branch of my project, but the problem is I don't know what revision of the trunk I checked out that I eventually created the branch from. I would think SVN logged this somewhere. Does anyone know how I can find the revision number?

(In other words, the Subversion equivalent of git merge-base master branch-name)

6
If you're using svn 1.5 or later, you don't need to know this revision number in order to do the merge. svn merge ^/trunk . will figure it out for itself. If that's not happening, you might have to svnadmin upgrade your repository.slowdog
Hmmm...Subclipse asks for the start revision, I'll have to see if it can do a merge this wayAndy
@slowdog you mean the version of the server, right?Line

6 Answers

76
votes

From the command line, the --stop-on-copy flag can be used to help show you where you copied a branch from:

svn log --stop-on-copy --verbose --limit 1 -r0:HEAD ^/branches/feature

(where feature is the name of your branch)

The last line of will say something like this:

Changed paths:
   A /branches/feature (from /trunk:1234)
18
votes

Perhaps a little bit late but.

If you're currently in the branch you can run:

svn log -r 1:HEAD --limit 1 --stop-on-copy

It displays the first revision of the branch i.e. when you created it.

13
votes

Are you using TortoiseSvn or command line?

Command Line: svn log --stop-on-copy and then look at the smallest rev number.

Tortoise SVN: right-click, tortoise-svn, show log, make sure 'stop on copy' is *checked* and press refresh. Scroll to the bottom and find the smallest rev number. enter image description here

2
votes

If you have used svn copy to create a tag/branch, then svn log can tell you from where your stuff in the branch was copied. For example, let's say we have svn://svn/trunk/foo and we have created a branch svn://svn/branches/super_foo. Run svn log -v svn://svn/branches/super_foo, it will tell you something like this - /branches/super_foo from /trunk/foo:22890, which means that you have copied revision 22890 of trunk into your branch.

0
votes

For the Cornerstone app, to see where a tag or branch originated, look in the timeline.

0
votes

To see changed paths with current TortoiseSVN command-line tool and to query repo without having local checkout run this (from any directory)

svn log --stop-on-copy --limit 1 --verbose -r0:HEAD "http://server:9876/svn/reponame/branches/branch name"

Notice --verbose to actually show the changed paths and explicit repo/branch URL to avoid having to check it out