# HG changeset patch # User Patrick Mezard # Date 1273438242 -7200 # Node ID ecc8b18736dab8071d6cf2dc88e6cb0ea681c5fa # Parent 73a4ed3bfef8032620f144ca8b73fd44f746cacf convert: display files data retrieval progress diff -r 73a4ed3bfef8 -r ecc8b18736da hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Sun May 09 22:50:07 2010 +0200 +++ b/hgext/convert/convcmd.py Sun May 09 22:50:42 2010 +0200 @@ -72,6 +72,25 @@ ui.note(_("convert: %s\n") % inst) raise util.Abort(_('%s: unknown repository type') % path) +class progresssource(object): + def __init__(self, ui, source, filecount): + self.ui = ui + self.source = source + self.filecount = filecount + self.retrieved = 0 + + def getfile(self, file, rev): + self.retrieved += 1 + self.ui.progress(_('retrieving file'), self.retrieved, + item=file, total=self.filecount) + return self.source.getfile(file, rev) + + def lookuprev(self, rev): + return self.source.lookuprev(rev) + + def close(self): + self.ui.progress(_('retrieving file'), None) + class converter(object): def __init__(self, ui, source, dest, revmapfile, opts): @@ -304,8 +323,10 @@ parents = [self.map.get(p, p) for p in parents] except KeyError: parents = [b[0] for b in pbranches] + source = progresssource(self.ui, self.source, len(files)) newnode = self.dest.putcommit(files, copies, parents, commit, - self.source, self.map) + source, self.map) + source.close() self.source.converted(rev, newnode) self.map[rev] = newnode diff -r 73a4ed3bfef8 -r ecc8b18736da tests/test-convert-svn-move.out --- a/tests/test-convert-svn-move.out Sun May 09 22:50:07 2010 +0200 +++ b/tests/test-convert-svn-move.out Sun May 09 22:50:42 2010 +0200 @@ -88,12 +88,23 @@ scanning [ <=> ] 4 converting [ ] 0/4 +retrieving file [==========> ] 1/5 +retrieving file [=====================> ] 2/5 +retrieving file [=================================> ] 3/5 +retrieving file [============================================> ] 4/5 +retrieving file [========================================================>] 5/5 converting [==============> ] 1/4 +retrieving file [========================================================>] 1/1 converting [==============================> ] 2/4 +retrieving file [=============> ] 1/4 +retrieving file [===========================> ] 2/4 +retrieving file [=========================================> ] 3/4 +retrieving file [========================================================>] 4/4 converting [=============================================> ] 3/4 +retrieving file [========================================================>] 1/1 initializing destination hg-progress repository scanning source...