Common subdirectories: fromcvs-9679642582bc/commitset and fromcvs/commitset
Common subdirectories: fromcvs-9679642582bc/t and fromcvs/t
diff -u fromcvs-9679642582bc/togit.rb fromcvs/togit.rb
--- fromcvs-9679642582bc/togit.rb	2008-12-01 02:28:19.000000000 +0200
+++ fromcvs/togit.rb	2008-12-30 11:09:40.000000000 +0200
@@ -31,6 +31,7 @@
     @deleted = []
     @modified = []
     @branchcache = {}
+    @last_dates = {}
     @files = Hash.new{|h,k| h[k] = {}}
 
     @mark = 0
@@ -47,13 +48,31 @@
       next if type != 'commit'
       branch[/^.*\//] = ""
       @branchcache[branch] = sha
+      @last_dates[branch] = _get_last_date(branch);
+      puts @last_dates[branch]
     end
     @pickupbranches = @branchcache.dup
   end
 
+  # All commits before this date is skipped when reading the CVS repository.
+  # In incremental mode, should be the date of *last* commit on any branch
+  # in the GIT repository. However, with this patch, we don't assume that
+  # all branches have been updated up to the same point in time. Therefore,
+  # take the *minimum* date of branch tips in GIT.
+  #
+  # In _commit function below, we check that we don't try to commit anything
+  # to a branch with older date the tip commit on the branch. Otherwise
+  # we'd get duplicate commits.
   def last_date
+    return @last_dates.values.min
+    #return @last_dates.values.max # use this for the normal incremental mode
+  end
+
+  def _get_last_date(branch)
+    branch = 'refs/heads/' + branch
+    puts 'requesting ' + branch
     latestref = _command(*%w{git for-each-ref --count=1 --sort=-committerdate 
-                                --format=%(refname) refs/heads})
+                                --format=%(refname) } + [branch])
     log = _command('git', 'cat-file', '-p', latestref.strip)
     log.split("\n").each do |line|
       break if line.empty?
@@ -148,7 +167,9 @@
   end
 
   def commit(author, date, msg, revs)
-    _commit(author, date, msg, revs)
+    if date > @last_dates[@curbranch]
+      _commit(author, date, msg, revs)
+    end
   end
 
   def merge(branch, author, date, msg, revs)
Only in fromcvs: togit.rb~
