# HG changeset patch # User Augie Fackler # Date 1401119592 14400 # Node ID c497e39d81a328f2d7cebbe17ab7c477cb34ce52 # Parent 9fdbf96fc0e0e781a67f91a6af526058d0d03d90 convert: add support for deterministic progress bar on scanning phase This makes it possible to estimate how long the "scanning source" phase will take, if the specified source repo type supports a quick "how many changes" check. diff -r 9fdbf96fc0e0 -r c497e39d81a3 hgext/convert/common.py --- a/hgext/convert/common.py Wed Sep 10 11:01:47 2014 -0400 +++ b/hgext/convert/common.py Mon May 26 11:53:12 2014 -0400 @@ -109,6 +109,13 @@ """Return the commit object for version""" raise NotImplementedError + def numcommits(self): + """Return the number of commits in this source. + + If unknown, return None. + """ + return None + def gettags(self): """Return the tags as a dictionary of name: revision diff -r 9fdbf96fc0e0 -r c497e39d81a3 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Wed Sep 10 11:01:47 2014 -0400 +++ b/hgext/convert/convcmd.py Mon May 26 11:53:12 2014 -0400 @@ -171,6 +171,7 @@ visit = heads known = set() parents = {} + numcommits = self.source.numcommits() while visit: n = visit.pop(0) if n in known: @@ -180,7 +181,8 @@ if m == SKIPREV or self.dest.hascommitfrommap(m): continue known.add(n) - self.ui.progress(_('scanning'), len(known), unit=_('revisions')) + self.ui.progress(_('scanning'), len(known), unit=_('revisions'), + total=numcommits) commit = self.cachecommit(n) parents[n] = [] for p in commit.parents: