1

For reasons to long to describe here, I created a local SVN repository, copied the contents of a remote repository, and make a total of 60 commits to it. In the mean time, the remote repository hasn't changed a single bit. Now I want to get those 60 commits in the remote repository. What is the best way to achieve this?

I've been looking for a solution. First thing I found was svnsync, but it will only work for a new empty repository.

Some similar questions were answered with 'use git-svn', without an explanation how this should work. The problem I get is that I end up with 2 unrelated branches in GIT. Using git-replace I should be able to mark the ancestor of the local branch in the remote branch, but in a small-scale test it results in a large number of merges. As a last resort I could write a shell-script that gets all patches from the local repository and apply them to the remote repository. It should be somewhere on the internet, but I can't find it.

In a future scenario I'd always use GIT to get a local repository, it would have saved a lot of trouble.


To elaborate on my small-scale git-svn test:

  • create SVN repository svn-original, check out, make a few commits
  • create SVN repository svn-local, copy contents of svn-original checkout, commit, make a few other commits
  • since I'm on windows, use svn-serve to create a server for svn-original at the default port, and svn-local on port 1234

Then I did this in a console:

cd temp/git
git svn init --prefix=svn-original –R svn-original svn://localhost/ --stdlayout 
git svn init --prefix=svn-local –R svn-local svn://localhost:1234/ --stdlayout
git svn fetch svn-original
git svn fetch svn-local
git checkout -b svn-original svn-original/trunk
git checkout -b svn-local    svn-local/trunk
git log svn-local --oneline
#  find the commit that adds code from the original
git log svn-original --oneline
#  find the last commit
git-replace <first-local> <last-original>

This doesn't work: the last commit of svn-original is now shown in gitk as part of svn-local. Merging results in merge-conflicts, and dcommit fails.

mbvlist
  • 13
  • 2

1 Answers1

1
svnrdump dump --incremental file:///path/to/local/repository -r 42:HEAD |
svnrdump load https://svn.example.org/path/to/remote/repository

See the following chapter in the SVN book for more details: Migrating Repository Data Elsewhere

nosid
  • 48,932
  • 13
  • 112
  • 139
  • This looks like the solution. It even allows to do this on a part of the repository, but if I try that locally, it fails for not finding 'trunk': `C:\svn-merge-test>svnrdump dump --incremental file:///C:svn-merge-test/svn-local/trunk -r 2:HEAD | svnrdump load file:///C:/svn-merge-test/svn-original/trunk` . This ends with output: `svnrdump: E160016: Path 'trunk' not present` – mbvlist Apr 26 '13 at 18:32
  • @mbvlist: Which of the two commands returns the error? Is `2` the first revision committed to `svn-local`, both repositories are identical up to revision 1, and there are no further revisions in `svn-original`? – nosid Apr 26 '13 at 19:56
  • The error comes from the second command. In this testcase everything is exactly the same: I added the files immediately under /trunk. For the real deal where I try to solve the problem I added the content of `http://original/repo/Driver/Product/trunk/*` in `file:///path/to/local/trunk/*`. So I'm afraid this solution needs more trickery to get it working – mbvlist Apr 26 '13 at 20:33
  • @mbvlist: You can fix the above error by removing the path segment from the target URL, i.e. `svnrdump load file:///C:/svn-merge-test/svn-original/`. – nosid Apr 26 '13 at 20:53
  • So svnrdump can't change the path. In the SVN book link you gave, there's a section that describes how to change the file for a changed path. So it can be done. I'll verify that tomorrow. – mbvlist Apr 28 '13 at 13:28
  • So I did this in cmd (svnrdump doesn't work from cygwin): `svnrdump dump -r5:57 --incremental "file:///c:/Path/To/Repo" > driver5-57.dump` Then I performed some find/replace in cygwin: `sed -b -i 's_\(Node-.*path.*\)trunk/Wrong/Path/To/Root_\1Right/Path/To/Root_' driver5-57.dump`. – mbvlist May 01 '13 at 12:22