[PATCH 1 of 2] convert: add missing numcommits() override to hg sources

Matt Harbison mharbison72 at gmail.com
Thu Jan 10 23:01:31 UTC 2019


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1547062386 18000
#      Wed Jan 09 14:33:06 2019 -0500
# Branch stable
# Node ID 60e7f0c9b572f995b0d196f6b946001f148d576f
# Parent  fbd5e2f0bba7661f6f09e6cfd2bc2ffd07559a41
convert: add missing numcommits() override to hg sources

Otherwise, the progressbar in converter.walktree() gets None as its total during
the initial scan.  (Though that seems harmless, and there are other foreign vcs
sources without this.)

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -270,6 +270,9 @@ class filemap_source(common.converter_so
             self.children[p] = self.children.get(p, 0) + 1
         return c
 
+    def numcommits(self):
+        return self.base.numcommits()
+
     def _cachedcommit(self, rev):
         if rev in self.commits:
             return self.commits[rev]
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -597,6 +597,9 @@ class mercurial_source(common.converter_
                              saverev=self.saverev,
                              phase=ctx.phase())
 
+    def numcommits(self):
+        return len(self.repo)
+
     def gettags(self):
         # This will get written to .hgtags, filter non global tags out.
         tags = [t for t in self.repo.tagslist()
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -451,7 +451,7 @@ Test rebuilding of map with unknown revi
   run hg source pre-conversion action
   run hg sink pre-conversion action
   scanning source...
-  scanning: 1 revisions
+  scanning: 1/7 revisions (14.29%)
   sorting...
   converting...
   0 merging something


More information about the Mercurial-devel mailing list