git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problems while converting complex repository from SVN
@ 2014-02-18 10:27 Mathy Vanvoorden
  0 siblings, 0 replies; only message in thread
From: Mathy Vanvoorden @ 2014-02-18 10:27 UTC (permalink / raw)
  To: git

Hi,

I had some issues while converting our current SVN repository to a GIT 
repository. The old repository has a lot of strange history in it making 
it far from easy to convert it but for some issues I had to modify the 
convert scripts.

As I don't know the internals of GIT or git-svn enough I don't know if 
these are actually bugs or not. I will also not produce and submit 
patches to fix this as I don't know enough Perl to know if maybe it can 
be solved in a better way or that it should be solved at all.

1. issue with git-svn dying because git could not find the refname. I 
noticed that in the function resolve_local_globs it was actually passing 
desanitized names to the cmt_metadata function, so I changed the code to 
use sanitized names, trying to keep the rest of the script (which I 
don't pretend to understand) intact:

sub resolve_local_globs {
     my ($url, $fetch, $glob_spec) = @_;
     return unless defined $glob_spec;
     my $ref = $glob_spec->{ref};
     my $path = $glob_spec->{path};
     foreach (command(qw#for-each-ref --format=%(refname) refs/#)) {
         next unless m#^$ref->{regex}$#;
         my $p = $1;
         my $pathname = $path->full_path($p);
         my $svnpathname = desanitize_refname($pathname);
         my $refname = $ref->full_path($p);
         my $svnrefname = desanitize_refname($refname);
         if (my $existing = $fetch->{$svnpathname}) {
             if ($existing ne $svnrefname) {
                 die "Refspec conflict:\n",
                     "existing: $existing\n",
                     " globbed: $svnrefname\n";
             }
             my $u = (::cmt_metadata("$refname"))[0];
             $u =~ s!^\Q$url\E(/|$)!! or die
               "$svnrefname: '$url' not found in '$u'\n";
             if ($pathname ne $u) {
                 warn "W: Refspec glob conflict ",
                      "(ref: $svnrefname):\n",
                      "expected path: $pathname\n",
                      "    real path: $u\n",
                      "Continuing ahead with $u\n";
                 next;
             }
         } else {
             $fetch->{$svnpathname} = $svnrefname;
         }
     }
}


2. issue with an @ being present in a branch name. A first branch was 
created just fine, but a second branch was created from that branch 
which failed.

The following message (simplified for confidentiality reasons) was 
shown while trying to branch 'blabla bla@bla blabla' to 'blabla blabla'

Found possible branch point: 
svn://localhost/path/to/branch/blabla%20bla@bla%20blabla => 
svn://localhost/path/to/branches/blabla%20blabla, 13486
refs/remotes/origin/branches/blabla bla@bla blabla: 'svn://localhost' 
not found in 'svn://bla%20blabla'

I found out that the git-svn-id was actually being wrongly initiated to 
'svn://bla%20blabla'. This is due to a mistake in the regex that is used 
in remove_username.

It was:
	$_[0] =~ s{^([^:]*://)[^@]+@}{$1};
I changed it to
	$_[0] =~ s{^([^:]*://)[^@/]+@}{$1};

And it works.


I did all this using the standard Git package for Windows, release 
1.8.5.2

PS: I tried to send this from my work email several times but I think 
the mail server can't handle the greylisting so I apologize if the mails 
still end up in the list.

-- 

Met vriendelijke groeten,
Best regards,

Mathy Vanvoorden

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-18 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-18 10:27 Problems while converting complex repository from SVN Mathy Vanvoorden

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).