git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] cvsimport: skip commits that are too recent

From
MLMartin Langhoff <martin@catalyst.net.nz>
Date
Jan 8, 2007, 01:11 UTC
Message-ID
<1168218683853-git-send-email-martin@catalyst.net.nz>

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>
---
 git-cvsimport.perl |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index c5bf2d1..2686775 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -129,6 +129,11 @@ if ($opt_M) {
 	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);
 
 
@@ -824,6 +829,15 @@ while (<CVS>) {
 			$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;
-- 
1.5.0.rc0.g4017-dirty
Next: Junio C Hamano
Message 1 of 5 in “cvsimport: skip commits that are too recent”
  1. cvsimport: skip commits that are too recentMartin Langhoff, Jan 8, 2007
  2. Junio C HamanoJan 8, 2007
  3. Martin LanghoffJan 8, 2007
  4. Junio C HamanoJan 8, 2007
  5. Martin LanghoffJan 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.