Skip to content

Commit

Permalink
cvsimport: skip commits that are too recent
Browse files Browse the repository at this point in the history
With this patch, cvsimport will skip commits made
in the last 10 minutes. The recent-ness test is of
5 minutes + cvsps fuzz window (5 minutes default).

When working with a CVS repository that is in use,
importing commits that are too recent can lead to
partially incorrect trees. This is mainly due to

 - Commits that are within the cvsps fuzz window may later
   be found to have affected more files.

 - When performing incremental imports, clock drift between
   the systems may lead to skipped commits.

This commit helps keep incremental imports of in-use
CVS repositories sane.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Martin Langhoff authored and Junio C Hamano committed Jan 8, 2007
1 parent 3faa541 commit 6211988
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ ($)
push (@mergerx, qr/$opt_M/);
}

# Remember UTC of our starting time
# we'll want to avoid importing commits
# that are too recent
our $starttime = time();

select(STDERR); $|=1; select(STDOUT);


Expand Down Expand Up @@ -824,6 +829,15 @@ sub commit {
$state = 11;
next;
}
if ( $starttime - 300 - (defined $opt_z ? $opt_z : 300) <= $date) {
# skip if the commit is too recent
# that the cvsps default fuzz is 300s, we give ourselves another
# 300s just in case -- this also prevents skipping commits
# due to server clock drift
print "skip patchset $patchset: $date too recent\n" if $opt_v;
$state = 11;
next;
}
if (exists $ignorebranch{$branch}) {
print STDERR "Skipping $branch\n";
$state = 11;
Expand Down

0 comments on commit 6211988

Please sign in to comment.