##// END OF EJS Templates
convert: add progress support
Patrick Mezard -
r11135:73a4ed3b default
parent child Browse files
Show More
@@ -111,11 +111,13 b' class converter(object):'
111 111 if n in known or n in self.map:
112 112 continue
113 113 known.add(n)
114 self.ui.progress(_('scanning'), len(known), unit=_('revisions'))
114 115 commit = self.cachecommit(n)
115 116 parents[n] = []
116 117 for p in commit.parents:
117 118 parents[n].append(p)
118 119 visit.append(p)
120 self.ui.progress(_('scanning'), None)
119 121
120 122 return parents
121 123
@@ -321,7 +323,7 b' class converter(object):'
321 323 c = None
322 324
323 325 self.ui.status(_("converting...\n"))
324 for c in t:
326 for i, c in enumerate(t):
325 327 num -= 1
326 328 desc = self.commitcache[c].desc
327 329 if "\n" in desc:
@@ -331,7 +333,10 b' class converter(object):'
331 333 # 'utf-8'
332 334 self.ui.status("%d %s\n" % (num, recode(desc)))
333 335 self.ui.note(_("source: %s\n") % recode(c))
336 self.ui.progress(_('converting'), i, unit=_('revisions'),
337 total=len(t))
334 338 self.copy(c)
339 self.ui.progress(_('converting'), None)
335 340
336 341 tags = self.source.gettags()
337 342 ctags = {}
@@ -51,3 +51,20 b' hg -v manifest -r 3'
51 51 echo '% try updating'
52 52 hg up -qC default
53 53 cd ..
54
55 echo '% test convert progress bar'
56
57 echo "progress=" >> $HGRCPATH
58 echo "[progress]" >> $HGRCPATH
59 echo "assume-tty=1" >> $HGRCPATH
60 echo "delay=0" >> $HGRCPATH
61 echo "refresh=0" >> $HGRCPATH
62
63 cat > filtercr.py <<EOF
64 import sys, re
65 for line in sys.stdin:
66 line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
67 sys.stdout.write(line)
68 EOF
69
70 hg convert svn-repo hg-progress 2>&1 | python filtercr.py
@@ -80,3 +80,26 b' 644 dlink/b'
80 80 644 @ dlink2
81 81 644 @ dlink3
82 82 % try updating
83 % test convert progress bar
84
85 scanning [ <=> ] 1
86 scanning [ <=> ] 2
87 scanning [ <=> ] 3
88 scanning [ <=> ] 4
89
90 converting [ ] 0/4
91
92 converting [==============> ] 1/4
93
94 converting [==============================> ] 2/4
95
96 converting [=============================================> ] 3/4
97
98 initializing destination hg-progress repository
99 scanning source...
100 sorting...
101 converting...
102 3 initial
103 2 clobber symlink
104 1 clobber1
105 0 clobber2
General Comments 0
You need to be logged in to leave comments. Login now