Show More
@@ -1,206 +1,214 b'' | |||||
1 | # progress.py show progress bars for some actions |
|
1 | # progress.py show progress bars for some actions | |
2 | # |
|
2 | # | |
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> |
|
3 | # Copyright (C) 2010 Augie Fackler <durin42@gmail.com> | |
4 | # |
|
4 | # | |
5 | # This program is free software; you can redistribute it and/or modify it |
|
5 | # This program is free software; you can redistribute it and/or modify it | |
6 | # under the terms of the GNU General Public License as published by the |
|
6 | # under the terms of the GNU General Public License as published by the | |
7 | # Free Software Foundation; either version 2 of the License, or (at your |
|
7 | # Free Software Foundation; either version 2 of the License, or (at your | |
8 | # option) any later version. |
|
8 | # option) any later version. | |
9 | # |
|
9 | # | |
10 | # This program is distributed in the hope that it will be useful, but |
|
10 | # This program is distributed in the hope that it will be useful, but | |
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
13 | # Public License for more details. |
|
13 | # Public License for more details. | |
14 | # |
|
14 | # | |
15 | # You should have received a copy of the GNU General Public License along |
|
15 | # You should have received a copy of the GNU General Public License along | |
16 | # with this program; if not, write to the Free Software Foundation, Inc., |
|
16 | # with this program; if not, write to the Free Software Foundation, Inc., | |
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 |
|
18 | |||
19 | """show progress bars for some actions |
|
19 | """show progress bars for some actions | |
20 |
|
20 | |||
21 | This extension uses the progress information logged by hg commands |
|
21 | This extension uses the progress information logged by hg commands | |
22 | to draw progress bars that are as informative as possible. Some progress |
|
22 | to draw progress bars that are as informative as possible. Some progress | |
23 | bars only offer indeterminate information, while others have a definite |
|
23 | bars only offer indeterminate information, while others have a definite | |
24 | end point. |
|
24 | end point. | |
25 |
|
25 | |||
26 | The following settings are available:: |
|
26 | The following settings are available:: | |
27 |
|
27 | |||
28 | [progress] |
|
28 | [progress] | |
29 | delay = 3 # number of seconds (float) before showing the progress bar |
|
29 | delay = 3 # number of seconds (float) before showing the progress bar | |
30 | refresh = 0.1 # time in seconds between refreshes of the progress bar |
|
30 | refresh = 0.1 # time in seconds between refreshes of the progress bar | |
31 | format = topic bar number # format of the progress bar |
|
31 | format = topic bar number # format of the progress bar | |
32 | width = <none> # if set, the maximum width of the progress information |
|
32 | width = <none> # if set, the maximum width of the progress information | |
33 | # (that is, min(width, term width) will be used) |
|
33 | # (that is, min(width, term width) will be used) | |
34 | clear-complete = True # clear the progress bar after it's done |
|
34 | clear-complete = True # clear the progress bar after it's done | |
35 | disable = False # if true, don't show a progress bar |
|
35 | disable = False # if true, don't show a progress bar | |
36 | assume-tty = False # if true, ALWAYS show a progress bar, unless |
|
36 | assume-tty = False # if true, ALWAYS show a progress bar, unless | |
37 | # disable is given |
|
37 | # disable is given | |
38 |
|
38 | |||
39 | Valid entries for the format field are topic, bar, number, unit, and |
|
39 | Valid entries for the format field are topic, bar, number, unit, and | |
40 | item. item defaults to the last 20 characters of the item, but this |
|
40 | item. item defaults to the last 20 characters of the item, but this | |
41 | can be changed by adding either ``-<num>`` which would take the last |
|
41 | can be changed by adding either ``-<num>`` which would take the last | |
42 | num characters, or ``+<num>`` for the first num characters. |
|
42 | num characters, or ``+<num>`` for the first num characters. | |
43 | """ |
|
43 | """ | |
44 |
|
44 | |||
45 | import sys |
|
45 | import sys | |
46 | import time |
|
46 | import time | |
47 |
|
47 | |||
48 | from mercurial import util |
|
48 | from mercurial import util | |
49 |
|
49 | |||
50 | def spacejoin(*args): |
|
50 | def spacejoin(*args): | |
51 | return ' '.join(s for s in args if s) |
|
51 | return ' '.join(s for s in args if s) | |
52 |
|
52 | |||
53 | def shouldprint(ui): |
|
53 | def shouldprint(ui): | |
54 | return (getattr(sys.stderr, 'isatty', None) and |
|
54 | return (getattr(sys.stderr, 'isatty', None) and | |
55 | (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty'))) |
|
55 | (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty'))) | |
56 |
|
56 | |||
57 | class progbar(object): |
|
57 | class progbar(object): | |
58 | def __init__(self, ui): |
|
58 | def __init__(self, ui): | |
59 | self.ui = ui |
|
59 | self.ui = ui | |
60 | self.resetstate() |
|
60 | self.resetstate() | |
61 |
|
61 | |||
62 | def resetstate(self): |
|
62 | def resetstate(self): | |
63 | self.topics = [] |
|
63 | self.topics = [] | |
|
64 | self.topicstates = {} | |||
64 | self.printed = False |
|
65 | self.printed = False | |
65 | self.lastprint = time.time() + float(self.ui.config( |
|
66 | self.lastprint = time.time() + float(self.ui.config( | |
66 | 'progress', 'delay', default=3)) |
|
67 | 'progress', 'delay', default=3)) | |
67 | self.indetcount = 0 |
|
68 | self.indetcount = 0 | |
68 | self.refresh = float(self.ui.config( |
|
69 | self.refresh = float(self.ui.config( | |
69 | 'progress', 'refresh', default=0.1)) |
|
70 | 'progress', 'refresh', default=0.1)) | |
70 | self.order = self.ui.configlist( |
|
71 | self.order = self.ui.configlist( | |
71 | 'progress', 'format', |
|
72 | 'progress', 'format', | |
72 | default=['topic', 'bar', 'number']) |
|
73 | default=['topic', 'bar', 'number']) | |
73 |
|
74 | |||
74 | def show(self, topic, pos, item, unit, total): |
|
75 | def show(self, topic, pos, item, unit, total): | |
75 | if not shouldprint(self.ui): |
|
76 | if not shouldprint(self.ui): | |
76 | return |
|
77 | return | |
77 | termwidth = self.width() |
|
78 | termwidth = self.width() | |
78 | self.printed = True |
|
79 | self.printed = True | |
79 | head = '' |
|
80 | head = '' | |
80 | needprogress = False |
|
81 | needprogress = False | |
81 | tail = '' |
|
82 | tail = '' | |
82 | for indicator in self.order: |
|
83 | for indicator in self.order: | |
83 | add = '' |
|
84 | add = '' | |
84 | if indicator == 'topic': |
|
85 | if indicator == 'topic': | |
85 | add = topic |
|
86 | add = topic | |
86 | elif indicator == 'number': |
|
87 | elif indicator == 'number': | |
87 | if total: |
|
88 | if total: | |
88 | add = ('% ' + str(len(str(total))) + |
|
89 | add = ('% ' + str(len(str(total))) + | |
89 | 's/%s') % (pos, total) |
|
90 | 's/%s') % (pos, total) | |
90 | else: |
|
91 | else: | |
91 | add = str(pos) |
|
92 | add = str(pos) | |
92 | elif indicator.startswith('item') and item: |
|
93 | elif indicator.startswith('item') and item: | |
93 | slice = 'end' |
|
94 | slice = 'end' | |
94 | if '-' in indicator: |
|
95 | if '-' in indicator: | |
95 | wid = int(indicator.split('-')[1]) |
|
96 | wid = int(indicator.split('-')[1]) | |
96 | elif '+' in indicator: |
|
97 | elif '+' in indicator: | |
97 | slice = 'beginning' |
|
98 | slice = 'beginning' | |
98 | wid = int(indicator.split('+')[1]) |
|
99 | wid = int(indicator.split('+')[1]) | |
99 | else: |
|
100 | else: | |
100 | wid = 20 |
|
101 | wid = 20 | |
101 | if slice == 'end': |
|
102 | if slice == 'end': | |
102 | add = item[-wid:] |
|
103 | add = item[-wid:] | |
103 | else: |
|
104 | else: | |
104 | add = item[:wid] |
|
105 | add = item[:wid] | |
105 | add += (wid - len(add)) * ' ' |
|
106 | add += (wid - len(add)) * ' ' | |
106 | elif indicator == 'bar': |
|
107 | elif indicator == 'bar': | |
107 | add = '' |
|
108 | add = '' | |
108 | needprogress = True |
|
109 | needprogress = True | |
109 | elif indicator == 'unit' and unit: |
|
110 | elif indicator == 'unit' and unit: | |
110 | add = unit |
|
111 | add = unit | |
111 | if not needprogress: |
|
112 | if not needprogress: | |
112 | head = spacejoin(head, add) |
|
113 | head = spacejoin(head, add) | |
113 | else: |
|
114 | else: | |
114 | tail = spacejoin(add, tail) |
|
115 | tail = spacejoin(add, tail) | |
115 | if needprogress: |
|
116 | if needprogress: | |
116 | used = 0 |
|
117 | used = 0 | |
117 | if head: |
|
118 | if head: | |
118 | used += len(head) + 1 |
|
119 | used += len(head) + 1 | |
119 | if tail: |
|
120 | if tail: | |
120 | used += len(tail) + 1 |
|
121 | used += len(tail) + 1 | |
121 | progwidth = termwidth - used - 3 |
|
122 | progwidth = termwidth - used - 3 | |
122 | if total and pos <= total: |
|
123 | if total and pos <= total: | |
123 | amt = pos * progwidth // total |
|
124 | amt = pos * progwidth // total | |
124 | bar = '=' * (amt - 1) |
|
125 | bar = '=' * (amt - 1) | |
125 | if amt > 0: |
|
126 | if amt > 0: | |
126 | bar += '>' |
|
127 | bar += '>' | |
127 | bar += ' ' * (progwidth - amt) |
|
128 | bar += ' ' * (progwidth - amt) | |
128 | else: |
|
129 | else: | |
129 | progwidth -= 3 |
|
130 | progwidth -= 3 | |
130 | self.indetcount += 1 |
|
131 | self.indetcount += 1 | |
131 | # mod the count by twice the width so we can make the |
|
132 | # mod the count by twice the width so we can make the | |
132 | # cursor bounce between the right and left sides |
|
133 | # cursor bounce between the right and left sides | |
133 | amt = self.indetcount % (2 * progwidth) |
|
134 | amt = self.indetcount % (2 * progwidth) | |
134 | amt -= progwidth |
|
135 | amt -= progwidth | |
135 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + |
|
136 | bar = (' ' * int(progwidth - abs(amt)) + '<=>' + | |
136 | ' ' * int(abs(amt))) |
|
137 | ' ' * int(abs(amt))) | |
137 | prog = ''.join(('[', bar , ']')) |
|
138 | prog = ''.join(('[', bar , ']')) | |
138 | out = spacejoin(head, prog, tail) |
|
139 | out = spacejoin(head, prog, tail) | |
139 | else: |
|
140 | else: | |
140 | out = spacejoin(head, tail) |
|
141 | out = spacejoin(head, tail) | |
141 | sys.stderr.write('\r' + out[:termwidth]) |
|
142 | sys.stderr.write('\r' + out[:termwidth]) | |
142 | sys.stderr.flush() |
|
143 | sys.stderr.flush() | |
143 |
|
144 | |||
144 | def clear(self): |
|
145 | def clear(self): | |
145 | if not shouldprint(self.ui): |
|
146 | if not shouldprint(self.ui): | |
146 | return |
|
147 | return | |
147 | sys.stderr.write('\r%s\r' % (' ' * self.width())) |
|
148 | sys.stderr.write('\r%s\r' % (' ' * self.width())) | |
148 |
|
149 | |||
149 | def complete(self): |
|
150 | def complete(self): | |
150 | if not shouldprint(self.ui): |
|
151 | if not shouldprint(self.ui): | |
151 | return |
|
152 | return | |
152 | if self.ui.configbool('progress', 'clear-complete', default=True): |
|
153 | if self.ui.configbool('progress', 'clear-complete', default=True): | |
153 | self.clear() |
|
154 | self.clear() | |
154 | else: |
|
155 | else: | |
155 | sys.stderr.write('\n') |
|
156 | sys.stderr.write('\n') | |
156 | sys.stderr.flush() |
|
157 | sys.stderr.flush() | |
157 |
|
158 | |||
158 | def width(self): |
|
159 | def width(self): | |
159 | tw = self.ui.termwidth() |
|
160 | tw = self.ui.termwidth() | |
160 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) |
|
161 | return min(int(self.ui.config('progress', 'width', default=tw)), tw) | |
161 |
|
162 | |||
162 | def progress(self, topic, pos, item='', unit='', total=None): |
|
163 | def progress(self, topic, pos, item='', unit='', total=None): | |
163 | if pos is None: |
|
164 | if pos is None: | |
164 | if self.topics and self.topics[-1] == topic and self.printed: |
|
165 | self.topicstates.pop(topic, None) | |
|
166 | # reset the progress bar if this is the outermost topic | |||
|
167 | if self.topics and self.topics[0] == topic and self.printed: | |||
165 | self.complete() |
|
168 | self.complete() | |
166 | self.resetstate() |
|
169 | self.resetstate() | |
|
170 | # truncate the list of topics assuming all topics within | |||
|
171 | # this one are also closed | |||
|
172 | if topic in self.topics: | |||
|
173 | self.topics = self.topics[:self.topics.index(topic)] | |||
167 | else: |
|
174 | else: | |
168 | if topic not in self.topics: |
|
175 | if topic not in self.topics: | |
169 | self.topics.append(topic) |
|
176 | self.topics.append(topic) | |
170 | now = time.time() |
|
177 | now = time.time() | |
171 | if (now - self.lastprint >= self.refresh |
|
178 | self.topicstates[topic] = pos, item, unit, total | |
172 | and topic == self.topics[-1]): |
|
179 | if now - self.lastprint >= self.refresh and self.topics: | |
173 | self.lastprint = now |
|
180 | self.lastprint = now | |
174 | self.show(topic, pos, item, unit, total) |
|
181 | current = self.topics[-1] | |
|
182 | self.show(current, *self.topicstates[current]) | |||
175 |
|
183 | |||
176 | def uisetup(ui): |
|
184 | def uisetup(ui): | |
177 | class progressui(ui.__class__): |
|
185 | class progressui(ui.__class__): | |
178 | _progbar = None |
|
186 | _progbar = None | |
179 |
|
187 | |||
180 | def progress(self, *args, **opts): |
|
188 | def progress(self, *args, **opts): | |
181 | self._progbar.progress(*args, **opts) |
|
189 | self._progbar.progress(*args, **opts) | |
182 | return super(progressui, self).progress(*args, **opts) |
|
190 | return super(progressui, self).progress(*args, **opts) | |
183 |
|
191 | |||
184 | def write(self, *args, **opts): |
|
192 | def write(self, *args, **opts): | |
185 | if self._progbar.printed: |
|
193 | if self._progbar.printed: | |
186 | self._progbar.clear() |
|
194 | self._progbar.clear() | |
187 | return super(progressui, self).write(*args, **opts) |
|
195 | return super(progressui, self).write(*args, **opts) | |
188 |
|
196 | |||
189 | def write_err(self, *args, **opts): |
|
197 | def write_err(self, *args, **opts): | |
190 | if self._progbar.printed: |
|
198 | if self._progbar.printed: | |
191 | self._progbar.clear() |
|
199 | self._progbar.clear() | |
192 | return super(progressui, self).write_err(*args, **opts) |
|
200 | return super(progressui, self).write_err(*args, **opts) | |
193 |
|
201 | |||
194 | # Apps that derive a class from ui.ui() can use |
|
202 | # Apps that derive a class from ui.ui() can use | |
195 | # setconfig('progress', 'disable', 'True') to disable this extension |
|
203 | # setconfig('progress', 'disable', 'True') to disable this extension | |
196 | if ui.configbool('progress', 'disable'): |
|
204 | if ui.configbool('progress', 'disable'): | |
197 | return |
|
205 | return | |
198 | if shouldprint(ui) and not ui.debugflag and not ui.quiet: |
|
206 | if shouldprint(ui) and not ui.debugflag and not ui.quiet: | |
199 | ui.__class__ = progressui |
|
207 | ui.__class__ = progressui | |
200 | # we instantiate one globally shared progress bar to avoid |
|
208 | # we instantiate one globally shared progress bar to avoid | |
201 | # competing progress bars when multiple UI objects get created |
|
209 | # competing progress bars when multiple UI objects get created | |
202 | if not progressui._progbar: |
|
210 | if not progressui._progbar: | |
203 | progressui._progbar = progbar(ui) |
|
211 | progressui._progbar = progbar(ui) | |
204 |
|
212 | |||
205 | def reposetup(ui, repo): |
|
213 | def reposetup(ui, repo): | |
206 | uisetup(repo.ui) |
|
214 | uisetup(repo.ui) |
@@ -1,257 +1,251 b'' | |||||
1 |
|
1 | |||
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 |
|
2 | $ "$TESTDIR/hghave" svn svn-bindings || exit 80 | |
3 |
|
3 | |||
4 | $ fixpath() |
|
4 | $ fixpath() | |
5 | > { |
|
5 | > { | |
6 | > tr '\\' / |
|
6 | > tr '\\' / | |
7 | > } |
|
7 | > } | |
8 | $ cat > $HGRCPATH <<EOF |
|
8 | $ cat > $HGRCPATH <<EOF | |
9 | > [extensions] |
|
9 | > [extensions] | |
10 | > convert = |
|
10 | > convert = | |
11 | > graphlog = |
|
11 | > graphlog = | |
12 | > EOF |
|
12 | > EOF | |
13 |
|
13 | |||
14 | $ svnadmin create svn-repo |
|
14 | $ svnadmin create svn-repo | |
15 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump" |
|
15 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/move.svndump" | |
16 | $ svnpath=`pwd | fixpath` |
|
16 | $ svnpath=`pwd | fixpath` | |
17 |
|
17 | |||
18 | SVN wants all paths to start with a slash. Unfortunately, |
|
18 | SVN wants all paths to start with a slash. Unfortunately, | |
19 | Windows ones don't. Handle that. |
|
19 | Windows ones don't. Handle that. | |
20 |
|
20 | |||
21 | $ expr "$svnpath" : "\/" > /dev/null |
|
21 | $ expr "$svnpath" : "\/" > /dev/null | |
22 | > if [ $? -ne 0 ]; then |
|
22 | > if [ $? -ne 0 ]; then | |
23 | > svnpath="/$svnpath" |
|
23 | > svnpath="/$svnpath" | |
24 | > fi |
|
24 | > fi | |
25 | > svnurl="file://$svnpath/svn-repo" |
|
25 | > svnurl="file://$svnpath/svn-repo" | |
26 |
|
26 | |||
27 | Convert trunk and branches |
|
27 | Convert trunk and branches | |
28 |
|
28 | |||
29 | $ hg convert --datesort "$svnurl"/subproject A-hg |
|
29 | $ hg convert --datesort "$svnurl"/subproject A-hg | |
30 | initializing destination A-hg repository |
|
30 | initializing destination A-hg repository | |
31 | scanning source... |
|
31 | scanning source... | |
32 | sorting... |
|
32 | sorting... | |
33 | converting... |
|
33 | converting... | |
34 | 13 createtrunk |
|
34 | 13 createtrunk | |
35 | 12 moved1 |
|
35 | 12 moved1 | |
36 | 11 moved1 |
|
36 | 11 moved1 | |
37 | 10 moved2 |
|
37 | 10 moved2 | |
38 | 9 changeb and rm d2 |
|
38 | 9 changeb and rm d2 | |
39 | 8 changeb and rm d2 |
|
39 | 8 changeb and rm d2 | |
40 | 7 moved1again |
|
40 | 7 moved1again | |
41 | 6 moved1again |
|
41 | 6 moved1again | |
42 | 5 copyfilefrompast |
|
42 | 5 copyfilefrompast | |
43 | 4 copydirfrompast |
|
43 | 4 copydirfrompast | |
44 | 3 add d3 |
|
44 | 3 add d3 | |
45 | 2 copy dir and remove subdir |
|
45 | 2 copy dir and remove subdir | |
46 | 1 add d4old |
|
46 | 1 add d4old | |
47 | 0 rename d4old into d4new |
|
47 | 0 rename d4old into d4new | |
48 |
|
48 | |||
49 | $ cd A-hg |
|
49 | $ cd A-hg | |
50 | $ hg glog --template '{rev} {desc|firstline} files: {files}\n' |
|
50 | $ hg glog --template '{rev} {desc|firstline} files: {files}\n' | |
51 | o 13 rename d4old into d4new files: d4new/g d4old/g |
|
51 | o 13 rename d4old into d4new files: d4new/g d4old/g | |
52 | | |
|
52 | | | |
53 | o 12 add d4old files: d4old/g |
|
53 | o 12 add d4old files: d4old/g | |
54 | | |
|
54 | | | |
55 | o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f |
|
55 | o 11 copy dir and remove subdir files: d3/d31/e d4/d31/e d4/f | |
56 | | |
|
56 | | | |
57 | o 10 add d3 files: d3/d31/e d3/f |
|
57 | o 10 add d3 files: d3/d31/e d3/f | |
58 | | |
|
58 | | | |
59 | o 9 copydirfrompast files: d2/d |
|
59 | o 9 copydirfrompast files: d2/d | |
60 | | |
|
60 | | | |
61 | o 8 copyfilefrompast files: d |
|
61 | o 8 copyfilefrompast files: d | |
62 | | |
|
62 | | | |
63 | o 7 moved1again files: d1/b d1/c |
|
63 | o 7 moved1again files: d1/b d1/c | |
64 | | |
|
64 | | | |
65 | | o 6 moved1again files: |
|
65 | | o 6 moved1again files: | |
66 | | | |
|
66 | | | | |
67 | o | 5 changeb and rm d2 files: d1/b d2/d |
|
67 | o | 5 changeb and rm d2 files: d1/b d2/d | |
68 | | | |
|
68 | | | | |
69 | | o 4 changeb and rm d2 files: b |
|
69 | | o 4 changeb and rm d2 files: b | |
70 | | | |
|
70 | | | | |
71 | o | 3 moved2 files: d2/d |
|
71 | o | 3 moved2 files: d2/d | |
72 | | | |
|
72 | | | | |
73 | o | 2 moved1 files: d1/b d1/c |
|
73 | o | 2 moved1 files: d1/b d1/c | |
74 | | | |
|
74 | | | | |
75 | | o 1 moved1 files: b c |
|
75 | | o 1 moved1 files: b c | |
76 | | |
|
76 | | | |
77 | o 0 createtrunk files: |
|
77 | o 0 createtrunk files: | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | Check move copy records |
|
80 | Check move copy records | |
81 |
|
81 | |||
82 | $ hg st --rev 12:13 --copies |
|
82 | $ hg st --rev 12:13 --copies | |
83 | A d4new/g |
|
83 | A d4new/g | |
84 | d4old/g |
|
84 | d4old/g | |
85 | R d4old/g |
|
85 | R d4old/g | |
86 |
|
86 | |||
87 | Check branches |
|
87 | Check branches | |
88 |
|
88 | |||
89 | $ hg branches |
|
89 | $ hg branches | |
90 | default 13:* (glob) |
|
90 | default 13:* (glob) | |
91 | d1 6:* (glob) |
|
91 | d1 6:* (glob) | |
92 | $ cd .. |
|
92 | $ cd .. | |
93 |
|
93 | |||
94 | $ mkdir test-replace |
|
94 | $ mkdir test-replace | |
95 | $ cd test-replace |
|
95 | $ cd test-replace | |
96 | $ svnadmin create svn-repo |
|
96 | $ svnadmin create svn-repo | |
97 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump" |
|
97 | $ svnadmin load -q svn-repo < "$TESTDIR/svn/replace.svndump" | |
98 |
|
98 | |||
99 | Convert files being replaced by directories |
|
99 | Convert files being replaced by directories | |
100 |
|
100 | |||
101 | $ hg convert svn-repo hg-repo |
|
101 | $ hg convert svn-repo hg-repo | |
102 | initializing destination hg-repo repository |
|
102 | initializing destination hg-repo repository | |
103 | scanning source... |
|
103 | scanning source... | |
104 | sorting... |
|
104 | sorting... | |
105 | converting... |
|
105 | converting... | |
106 | 6 initial |
|
106 | 6 initial | |
107 | 5 clobber symlink |
|
107 | 5 clobber symlink | |
108 | 4 clobber1 |
|
108 | 4 clobber1 | |
109 | 3 clobber2 |
|
109 | 3 clobber2 | |
110 | 2 adddb |
|
110 | 2 adddb | |
111 | 1 branch |
|
111 | 1 branch | |
112 | 0 clobberdir |
|
112 | 0 clobberdir | |
113 |
|
113 | |||
114 | $ cd hg-repo |
|
114 | $ cd hg-repo | |
115 |
|
115 | |||
116 | Manifest before |
|
116 | Manifest before | |
117 |
|
117 | |||
118 | $ hg -v manifest -r 1 |
|
118 | $ hg -v manifest -r 1 | |
119 | 644 a |
|
119 | 644 a | |
120 | 644 d/b |
|
120 | 644 d/b | |
121 | 644 d2/a |
|
121 | 644 d2/a | |
122 | 644 @ dlink |
|
122 | 644 @ dlink | |
123 | 644 @ dlink2 |
|
123 | 644 @ dlink2 | |
124 | 644 dlink3 |
|
124 | 644 dlink3 | |
125 |
|
125 | |||
126 | Manifest after clobber1 |
|
126 | Manifest after clobber1 | |
127 |
|
127 | |||
128 | $ hg -v manifest -r 2 |
|
128 | $ hg -v manifest -r 2 | |
129 | 644 a/b |
|
129 | 644 a/b | |
130 | 644 d/b |
|
130 | 644 d/b | |
131 | 644 d2/a |
|
131 | 644 d2/a | |
132 | 644 dlink/b |
|
132 | 644 dlink/b | |
133 | 644 @ dlink2 |
|
133 | 644 @ dlink2 | |
134 | 644 dlink3 |
|
134 | 644 dlink3 | |
135 |
|
135 | |||
136 | Manifest after clobber2 |
|
136 | Manifest after clobber2 | |
137 |
|
137 | |||
138 | $ hg -v manifest -r 3 |
|
138 | $ hg -v manifest -r 3 | |
139 | 644 a/b |
|
139 | 644 a/b | |
140 | 644 d/b |
|
140 | 644 d/b | |
141 | 644 d2/a |
|
141 | 644 d2/a | |
142 | 644 dlink/b |
|
142 | 644 dlink/b | |
143 | 644 @ dlink2 |
|
143 | 644 @ dlink2 | |
144 | 644 @ dlink3 |
|
144 | 644 @ dlink3 | |
145 |
|
145 | |||
146 | Manifest after clobberdir |
|
146 | Manifest after clobberdir | |
147 |
|
147 | |||
148 | $ hg -v manifest -r 6 |
|
148 | $ hg -v manifest -r 6 | |
149 | 644 a/b |
|
149 | 644 a/b | |
150 | 644 d/b |
|
150 | 644 d/b | |
151 | 644 d2/a |
|
151 | 644 d2/a | |
152 | 644 d2/c |
|
152 | 644 d2/c | |
153 | 644 dlink/b |
|
153 | 644 dlink/b | |
154 | 644 @ dlink2 |
|
154 | 644 @ dlink2 | |
155 | 644 @ dlink3 |
|
155 | 644 @ dlink3 | |
156 |
|
156 | |||
157 | Try updating |
|
157 | Try updating | |
158 |
|
158 | |||
159 | $ hg up -qC default |
|
159 | $ hg up -qC default | |
160 | $ cd .. |
|
160 | $ cd .. | |
161 |
|
161 | |||
162 | Test convert progress bar' |
|
162 | Test convert progress bar' | |
163 |
|
163 | |||
164 | $ cat >> $HGRCPATH <<EOF |
|
164 | $ cat >> $HGRCPATH <<EOF | |
165 | > [extensions] |
|
165 | > [extensions] | |
166 | > progress = |
|
166 | > progress = | |
167 | > [progress] |
|
167 | > [progress] | |
168 | > assume-tty = 1 |
|
168 | > assume-tty = 1 | |
169 | > delay = 0 |
|
169 | > delay = 0 | |
170 | > refresh = 0 |
|
170 | > refresh = 0 | |
171 | > EOF |
|
171 | > EOF | |
172 | $ cat > filtercr.py <<EOF |
|
172 | $ cat > filtercr.py <<EOF | |
173 | > import sys, re |
|
173 | > import sys, re | |
174 | > for line in sys.stdin: |
|
174 | > for line in sys.stdin: | |
175 | > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) |
|
175 | > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line) | |
176 | > sys.stdout.write(line) |
|
176 | > sys.stdout.write(line) | |
177 | > EOF |
|
177 | > EOF | |
178 |
|
178 | |||
179 | $ hg convert svn-repo hg-progress 2>&1 | python filtercr.py |
|
179 | $ hg convert svn-repo hg-progress 2>&1 | python filtercr.py | |
180 |
|
180 | |||
181 | scanning [ <=> ] 1 |
|
181 | scanning [ <=> ] 1 | |
182 | scanning [ <=> ] 2 |
|
182 | scanning [ <=> ] 2 | |
183 | scanning [ <=> ] 3 |
|
183 | scanning [ <=> ] 3 | |
184 | scanning [ <=> ] 4 |
|
184 | scanning [ <=> ] 4 | |
185 | scanning [ <=> ] 5 |
|
185 | scanning [ <=> ] 5 | |
186 | scanning [ <=> ] 6 |
|
186 | scanning [ <=> ] 6 | |
187 | scanning [ <=> ] 7 |
|
187 | scanning [ <=> ] 7 | |
188 |
|
188 | |||
189 | converting [ ] 0/7 |
|
189 | converting [ ] 0/7 | |
190 | getting files [========> ] 1/6 |
|
190 | getting files [========> ] 1/6 | |
191 | getting files [==================> ] 2/6 |
|
191 | getting files [==================> ] 2/6 | |
192 | getting files [============================> ] 3/6 |
|
192 | getting files [============================> ] 3/6 | |
193 | getting files [======================================> ] 4/6 |
|
193 | getting files [======================================> ] 4/6 | |
194 | getting files [================================================> ] 5/6 |
|
194 | getting files [================================================> ] 5/6 | |
195 | getting files [==========================================================>] 6/6 |
|
195 | getting files [==========================================================>] 6/6 | |
196 |
|
196 | |||
197 | converting [=======> ] 1/7 |
|
197 | converting [=======> ] 1/7 | |
198 | scanning paths [ ] 0/1 |
|
198 | scanning paths [ ] 0/1 | |
199 |
|
||||
200 | getting files [==========================================================>] 1/1 |
|
199 | getting files [==========================================================>] 1/1 | |
201 |
|
200 | |||
202 | converting [================> ] 2/7 |
|
201 | converting [================> ] 2/7 | |
203 | scanning paths [ ] 0/2 |
|
202 | scanning paths [ ] 0/2 | |
204 | scanning paths [============================> ] 1/2 |
|
203 | scanning paths [============================> ] 1/2 | |
205 |
|
||||
206 | getting files [=============> ] 1/4 |
|
204 | getting files [=============> ] 1/4 | |
207 | getting files [============================> ] 2/4 |
|
205 | getting files [============================> ] 2/4 | |
208 | getting files [===========================================> ] 3/4 |
|
206 | getting files [===========================================> ] 3/4 | |
209 | getting files [==========================================================>] 4/4 |
|
207 | getting files [==========================================================>] 4/4 | |
210 |
|
208 | |||
211 | converting [=========================> ] 3/7 |
|
209 | converting [=========================> ] 3/7 | |
212 | scanning paths [ ] 0/1 |
|
210 | scanning paths [ ] 0/1 | |
213 |
|
||||
214 | getting files [==========================================================>] 1/1 |
|
211 | getting files [==========================================================>] 1/1 | |
215 |
|
212 | |||
216 | converting [==================================> ] 4/7 |
|
213 | converting [==================================> ] 4/7 | |
217 | scanning paths [ ] 0/1 |
|
214 | scanning paths [ ] 0/1 | |
218 |
|
||||
219 | getting files [==========================================================>] 1/1 |
|
215 | getting files [==========================================================>] 1/1 | |
220 |
|
216 | |||
221 | converting [===========================================> ] 5/7 |
|
217 | converting [===========================================> ] 5/7 | |
222 | scanning paths [ ] 0/3 |
|
218 | scanning paths [ ] 0/3 | |
223 | scanning paths [==================> ] 1/3 |
|
219 | scanning paths [==================> ] 1/3 | |
224 | scanning paths [=====================================> ] 2/3 |
|
220 | scanning paths [=====================================> ] 2/3 | |
225 |
|
||||
226 | getting files [======> ] 1/8 |
|
221 | getting files [======> ] 1/8 | |
227 | getting files [=============> ] 2/8 |
|
222 | getting files [=============> ] 2/8 | |
228 | getting files [=====================> ] 3/8 |
|
223 | getting files [=====================> ] 3/8 | |
229 | getting files [============================> ] 4/8 |
|
224 | getting files [============================> ] 4/8 | |
230 | getting files [===================================> ] 5/8 |
|
225 | getting files [===================================> ] 5/8 | |
231 | getting files [===========================================> ] 6/8 |
|
226 | getting files [===========================================> ] 6/8 | |
232 | getting files [==================================================> ] 7/8 |
|
227 | getting files [==================================================> ] 7/8 | |
233 | getting files [==========================================================>] 8/8 |
|
228 | getting files [==========================================================>] 8/8 | |
234 |
|
229 | |||
235 | converting [====================================================> ] 6/7 |
|
230 | converting [====================================================> ] 6/7 | |
236 | scanning paths [ ] 0/1 |
|
231 | scanning paths [ ] 0/1 | |
237 |
|
||||
238 | getting files [======> ] 1/8 |
|
232 | getting files [======> ] 1/8 | |
239 | getting files [=============> ] 2/8 |
|
233 | getting files [=============> ] 2/8 | |
240 | getting files [=====================> ] 3/8 |
|
234 | getting files [=====================> ] 3/8 | |
241 | getting files [============================> ] 4/8 |
|
235 | getting files [============================> ] 4/8 | |
242 | getting files [===================================> ] 5/8 |
|
236 | getting files [===================================> ] 5/8 | |
243 | getting files [===========================================> ] 6/8 |
|
237 | getting files [===========================================> ] 6/8 | |
244 | getting files [==================================================> ] 7/8 |
|
238 | getting files [==================================================> ] 7/8 | |
245 | getting files [==========================================================>] 8/8 |
|
239 | getting files [==========================================================>] 8/8 | |
246 |
|
240 | |||
247 | initializing destination hg-progress repository |
|
241 | initializing destination hg-progress repository | |
248 | scanning source... |
|
242 | scanning source... | |
249 | sorting... |
|
243 | sorting... | |
250 | converting... |
|
244 | converting... | |
251 | 6 initial |
|
245 | 6 initial | |
252 | 5 clobber symlink |
|
246 | 5 clobber symlink | |
253 | 4 clobber1 |
|
247 | 4 clobber1 | |
254 | 3 clobber2 |
|
248 | 3 clobber2 | |
255 | 2 adddb |
|
249 | 2 adddb | |
256 | 1 branch |
|
250 | 1 branch | |
257 | 0 clobberdir |
|
251 | 0 clobberdir |
General Comments 0
You need to be logged in to leave comments.
Login now