Reputation: 37349
I have 2 repositories. As the trunk code was in one repository, which was protected, I did a checkout and then checked in to the other repository (as users did not have permission to the first protected one).
Now the issue is that both the repositories have been worked on and we wish to finally merge the code/branch in the second unprotected one with the protected one. But, there will be conflicts in these.
Is there a way to find out the diff for the 2 repository branches? Also, if there are whitespace changes, how do I ignore those?
Upvotes: 23
Views: 29839
Reputation: 51
Anytime I get in to this situation I use Meld. It's a multi-platform GUI compare tool. it can compare file to file or directory to directory. In your case you could checkout both projects into separate directories and use meld to compare. You can move changes (linesa or blocks) from one file to another very easily.
diff is good too!
Upvotes: 1
Reputation: 53
If you are on linux you could also use "meld" tool... It makes great diff, and you can easily do a merge...
Upvotes: 1
Reputation: 311
svn diff --old=URL1@rev1 --new=URL2@rev2
Example:
svn diff --old=http://svn.whatever.com/trunk/myfile.txt@1234 --new=http://svn.whatever.com/branch/myfile.txt@5678
This allows you to specify both the branches and the revision numbers for both files. I know it works because I just executed it.
Upvotes: 31
Reputation: 212674
The best tool for doing this merge may be git-svn. If the URL of the two repositories are $URL1 and $URL2, then try:
$ git svn clone $URL1 svn1 $ git svn clone $URL2 svn2 $ cd svn1 $ git fetch ../svn2 $ git diff FETCH_HEAD master
To ignore whitespace changes, use git diff -w
Upvotes: 5
Reputation: 3861
Copy the second repository into the first using something along the following in a working copy of the first repository:
svn cp svn://url/to/the/second/repo branches/second_repo
Checkin and do a regular merge from the new branch to your trunk.
This explanation assumes that you use the most common svn repository layout (branches/, tags/ and /trunk as top level directories) and so it may be necessary to adapt the copy command.
Also note that some GUIs for SVN support this copy mode, too. In SmartSVN the command is called "Copy from URL".
Upvotes: 1
Reputation: 9620
I don't know of a built-in subversion feature that would allow this, but you could create a complete checkout of both repositories and use the command line diff utility to compare both working copies:
diff -w -u -r -N WorkingCopy1 WorkingCopy2
-w
to ignore all Whitespace
-u
to use the unified diff format (like subversion)
-r
for recursive
-N
to let new files appear in the patch
It's surely not the fastest approach, but might be acceptable for a one-time process. You can also create a patch by redirecting the output to a file diff -w -u -r -N WorkingCopy1 WorkingCopy2 > wc1-to-wc2.patch
If you're running windows, win32 builds of diff and patch can be found here: http://gnuwin32.sourceforge.net/packages/diffutils.htm
Upvotes: 26
Reputation: 131202
Probably the simplest thing is to check out both branches and use a tool like winmerge (which will allow you to ignore spaces and do a multi compare)
Upvotes: 1
Reputation: 527558
You could use a tool like kdiff3 to simply compare checked-out working copies from both repositories. (Just point it at the two directories and it'll recursively compare all files in them.)
Upvotes: 3