Mercurial > hg
comparison hgext/convert/convcmd.py @ 11135:73a4ed3bfef8
convert: add progress support
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 09 May 2010 22:50:07 +0200 |
parents | 08a0f04b56bd |
children | ecc8b18736da |
comparison
equal
deleted
inserted
replaced
11134:33010ff1fd6f | 11135:73a4ed3bfef8 |
---|---|
109 while visit: | 109 while visit: |
110 n = visit.pop(0) | 110 n = visit.pop(0) |
111 if n in known or n in self.map: | 111 if n in known or n in self.map: |
112 continue | 112 continue |
113 known.add(n) | 113 known.add(n) |
114 self.ui.progress(_('scanning'), len(known), unit=_('revisions')) | |
114 commit = self.cachecommit(n) | 115 commit = self.cachecommit(n) |
115 parents[n] = [] | 116 parents[n] = [] |
116 for p in commit.parents: | 117 for p in commit.parents: |
117 parents[n].append(p) | 118 parents[n].append(p) |
118 visit.append(p) | 119 visit.append(p) |
120 self.ui.progress(_('scanning'), None) | |
119 | 121 |
120 return parents | 122 return parents |
121 | 123 |
122 def toposort(self, parents, sortmode): | 124 def toposort(self, parents, sortmode): |
123 '''Return an ordering such that every uncommitted changeset is | 125 '''Return an ordering such that every uncommitted changeset is |
319 t = self.toposort(parents, sortmode) | 321 t = self.toposort(parents, sortmode) |
320 num = len(t) | 322 num = len(t) |
321 c = None | 323 c = None |
322 | 324 |
323 self.ui.status(_("converting...\n")) | 325 self.ui.status(_("converting...\n")) |
324 for c in t: | 326 for i, c in enumerate(t): |
325 num -= 1 | 327 num -= 1 |
326 desc = self.commitcache[c].desc | 328 desc = self.commitcache[c].desc |
327 if "\n" in desc: | 329 if "\n" in desc: |
328 desc = desc.splitlines()[0] | 330 desc = desc.splitlines()[0] |
329 # convert log message to local encoding without using | 331 # convert log message to local encoding without using |
330 # tolocal() because encoding.encoding conver() use it as | 332 # tolocal() because encoding.encoding conver() use it as |
331 # 'utf-8' | 333 # 'utf-8' |
332 self.ui.status("%d %s\n" % (num, recode(desc))) | 334 self.ui.status("%d %s\n" % (num, recode(desc))) |
333 self.ui.note(_("source: %s\n") % recode(c)) | 335 self.ui.note(_("source: %s\n") % recode(c)) |
336 self.ui.progress(_('converting'), i, unit=_('revisions'), | |
337 total=len(t)) | |
334 self.copy(c) | 338 self.copy(c) |
339 self.ui.progress(_('converting'), None) | |
335 | 340 |
336 tags = self.source.gettags() | 341 tags = self.source.gettags() |
337 ctags = {} | 342 ctags = {} |
338 for k in tags: | 343 for k in tags: |
339 v = tags[k] | 344 v = tags[k] |