tags:

views:

1309

answers:

7

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?

+1  A: 

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.)

Amber
A: 

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)

Sam Saffron
+5  A: 

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

Cygon
I like the idea. If the amount of expected in-file conflicts is small you could also do rsync -av --ignore='.svn' in both directions (first with -n, dry run flag and then without)
bobah
+1  A: 

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".

sebasgo
+2  A: 

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

William Pursell
A: 

The following works but it slow:

svn diff [url] [url]

Jonathan
A: 

Are you sure this works? This isn't works for me .. svn diff [url] [url]