threads / discuss / 15924

git-svn and svnsync

Subject: git-svn and svnsync

## tl;dr

4 messages between Oct 16, 2008 and Nov 24, 2008.

replies: 3people: 2as markdown or json

Andriy Gapon· Oct 16, 2008, 08:07 UTC · lore
I did the following:
1. mirror svn repository using svnsync
2. clone the mirror with git-svn --use-svnsync-props and some tweaking[*]
3. run git svn info in the clone
4. get error "Unable to determine upstream SVN information from working 
tree history"

git svn log and git svn rebase do not work either. git log does work.

I have git version 1.6.0.2 (from FreeBSD ports).
[*] About the tweaking - I manually massaged config file to get the 
branches I was interested in, so .git/config is this:
[core]
         repositoryformatversion = 0
         filemode = true
         bare = false
         logallrefupdates = true
[svn-remote "svn"]
         useSvnsyncProps = 1
         url = file:///system/devel/svn/base
         fetch = head:refs/remotes/trunk
         fetch = stable/6:refs/remotes/stable_6
         fetch = stable/7:refs/remotes/stable_7
         fetch = releng/6.3:refs/remotes/releng_6_3
         fetch = releng/6.4:refs/remotes/releng_6_4
         fetch = releng/7.0:refs/remotes/releng_7_0
         fetch = release/6.3.0:refs/remotes/release_6_3_0
         fetch = release/7.0.0:refs/remotes/release_7_0_0
This is .git/svn/.metadata:
; This file is used internally by git-svn
; You should not have to edit it
[svn-remote "svn"]
         reposRoot = file:///system/devel/svn/base
         uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
         svnsync-uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
         svnsync-url = svn://svn.freebsd.org/base
So you can see the original svn repository URL.

git log reports svn info like the following: git-svn-id: svn://svn.freebsd.org/base/stable/7@183898 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

It seems that the problem is that the code in find_by_url() and/or read_all_remotes() subroutines (in git-svn.perl) are not aware of svnsync and do not realize an URL in logs and URL in svn-remote are different. BTW, I see that there is some special svm logic in read_all_remotes.

Thank you very much for any help in advance.
-- 
Andriy Gapon
Andriy Gapon· Nov 24, 2008, 12:56 UTC · re: Andriy Gapon · lore

Re: git-svn and svnsync

on 16/10/2008 11:07 Andriy Gapon said the following:
Show 54 quoted lines
> 
> I did the following:
> 1. mirror svn repository using svnsync
> 2. clone the mirror with git-svn --use-svnsync-props and some tweaking[*]
> 3. run git svn info in the clone
> 4. get error "Unable to determine upstream SVN information from working
> tree history"
> 
> git svn log and git svn rebase do not work either.
> git log does work.
> 
> I have git version 1.6.0.2 (from FreeBSD ports).
> [*] About the tweaking - I manually massaged config file to get the
> branches I was interested in, so .git/config is this:
> [core]
>         repositoryformatversion = 0
>         filemode = true
>         bare = false
>         logallrefupdates = true
> [svn-remote "svn"]
>         useSvnsyncProps = 1
>         url = file:///system/devel/svn/base
>         fetch = head:refs/remotes/trunk
>         fetch = stable/6:refs/remotes/stable_6
>         fetch = stable/7:refs/remotes/stable_7
>         fetch = releng/6.3:refs/remotes/releng_6_3
>         fetch = releng/6.4:refs/remotes/releng_6_4
>         fetch = releng/7.0:refs/remotes/releng_7_0
>         fetch = release/6.3.0:refs/remotes/release_6_3_0
>         fetch = release/7.0.0:refs/remotes/release_7_0_0
> 
> This is .git/svn/.metadata:
> ; This file is used internally by git-svn
> ; You should not have to edit it
> [svn-remote "svn"]
>         reposRoot = file:///system/devel/svn/base
>         uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>         svnsync-uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>         svnsync-url = svn://svn.freebsd.org/base
> 
> So you can see the original svn repository URL.
> 
> git log reports svn info like the following:
> git-svn-id: svn://svn.freebsd.org/base/stable/7@183898
> ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
> 
> It seems that the problem is that the code in find_by_url() and/or
> read_all_remotes() subroutines (in git-svn.perl) are not aware of
> svnsync and do not realize an URL in logs and URL in svn-remote are
> different.
> BTW, I see that there is some special svm logic in read_all_remotes.
> 
> Thank you very much for any help in advance.
> 

