Re: git export to svn
- From
Warren Harris <warrensomebody@gmail.com>
- Date
- Oct 26, 2008, 16:24 UTC
- Message-ID
- <8ED0030A-E55E-4082-87C9-53B11F763E1B@gmail.com>
- In-Reply-To
- <20081026091554.GC3612@atjola.homenet>
On Oct 26, 2008, at 2:15 AM, Björn Steinbrink wrote:
Show 27 quoted lines
> On 2008.10.25 13:29:50 -0700, Warren Harris wrote: >> I tried a fetch, but still no luck: >> >> $ git svn fetch >> W: Ignoring error from SVN, path probably does not exist: (175002): >> RA >> layer request failed: REPORT of '/svn/!svn/bc/100': Could not read >> chunk >> size: Secure connection truncated (https://svn) >> W: Do not be alarmed at the above message git-svn is just searching >> aggressively for old history. >> This may take a while on large repositories >> r58084 = c01dadf89b552077da132273485e7569d8694518 (trunk) >> A ... >> r58088 = 7916f3a02ad6c759985bd9fb886423c373a72125 (trunk) >> >> $ git svn rebase >> Unable to determine upstream SVN information from working tree >> history > > Means that your current branch is not based on what git-svn has > fetched, > which is expected when you use "svn init" + "svn fetch" after you > already started working. > > What's the actual relationship between your local history and the > history you fetched from svn?
Since I'm trying to export my git repo to svn, the svn repo is completely empty.
Show 7 quoted lines
> > > If your local stuff started from revision X, which you manually > imported > from svn, you can just rebase it: > > git rebase --onto <svn-revision-X> <your-revision-X>
When I try this, I keep getting:
fatal: Needed a single revision invalid upstream
Show 46 quoted lines
> > > > If you have a bunch of merges in your local history, you might want to > merge your stuff into the svn-based branch instead. When you dcommit, > the svn repo will only see one big "do it all" commit though. > > For that, you would create a graft, so that your first "real" local > commit gets the svn revision X commit as its parent. That is, from: > > S---S---SX---S---S---S (svn) > > LX--------L---L---L---L (local) > > You want to go to: > > S---S---SX---S---S---S (svn) > \ > LX L---L---L---L (local) > > > Where 'S' means that the commit came from SVN, and L means that it > is a > "local" commit. SX and LX are the commits that have the same tree > attached (same directories/files), but have a different hash due to > how > they were created. The graft overrides the parent-child relation for > the > first "L" commit, so that it actually appears as being branched off > of SX. > > And then, you'd merge local into svn, so you get: > > S---S---SX---S---S---S--M (svn) > \ / > LX L---L---L---L (local) > > > > If possible, go with the rebase though. That at least gives a somewhat > reasonable history in the svn repo as well. Also note that when you go > with the merge way, make sure that the svn branch is totally uptodate > before you merge and that the merge commit is the only one to be > dcommitted. Otherwise, funny stuff might happen, and rebase might kick > in anyway, I don't exactly remember what git-svn does, but it wasn't > pleasant :-)
I may not have been clear about what I'm trying to do: I have a git repository, and I'd like to put it (either the head of the master, or the entire revision history if possible) into svn. From then on, I would like to be able to use 'git svn' commands to manage the two repos. (Initially I don't expect anyone else to be committing to svn -- it's just an archive and something for others to pull from.)
Here's a complete transcript of how I tried to do this, which seems to be missing some crucial step:
$ mkdir test2-git-clone $ git clone ../test2/ # clone my working repo which is unrelated to svn at this point $ cd test2-git-clone/test2 $ svn mkdir https://svn/svn/SANDBOX/warren/test2 -m "test2" $ svn mkdir https://svn/svn/SANDBOX/warren/test2/trunk -m "test2" $ svn mkdir https://svn/svn/SANDBOX/warren/test2/branches -m "test2" $ svn mkdir https://svn/svn/SANDBOX/warren/test2/tags -m "test2" $ git svn init https://svn/svn/SANDBOX/warren/test2 -T trunk -t tags - b branches Initialized empty Git repository in /Users/warren/projects/tmp/test2- git-clone/test2/.git/ Using higher level of URL: https://svn/svn/SANDBOX/warren/test2 => https://svn/svn $ git svn dcommit Can't call method "full_url" on an undefined value at /opt/local/ libexec/git-core/git-svn line 425. $ git merge --no-ff master Already up-to-date. $ git svn dcommit Can't call method "full_url" on an undefined value at /opt/local/ libexec/git-core/git-svn line 425. $ git svn fetch $ git svn dcommit Can't call method "full_url" on an undefined value at /opt/local/ libexec/git-core/git-svn line 425.
Thanks for your help,
Warren