# HG changeset patch # User Patrick Mezard # Date 1273438207 -7200 # Node ID 73a4ed3bfef8032620f144ca8b73fd44f746cacf # Parent 33010ff1fd6f39ec3a8486d41920af0ea6a366a2 convert: add progress support diff -r 33010ff1fd6f -r 73a4ed3bfef8 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Sun May 09 21:52:34 2010 +0200 +++ b/hgext/convert/convcmd.py Sun May 09 22:50:07 2010 +0200 @@ -111,11 +111,13 @@ if n in known or n in self.map: continue known.add(n) + self.ui.progress(_('scanning'), len(known), unit=_('revisions')) commit = self.cachecommit(n) parents[n] = [] for p in commit.parents: parents[n].append(p) visit.append(p) + self.ui.progress(_('scanning'), None) return parents @@ -321,7 +323,7 @@ c = None self.ui.status(_("converting...\n")) - for c in t: + for i, c in enumerate(t): num -= 1 desc = self.commitcache[c].desc if "\n" in desc: @@ -331,7 +333,10 @@ # 'utf-8' self.ui.status("%d %s\n" % (num, recode(desc))) self.ui.note(_("source: %s\n") % recode(c)) + self.ui.progress(_('converting'), i, unit=_('revisions'), + total=len(t)) self.copy(c) + self.ui.progress(_('converting'), None) tags = self.source.gettags() ctags = {} diff -r 33010ff1fd6f -r 73a4ed3bfef8 tests/test-convert-svn-move --- a/tests/test-convert-svn-move Sun May 09 21:52:34 2010 +0200 +++ b/tests/test-convert-svn-move Sun May 09 22:50:07 2010 +0200 @@ -51,3 +51,20 @@ echo '% try updating' hg up -qC default cd .. + +echo '% test convert progress bar' + +echo "progress=" >> $HGRCPATH +echo "[progress]" >> $HGRCPATH +echo "assume-tty=1" >> $HGRCPATH +echo "delay=0" >> $HGRCPATH +echo "refresh=0" >> $HGRCPATH + +cat > filtercr.py <&1 | python filtercr.py diff -r 33010ff1fd6f -r 73a4ed3bfef8 tests/test-convert-svn-move.out --- a/tests/test-convert-svn-move.out Sun May 09 21:52:34 2010 +0200 +++ b/tests/test-convert-svn-move.out Sun May 09 22:50:07 2010 +0200 @@ -80,3 +80,26 @@ 644 @ dlink2 644 @ dlink3 % try updating +% test convert progress bar + +scanning [ <=> ] 1 +scanning [ <=> ] 2 +scanning [ <=> ] 3 +scanning [ <=> ] 4 + +converting [ ] 0/4 + +converting [==============> ] 1/4 + +converting [==============================> ] 2/4 + +converting [=============================================> ] 3/4 + +initializing destination hg-progress repository +scanning source... +sorting... +converting... +3 initial +2 clobber symlink +1 clobber1 +0 clobber2