Anyone? I wonder if this is my local problem/misconfiguration or an issue with git-svn.

-- 
Andriy Gapon
Michael J Gruber· Nov 24, 2008, 17:15 UTC · re: Andriy Gapon · lore

Re: git-svn and svnsync

Andriy Gapon venit, vidit, dixit 24.11.2008 13:56:
Show 58 quoted lines
> on 16/10/2008 11:07 Andriy Gapon said the following:
>> I did the following:
>> 1. mirror svn repository using svnsync
>> 2. clone the mirror with git-svn --use-svnsync-props and some tweaking[*]
>> 3. run git svn info in the clone
>> 4. get error "Unable to determine upstream SVN information from working
>> tree history"
>>
>> git svn log and git svn rebase do not work either.
>> git log does work.
>>
>> I have git version 1.6.0.2 (from FreeBSD ports).
>> [*] About the tweaking - I manually massaged config file to get the
>> branches I was interested in, so .git/config is this:
>> [core]
>>         repositoryformatversion = 0
>>         filemode = true
>>         bare = false
>>         logallrefupdates = true
>> [svn-remote "svn"]
>>         useSvnsyncProps = 1
>>         url = file:///system/devel/svn/base
>>         fetch = head:refs/remotes/trunk
>>         fetch = stable/6:refs/remotes/stable_6
>>         fetch = stable/7:refs/remotes/stable_7
>>         fetch = releng/6.3:refs/remotes/releng_6_3
>>         fetch = releng/6.4:refs/remotes/releng_6_4
>>         fetch = releng/7.0:refs/remotes/releng_7_0
>>         fetch = release/6.3.0:refs/remotes/release_6_3_0
>>         fetch = release/7.0.0:refs/remotes/release_7_0_0
>>
>> This is .git/svn/.metadata:
>> ; This file is used internally by git-svn
>> ; You should not have to edit it
>> [svn-remote "svn"]
>>         reposRoot = file:///system/devel/svn/base
>>         uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>         svnsync-uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>         svnsync-url = svn://svn.freebsd.org/base
>>
>> So you can see the original svn repository URL.
>>
>> git log reports svn info like the following:
>> git-svn-id: svn://svn.freebsd.org/base/stable/7@183898
>> ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>
>> It seems that the problem is that the code in find_by_url() and/or
>> read_all_remotes() subroutines (in git-svn.perl) are not aware of
>> svnsync and do not realize an URL in logs and URL in svn-remote are
>> different.
>> BTW, I see that there is some special svm logic in read_all_remotes.
>>
>> Thank you very much for any help in advance.
>>
> 
> Anyone?
> I wonder if this is my local problem/misconfiguration or an issue with
> git-svn.
Same happens here, so it's a general issue ;)

I think I encountered that before and ended up experimenting with git-svn cloning from a svnsync source until I found the final config, with which I git-svn cloned directly from upstream, so that I had to wait only twice.

Michael
Andriy Gapon· Nov 24, 2008, 17:33 UTC · re: Michael J Gruber · lore

Re: git-svn and svnsync

