X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-archimport-script;h=8f475fd66da3c09a4f6a0f8ecdc708334d861ae1;hb=fa6a1427c608e4e4a22aa6d176dd7b001b5f3021;hp=6ff5d7dce05cea7bbe1ad5020585a24660a4dda3;hpb=d3968363b43b3d6badd662869e13fa3aa34c5b41;p=git.git diff --git a/git-archimport-script b/git-archimport-script index 6ff5d7dc..8f475fd6 100755 --- a/git-archimport-script +++ b/git-archimport-script @@ -49,12 +49,12 @@ $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; our($opt_h,$opt_v, $opt_T, - $opt_C,$opt_t, $opt_i); + $opt_C,$opt_t); sub usage() { print STDERR <{branch} = branchname($ps->{id}); @@ -201,14 +199,22 @@ foreach my $ps (@psets) { } die $! if $?; + # + # skip commits already in repo + # + if (ptag($ps->{id})) { + $opt_v && print "Skipping already imported: $ps->{id}\n"; + next; + } + # # create the branch if needed # - if ($ps->{type} eq 'i' && $importseen) { - die "Should not have more than one 'Initial import' per GIT import"; + if ($ps->{type} eq 'i' && !$import) { + die "Should not have more than one 'Initial import' per GIT import: $ps->{id}"; } - unless ($opt_i && !$importseen) { # skip for first commit + unless ($import) { # skip for import if ( -e ".git/refs/heads/$ps->{branch}") { # we know about this branch `git checkout $ps->{branch}`; @@ -221,17 +227,24 @@ foreach my $ps (@psets) { # find where we are supposed to branch from `git checkout -b $ps->{branch} $branchpoint`; + + # If we trust Arch with the fact that this is just + # a tag, and it does not affect the state of the tree + # then we just tag and move on + tag($ps->{id}, $branchpoint); + ptag($ps->{id}, $branchpoint); + print " * Tagged $ps->{id} at $branchpoint\n"; + next; } die $! if $?; } - # # Apply the import/changeset/merge into the working tree # if ($ps->{type} eq 'i' || $ps->{type} eq 't') { - $importseen = 1; apply_import($ps) or die $!; + $import=0; } elsif ($ps->{type} eq 's') { apply_cset($ps); } @@ -577,8 +590,6 @@ sub ptag { } else { # read # if the tag isn't there, return 0 unless ( -s ".git/archimport/tags/$tag") { - warn "Could not find tag $tag -- perhaps it isn't in the repos we have?\n" - if $opt_v; return 0; } open(C,"<.git/archimport/tags/$tag")