git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* reviving a git-svn clone
@ 2009-04-20 10:43 martin f krafft
  2009-04-21  6:51 ` Sam Vilain
  0 siblings, 1 reply; 6+ messages in thread
From: martin f krafft @ 2009-04-20 10:43 UTC (permalink / raw)
  To: git discussion list

[-- Attachment #1: Type: text/plain, Size: 2686 bytes --]

Hello folks,

The hibernate-script is maintained in SVN, but we've long tracked it
with Git at git://git.debian.org/git/collab-maint/hibernate.git .

Unfortunately, I seem to have lost the repository I always used to
git-svn-rebase and push new upstream commits to the repository on
git.debian.org.

I am now trying to revive the clone, but git-svn remains "unable to
determine the upstream SVN information from the working tree
history". This baffles me.

Here are my steps:


-8<--8<--8<-
alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync
Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/

alioth:~|master|% cd hibernate-svnsync

alioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream

alioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof
heredoc> [svn-remote "svn"]
heredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script
heredoc>        fetch = trunk:refs/remotes/upstream/trunk
heredoc>        branches = branches/*:refs/remotes/upstream/*
heredoc>        tags = tags/*:refs/remotes/upstream/tags/*
heredoc> _eof

alioth:~/hibernate-svnsync|master|% git checkout upstream

alioth:~/hibernate-svnsync|upstream|% git show HEAD | grep git-svn-id
    git-svn-id: svn+ssh://svn.suspend2.net/svn/hibernate-script/trunk@1195 c12ee44c-9ede-0310-94ea-d4716f4f7118

-8<--8<--8<-


So the repository is now cloned and the URL is the same as the one
in the HEAD commit message.

But when I try to rebase, I am told:



-8<--8<--8<-
alioth:~/hibernate-svnsync|master|% git svn rebase
Migrating from a git-svn v1 layout...
Data from a previous version of git-svn exists, but
        .git/svn
        (required for this version (1.5.6.5) of git-svn) does not exist.
Done migrating from a git-svn v1 layout
Unable to determine upstream SVN information from working tree history

-8<--8<--8<-
(I get the same result with Git 1.6.2.3)



I've spend a bit of time with the code, but I cannot figure out why
it has these hiccups. I think it's because git-svn needs a rev-map
file in
.git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118,
which is now gone, but that file is now gone.

Does anyone know how I can revive the git-svn clone? I cannot just
reclone, or else all of the commit IDs in the public upstream branch
would be rewritten.

Thanks,

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"alle vorurteile kommen aus den eingeweiden."
                                                 - friedrich nietzsche
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: reviving a git-svn clone
  2009-04-20 10:43 reviving a git-svn clone martin f krafft
@ 2009-04-21  6:51 ` Sam Vilain
  2009-04-21  8:14   ` martin f krafft
  2009-04-21  9:09   ` Deskin Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Sam Vilain @ 2009-04-21  6:51 UTC (permalink / raw)
  To: martin f krafft; +Cc: git discussion list

On Mon, 2009-04-20 at 12:43 +0200, martin f krafft wrote:
> I am now trying to revive the clone, but git-svn remains "unable to
> determine the upstream SVN information from the working tree
> history". This baffles me.
> 
> Here are my steps:

