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

login
register
mail settings
Submitter Matt Harbison
Date Jan. 10, 2019, 11:01 p.m.
Message ID <60e7f0c9b572f995b0d1.1547161291@mharbison-pc.attotech.com>
Download mbox | patch
Permalink /patch/37639/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 10, 2019, 11:01 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.)
Yuya Nishihara - Jan. 11, 2019, 12:35 p.m.
On Thu, 10 Jan 2019 18:01:31 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@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

Queued, thanks.

Patch

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