A git mirror for Gnucash's Subversion Repository

John Ralls jralls at ceridwen.us
Sat Feb 19 00:03:19 EST 2011


On Feb 17, 2011, at 10:24 PM, John Ralls wrote:

> 
> Today I got the Loeliger book that Yawar cited. It does indeed have a different approach, and if it works it will be more attractive because it allows the git users to do git-ish things (almost) as much as they like. The penalty is that only one repository is allowed to commit back to subversion. 
> 
> 1. Create a git-svn repository as usual, passing a --prefix=svn/ arg to git svn clone. (Nicolaison doesn't use a prefix)
> 2. In a separate directory, create a bare git repo ("public") and git push -all from the svn repo to the new bare one, mapping refs/remotes/svn/* in the git-svn repo to refs/heads/svn/* in the new, bare, one. (Again, same for Nicolaison but without the  svn/ prefix.) Master is created as a tracking branch of svn/trunk, and any active svn branches (think 2.4) will similarly need tracking branches.
> 
> The public repository gets pushed to github and is periodically pulled back for synchronizing with subversion. Here's where things get interesting. To sync back into svn trunk (procedure would be the same for any subversion branch):
> 
> 1. In the git svn repo, checkout master and pull from the public repo.
> 2. git checkout svn/trunk (This is in refs/remotes, so you get a detached head.)
> 3. git merge --no-ff master (Creates a merge commit rather than splicing the commits. This loses some history in svn, but so it goes.)
> 4. git svn dcommit pushes the commit into subversion.
> 
> I've left out a bit of detail in the checkout and had to interpolate some in for committing, so I'll have to test this out to make sure I have all of the details right and that it actually works... but that's also true of Nicolaison's method. Also, they're both silent on tags, and we need to integrate our tags so that we know where releases occurred.
> 

I got the svn2git perl program working and started playing with a small repo and the Loeliger method.

It goes quite nicely into subversion:
$ manjusri:usr/local/src/bouml-svn> svn log -r79:70
------------------------------------------------------------------------
r79 | john | 2011-02-18 19:58:20 -0800 (Fri, 18 Feb 2011) | 1 line

Rename genplugouts/sm to sm_generator to match the .pro file
------------------------------------------------------------------------
r78 | john | 2011-02-18 19:58:17 -0800 (Fri, 18 Feb 2011) | 1 line

Rename a couple of pro files to match what (should be) their directory names
------------------------------------------------------------------------
r77 | john | 2011-02-18 19:18:42 -0800 (Fri, 18 Feb 2011) | 1 line

Cleanup: Remove two cpp subdirectories missed earlier
------------------------------------------------------------------------
r76 | john | 2011-02-18 19:18:26 -0800 (Fri, 18 Feb 2011) | 1 line

Cleanup: Remove executable files and cpp subdirectories
------------------------------------------------------------------------
r75 | john | 2011-02-18 14:13:34 -0800 (Fri, 18 Feb 2011) | 1 line

Cleanup genplugouts/deploy
------------------------------------------------------------------------
r74 | john | 2011-02-18 13:13:57 -0800 (Fri, 18 Feb 2011) | 1 line

Delete executable ghtml. What's that doing in a repo?
------------------------------------------------------------------------
r73 | john | 2011-02-18 13:11:42 -0800 (Fri, 18 Feb 2011) | 1 line

Flatten out useless html/cpp directory
------------------------------------------------------------------------
r72 | john | 2011-02-18 13:08:18 -0800 (Fri, 18 Feb 2011) | 1 line

Rename rose.pro to import_rose.pro so that qmake can see it.
------------------------------------------------------------------------
r71 | john | 2011-02-18 12:57:48 -0800 (Fri, 18 Feb 2011) | 1 line

Merge branch 'refs/heads/qt4douml' into HEAD
------------------------------------------------------------------------
r70 | rageek | 2011-01-25 02:43:41 -0800 (Tue, 25 Jan 2011) | 2 lines

Douml name changes, icons, linux test environment

Changes 71 to 74 were done directly on the branch in git, then pushed back through the bare repository (standing in for Github) to the git-mirror repo (the one that uses git-svn), then dcommitted back to the subversion repo. 75-79 were done on one feature branch then multiple changes were batched into a --no-ff merge to the mirrored branch, pushed to bare, retrieved from bare and dcommitted. From the subversion side it all looks fine except that the user running the git-svn mirror gets all the credit. (Bwaaa-haaa-haaaa! ;-) )

On the git side, though, things look a little different; here's the log from the git-svn mirror repo:
cfe2205 John Ralls Merge branch 'qt4douml' of ../bouml-git-bare into qt4douml			(I)
a4df453 john Rename genplugouts/sm to sm_generator to match the .pro file		(79)	
39b3f20 john Rename a couple of pro files to match what (should be) their directo	(78)	
42a2789 John Ralls Fix up a couple of .pro files and directories so that qmake wi		(H)
d6255bb John Ralls Rename genplugouts/sm to sm_generator to match the .pro file			(G)
e7d0f94 John Ralls Rename a couple of pro files to match what (should be) their d		(F)
ce058c6 John Ralls Merge branch 'qt4douml' of /usr/local/src/bouml-git-bare into 		(E)
792b4dd john Cleanup: Remove two cpp subdirectories missed earlier			(77)	
f89f22e john Cleanup: Remove executable files and cpp subdirectories			(76)	
31b1370 John Ralls Cleanup: Remove two cpp subdirectories missed earlier			(D)
0e1278d John Ralls Flattened usecasewizard directory						(C)
239d829 John Ralls Flattened uml_projection directory						(B)
d7e7fcf John Ralls Cleanup: Remove executable files and cpp subdirectories			(A)
6a83d6c John Ralls Flattened sort directory
244b9f5 John Ralls Flattened sm directory
4524ae1 John Ralls Flattened singleton directory
ee2657a John Ralls deleted the rest of the executable files that shouldn't have b
eb8cb0d john Cleanup genplugouts/deploy							(75)
55406ff John Ralls Remove executable from repo
5eabb1d John Ralls Collapse deploy/cpp into deploy; no reason for the extra direc
0947aa0 john Delete executable ghtml. What's that doing in a repo?			(74)
53bac48 john Flatten out useless html/cpp directory					(73)
fe49eb3 john Rename rose.pro to import_rose.pro so that qmake can see it.		(72)
d94c787 john Merge branch 'refs/heads/qt4douml' into HEAD				(71)
97d8654 John Ralls Move the translation files out of root to reduce clutter.
a952649 John Ralls Move the icon files to a new icon directory to reduce the clut
e7e950b John Ralls Create base douml.pro, which subdirs all of the other .pro fil
48f7115 rageek Douml name changes, icons, linux test environment			(70)

1. All of the changes after (75) up to (A), were done on the feature branch and merged in "working" to the mirrored branch with --no-ff (which merge became (A)) and that branch alone was pushed to bare, then pulled to mirror and dcommitted from the normal (refs/heads) branch, becoming r76. So far, so good.
2. (B) and (C) were similarly merged --no-ff into mirror-branch in working, resulting in (D), pushed to bare, pulled to refs/heads on mirror, and dcommitted as (77).
3. After the dcommit of (77), git complained that bare diverged and wasn't a fast-forward. I had to force-push  back to bare to clear the warning; this merge is change (E). Notice that (A) and (76) have the same subject, as do (D) and (77). (A) and (D) do not have the git-svn-ids, which is why they differ.
4. I did some more changes (E & F ->78, G & H -> 79), still merging the changes onto the mirror-branch in working and pushing to bare; but this time in mirror I pulled them onto a disconnected HEAD in refs/remotes and dcommitted from there. 

Git immediately complained that refs/remotes was ahead of refs/heads, and was fast-forwardable. I merged and pushed, which I probably shouldn't have done, because when I rebased:
$ manjusri:al/src/bouml-git-mirror> git svn rebase
warning: refname 'qt4douml' is ambiguous.
First, rewinding head to replay your work on top of it...
Applying: Rename a couple of pro files to match what (should be) their directory names
Using index info to reconstruct a base tree...
<stdin>:487: trailing whitespace.
QT += network  qt3support 
<stdin>:1191: trailing whitespace.
QT += network  qt3support 
warning: 2 lines add whitespace errors.
Falling back to patching base and 3-way merge...
CONFLICT (rename/rename): Rename "genplugouts/file_control/FileControl.pro"->"genplugouts/xmi/xmi.pro" in branch "HEAD" rename "genplugouts/file_control/FileControl.pro"->"genplugouts/file_control/file_control.pro" in "Rename a couple of pro files to match what (should be) their directory names"
CONFLICT (rename/rename): Rename "genplugouts/sm/SmGenerator.pro"->"genplugouts/xmi2import/xmi2import.pro" in branch "HEAD" rename "genplugouts/sm/SmGenerator.pro"->"genplugouts/sm/sm_generator.pro" in "Rename a couple of pro files to match what (should be) their directory names"
Failed to merge in the changes.
Patch failed at 0001 Rename a couple of pro files to match what (should be) their directory names

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/qt4douml: command returned error: 1

I'll try again differently tomorrow, but at the moment I wonder if this is going to be automatable.

Regards,
John Ralls




More information about the gnucash-devel mailing list