> -8<--8<--8<-
> alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync
> Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/
> 
> alioth:~|master|% cd hibernate-svnsync
> 
> alioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream
> 
> alioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof
> heredoc> [svn-remote "svn"]
> heredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script
> heredoc>        fetch = trunk:refs/remotes/upstream/trunk
> heredoc>        branches = branches/*:refs/remotes/upstream/*
> heredoc>        tags = tags/*:refs/remotes/upstream/tags/*
> heredoc> _eof

for git-svn to resume, it needs the refs all in the right place.  If you
clone a git-svn repository they will be in the wrong place.

eg for this use case something like this to copy the
refs/remotes/origin/* refs to refs/remotes/upstream/*:

  git for-each-ref --format="%(refname)" refs/remotes/origin/* |
     perl -le '$x = $_; $x =~ s{origin}{upstream};
       system "git update-ref $x $_"'

It's a bit hard to test without access to the upstream svn!

Good luck,
Sam.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: reviving a git-svn clone
  2009-04-21  6:51 ` Sam Vilain
@ 2009-04-21  8:14   ` martin f krafft
  2009-04-21  9:09   ` Deskin Miller
  1 sibling, 0 replies; 6+ messages in thread
From: martin f krafft @ 2009-04-21  8:14 UTC (permalink / raw)
  To: git discussion list; +Cc: Sam Vilain

also sprach Sam Vilain <sam@vilain.net> [2009.04.21.0851 +0200]:
> eg for this use case something like this to copy the
> refs/remotes/origin/* refs to refs/remotes/upstream/*:
> 
>   git for-each-ref --format="%(refname)" refs/remotes/origin/* |
>      perl -le '$x = $_; $x =~ s{origin}{upstream};
>        system "git update-ref $x $_"'

Let me see if I parse this right: you want me to put the same SHA
into refs/remotes/upstream/trunk as there is in
refs/remotes/origin/upstream (since the upstream branch tracks the
trunk)?

> It's a bit hard to test without access to the upstream svn!

Sorry, I should have been more careful. You can access the upstream
SVN at http://svn.tuxonice.net/svn/hibernate-script . I am on
a train, so I cannot verify that, but the exact URL is listed on the
http://svn.tuxonice.net/ website.

One reason why I was a bit hesitant to change the URL from svn+ssh
to http was because my study of the code base suggested, that
git-svn actually matches the git-svn-id in the last commit message
with the URL in the svn-remote config stanza, and recurses the
commits parents until it finds a match. The error I am seeing
actually seems to occur when git-svn recursed all the way to the
first commit without a match.

Then again, I may well have misparsed the Perl code, so feel free to
ignore me.

Many thanks,

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
all of you that believe in telekinetics, raise my hand!
 
spamtraps: madduck.bogus@madduck.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: reviving a git-svn clone
  2009-04-21  6:51 ` Sam Vilain
  2009-04-21  8:14   ` martin f krafft
@ 2009-04-21  9:09   ` Deskin Miller
  2009-04-21 11:58     ` martin f krafft
  1 sibling, 1 reply; 6+ messages in thread
From: Deskin Miller @ 2009-04-21  9:09 UTC (permalink / raw)
  To: Sam Vilain; +Cc: martin f krafft, git discussion list

On Mon, Apr 20, 2009 at 23:51, Sam Vilain <sam@vilain.net> wrote:
> On Mon, 2009-04-20 at 12:43 +0200, martin f krafft wrote:
>> I am now trying to revive the clone, but git-svn remains "unable to
>> determine the upstream SVN information from the working tree
>> history". This baffles me.
>>
>> Here are my steps:
>
>> -8<--8<--8<-
>> alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync
>> Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/
>>
>> alioth:~|master|% cd hibernate-svnsync
>>
>> alioth:~/hibernate-svnsync|master|% git branch --no-track upstream origin/upstream
>>
>> alioth:~/hibernate-svnsync|master|% cat >> .git/config <<_eof
>> heredoc> [svn-remote "svn"]
>> heredoc>        url = svn+ssh://svn.suspend2.net/svn/hibernate-script
>> heredoc>        fetch = trunk:refs/remotes/upstream/trunk
>> heredoc>        branches = branches/*:refs/remotes/upstream/*
>> heredoc>        tags = tags/*:refs/remotes/upstream/tags/*
>> heredoc> _eof
>
> for git-svn to resume, it needs the refs all in the right place.  If you
> clone a git-svn repository they will be in the wrong place.
>
> eg for this use case something like this to copy the
> refs/remotes/origin/* refs to refs/remotes/upstream/*:
>
>  git for-each-ref --format="%(refname)" refs/remotes/origin/* |
>     perl -le '$x = $_; $x =~ s{origin}{upstream};
>       system "git update-ref $x $_"'

Sam is on the right track.  I got the rev-map to rebuild with the
following steps (sufficient, perhaps not all necessary); enter these
after you hack .git/config with the svn info.

First, we need the backend .git/svn/.metadata file, populated with the
right URL and svn uuid; the uuid follows the URL and revision on log
messages:

$ mkdir .git/svn
$ cat > .git/svn/.metadata << EOF
[svn-remote "svn"]
        reposRoot = svn+ssh://svn.suspend2.net/svn
        uuid = c12ee44c-9ede-0310-94ea-d4716f4f7118
EOF

Now, make the remote-tracking branch upstream/trunk at the right
commit, and check out a local copy; the commit ID is the latest commit
from svn, also known as master^2 (at the time of this writing) if you
do a normal git clone from your provided url:

$ git update-ref refs/remotes/upstream/trunk 1784ac6d
$ git checkout -b upstream upstream/trunk

Now, do git svn info or your other favourite local command to rebuild
the rev-map:

$ git svn info

If you have access to the svn remote, you should be able to avoid
hacking config and .metadata entirely by entering

$ git svn init --stdlayout --prefix=upstream/
svn+ssh://svn.suspend2.net/svn/hibernate-script

This doesn't fetch any commits, but will contact the svn server to
obtain the uuid.  Plus, it's much easier to type.  At any rate, the
commands prior to that rebuilt the rev-map metadata for me; I can't
guarantee the alternative last one, since I can't test it myself.

> It's a bit hard to test without access to the upstream svn!

I concur :)  Hope that straightens things out.

Deskin Miller

P.S. Thanks Dscho for the excellent msysgit package

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: reviving a git-svn clone
  2009-04-21  9:09   ` Deskin Miller
@ 2009-04-21 11:58     ` martin f krafft
  2009-04-21 17:06       ` switching a git-svn clone to a different URL (was: reviving a git-svn clone) martin f krafft
  0 siblings, 1 reply; 6+ messages in thread
From: martin f krafft @ 2009-04-21 11:58 UTC (permalink / raw)
  To: Deskin Miller, Sam Vilain, git discussion list

[-- Attachment #1: Type: text/plain, Size: 3562 bytes --]

also sprach Deskin Miller <deskinm@gmail.com> [2009.04.21.1109 +0200]:
> If you have access to the svn remote, you should be able to avoid
> hacking config and .metadata entirely by entering
> 
> $ git svn init --stdlayout --prefix=upstream/
> svn+ssh://svn.suspend2.net/svn/hibernate-script

This worked nicely, so thanks to you, Sam, and Thomas Rast (who
helped on IRC). Here is what I ended up doing:

alioth:~|master|% git clone /git/collab-maint/hibernate.git hibernate-svnsync
Initialized empty Git repository in /srv/alioth.debian.org/chroot/home/users/madduck/hibernate-svnsync/.git/
alioth:~|master|% cd hibernate-svnsync 
total 204
drwx------ 2  4096 20090421.1013 admin
drwx------ 3  4096 20090421.1013 debian
drwx------ 2  4096 20090421.1013 init.d
drwx------ 2  4096 20090421.1013 scriptlets.d
-rw------- 1 21417 20090421.1013 CHANGELOG
-rw------- 1 17992 20090421.1013 COPYING
-rw------- 1  6902 20090421.1013 README
-rw------- 1  1470 20090421.1013 README.xfs
-rw------- 1  6891 20090421.1013 SCRIPTLET-API
-rw------- 1  2020 20090421.1013 blacklisted-modules
-rw------- 1  4004 20090421.1013 common.conf
-rw------- 1   310 20090421.1013 disk.conf
-rw------- 1  7047 20090421.1013 gen-manpages.sh
-rw------- 1   518 20090421.1013 hibernate.conf
-rw------- 1 26637 20090421.1013 hibernate.sh
-rw------- 1  4165 20090421.1013 hibernate.spec
-rw------- 1 13822 20090421.1013 hibernate.vim
-rwx------ 1  4664 20090421.1013 install.sh
-rw------- 1    79 20090421.1013 logrotate.d-hibernate-script
-rwx------ 1   608 20090421.1013 mktarball.sh
-rw------- 1   837 20090421.1013 ram.conf
-rw------- 1  1288 20090421.1013 suspend2.conf
-rw------- 1   345 20090421.1013 sysfs-disk.conf
-rw------- 1   289 20090421.1013 sysfs-ram.conf
-rw------- 1     8 20090421.1013 tuxonice-binary-signature.bin
-rw------- 1   509 20090421.1013 ususpend-both.conf
-rw------- 1   501 20090421.1013 ususpend-disk.conf
-rw------- 1  1324 20090421.1013 ususpend-ram.conf
alioth:~/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
alioth:~/hibernate-svnsync|master|% git show-ref refs/remotes/upstream/trunk refs/remotes/origin/upstream
1784ac6d733527ea65c2e9515df30c7a77d8f90b refs/remotes/origin/upstream
1784ac6d733527ea65c2e9515df30c7a77d8f90b refs/remotes/upstream/trunk
alioth:~/hibernate-svnsync|master|% git checkout -b upstream upstream/trunk
Switched to a new branch "upstream"
alioth:..bernate-svnsync|upstream|% git svn info
Rebuilding .git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118 ...
r840 = 56b969c867a8480521c25e7f943634a865d4ac33
[…]
r1195 = 1784ac6d733527ea65c2e9515df30c7a77d8f90b
Done rebuilding .git/svn/upstream/trunk/.rev_map.c12ee44c-9ede-0310-94ea-d4716f4f7118
Use of uninitialized value within @_ in localtime at /usr/bin/git-svn line 4277.
No such file or directory at /usr/bin/git-svn line 897.



Now I can turn to changing the URL, since upstream wants to drop
svn.suspend2.net in favour of svn.tuxonice.net. This does not seem
to be as straight-forward as it should be. I hate SVN!

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
god is real, unless declared integer.
                                          (dedicated to gabriel gómez)
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* switching a git-svn clone to a different URL (was: reviving a git-svn clone)
  2009-04-21 11:58     ` martin f krafft
@ 2009-04-21 17:06       ` martin f krafft
  0 siblings, 0 replies; 6+ messages in thread
From: martin f krafft @ 2009-04-21 17:06 UTC (permalink / raw)
  To: git discussion list

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

also sprach martin f krafft <madduck@madduck.net> [2009.04.21.1358 +0200]:
> Now I can turn to changing the URL, since upstream wants to drop
> svn.suspend2.net in favour of svn.tuxonice.net. This does not seem
> to be as straight-forward as it should be. I hate SVN!

Turns out using the --rewrite-root option to 'git svn init' and
swapping the URLs later, as described on the wiki [0], is exactly
what I needed.

0. http://git.or.cz/gitwiki/GitSvnSwitch

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"alas, i am dying beyond my means."
                                                        -- oscar wilde
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-21 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 10:43 reviving a git-svn clone martin f krafft
2009-04-21  6:51 ` Sam Vilain
2009-04-21  8:14   ` martin f krafft
2009-04-21  9:09   ` Deskin Miller
2009-04-21 11:58     ` martin f krafft
2009-04-21 17:06       ` switching a git-svn clone to a different URL (was: reviving a git-svn clone) martin f krafft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).