##// 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 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
@@ -321,7 +323,7 b' class converter(object):'
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:
@@ -331,7 +333,10 b' class converter(object):'
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 = {}
@@ -51,3 +51,20 b' hg -v manifest -r 3'
51 echo '% try updating'
51 echo '% try updating'
52 hg up -qC default
52 hg up -qC default
53 cd ..
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 644 @ dlink2
80 644 @ dlink2
81 644 @ dlink3
81 644 @ dlink3
82 % try updating
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