summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce726ec)
raw | patch | inline | side by side (parent: ce726ec)
author | Martin Langhoff <martin@catalyst.net.nz> | |
Sun, 4 Sep 2005 10:55:06 +0000 (22:55 +1200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 4 Sep 2005 17:28:43 +0000 (10:28 -0700) |
If there is no GIT directory, archimport will assume it is an initial import.
It now also supports incremental imports, skipping "seen" commits. You can
now run it repeatedly to pull new commits from the Arch repository.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
It now also supports incremental imports, skipping "seen" commits. You can
now run it repeatedly to pull new commits from the Arch repository.
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-archimport-script | patch | blob | history |
diff --git a/git-archimport-script b/git-archimport-script
index 6ff5d7dce05cea7bbe1ad5020585a24660a4dda3..3c8aab74be49fd69a23ad140b8f8b5bb12fa13b2 100755 (executable)
--- a/git-archimport-script
+++ b/git-archimport-script
$ENV{'TZ'}="UTC";
our($opt_h,$opt_v, $opt_T,
- $opt_C,$opt_t, $opt_i);
+ $opt_C,$opt_t);
sub usage() {
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from Arch
- [ -h ] [ -v ] [ -i ] [ -T ]
+ [ -h ] [ -v ] [ -T ]
[ -C GIT_repository ] [ -t tempdir ]
repository/arch-branch [ repository/arch-branch] ...
END
## TODO cleanup irrelevant patches
## and put an initial import
## or a full tag
-
-if ($opt_i) { # initial import
+my $import = 0;
+unless (-d '.git') { # initial import
if ($psets[0]{type} eq 'i' || $psets[0]{type} eq 't') {
print "Starting import from $psets[0]{id}\n";
+ `git-init-db`;
+ die $! if $?;
+ $import = 1;
} else {
die "Need to start from an import or a tag -- cannot use $psets[0]{id}";
}
- `git-init-db`;
- die $! if $?;
}
-# process
-my $lastbranch = branchname($psets[0]{id}); # only good for initial import
-my $importseen = $opt_i ? 0 : 1; # start at 1 if opt_i
-
+# process patchsets
foreach my $ps (@psets) {
$ps->{branch} = branchname($ps->{id});
}
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}`;
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);
}
} 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")