cvsimport: skip commits that are too recent
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>
Martin Langhoff committed
Jan 8, 2007 at 14:11 UTC
6211988f77ab20cc8705fb8c9ecb72ba166b80da
1 file changed
+14
git-cvsimport.perl
+14
@@ -129,6 +129,11 @@ if ($opt_M) {
129
push (@mergerx, qr/$opt_M/);
130
}
131
132
+# Remember UTC of our starting time
133
+# we'll want to avoid importing commits
134
+# that are too recent
135
+our $starttime = time();
136
+
137
select(STDERR); $|=1; select(STDOUT);
138
139
@@ -824,6 +829,15 @@ while (<CVS>) {
829
$state = 11;
830
next;
831
}
832
+ if ( $starttime - 300 - (defined $opt_z ? $opt_z : 300) <= $date) {
833
+ # skip if the commit is too recent
834
+ # that the cvsps default fuzz is 300s, we give ourselves another
835
+ # 300s just in case -- this also prevents skipping commits
836
+ # due to server clock drift
837
+ print "skip patchset $patchset: $date too recent\n" if $opt_v;
838
+ $state = 11;
839
+ next;
840
+ }
841
if (exists $ignorebranch{$branch}) {
842
print STDERR "Skipping $branch\n";
843
$state = 11;