on 24/11/2008 19:15 Michael J Gruber said the following:
Show 65 quoted lines
> Andriy Gapon venit, vidit, dixit 24.11.2008 13:56:
>> on 16/10/2008 11:07 Andriy Gapon said the following:
>>> I did the following:
>>> 1. mirror svn repository using svnsync
>>> 2. clone the mirror with git-svn --use-svnsync-props and some tweaking[*]
>>> 3. run git svn info in the clone
>>> 4. get error "Unable to determine upstream SVN information from working
>>> tree history"
>>>
>>> git svn log and git svn rebase do not work either.
>>> git log does work.
>>>
>>> I have git version 1.6.0.2 (from FreeBSD ports).
>>> [*] About the tweaking - I manually massaged config file to get the
>>> branches I was interested in, so .git/config is this:
>>> [core]
>>>         repositoryformatversion = 0
>>>         filemode = true
>>>         bare = false
>>>         logallrefupdates = true
>>> [svn-remote "svn"]
>>>         useSvnsyncProps = 1
>>>         url = file:///system/devel/svn/base
>>>         fetch = head:refs/remotes/trunk
>>>         fetch = stable/6:refs/remotes/stable_6
>>>         fetch = stable/7:refs/remotes/stable_7
>>>         fetch = releng/6.3:refs/remotes/releng_6_3
>>>         fetch = releng/6.4:refs/remotes/releng_6_4
>>>         fetch = releng/7.0:refs/remotes/releng_7_0
>>>         fetch = release/6.3.0:refs/remotes/release_6_3_0
>>>         fetch = release/7.0.0:refs/remotes/release_7_0_0
>>>
>>> This is .git/svn/.metadata:
>>> ; This file is used internally by git-svn
>>> ; You should not have to edit it
>>> [svn-remote "svn"]
>>>         reposRoot = file:///system/devel/svn/base
>>>         uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>>         svnsync-uuid = ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>>         svnsync-url = svn://svn.freebsd.org/base
>>>
>>> So you can see the original svn repository URL.
>>>
>>> git log reports svn info like the following:
>>> git-svn-id: svn://svn.freebsd.org/base/stable/7@183898
>>> ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
>>>
>>> It seems that the problem is that the code in find_by_url() and/or
>>> read_all_remotes() subroutines (in git-svn.perl) are not aware of
>>> svnsync and do not realize an URL in logs and URL in svn-remote are
>>> different.
>>> BTW, I see that there is some special svm logic in read_all_remotes.
>>>
>>> Thank you very much for any help in advance.
>>>
>> Anyone?
>> I wonder if this is my local problem/misconfiguration or an issue with
>> git-svn.
> 
> Same happens here, so it's a general issue ;)
> 
> I think I encountered that before and ended up experimenting with
> git-svn cloning from a svnsync source until I found the final config,
> with which I git-svn cloned directly from upstream, so that I had to
> wait only twice.

I hacked together an ugly patch that replaces svm support with snvsync support. This works for me, not sure if it will be useful in general.

-- 
Andriy Gapon


--- git-svn	2008-11-11 10:20:38.714620442 +0200
+++ git-svn	2008-11-07 17:10:49.245681213 +0200
@@ -1433,7 +1433,7 @@
 sub read_all_remotes {
 	my $r = {};
 	my $use_svm_props = eval { command_oneline(qw/config --bool
-	    svn.useSvmProps/) };
+	    svn.useSvnsyncProps/) };
 	$use_svm_props = $use_svm_props eq 'true' if $use_svm_props;
 	foreach (grep { s/^svn-remote\.// } command(qw/config -l/)) {
 		if (m!^(.+)\.fetch=\s*(.*)\s*:\s*(.+)\s*$!) {
@@ -1445,7 +1445,7 @@
 			$local_ref =~ s{^/}{};
 			$r->{$remote}->{fetch}->{$local_ref} = $remote_ref;
 			$r->{$remote}->{svm} = {} if $use_svm_props;
-		} elsif (m!^(.+)\.usesvmprops=\s*(.*)\s*$!) {
+		} elsif (m!^(.+)\.usesvnsyncprops=\s*(.*)\s*$!) {
 			$r->{$1}->{svm} = {};
 		} elsif (m!^(.+)\.url=\s*(.*)\s*$!) {
 			$r->{$1}->{url} = $2;
@@ -1471,9 +1471,8 @@
 				my $section = "svn-remote.$_";
 				$svm = {
 					source => tmp_config('--get',
-					    "$section.svm-source"),
-					replace => tmp_config('--get',
-					    "$section.svm-replace"),
+					    "$section.svnsync-url"),
+					replace => '',
 				}
 			};
 			$r->{$_}->{svm} = $svm;

← back to recent threads