Tuesday, December 2. 2008

roll back a git-svn mirror

Several Amanda developers use git internally, but the Amanda source code is in Subversion at SourceForge. Git-svn manages bidirectional mirroring for us, and works flawlessly.

Recently, however, we introduced a problem through user error: due to a typo in our git-authors file, a bunch of revisions were mirrored with incorrect author information. This was more than a cosmetic problem because it caused the SHA1 hashes to differ between developers who fixed the typo at different times (because the author information is included in the data that feeds the hash algorithm). This would leave us with divergent commits forever.

The challenge, then, is to make git-svn think that it never fetched that revision. HEAD was at r1413, but r1391 had the bad author. We branched for release right after the bum commit, so there are two branches to deal with. Here's what I did:

First, roll back the remote branches (e945b67d78c239b42cb882e5c28e24354d0c05f0 is r1390)

$ git update-ref -m "roll back git-svn" ext/trunk e945b67d78c239b42cb882e5c28e24354d0c05f0
$ git update-ref -m "roll back git-svn" -d ext/amanda-261 cad126843a7649ca3e05088dd46ee41d7f17e7e2

Next, edit both maxRev values in git-svn's metadata (.git/svn/.metadata):

[svn-remote "ext"]
    reposRoot = https://amanda.svn.sourceforge.net/svnroot/amanda
    uuid = a8d146d6-cc15-0410-8900-af154a0219e0
    branches-maxRev = 1413
    tags-maxRev = 1413

Finally, delete the .reflog

$ rm .git/svn/ext/trunk/.rev_map*
$ rm .git/svn/ext/amanda-261/.rev_map*

Then just re-run the fetch:

$ git svn fetch ext

Trackbacks

No Trackbacks

Comments
Display comments as (Linear | Threaded)

*Incidentally, at this point you can use a simple

git svn reset -r 1390

and all should be well.

#1 Dustin J. Mitchell (Homepage) on 2010-12-11 22:58 (Reply)

Add Comment


To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Markdown format allowed
 
 

Notice

The postings on this site are my own and don't necessarily represent the opinions of Zmanda, Inc.