{"thread":{"id":"18965","subject":"reviving a git-svn clone","startedAt":"2009-04-20T10:43:16Z","lastAt":"2009-04-21T17:06:33Z","messageCount":6,"participants":["martin f krafft","Sam Vilain","Deskin Miller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"111712","messageId":"20090420104316.GA11433@lapse.rw.madduck.net","threadId":"18965","inReplyTo":null,"subject":"reviving a git-svn clone","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2009-04-20T10:43:16Z","receivedAt":"2009-04-20T10:43:16Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"Hello folks,\n\nThe hibernate-script is maintained in SVN, but we've long tracked it\nwith Git at git://git.debian.org/git/collab-maint/hibernate.git .\n\nUnfortunately, I seem to have lost the repository I always used to\ngit-svn-rebase and push new upstream commits to the repository on\ngit.debian.org.\n\nI am now trying to revive the clone, but git-svn remains \"unable to\ndetermine the upstream SVN information from the working tree\nhistory\". This baffles me.\n\nHere are my steps:\n\n\n-8<--8<--8<-\nalioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync\nInitialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/\n\nalioth:~|master|% cd hibernate-svnsync\n\nalioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream\n\nalioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof\nheredoc> [svn-remote \"svn\"]\nheredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script\nheredoc>        fetch = trunk:refs/remotes/upstream/trunk\nheredoc>        branches = branches/*:refs/remotes/upstream/*\nheredoc>        tags = tags/*:refs/remotes/upstream/tags/*\nheredoc> _eof\n\nalioth:~/hibernate-svnsync|master|% git checkout upstream\n\nalioth:~/hibernate-svnsync|upstream|% git show HEAD | grep git-svn-id\n    git-svn-id: svn+ssh://svn.suspend2.net/svn/hibernate-script/trunk@1195 c12ee44c-9ede-0310-94ea-d4716f4f7118\n\n-8<--8<--8<-\n\n\nSo the repository is now cloned and the URL is the same as the one\nin the HEAD commit message.\n\nBut when I try to rebase, I am told:\n\n\n\n-8<--8<--8<-\nalioth:~/hibernate-svnsync|master|% git svn rebase\nMigrating from a git-svn v1 layout...\nData from a previous version of git-svn exists, but\n        .git/svn\n        (required for this version (1.5.6.5) of git-svn) does not exist.\nDone migrating from a git-svn v1 layout\nUnable to determine upstream SVN information from working tree history\n\n-8<--8<--8<-\n(I get the same result with Git 1.6.2.3)\n\n\n\nI've spend a bit of time with the code, but I cannot figure out why\nit has these hiccups. I think it's because git-svn needs a rev-map\nfile in\n.git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118,\nwhich is now gone, but that file is now gone.\n\nDoes anyone know how I can revive the git-svn clone? I cannot just\nreclone, or else all of the commit IDs in the public upstream branch\nwould be rewritten.\n\nThanks,\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \n\"alle vorurteile kommen aus den eingeweiden.\"\n                                                 - friedrich nietzsche\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"111845","messageId":"1240296712.3424.8.camel@maia.lan","threadId":"18965","inReplyTo":"20090420104316.GA11433@lapse.rw.madduck.net","subject":"Re: reviving a git-svn clone","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2009-04-21T06:51:52Z","receivedAt":"2009-04-21T06:51:52Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On Mon, 2009-04-20 at 12:43 +0200, martin f krafft wrote:\n> I am now trying to revive the clone, but git-svn remains \"unable to\n> determine the upstream SVN information from the working tree\n> history\". This baffles me.\n> \n> Here are my steps:\n\n> -8<--8<--8<-\n> alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync\n> Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/\n> \n> alioth:~|master|% cd hibernate-svnsync\n> \n> alioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream\n> \n> alioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof\n> heredoc> [svn-remote \"svn\"]\n> heredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script\n> heredoc>        fetch = trunk:refs/remotes/upstream/trunk\n> heredoc>        branches = branches/*:refs/remotes/upstream/*\n> heredoc>        tags = tags/*:refs/remotes/upstream/tags/*\n> heredoc> _eof\n\nfor git-svn to resume, it needs the refs all in the right place.  If you\nclone a git-svn repository they will be in the wrong place.\n\neg for this use case something like this to copy the\nrefs/remotes/origin/* refs to refs/remotes/upstream/*:\n\n  git for-each-ref --format=\"%(refname)\" refs/remotes/origin/* |\n     perl -le '$x = $_; $x =~ s{origin}{upstream};\n       system \"git update-ref $x $_\"'\n\nIt's a bit hard to test without access to the upstream svn!\n\nGood luck,\nSam.\n"},{"id":"111866","messageId":"20090421081457.GC28007@lapse.rw.madduck.net","threadId":"18965","inReplyTo":"1240296712.3424.8.camel@maia.lan","subject":"Re: reviving a git-svn clone","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2009-04-21T08:14:57Z","receivedAt":"2009-04-21T08:14:57Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Sam Vilain <sam@vilain.net> [2009.04.21.0851 +0200]:\n> eg for this use case something like this to copy the\n> refs/remotes/origin/* refs to refs/remotes/upstream/*:\n> \n>   git for-each-ref --format=\"%(refname)\" refs/remotes/origin/* |\n>      perl -le '$x = $_; $x =~ s{origin}{upstream};\n>        system \"git update-ref $x $_\"'\n\nLet me see if I parse this right: you want me to put the same SHA\ninto refs/remotes/upstream/trunk as there is in\nrefs/remotes/origin/upstream (since the upstream branch tracks the\ntrunk)?\n\n> It's a bit hard to test without access to the upstream svn!\n\nSorry, I should have been more careful. You can access the upstream\nSVN at http://svn.tuxonice.net/svn/hibernate-script . I am on\na train, so I cannot verify that, but the exact URL is listed on the\nhttp://svn.tuxonice.net/ website.\n\nOne reason why I was a bit hesitant to change the URL from svn+ssh\nto http was because my study of the code base suggested, that\ngit-svn actually matches the git-svn-id in the last commit message\nwith the URL in the svn-remote config stanza, and recurses the\ncommits parents until it finds a match. The error I am seeing\nactually seems to occur when git-svn recursed all the way to the\nfirst commit without a match.\n\nThen again, I may well have misparsed the Perl code, so feel free to\nignore me.\n\nMany thanks,\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \nall of you that believe in telekinetics, raise my hand!\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"111860","messageId":"86d4c5e00904210209v3f1b8fd3t6a991fe44455941@mail.gmail.com","threadId":"18965","inReplyTo":"1240296712.3424.8.camel@maia.lan","subject":"Re: reviving a git-svn clone","fromName":"Deskin Miller","fromEmail":"deskinm@gmail.com","sentAt":"2009-04-21T09:09:31Z","receivedAt":"2009-04-21T09:09:31Z","isPatch":false,"sender":{"key":"deskinm@gmail.com","avatar":null},"body":"On Mon, Apr 20, 2009 at 23:51, Sam Vilain <sam@vilain.net> wrote:\n> On Mon, 2009-04-20 at 12:43 +0200, martin f krafft wrote:\n>> I am now trying to revive the clone, but git-svn remains \"unable to\n>> determine the upstream SVN information from the working tree\n>> history\". This baffles me.\n>>\n>> Here are my steps:\n>\n>> -8<--8<--8<-\n>> alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync\n>> Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/\n>>\n>> alioth:~|master|% cd hibernate-svnsync\n>>\n>> alioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream\n>>\n>> alioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof\n>> heredoc> [svn-remote \"svn\"]\n>> heredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script\n>> heredoc>        fetch = trunk:refs/remotes/upstream/trunk\n>> heredoc>        branches = branches/*:refs/remotes/upstream/*\n>> heredoc>        tags = tags/*:refs/remotes/upstream/tags/*\n>> heredoc> _eof\n>\n> for git-svn to resume, it needs the refs all in the right place.  If you\n> clone a git-svn repository they will be in the wrong place.\n>\n> eg for this use case something like this to copy the\n> refs/remotes/origin/* refs to refs/remotes/upstream/*:\n>\n>  git for-each-ref --format=\"%(refname)\" refs/remotes/origin/* |\n>     perl -le '$x = $_; $x =~ s{origin}{upstream};\n>       system \"git update-ref $x $_\"'\n\nSam is on the right track.  I got the rev-map to rebuild with the\nfollowing steps (sufficient, perhaps not all necessary); enter these\nafter you hack .git/config with the svn info.\n\nFirst, we need the backend .git/svn/.metadata file, populated with the\nright URL and svn uuid; the uuid follows the URL and revision on log\nmessages:\n\n$ mkdir .git/svn\n$ cat > .git/svn/.metadata << EOF\n[svn-remote \"svn\"]\n        reposRoot = svn+ssh://svn.suspend2.net/svn\n        uuid = c12ee44c-9ede-0310-94ea-d4716f4f7118\nEOF\n\nNow, make the remote-tracking branch upstream/trunk at the right\ncommit, and check out a local copy; the commit ID is the latest commit\nfrom svn, also known as master^2 (at the time of this writing) if you\ndo a normal git clone from your provided url:\n\n$ git update-ref refs/remotes/upstream/trunk 1784ac6d\n$ git checkout -b upstream upstream/trunk\n\nNow, do git svn info or your other favourite local command to rebuild\nthe rev-map:\n\n$ git svn info\n\nIf you have access to the svn remote, you should be able to avoid\nhacking config and .metadata entirely by entering\n\n$ git svn init --stdlayout --prefix=upstream/\nsvn+ssh://svn.suspend2.net/svn/hibernate-script\n\nThis doesn't fetch any commits, but will contact the svn server to\nobtain the uuid.  Plus, it's much easier to type.  At any rate, the\ncommands prior to that rebuilt the rev-map metadata for me; I can't\nguarantee the alternative last one, since I can't test it myself.\n\n> It's a bit hard to test without access to the upstream svn!\n\nI concur :)  Hope that straightens things out.\n\nDeskin Miller\n\nP.S. Thanks Dscho for the excellent msysgit package\n"},{"id":"111872","messageId":"20090421115815.GC7967@piper.oerlikon.madduck.net","threadId":"18965","inReplyTo":"86d4c5e00904210209v3f1b8fd3t6a991fe44455941@mail.gmail.com","subject":"Re: reviving a git-svn clone","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2009-04-21T11:58:15Z","receivedAt":"2009-04-21T11:58:15Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Deskin Miller <deskinm@gmail.com> [2009.04.21.1109 +0200]:\n> If you have access to the svn remote, you should be able to avoid\n> hacking config and .metadata entirely by entering\n> \n> $ git svn init --stdlayout --prefix=upstream/\n> svn+ssh://svn.suspend2.net/svn/hibernate-script\n\nThis worked nicely, so thanks to you, Sam, and Thomas Rast (who\nhelped on IRC). Here is what I ended up doing:\n\nalioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync\nInitialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/\nalioth:~|master|% cd hibernate-svnsync \ntotal 204\ndrwx------ 2  4096 20090421.1013 admin\ndrwx------ 3  4096 20090421.1013 debian\ndrwx------ 2  4096 20090421.1013 init.d\ndrwx------ 2  4096 20090421.1013 scriptlets.d\n-rw------- 1 21417 20090421.1013 CHANGELOG\n-rw------- 1 17992 20090421.1013 COPYING\n-rw------- 1  6902 20090421.1013 README\n-rw------- 1  1470 20090421.1013 README.xfs\n-rw------- 1  6891 20090421.1013 SCRIPTLET-API\n-rw------- 1  2020 20090421.1013 blacklisted-modules\n-rw------- 1  4004 20090421.1013 common.conf\n-rw------- 1   310 20090421.1013 disk.conf\n-rw------- 1  7047 20090421.1013 gen-manpages.sh\n-rw------- 1   518 20090421.1013 hibernate.conf\n-rw------- 1 26637 20090421.1013 hibernate.sh\n-rw------- 1  4165 20090421.1013 hibernate.spec\n-rw------- 1 13822 20090421.1013 hibernate.vim\n-rwx------ 1  4664 20090421.1013 install.sh\n-rw------- 1    79 20090421.1013 logrotate.d-hibernate-script\n-rwx------ 1   608 20090421.1013 mktarball.sh\n-rw------- 1   837 20090421.1013 ram.conf\n-rw------- 1  1288 20090421.1013 suspend2.conf\n-rw------- 1   345 20090421.1013 sysfs-disk.conf\n-rw------- 1   289 20090421.1013 sysfs-ram.conf\n-rw------- 1     8 20090421.1013 tuxonice-binary-signature.bin\n-rw------- 1   509 20090421.1013 ususpend-both.conf\n-rw------- 1   501 20090421.1013 ususpend-disk.conf\n-rw------- 1  1324 20090421.1013 ususpend-ram.conf\nalioth:~/hibernate-svnsync|master|% git svn init --stdlayout --prefix=upstream/ svn+ssh://svn.suspend2.net/svn/hibernate-script                                                                                   alioth:~/hibernate-svnsync|master|% git update-ref refs/remotes/upstream/trunk refs/remotes/origin/upstream\nalioth:~/hibernate-svnsync|master|% git show-ref refs/remotes/upstream/trunk refs/remotes/origin/upstream\n1784ac6d733527ea65c2e9515df30c7a77d8f90b refs/remotes/origin/upstream\n1784ac6d733527ea65c2e9515df30c7a77d8f90b refs/remotes/upstream/trunk\nalioth:~/hibernate-svnsync|master|% git checkout -b upstream upstream/trunk\nSwitched to a new branch \"upstream\"\nalioth:..bernate-svnsync|upstream|% git svn info\nRebuilding .git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118 ...\nr840 = 56b969c867a8480521c25e7f943634a865d4ac33\n[…]\nr1195 = 1784ac6d733527ea65c2e9515df30c7a77d8f90b\nDone rebuilding .git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118\nUse of uninitialized value within @_ in localtime at /usr/bin/git-svn line 4277.\nNo such file or directory at /usr/bin/git-svn line 897.\n\n\n\nNow I can turn to changing the URL, since upstream wants to drop\nsvn.suspend2.net in favour of svn.tuxonice.net. This does not seem\nto be as straight-forward as it should be. I hate SVN!\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \ngod is real, unless declared integer.\n                                          (dedicated to gabriel gómez)\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"111885","messageId":"20090421170633.GB16665@piper.oerlikon.madduck.net","threadId":"18965","inReplyTo":"20090421115815.GC7967@piper.oerlikon.madduck.net","subject":"switching a git-svn clone to a different URL (was: reviving a git-svn clone)","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2009-04-21T17:06:33Z","receivedAt":"2009-04-21T17:06:33Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach martin f krafft <madduck@madduck.net> [2009.04.21.1358 +0200]:\n> Now I can turn to changing the URL, since upstream wants to drop\n> svn.suspend2.net in favour of svn.tuxonice.net. This does not seem\n> to be as straight-forward as it should be. I hate SVN!\n\nTurns out using the --rewrite-root option to 'git svn init' and\nswapping the URLs later, as described on the wiki [0], is exactly\nwhat I needed.\n\n0. http://git.or.cz/gitwiki/GitSvnSwitch\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \n\"alas, i am dying beyond my means.\"\n                                                        -- oscar wilde\n \nspamtraps: madduck.bogus@madduck.net\n"}]}