git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathy Vanvoorden <mathy@vanvoorden.be>
To: <git@vger.kernel.org>
Subject: Problems while converting complex repository from SVN
Date: Tue, 18 Feb 2014 11:27:33 +0100	[thread overview]
Message-ID: <197e3eca78fa1e827466d2a9387db48e@webmail.mvision.be> (raw)

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

                 reply	other threads:[~2014-02-18 10:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=197e3eca78fa1e827466d2a9387db48e@webmail.mvision.be \
    --to=mathy@vanvoorden.be \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).