Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compare a branch against trunk in subversion?

Tags:

svn

In Subversion, I created a branch from a trunk using svn copy. According to the the SVN 1.5 manual, "This is the easiest way to “tag” a revision in your repository—just svn copy that revision (usually HEAD) into your tags directory."

svn copy file:////svn/projectX/trunk file:///svn/projectX/branches/stefanl 

Then, I make my modifications to the stefanl branch. I want to commit my changes to the trunk, but before I do that I would like to see a diff of the changes.

How can I diff the 'stefanl' branch against the 'trunk' branch? I tried svn diff, but it didn't provide much information:

% svn diff file:////svn/projectX/trunk file:///svn/projectX/branches/stefanl Property changes on: . ___________________________________________________________________ Modified: svn:mergeinfo    Reverse-merged /trunk:r1699-1870 
like image 873
Stefan Lasiewski Avatar asked Jan 24 '11 17:01

Stefan Lasiewski


People also ask

How do I find the difference between two branches in SVN?

Go to the repository browser (<right click>/TortoiseSVN/Repo-browser/<enter URL>). Open right click menu on branch B, select 'Mark for comparison'. Then open right click menu on branch A, select 'Compare URLs' or 'Show differences as unified diff'.

How do I compare changes in SVN?

Just hold down the Shift key while you right click on the file. Then select TortoiseSVN → Diff with URL. In the following dialog, specify the URL in the repository with which you want to compare your local file to.

What is branch tag and trunk in SVN?

A tag is just a marker. Trunk would be the main body of development, originating from the start of the project until the present. Branch will be a copy of code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk.

What is Subversion trunk?

The trunk is the main line of development in a SVN repository. A branch is a side-line of development created to make larger, experimental or disrupting work without annoying users of the trunk version.


2 Answers

Adding to the previous answers (if using Tortoise SVN on Windows):

  • Right-click any folder. From the context menu, select TortoiseSVN -> Repo-browser.
  • Enter your repo address in the URL box.
  • Navigate to the first folder which you want to compare. Right-click and select Mark for comparison.
  • Navigate to the second folder. Right-click and select Compare URLs
like image 188
sam-w Avatar answered Sep 28 '22 00:09

sam-w


You can Unix diff to compare directories.

To find missing files:

diff -r svn/projectX/trunk svn/projectX/branches/stefanl | grep -i only 

To find what the differences between files:

diff -ru svn/projectX/trunk svn/projectX/branches/stefanl 

I had the same question and found the suggestion in a mail thread: http://svn.haxx.se/users/archive-2003-08/0538.shtml

like image 34
mberkow Avatar answered Sep 27 '22 23:09

mberkow