##// END OF EJS Templates
check-code: warning and fixes for whitespace in unified tests
Matt Mackall -
r12785:c7d23b4c default
parent child Browse files
Show More
@@ -1,295 +1,296 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # check-code - a style and portability checker for Mercurial
3 # check-code - a style and portability checker for Mercurial
4 #
4 #
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 import re, glob, os, sys
10 import re, glob, os, sys
11 import optparse
11 import optparse
12
12
13 def repquote(m):
13 def repquote(m):
14 t = re.sub(r"\w", "x", m.group('text'))
14 t = re.sub(r"\w", "x", m.group('text'))
15 t = re.sub(r"[^\sx]", "o", t)
15 t = re.sub(r"[^\sx]", "o", t)
16 return m.group('quote') + t + m.group('quote')
16 return m.group('quote') + t + m.group('quote')
17
17
18 def reppython(m):
18 def reppython(m):
19 comment = m.group('comment')
19 comment = m.group('comment')
20 if comment:
20 if comment:
21 return "#" * len(comment)
21 return "#" * len(comment)
22 return repquote(m)
22 return repquote(m)
23
23
24 def repcomment(m):
24 def repcomment(m):
25 return m.group(1) + "#" * len(m.group(2))
25 return m.group(1) + "#" * len(m.group(2))
26
26
27 def repccomment(m):
27 def repccomment(m):
28 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
28 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
29 return m.group(1) + t + "*/"
29 return m.group(1) + t + "*/"
30
30
31 def repcallspaces(m):
31 def repcallspaces(m):
32 t = re.sub(r"\n\s+", "\n", m.group(2))
32 t = re.sub(r"\n\s+", "\n", m.group(2))
33 return m.group(1) + t
33 return m.group(1) + t
34
34
35 def repinclude(m):
35 def repinclude(m):
36 return m.group(1) + "<foo>"
36 return m.group(1) + "<foo>"
37
37
38 def rephere(m):
38 def rephere(m):
39 t = re.sub(r"\S", "x", m.group(2))
39 t = re.sub(r"\S", "x", m.group(2))
40 return m.group(1) + t
40 return m.group(1) + t
41
41
42
42
43 testpats = [
43 testpats = [
44 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
44 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
45 (r'\W\$?\(\([^\)]*\)\)', "don't use (()) or $(()), use 'expr'"),
45 (r'\W\$?\(\([^\)]*\)\)', "don't use (()) or $(()), use 'expr'"),
46 (r'^function', "don't use 'function', use old style"),
46 (r'^function', "don't use 'function', use old style"),
47 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
47 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
48 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
48 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
49 (r'echo -n', "don't use 'echo -n', use printf"),
49 (r'echo -n', "don't use 'echo -n', use printf"),
50 (r'^diff.*-\w*N', "don't use 'diff -N'"),
50 (r'^diff.*-\w*N', "don't use 'diff -N'"),
51 (r'(^| )wc[^|]*$', "filter wc output"),
51 (r'(^| )wc[^|]*$', "filter wc output"),
52 (r'head -c', "don't use 'head -c', use 'dd'"),
52 (r'head -c', "don't use 'head -c', use 'dd'"),
53 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
53 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
54 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
54 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
55 (r'printf.*\\x', "don't use printf \\x, use Python"),
55 (r'printf.*\\x', "don't use printf \\x, use Python"),
56 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
56 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
57 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
57 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
58 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
58 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
59 "use egrep for extended grep syntax"),
59 "use egrep for extended grep syntax"),
60 (r'/bin/', "don't use explicit paths for tools"),
60 (r'/bin/', "don't use explicit paths for tools"),
61 (r'\$PWD', "don't use $PWD, use `pwd`"),
61 (r'\$PWD', "don't use $PWD, use `pwd`"),
62 (r'[^\n]\Z', "no trailing newline"),
62 (r'[^\n]\Z', "no trailing newline"),
63 (r'export.*=', "don't export and assign at once"),
63 (r'export.*=', "don't export and assign at once"),
64 ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"),
64 ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"),
65 (r'^source\b', "don't use 'source', use '.'"),
65 (r'^source\b', "don't use 'source', use '.'"),
66 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
66 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
67 ]
67 ]
68
68
69 testfilters = [
69 testfilters = [
70 (r"( *)(#([^\n]*\S)?)", repcomment),
70 (r"( *)(#([^\n]*\S)?)", repcomment),
71 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
71 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
72 ]
72 ]
73
73
74 uprefix = r"^ \$ "
74 uprefix = r"^ \$ "
75 uprefixc = r"^ > "
75 uprefixc = r"^ > "
76 utestpats = [
76 utestpats = [
77 (r'^(\S| $ ).*(\S\s+|^\s+)\n', "trailing whitespace on non-output"),
77 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
78 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
78 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
79 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
79 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
80 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
80 (uprefix + r'.*\|\| echo.*(fail|error)',
81 (uprefix + r'.*\|\| echo.*(fail|error)',
81 "explicit exit code checks unnecessary"),
82 "explicit exit code checks unnecessary"),
82 (uprefix + r'set -e', "don't use set -e"),
83 (uprefix + r'set -e', "don't use set -e"),
83 (uprefixc + r'( *)\t', "don't use tabs to indent"),
84 (uprefixc + r'( *)\t', "don't use tabs to indent"),
84 ]
85 ]
85
86
86 for p, m in testpats:
87 for p, m in testpats:
87 if p.startswith('^'):
88 if p.startswith('^'):
88 p = uprefix + p[1:]
89 p = uprefix + p[1:]
89 else:
90 else:
90 p = uprefix + p
91 p = uprefix + p
91 utestpats.append((p, m))
92 utestpats.append((p, m))
92
93
93 utestfilters = [
94 utestfilters = [
94 (r"( *)(#([^\n]*\S)?)", repcomment),
95 (r"( *)(#([^\n]*\S)?)", repcomment),
95 ]
96 ]
96
97
97 pypats = [
98 pypats = [
98 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
99 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
99 "tuple parameter unpacking not available in Python 3+"),
100 "tuple parameter unpacking not available in Python 3+"),
100 (r'lambda\s*\(.*,.*\)',
101 (r'lambda\s*\(.*,.*\)',
101 "tuple parameter unpacking not available in Python 3+"),
102 "tuple parameter unpacking not available in Python 3+"),
102 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
103 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
103 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
104 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
104 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
105 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
105 (r'^\s*\t', "don't use tabs"),
106 (r'^\s*\t', "don't use tabs"),
106 (r'\S;\s*\n', "semicolon"),
107 (r'\S;\s*\n', "semicolon"),
107 (r'\w,\w', "missing whitespace after ,"),
108 (r'\w,\w', "missing whitespace after ,"),
108 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
109 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
109 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
110 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
110 (r'.{85}', "line too long"),
111 (r'.{85}', "line too long"),
111 (r'.{81}', "warning: line over 80 characters"),
112 (r'.{81}', "warning: line over 80 characters"),
112 (r'[^\n]\Z', "no trailing newline"),
113 (r'[^\n]\Z', "no trailing newline"),
113 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
114 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
114 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
115 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
115 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
116 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
116 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
117 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
117 "linebreak after :"),
118 "linebreak after :"),
118 (r'class\s[^(]:', "old-style class, use class foo(object)"),
119 (r'class\s[^(]:', "old-style class, use class foo(object)"),
119 (r'^\s+del\(', "del isn't a function"),
120 (r'^\s+del\(', "del isn't a function"),
120 (r'^\s+except\(', "except isn't a function"),
121 (r'^\s+except\(', "except isn't a function"),
121 (r',]', "unneeded trailing ',' in list"),
122 (r',]', "unneeded trailing ',' in list"),
122 # (r'class\s[A-Z][^\(]*\((?!Exception)',
123 # (r'class\s[A-Z][^\(]*\((?!Exception)',
123 # "don't capitalize non-exception classes"),
124 # "don't capitalize non-exception classes"),
124 # (r'in range\(', "use xrange"),
125 # (r'in range\(', "use xrange"),
125 # (r'^\s*print\s+', "avoid using print in core and extensions"),
126 # (r'^\s*print\s+', "avoid using print in core and extensions"),
126 (r'[\x80-\xff]', "non-ASCII character literal"),
127 (r'[\x80-\xff]', "non-ASCII character literal"),
127 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
128 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
128 (r'^\s*with\s+', "with not available in Python 2.4"),
129 (r'^\s*with\s+', "with not available in Python 2.4"),
129 (r'(?<!def)\s+(any|all|format)\(',
130 (r'(?<!def)\s+(any|all|format)\(',
130 "any/all/format not available in Python 2.4"),
131 "any/all/format not available in Python 2.4"),
131 (r'(?<!def)\s+(callable)\(',
132 (r'(?<!def)\s+(callable)\(',
132 "callable not available in Python 3, use hasattr(f, '__call__')"),
133 "callable not available in Python 3, use hasattr(f, '__call__')"),
133 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
134 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
134 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
135 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
135 # (r'\s\s=', "gratuitous whitespace before ="),
136 # (r'\s\s=', "gratuitous whitespace before ="),
136 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
137 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
137 "missing whitespace around operator"),
138 "missing whitespace around operator"),
138 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
139 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
139 "missing whitespace around operator"),
140 "missing whitespace around operator"),
140 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
141 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
141 "missing whitespace around operator"),
142 "missing whitespace around operator"),
142 (r'[^+=*!<>&| -](\s=|=\s)[^= ]',
143 (r'[^+=*!<>&| -](\s=|=\s)[^= ]',
143 "wrong whitespace around ="),
144 "wrong whitespace around ="),
144 (r'raise Exception', "don't raise generic exceptions"),
145 (r'raise Exception', "don't raise generic exceptions"),
145 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
146 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
146 "warning: unwrapped ui message"),
147 "warning: unwrapped ui message"),
147 ]
148 ]
148
149
149 pyfilters = [
150 pyfilters = [
150 (r"""(?msx)(?P<comment>\#.*?$)|
151 (r"""(?msx)(?P<comment>\#.*?$)|
151 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
152 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
152 (?P<text>(([^\\]|\\.)*?))
153 (?P<text>(([^\\]|\\.)*?))
153 (?P=quote))""", reppython),
154 (?P=quote))""", reppython),
154 ]
155 ]
155
156
156 cpats = [
157 cpats = [
157 (r'//', "don't use //-style comments"),
158 (r'//', "don't use //-style comments"),
158 (r'^ ', "don't use spaces to indent"),
159 (r'^ ', "don't use spaces to indent"),
159 (r'\S\t', "don't use tabs except for indent"),
160 (r'\S\t', "don't use tabs except for indent"),
160 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
161 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
161 (r'.{85}', "line too long"),
162 (r'.{85}', "line too long"),
162 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
163 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
163 (r'return\(', "return is not a function"),
164 (r'return\(', "return is not a function"),
164 (r' ;', "no space before ;"),
165 (r' ;', "no space before ;"),
165 (r'\w+\* \w+', "use int *foo, not int* foo"),
166 (r'\w+\* \w+', "use int *foo, not int* foo"),
166 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
167 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
167 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
168 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
168 (r'\w,\w', "missing whitespace after ,"),
169 (r'\w,\w', "missing whitespace after ,"),
169 (r'\w[+/*]\w', "missing whitespace in expression"),
170 (r'\w[+/*]\w', "missing whitespace in expression"),
170 (r'^#\s+\w', "use #foo, not # foo"),
171 (r'^#\s+\w', "use #foo, not # foo"),
171 (r'[^\n]\Z', "no trailing newline"),
172 (r'[^\n]\Z', "no trailing newline"),
172 ]
173 ]
173
174
174 cfilters = [
175 cfilters = [
175 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
176 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
176 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
177 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
177 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
178 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
178 (r'(\()([^)]+\))', repcallspaces),
179 (r'(\()([^)]+\))', repcallspaces),
179 ]
180 ]
180
181
181 checks = [
182 checks = [
182 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
183 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
183 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
184 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
184 ('c', r'.*\.c$', cfilters, cpats),
185 ('c', r'.*\.c$', cfilters, cpats),
185 ('unified test', r'.*\.t$', utestfilters, utestpats),
186 ('unified test', r'.*\.t$', utestfilters, utestpats),
186 ]
187 ]
187
188
188 class norepeatlogger(object):
189 class norepeatlogger(object):
189 def __init__(self):
190 def __init__(self):
190 self._lastseen = None
191 self._lastseen = None
191
192
192 def log(self, fname, lineno, line, msg, blame):
193 def log(self, fname, lineno, line, msg, blame):
193 """print error related a to given line of a given file.
194 """print error related a to given line of a given file.
194
195
195 The faulty line will also be printed but only once in the case
196 The faulty line will also be printed but only once in the case
196 of multiple errors.
197 of multiple errors.
197
198
198 :fname: filename
199 :fname: filename
199 :lineno: line number
200 :lineno: line number
200 :line: actual content of the line
201 :line: actual content of the line
201 :msg: error message
202 :msg: error message
202 """
203 """
203 msgid = fname, lineno, line
204 msgid = fname, lineno, line
204 if msgid != self._lastseen:
205 if msgid != self._lastseen:
205 if blame:
206 if blame:
206 print "%s:%d (%s):" % (fname, lineno, blame)
207 print "%s:%d (%s):" % (fname, lineno, blame)
207 else:
208 else:
208 print "%s:%d:" % (fname, lineno)
209 print "%s:%d:" % (fname, lineno)
209 print " > %s" % line
210 print " > %s" % line
210 self._lastseen = msgid
211 self._lastseen = msgid
211 print " " + msg
212 print " " + msg
212
213
213 _defaultlogger = norepeatlogger()
214 _defaultlogger = norepeatlogger()
214
215
215 def getblame(f):
216 def getblame(f):
216 lines = []
217 lines = []
217 for l in os.popen('hg annotate -un %s' % f):
218 for l in os.popen('hg annotate -un %s' % f):
218 start, line = l.split(':', 1)
219 start, line = l.split(':', 1)
219 user, rev = start.split()
220 user, rev = start.split()
220 lines.append((line[1:-1], user, rev))
221 lines.append((line[1:-1], user, rev))
221 return lines
222 return lines
222
223
223 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
224 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
224 blame=False):
225 blame=False):
225 """checks style and portability of a given file
226 """checks style and portability of a given file
226
227
227 :f: filepath
228 :f: filepath
228 :logfunc: function used to report error
229 :logfunc: function used to report error
229 logfunc(filename, linenumber, linecontent, errormessage)
230 logfunc(filename, linenumber, linecontent, errormessage)
230 :maxerr: number of error to display before arborting.
231 :maxerr: number of error to display before arborting.
231 Set to None (default) to report all errors
232 Set to None (default) to report all errors
232
233
233 return True if no error is found, False otherwise.
234 return True if no error is found, False otherwise.
234 """
235 """
235 blamecache = None
236 blamecache = None
236 result = True
237 result = True
237 for name, match, filters, pats in checks:
238 for name, match, filters, pats in checks:
238 fc = 0
239 fc = 0
239 if not re.match(match, f):
240 if not re.match(match, f):
240 continue
241 continue
241 pre = post = open(f).read()
242 pre = post = open(f).read()
242 if "no-" + "check-code" in pre:
243 if "no-" + "check-code" in pre:
243 break
244 break
244 for p, r in filters:
245 for p, r in filters:
245 post = re.sub(p, r, post)
246 post = re.sub(p, r, post)
246 # print post # uncomment to show filtered version
247 # print post # uncomment to show filtered version
247 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
248 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
248 for n, l in z:
249 for n, l in z:
249 if "check-code" + "-ignore" in l[0]:
250 if "check-code" + "-ignore" in l[0]:
250 continue
251 continue
251 for p, msg in pats:
252 for p, msg in pats:
252 if not warnings and msg.startswith("warning"):
253 if not warnings and msg.startswith("warning"):
253 continue
254 continue
254 if re.search(p, l[1]):
255 if re.search(p, l[1]):
255 bd = ""
256 bd = ""
256 if blame:
257 if blame:
257 bd = 'working directory'
258 bd = 'working directory'
258 if not blamecache:
259 if not blamecache:
259 blamecache = getblame(f)
260 blamecache = getblame(f)
260 if n < len(blamecache):
261 if n < len(blamecache):
261 bl, bu, br = blamecache[n]
262 bl, bu, br = blamecache[n]
262 if bl == l[0]:
263 if bl == l[0]:
263 bd = '%s@%s' % (bu, br)
264 bd = '%s@%s' % (bu, br)
264 logfunc(f, n + 1, l[0], msg, bd)
265 logfunc(f, n + 1, l[0], msg, bd)
265 fc += 1
266 fc += 1
266 result = False
267 result = False
267 if maxerr is not None and fc >= maxerr:
268 if maxerr is not None and fc >= maxerr:
268 print " (too many errors, giving up)"
269 print " (too many errors, giving up)"
269 break
270 break
270 break
271 break
271 return result
272 return result
272
273
273 if __name__ == "__main__":
274 if __name__ == "__main__":
274 parser = optparse.OptionParser("%prog [options] [files]")
275 parser = optparse.OptionParser("%prog [options] [files]")
275 parser.add_option("-w", "--warnings", action="store_true",
276 parser.add_option("-w", "--warnings", action="store_true",
276 help="include warning-level checks")
277 help="include warning-level checks")
277 parser.add_option("-p", "--per-file", type="int",
278 parser.add_option("-p", "--per-file", type="int",
278 help="max warnings per file")
279 help="max warnings per file")
279 parser.add_option("-b", "--blame", action="store_true",
280 parser.add_option("-b", "--blame", action="store_true",
280 help="use annotate to generate blame info")
281 help="use annotate to generate blame info")
281
282
282 parser.set_defaults(per_file=15, warnings=False, blame=False)
283 parser.set_defaults(per_file=15, warnings=False, blame=False)
283 (options, args) = parser.parse_args()
284 (options, args) = parser.parse_args()
284
285
285 if len(args) == 0:
286 if len(args) == 0:
286 check = glob.glob("*")
287 check = glob.glob("*")
287 else:
288 else:
288 check = args
289 check = args
289
290
290 for f in check:
291 for f in check:
291 ret = 0
292 ret = 0
292 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
293 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
293 blame=options.blame):
294 blame=options.blame):
294 ret = 1
295 ret = 1
295 sys.exit(ret)
296 sys.exit(ret)
@@ -1,192 +1,192 b''
1 This is http://mercurial.selenic.com/bts/issue1148
1 This is http://mercurial.selenic.com/bts/issue1148
2 and http://mercurial.selenic.com/bts/issue1447
2 and http://mercurial.selenic.com/bts/issue1447
3
3
4 $ "$TESTDIR/hghave" cvs || exit 80
4 $ "$TESTDIR/hghave" cvs || exit 80
5 $ cvscall()
5 $ cvscall()
6 > {
6 > {
7 > cvs -f "$@" > /dev/null
7 > cvs -f "$@" > /dev/null
8 > }
8 > }
9 $ echo "[extensions]" >> $HGRCPATH
9 $ echo "[extensions]" >> $HGRCPATH
10 $ echo "convert = " >> $HGRCPATH
10 $ echo "convert = " >> $HGRCPATH
11 $ echo "graphlog = " >> $HGRCPATH
11 $ echo "graphlog = " >> $HGRCPATH
12 $ echo "[convert]" >> $HGRCPATH
12 $ echo "[convert]" >> $HGRCPATH
13 $ echo "cvsps.cache=0" >> $HGRCPATH
13 $ echo "cvsps.cache=0" >> $HGRCPATH
14
14
15 create cvs repository
15 create cvs repository
16
16
17 $ mkdir cvsrepo
17 $ mkdir cvsrepo
18 $ cd cvsrepo
18 $ cd cvsrepo
19 $ CVSROOT=`pwd`
19 $ CVSROOT=`pwd`
20 $ export CVSROOT
20 $ export CVSROOT
21 $ CVS_OPTIONS=-f
21 $ CVS_OPTIONS=-f
22 $ export CVS_OPTIONS
22 $ export CVS_OPTIONS
23 $ cd ..
23 $ cd ..
24 $ cvscall -q -d "$CVSROOT" init
24 $ cvscall -q -d "$CVSROOT" init
25
25
26 Create a new project
26 Create a new project
27
27
28 $ mkdir src
28 $ mkdir src
29 $ cd src
29 $ cd src
30 $ echo "1" > a
30 $ echo "1" > a
31 $ echo "1" > b
31 $ echo "1" > b
32 $ cvscall import -m "init" src v0 r0 | sort
32 $ cvscall import -m "init" src v0 r0 | sort
33 $ cd ..
33 $ cd ..
34 $ cvscall co src
34 $ cvscall co src
35 cvs checkout: Updating src
35 cvs checkout: Updating src
36 $ cd src
36 $ cd src
37
37
38 Branch the project
38 Branch the project
39
39
40 $ cvscall tag -b BRANCH
40 $ cvscall tag -b BRANCH
41 cvs tag: Tagging .
41 cvs tag: Tagging .
42 $ cvscall up -r BRANCH > /dev/null
42 $ cvscall up -r BRANCH > /dev/null
43 cvs update: Updating .
43 cvs update: Updating .
44
44
45 Modify file a, then b, then a
45 Modify file a, then b, then a
46
46
47 $ sleep 1
47 $ sleep 1
48 $ echo "2" > a
48 $ echo "2" > a
49 $ cvscall ci -m "mod a"
49 $ cvscall ci -m "mod a"
50 cvs commit: Examining .
50 cvs commit: Examining .
51 $ echo "2" > b
51 $ echo "2" > b
52 $ cvscall ci -m "mod b"
52 $ cvscall ci -m "mod b"
53 cvs commit: Examining .
53 cvs commit: Examining .
54 $ sleep 1
54 $ sleep 1
55 $ echo "3" > a
55 $ echo "3" > a
56 $ cvscall ci -m "mod a again"
56 $ cvscall ci -m "mod a again"
57 cvs commit: Examining .
57 cvs commit: Examining .
58
58
59 Convert
59 Convert
60
60
61 $ cd ..
61 $ cd ..
62 $ hg convert src
62 $ hg convert src
63 assuming destination src-hg
63 assuming destination src-hg
64 initializing destination src-hg repository
64 initializing destination src-hg repository
65 connecting to $TESTTMP/cvsrepo
65 connecting to $TESTTMP/cvsrepo
66 scanning source...
66 scanning source...
67 collecting CVS rlog
67 collecting CVS rlog
68 7 log entries
68 7 log entries
69 creating changesets
69 creating changesets
70 5 changeset entries
70 5 changeset entries
71 sorting...
71 sorting...
72 converting...
72 converting...
73 4 Initial revision
73 4 Initial revision
74 3 init
74 3 init
75 2 mod a
75 2 mod a
76 1 mod b
76 1 mod b
77 0 mod a again
77 0 mod a again
78 updating tags
78 updating tags
79
79
80 Check the result
80 Check the result
81
81
82 $ hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
82 $ hg -R src-hg glog --template '{rev} ({branches}) {desc} files: {files}\n'
83 o 5 () update tags files: .hgtags
83 o 5 () update tags files: .hgtags
84 |
84 |
85 | o 4 (BRANCH) mod a again files: a
85 | o 4 (BRANCH) mod a again files: a
86 | |
86 | |
87 | o 3 (BRANCH) mod b files: b
87 | o 3 (BRANCH) mod b files: b
88 | |
88 | |
89 | o 2 (BRANCH) mod a files: a
89 | o 2 (BRANCH) mod a files: a
90 | |
90 | |
91 | o 1 (v0) init files:
91 | o 1 (v0) init files:
92 |/
92 |/
93 o 0 () Initial revision files: a b
93 o 0 () Initial revision files: a b
94
94
95
95
96
96
97 issue 1447
97 issue 1447
98
98
99 $ cvscall()
99 $ cvscall()
100 > {
100 > {
101 > cvs -f "$@" > /dev/null
101 > cvs -f "$@" > /dev/null
102 > sleep 1
102 > sleep 1
103 > }
103 > }
104 $ cvsci()
104 $ cvsci()
105 > {
105 > {
106 > cvs -f ci "$@" >/dev/null
106 > cvs -f ci "$@" >/dev/null
107 > sleep 1
107 > sleep 1
108 > }
108 > }
109 $ cvscall -Q -d `pwd`/cvsmaster2 init
109 $ cvscall -Q -d `pwd`/cvsmaster2 init
110 $ cd cvsmaster2
110 $ cd cvsmaster2
111 $ CVSROOT=`pwd`
111 $ CVSROOT=`pwd`
112 $ export CVSROOT
112 $ export CVSROOT
113 $ mkdir foo
113 $ mkdir foo
114 $ cd ..
114 $ cd ..
115 $ cvscall -Q co -d cvswork2 foo
115 $ cvscall -Q co -d cvswork2 foo
116 $ cd cvswork2
116 $ cd cvswork2
117 $ echo foo > a.txt
117 $ echo foo > a.txt
118 $ echo bar > b.txt
118 $ echo bar > b.txt
119 $ cvscall -Q add a.txt b.txt
119 $ cvscall -Q add a.txt b.txt
120 $ cvsci -m "Initial commit"
120 $ cvsci -m "Initial commit"
121 cvs commit: Examining .
121 cvs commit: Examining .
122 $ echo foo > b.txt
122 $ echo foo > b.txt
123 $ cvsci -m "Fix b on HEAD"
123 $ cvsci -m "Fix b on HEAD"
124 cvs commit: Examining .
124 cvs commit: Examining .
125 $ echo bar > a.txt
125 $ echo bar > a.txt
126 $ cvsci -m "Small fix in a on HEAD"
126 $ cvsci -m "Small fix in a on HEAD"
127 cvs commit: Examining .
127 cvs commit: Examining .
128 $ cvscall -Q tag -b BRANCH
128 $ cvscall -Q tag -b BRANCH
129 $ cvscall -Q up -P -rBRANCH
129 $ cvscall -Q up -P -rBRANCH
130 $ echo baz > b.txt
130 $ echo baz > b.txt
131 $ cvsci -m "Change on BRANCH in b"
131 $ cvsci -m "Change on BRANCH in b"
132 cvs commit: Examining .
132 cvs commit: Examining .
133 $ hg debugcvsps -x --parents foo
133 $ hg debugcvsps -x --parents foo
134 collecting CVS rlog
134 collecting CVS rlog
135 5 log entries
135 5 log entries
136 creating changesets
136 creating changesets
137 4 changeset entries
137 4 changeset entries
138 ---------------------
138 ---------------------
139 PatchSet 1
139 PatchSet 1
140 Date: * (glob)
140 Date: * (glob)
141 Author: * (glob)
141 Author: * (glob)
142 Branch: HEAD
142 Branch: HEAD
143 Tag: (none)
143 Tag: (none)
144 Log:
144 Log:
145 Initial commit
145 Initial commit
146
146
147 Members:
147 Members:
148 a.txt:INITIAL->1.1
148 a.txt:INITIAL->1.1
149 b.txt:INITIAL->1.1
149 b.txt:INITIAL->1.1
150
150
151 ---------------------
151 ---------------------
152 PatchSet 2
152 PatchSet 2
153 Date: * (glob)
153 Date: * (glob)
154 Author: * (glob)
154 Author: * (glob)
155 Branch: HEAD
155 Branch: HEAD
156 Tag: (none)
156 Tag: (none)
157 Branchpoints: BRANCH
157 Branchpoints: BRANCH
158 Parent: 1
158 Parent: 1
159 Log:
159 Log:
160 Fix b on HEAD
160 Fix b on HEAD
161
161
162 Members:
162 Members:
163 b.txt:1.1->1.2
163 b.txt:1.1->1.2
164
164
165 ---------------------
165 ---------------------
166 PatchSet 3
166 PatchSet 3
167 Date: * (glob)
167 Date: * (glob)
168 Author: * (glob)
168 Author: * (glob)
169 Branch: HEAD
169 Branch: HEAD
170 Tag: (none)
170 Tag: (none)
171 Branchpoints: BRANCH
171 Branchpoints: BRANCH
172 Parent: 2
172 Parent: 2
173 Log:
173 Log:
174 Small fix in a on HEAD
174 Small fix in a on HEAD
175
175
176 Members:
176 Members:
177 a.txt:1.1->1.2
177 a.txt:1.1->1.2
178
178
179 ---------------------
179 ---------------------
180 PatchSet 4
180 PatchSet 4
181 Date: * (glob)
181 Date: * (glob)
182 Author: * (glob)
182 Author: * (glob)
183 Branch: BRANCH
183 Branch: BRANCH
184 Tag: (none)
184 Tag: (none)
185 Parent: 3
185 Parent: 3
186 Log:
186 Log:
187 Change on BRANCH in b
187 Change on BRANCH in b
188
188
189 Members:
189 Members:
190 b.txt:1.2->1.2.2.1
190 b.txt:1.2->1.2.2.1
191
191
192
192
@@ -1,701 +1,701 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "graphlog=" >> $HGRCPATH
2 $ echo "graphlog=" >> $HGRCPATH
3
3
4 $ mkdir a
4 $ mkdir a
5 $ cd a
5 $ cd a
6 $ hg init
6 $ hg init
7 $ echo foo > t1
7 $ echo foo > t1
8 $ hg add t1
8 $ hg add t1
9 $ hg commit -m "1"
9 $ hg commit -m "1"
10
10
11 $ cd ..
11 $ cd ..
12 $ hg clone a b
12 $ hg clone a b
13 updating to branch default
13 updating to branch default
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15
15
16 $ cd a
16 $ cd a
17 $ echo foo > t2
17 $ echo foo > t2
18 $ hg add t2
18 $ hg add t2
19 $ hg commit -m "2"
19 $ hg commit -m "2"
20
20
21 $ cd ../b
21 $ cd ../b
22 $ echo foo > t3
22 $ echo foo > t3
23 $ hg add t3
23 $ hg add t3
24 $ hg commit -m "3"
24 $ hg commit -m "3"
25
25
26 $ hg push ../a
26 $ hg push ../a
27 pushing to ../a
27 pushing to ../a
28 searching for changes
28 searching for changes
29 abort: push creates new remote heads on branch 'default'!
29 abort: push creates new remote heads on branch 'default'!
30 (you should pull and merge or use push -f to force)
30 (you should pull and merge or use push -f to force)
31 [255]
31 [255]
32
32
33 $ hg pull ../a
33 $ hg pull ../a
34 pulling from ../a
34 pulling from ../a
35 searching for changes
35 searching for changes
36 adding changesets
36 adding changesets
37 adding manifests
37 adding manifests
38 adding file changes
38 adding file changes
39 added 1 changesets with 1 changes to 1 files (+1 heads)
39 added 1 changesets with 1 changes to 1 files (+1 heads)
40 (run 'hg heads' to see heads, 'hg merge' to merge)
40 (run 'hg heads' to see heads, 'hg merge' to merge)
41
41
42 $ hg push ../a
42 $ hg push ../a
43 pushing to ../a
43 pushing to ../a
44 searching for changes
44 searching for changes
45 abort: push creates new remote heads on branch 'default'!
45 abort: push creates new remote heads on branch 'default'!
46 (did you forget to merge? use push -f to force)
46 (did you forget to merge? use push -f to force)
47 [255]
47 [255]
48
48
49 $ hg merge
49 $ hg merge
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 (branch merge, don't forget to commit)
51 (branch merge, don't forget to commit)
52
52
53 $ hg commit -m "4"
53 $ hg commit -m "4"
54 $ hg push ../a
54 $ hg push ../a
55 pushing to ../a
55 pushing to ../a
56 searching for changes
56 searching for changes
57 adding changesets
57 adding changesets
58 adding manifests
58 adding manifests
59 adding file changes
59 adding file changes
60 added 2 changesets with 1 changes to 1 files
60 added 2 changesets with 1 changes to 1 files
61
61
62 $ cd ..
62 $ cd ..
63
63
64 $ hg init c
64 $ hg init c
65 $ cd c
65 $ cd c
66 $ for i in 0 1 2; do
66 $ for i in 0 1 2; do
67 > echo $i >> foo
67 > echo $i >> foo
68 > hg ci -Am $i
68 > hg ci -Am $i
69 > done
69 > done
70 adding foo
70 adding foo
71 $ cd ..
71 $ cd ..
72
72
73 $ hg clone c d
73 $ hg clone c d
74 updating to branch default
74 updating to branch default
75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
76
76
77 $ cd d
77 $ cd d
78 $ for i in 0 1; do
78 $ for i in 0 1; do
79 > hg co -C $i
79 > hg co -C $i
80 > echo d-$i >> foo
80 > echo d-$i >> foo
81 > hg ci -m d-$i
81 > hg ci -m d-$i
82 > done
82 > done
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 created new head
84 created new head
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 created new head
86 created new head
87
87
88 $ HGMERGE=true hg merge 3
88 $ HGMERGE=true hg merge 3
89 merging foo
89 merging foo
90 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
90 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
91 (branch merge, don't forget to commit)
91 (branch merge, don't forget to commit)
92
92
93 $ hg ci -m c-d
93 $ hg ci -m c-d
94
94
95 $ hg push ../c
95 $ hg push ../c
96 pushing to ../c
96 pushing to ../c
97 searching for changes
97 searching for changes
98 abort: push creates new remote heads on branch 'default'!
98 abort: push creates new remote heads on branch 'default'!
99 (did you forget to merge? use push -f to force)
99 (did you forget to merge? use push -f to force)
100 [255]
100 [255]
101
101
102 $ hg push -r 2 ../c
102 $ hg push -r 2 ../c
103 pushing to ../c
103 pushing to ../c
104 searching for changes
104 searching for changes
105 no changes found
105 no changes found
106
106
107 $ hg push -r 3 ../c
107 $ hg push -r 3 ../c
108 pushing to ../c
108 pushing to ../c
109 searching for changes
109 searching for changes
110 abort: push creates new remote heads on branch 'default'!
110 abort: push creates new remote heads on branch 'default'!
111 (did you forget to merge? use push -f to force)
111 (did you forget to merge? use push -f to force)
112 [255]
112 [255]
113
113
114 $ hg push -r 3 -r 4 ../c
114 $ hg push -r 3 -r 4 ../c
115 pushing to ../c
115 pushing to ../c
116 searching for changes
116 searching for changes
117 abort: push creates new remote heads on branch 'default'!
117 abort: push creates new remote heads on branch 'default'!
118 (did you forget to merge? use push -f to force)
118 (did you forget to merge? use push -f to force)
119 [255]
119 [255]
120
120
121 $ hg push -f -r 3 -r 4 ../c
121 $ hg push -f -r 3 -r 4 ../c
122 pushing to ../c
122 pushing to ../c
123 searching for changes
123 searching for changes
124 adding changesets
124 adding changesets
125 adding manifests
125 adding manifests
126 adding file changes
126 adding file changes
127 added 2 changesets with 2 changes to 1 files (+2 heads)
127 added 2 changesets with 2 changes to 1 files (+2 heads)
128
128
129 $ hg push -r 5 ../c
129 $ hg push -r 5 ../c
130 pushing to ../c
130 pushing to ../c
131 searching for changes
131 searching for changes
132 adding changesets
132 adding changesets
133 adding manifests
133 adding manifests
134 adding file changes
134 adding file changes
135 added 1 changesets with 1 changes to 1 files (-1 heads)
135 added 1 changesets with 1 changes to 1 files (-1 heads)
136
136
137 $ hg in ../c
137 $ hg in ../c
138 comparing with ../c
138 comparing with ../c
139 searching for changes
139 searching for changes
140 no changes found
140 no changes found
141 [1]
141 [1]
142
142
143
143
144 Issue450: push -r warns about remote head creation even if no heads
144 Issue450: push -r warns about remote head creation even if no heads
145 will be created
145 will be created
146
146
147 $ hg init ../e
147 $ hg init ../e
148 $ hg push -r 0 ../e
148 $ hg push -r 0 ../e
149 pushing to ../e
149 pushing to ../e
150 searching for changes
150 searching for changes
151 adding changesets
151 adding changesets
152 adding manifests
152 adding manifests
153 adding file changes
153 adding file changes
154 added 1 changesets with 1 changes to 1 files
154 added 1 changesets with 1 changes to 1 files
155
155
156 $ hg push -r 1 ../e
156 $ hg push -r 1 ../e
157 pushing to ../e
157 pushing to ../e
158 searching for changes
158 searching for changes
159 adding changesets
159 adding changesets
160 adding manifests
160 adding manifests
161 adding file changes
161 adding file changes
162 added 1 changesets with 1 changes to 1 files
162 added 1 changesets with 1 changes to 1 files
163
163
164 $ cd ..
164 $ cd ..
165
165
166
166
167 Issue736: named branches are not considered for detection of
167 Issue736: named branches are not considered for detection of
168 unmerged heads in "hg push"
168 unmerged heads in "hg push"
169
169
170 $ hg init f
170 $ hg init f
171 $ cd f
171 $ cd f
172 $ hg -q branch a
172 $ hg -q branch a
173 $ echo 0 > foo
173 $ echo 0 > foo
174 $ hg -q ci -Am 0
174 $ hg -q ci -Am 0
175 $ echo 1 > foo
175 $ echo 1 > foo
176 $ hg -q ci -m 1
176 $ hg -q ci -m 1
177 $ hg -q up 0
177 $ hg -q up 0
178 $ echo 2 > foo
178 $ echo 2 > foo
179 $ hg -q ci -m 2
179 $ hg -q ci -m 2
180 $ hg -q up 0
180 $ hg -q up 0
181 $ hg -q branch b
181 $ hg -q branch b
182 $ echo 3 > foo
182 $ echo 3 > foo
183 $ hg -q ci -m 3
183 $ hg -q ci -m 3
184 $ cd ..
184 $ cd ..
185
185
186 $ hg -q clone f g
186 $ hg -q clone f g
187 $ cd g
187 $ cd g
188
188
189 Push on existing branch and new branch:
189 Push on existing branch and new branch:
190
190
191 $ hg -q up 1
191 $ hg -q up 1
192 $ echo 4 > foo
192 $ echo 4 > foo
193 $ hg -q ci -m 4
193 $ hg -q ci -m 4
194 $ hg -q up 0
194 $ hg -q up 0
195 $ echo 5 > foo
195 $ echo 5 > foo
196 $ hg -q branch c
196 $ hg -q branch c
197 $ hg -q ci -m 5
197 $ hg -q ci -m 5
198
198
199 $ hg push ../f
199 $ hg push ../f
200 pushing to ../f
200 pushing to ../f
201 searching for changes
201 searching for changes
202 abort: push creates new remote branches: c!
202 abort: push creates new remote branches: c!
203 (use 'hg push --new-branch' to create new remote branches)
203 (use 'hg push --new-branch' to create new remote branches)
204 [255]
204 [255]
205
205
206 $ hg push -r 4 -r 5 ../f
206 $ hg push -r 4 -r 5 ../f
207 pushing to ../f
207 pushing to ../f
208 searching for changes
208 searching for changes
209 abort: push creates new remote branches: c!
209 abort: push creates new remote branches: c!
210 (use 'hg push --new-branch' to create new remote branches)
210 (use 'hg push --new-branch' to create new remote branches)
211 [255]
211 [255]
212
212
213
213
214 Multiple new branches:
214 Multiple new branches:
215
215
216 $ hg -q branch d
216 $ hg -q branch d
217 $ echo 6 > foo
217 $ echo 6 > foo
218 $ hg -q ci -m 6
218 $ hg -q ci -m 6
219
219
220 $ hg push ../f
220 $ hg push ../f
221 pushing to ../f
221 pushing to ../f
222 searching for changes
222 searching for changes
223 abort: push creates new remote branches: c, d!
223 abort: push creates new remote branches: c, d!
224 (use 'hg push --new-branch' to create new remote branches)
224 (use 'hg push --new-branch' to create new remote branches)
225 [255]
225 [255]
226
226
227 $ hg push -r 4 -r 6 ../f
227 $ hg push -r 4 -r 6 ../f
228 pushing to ../f
228 pushing to ../f
229 searching for changes
229 searching for changes
230 abort: push creates new remote branches: c, d!
230 abort: push creates new remote branches: c, d!
231 (use 'hg push --new-branch' to create new remote branches)
231 (use 'hg push --new-branch' to create new remote branches)
232 [255]
232 [255]
233
233
234 $ cd ../g
234 $ cd ../g
235
235
236
236
237 Fail on multiple head push:
237 Fail on multiple head push:
238
238
239 $ hg -q up 1
239 $ hg -q up 1
240 $ echo 7 > foo
240 $ echo 7 > foo
241 $ hg -q ci -m 7
241 $ hg -q ci -m 7
242
242
243 $ hg push -r 4 -r 7 ../f
243 $ hg push -r 4 -r 7 ../f
244 pushing to ../f
244 pushing to ../f
245 searching for changes
245 searching for changes
246 abort: push creates new remote heads on branch 'a'!
246 abort: push creates new remote heads on branch 'a'!
247 (did you forget to merge? use push -f to force)
247 (did you forget to merge? use push -f to force)
248 [255]
248 [255]
249
249
250 Push replacement head on existing branches:
250 Push replacement head on existing branches:
251
251
252 $ hg -q up 3
252 $ hg -q up 3
253 $ echo 8 > foo
253 $ echo 8 > foo
254 $ hg -q ci -m 8
254 $ hg -q ci -m 8
255
255
256 $ hg push -r 7 -r 8 ../f
256 $ hg push -r 7 -r 8 ../f
257 pushing to ../f
257 pushing to ../f
258 searching for changes
258 searching for changes
259 adding changesets
259 adding changesets
260 adding manifests
260 adding manifests
261 adding file changes
261 adding file changes
262 added 2 changesets with 2 changes to 1 files
262 added 2 changesets with 2 changes to 1 files
263
263
264
264
265 Merge of branch a to other branch b followed by unrelated push
265 Merge of branch a to other branch b followed by unrelated push
266 on branch a:
266 on branch a:
267
267
268 $ hg -q up 7
268 $ hg -q up 7
269 $ HGMERGE=true hg -q merge 8
269 $ HGMERGE=true hg -q merge 8
270 $ hg -q ci -m 9
270 $ hg -q ci -m 9
271 $ hg -q up 8
271 $ hg -q up 8
272 $ echo 10 > foo
272 $ echo 10 > foo
273 $ hg -q ci -m 10
273 $ hg -q ci -m 10
274
274
275 $ hg push -r 9 ../f
275 $ hg push -r 9 ../f
276 pushing to ../f
276 pushing to ../f
277 searching for changes
277 searching for changes
278 adding changesets
278 adding changesets
279 adding manifests
279 adding manifests
280 adding file changes
280 adding file changes
281 added 1 changesets with 1 changes to 1 files (-1 heads)
281 added 1 changesets with 1 changes to 1 files (-1 heads)
282
282
283 $ hg push -r 10 ../f
283 $ hg push -r 10 ../f
284 pushing to ../f
284 pushing to ../f
285 searching for changes
285 searching for changes
286 adding changesets
286 adding changesets
287 adding manifests
287 adding manifests
288 adding file changes
288 adding file changes
289 added 1 changesets with 1 changes to 1 files (+1 heads)
289 added 1 changesets with 1 changes to 1 files (+1 heads)
290
290
291
291
292 Cheating the counting algorithm:
292 Cheating the counting algorithm:
293
293
294 $ hg -q up 9
294 $ hg -q up 9
295 $ HGMERGE=true hg -q merge 2
295 $ HGMERGE=true hg -q merge 2
296 $ hg -q ci -m 11
296 $ hg -q ci -m 11
297 $ hg -q up 1
297 $ hg -q up 1
298 $ echo 12 > foo
298 $ echo 12 > foo
299 $ hg -q ci -m 12
299 $ hg -q ci -m 12
300
300
301 $ hg push -r 11 -r 12 ../f
301 $ hg push -r 11 -r 12 ../f
302 pushing to ../f
302 pushing to ../f
303 searching for changes
303 searching for changes
304 adding changesets
304 adding changesets
305 adding manifests
305 adding manifests
306 adding file changes
306 adding file changes
307 added 2 changesets with 2 changes to 1 files
307 added 2 changesets with 2 changes to 1 files
308
308
309
309
310 Failed push of new named branch:
310 Failed push of new named branch:
311
311
312 $ echo 12 > foo
312 $ echo 12 > foo
313 $ hg -q ci -m 12a
313 $ hg -q ci -m 12a
314 [1]
314 [1]
315 $ hg -q up 11
315 $ hg -q up 11
316 $ echo 13 > foo
316 $ echo 13 > foo
317 $ hg -q branch e
317 $ hg -q branch e
318 $ hg -q ci -m 13d
318 $ hg -q ci -m 13d
319
319
320 $ hg push -r 12 -r 13 ../f
320 $ hg push -r 12 -r 13 ../f
321 pushing to ../f
321 pushing to ../f
322 searching for changes
322 searching for changes
323 abort: push creates new remote branches: e!
323 abort: push creates new remote branches: e!
324 (use 'hg push --new-branch' to create new remote branches)
324 (use 'hg push --new-branch' to create new remote branches)
325 [255]
325 [255]
326
326
327
327
328 Using --new-branch to push new named branch:
328 Using --new-branch to push new named branch:
329
329
330 $ hg push --new-branch -r 12 -r 13 ../f
330 $ hg push --new-branch -r 12 -r 13 ../f
331 pushing to ../f
331 pushing to ../f
332 searching for changes
332 searching for changes
333 adding changesets
333 adding changesets
334 adding manifests
334 adding manifests
335 adding file changes
335 adding file changes
336 added 1 changesets with 1 changes to 1 files
336 added 1 changesets with 1 changes to 1 files
337
337
338
338
339 Checking prepush logic does not allow silently pushing
339 Checking prepush logic does not allow silently pushing
340 multiple new heads:
340 multiple new heads:
341
341
342 $ cd ..
342 $ cd ..
343 $ hg init h
343 $ hg init h
344 $ echo init > h/init
344 $ echo init > h/init
345 $ hg -R h ci -Am init
345 $ hg -R h ci -Am init
346 adding init
346 adding init
347 $ echo a > h/a
347 $ echo a > h/a
348 $ hg -R h ci -Am a
348 $ hg -R h ci -Am a
349 adding a
349 adding a
350 $ hg clone h i
350 $ hg clone h i
351 updating to branch default
351 updating to branch default
352 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 $ hg -R h up 0
353 $ hg -R h up 0
354 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
354 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
355 $ echo b > h/b
355 $ echo b > h/b
356 $ hg -R h ci -Am b
356 $ hg -R h ci -Am b
357 adding b
357 adding b
358 created new head
358 created new head
359 $ hg -R i up 0
359 $ hg -R i up 0
360 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
360 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
361 $ echo c > i/c
361 $ echo c > i/c
362 $ hg -R i ci -Am c
362 $ hg -R i ci -Am c
363 adding c
363 adding c
364 created new head
364 created new head
365
365
366 $ hg -R i push h
366 $ hg -R i push h
367 pushing to h
367 pushing to h
368 searching for changes
368 searching for changes
369 abort: push creates new remote heads on branch 'default'!
369 abort: push creates new remote heads on branch 'default'!
370 (you should pull and merge or use push -f to force)
370 (you should pull and merge or use push -f to force)
371 [255]
371 [255]
372
372
373
373
374 Check prepush logic with merged branches:
374 Check prepush logic with merged branches:
375
375
376 $ hg init j
376 $ hg init j
377 $ hg -R j branch a
377 $ hg -R j branch a
378 marked working directory as branch a
378 marked working directory as branch a
379 $ echo init > j/foo
379 $ echo init > j/foo
380 $ hg -R j ci -Am init
380 $ hg -R j ci -Am init
381 adding foo
381 adding foo
382 $ hg clone j k
382 $ hg clone j k
383 updating to branch a
383 updating to branch a
384 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
384 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 $ echo a1 > j/foo
385 $ echo a1 > j/foo
386 $ hg -R j ci -m a1
386 $ hg -R j ci -m a1
387 $ hg -R k branch b
387 $ hg -R k branch b
388 marked working directory as branch b
388 marked working directory as branch b
389 $ echo b > k/foo
389 $ echo b > k/foo
390 $ hg -R k ci -m b
390 $ hg -R k ci -m b
391 $ hg -R k up 0
391 $ hg -R k up 0
392 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
392 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
393
393
394 $ hg -R k merge b
394 $ hg -R k merge b
395 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
395 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
396 (branch merge, don't forget to commit)
396 (branch merge, don't forget to commit)
397
397
398 $ hg -R k ci -m merge
398 $ hg -R k ci -m merge
399
399
400 $ hg -R k push -r a j
400 $ hg -R k push -r a j
401 pushing to j
401 pushing to j
402 searching for changes
402 searching for changes
403 abort: push creates new remote branches: b!
403 abort: push creates new remote branches: b!
404 (use 'hg push --new-branch' to create new remote branches)
404 (use 'hg push --new-branch' to create new remote branches)
405 [255]
405 [255]
406
406
407
407
408 Prepush -r should not allow you to sneak in new heads:
408 Prepush -r should not allow you to sneak in new heads:
409
409
410 $ hg init l
410 $ hg init l
411 $ cd l
411 $ cd l
412 $ echo a >> foo
412 $ echo a >> foo
413 $ hg -q add foo
413 $ hg -q add foo
414 $ hg -q branch a
414 $ hg -q branch a
415 $ hg -q ci -ma
415 $ hg -q ci -ma
416 $ hg -q up null
416 $ hg -q up null
417 $ echo a >> foo
417 $ echo a >> foo
418 $ hg -q add foo
418 $ hg -q add foo
419 $ hg -q branch b
419 $ hg -q branch b
420 $ hg -q ci -mb
420 $ hg -q ci -mb
421 $ cd ..
421 $ cd ..
422 $ hg -q clone l m -u a
422 $ hg -q clone l m -u a
423 $ cd m
423 $ cd m
424 $ hg -q merge b
424 $ hg -q merge b
425 $ hg -q ci -mmb
425 $ hg -q ci -mmb
426 $ hg -q up 0
426 $ hg -q up 0
427 $ echo a >> foo
427 $ echo a >> foo
428 $ hg -q ci -ma2
428 $ hg -q ci -ma2
429 $ hg -q up 2
429 $ hg -q up 2
430 $ echo a >> foo
430 $ echo a >> foo
431 $ hg -q branch -f b
431 $ hg -q branch -f b
432 $ hg -q ci -mb2
432 $ hg -q ci -mb2
433 $ hg -q merge 3
433 $ hg -q merge 3
434 $ hg -q ci -mma
434 $ hg -q ci -mma
435
435
436 $ hg push ../l -b b
436 $ hg push ../l -b b
437 pushing to ../l
437 pushing to ../l
438 searching for changes
438 searching for changes
439 abort: push creates new remote heads on branch 'a'!
439 abort: push creates new remote heads on branch 'a'!
440 (did you forget to merge? use push -f to force)
440 (did you forget to merge? use push -f to force)
441 [255]
441 [255]
442
442
443 $ cd ..
443 $ cd ..
444
444
445
445
446 Check prepush with new branch head on former topo non-head:
446 Check prepush with new branch head on former topo non-head:
447
447
448 $ hg init n
448 $ hg init n
449 $ cd n
449 $ cd n
450 $ hg branch A
450 $ hg branch A
451 marked working directory as branch A
451 marked working directory as branch A
452 $ echo a >a
452 $ echo a >a
453 $ hg ci -Ama
453 $ hg ci -Ama
454 adding a
454 adding a
455 $ hg branch B
455 $ hg branch B
456 marked working directory as branch B
456 marked working directory as branch B
457 $ echo b >b
457 $ echo b >b
458 $ hg ci -Amb
458 $ hg ci -Amb
459 adding b
459 adding b
460
460
461 b is now branch head of B, and a topological head
461 b is now branch head of B, and a topological head
462 a is now branch head of A, but not a topological head
462 a is now branch head of A, but not a topological head
463
463
464 $ hg clone . inner
464 $ hg clone . inner
465 updating to branch B
465 updating to branch B
466 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
466 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
467 $ cd inner
467 $ cd inner
468 $ hg up B
468 $ hg up B
469 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
469 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 $ echo b1 >b1
470 $ echo b1 >b1
471 $ hg ci -Amb1
471 $ hg ci -Amb1
472 adding b1
472 adding b1
473
473
474 in the clone b1 is now the head of B
474 in the clone b1 is now the head of B
475
475
476 $ cd ..
476 $ cd ..
477 $ hg up 0
477 $ hg up 0
478 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
478 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
479 $ echo a2 >a2
479 $ echo a2 >a2
480 $ hg ci -Ama2
480 $ hg ci -Ama2
481 adding a2
481 adding a2
482
482
483 a2 is now the new branch head of A, and a new topological head
483 a2 is now the new branch head of A, and a new topological head
484 it replaces a former inner branch head, so it should at most warn about
484 it replaces a former inner branch head, so it should at most warn about
485 A, not B
485 A, not B
486
486
487 glog of local:
487 glog of local:
488
488
489 $ hg glog --template "{rev}: {branches} {desc}\n"
489 $ hg glog --template "{rev}: {branches} {desc}\n"
490 @ 2: A a2
490 @ 2: A a2
491 |
491 |
492 | o 1: B b
492 | o 1: B b
493 |/
493 |/
494 o 0: A a
494 o 0: A a
495
495
496 glog of remote:
496 glog of remote:
497
497
498 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
498 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
499 @ 2: B b1
499 @ 2: B b1
500 |
500 |
501 o 1: B b
501 o 1: B b
502 |
502 |
503 o 0: A a
503 o 0: A a
504
504
505 outgoing:
505 outgoing:
506
506
507 $ hg out inner --template "{rev}: {branches} {desc}\n"
507 $ hg out inner --template "{rev}: {branches} {desc}\n"
508 comparing with inner
508 comparing with inner
509 searching for changes
509 searching for changes
510 2: A a2
510 2: A a2
511
511
512 $ hg push inner
512 $ hg push inner
513 pushing to inner
513 pushing to inner
514 searching for changes
514 searching for changes
515 adding changesets
515 adding changesets
516 adding manifests
516 adding manifests
517 adding file changes
517 adding file changes
518 added 1 changesets with 1 changes to 1 files (+1 heads)
518 added 1 changesets with 1 changes to 1 files (+1 heads)
519
519
520 $ cd ..
520 $ cd ..
521
521
522
522
523 Check prepush with new branch head on former topo head:
523 Check prepush with new branch head on former topo head:
524
524
525 $ hg init o
525 $ hg init o
526 $ cd o
526 $ cd o
527 $ hg branch A
527 $ hg branch A
528 marked working directory as branch A
528 marked working directory as branch A
529 $ echo a >a
529 $ echo a >a
530 $ hg ci -Ama
530 $ hg ci -Ama
531 adding a
531 adding a
532 $ hg branch B
532 $ hg branch B
533 marked working directory as branch B
533 marked working directory as branch B
534 $ echo b >b
534 $ echo b >b
535 $ hg ci -Amb
535 $ hg ci -Amb
536 adding b
536 adding b
537
537
538 b is now branch head of B, and a topological head
538 b is now branch head of B, and a topological head
539
539
540 $ hg up 0
540 $ hg up 0
541 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
541 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
542 $ echo a1 >a1
542 $ echo a1 >a1
543 $ hg ci -Ama1
543 $ hg ci -Ama1
544 adding a1
544 adding a1
545
545
546 a1 is now branch head of A, and a topological head
546 a1 is now branch head of A, and a topological head
547
547
548 $ hg clone . inner
548 $ hg clone . inner
549 updating to branch A
549 updating to branch A
550 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
550 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
551 $ cd inner
551 $ cd inner
552 $ hg up B
552 $ hg up B
553 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
553 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
554 $ echo b1 >b1
554 $ echo b1 >b1
555 $ hg ci -Amb1
555 $ hg ci -Amb1
556 adding b1
556 adding b1
557
557
558 in the clone b1 is now the head of B
558 in the clone b1 is now the head of B
559
559
560 $ cd ..
560 $ cd ..
561 $ echo a2 >a2
561 $ echo a2 >a2
562 $ hg ci -Ama2
562 $ hg ci -Ama2
563 adding a2
563 adding a2
564
564
565 a2 is now the new branch head of A, and a topological head
565 a2 is now the new branch head of A, and a topological head
566 it replaces a former topological and branch head, so this should not warn
566 it replaces a former topological and branch head, so this should not warn
567
567
568 glog of local:
568 glog of local:
569
569
570 $ hg glog --template "{rev}: {branches} {desc}\n"
570 $ hg glog --template "{rev}: {branches} {desc}\n"
571 @ 3: A a2
571 @ 3: A a2
572 |
572 |
573 o 2: A a1
573 o 2: A a1
574 |
574 |
575 | o 1: B b
575 | o 1: B b
576 |/
576 |/
577 o 0: A a
577 o 0: A a
578
578
579 glog of remote:
579 glog of remote:
580
580
581 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
581 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
582 @ 3: B b1
582 @ 3: B b1
583 |
583 |
584 | o 2: A a1
584 | o 2: A a1
585 | |
585 | |
586 o | 1: B b
586 o | 1: B b
587 |/
587 |/
588 o 0: A a
588 o 0: A a
589
589
590 outgoing:
590 outgoing:
591
591
592 $ hg out inner --template "{rev}: {branches} {desc}\n"
592 $ hg out inner --template "{rev}: {branches} {desc}\n"
593 comparing with inner
593 comparing with inner
594 searching for changes
594 searching for changes
595 3: A a2
595 3: A a2
596
596
597 $ hg push inner
597 $ hg push inner
598 pushing to inner
598 pushing to inner
599 searching for changes
599 searching for changes
600 adding changesets
600 adding changesets
601 adding manifests
601 adding manifests
602 adding file changes
602 adding file changes
603 added 1 changesets with 1 changes to 1 files
603 added 1 changesets with 1 changes to 1 files
604
604
605 $ cd ..
605 $ cd ..
606
606
607
607
608 Check prepush with new branch head and new child of former branch head
608 Check prepush with new branch head and new child of former branch head
609 but child is on different branch:
609 but child is on different branch:
610
610
611 $ hg init p
611 $ hg init p
612 $ cd p
612 $ cd p
613 $ hg branch A
613 $ hg branch A
614 marked working directory as branch A
614 marked working directory as branch A
615 $ echo a0 >a
615 $ echo a0 >a
616 $ hg ci -Ama0
616 $ hg ci -Ama0
617 adding a
617 adding a
618 $ echo a1 >a
618 $ echo a1 >a
619 $ hg ci -ma1
619 $ hg ci -ma1
620 $ hg up null
620 $ hg up null
621 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
621 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
622 $ hg branch B
622 $ hg branch B
623 marked working directory as branch B
623 marked working directory as branch B
624 $ echo b0 >b
624 $ echo b0 >b
625 $ hg ci -Amb0
625 $ hg ci -Amb0
626 adding b
626 adding b
627 $ echo b1 >b
627 $ echo b1 >b
628 $ hg ci -mb1
628 $ hg ci -mb1
629
629
630 $ hg clone . inner
630 $ hg clone . inner
631 updating to branch B
631 updating to branch B
632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
632 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
633
633
634 $ hg up A
634 $ hg up A
635 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
635 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
636 $ hg branch -f B
636 $ hg branch -f B
637 marked working directory as branch B
637 marked working directory as branch B
638 $ echo a3 >a
638 $ echo a3 >a
639 $ hg ci -ma3
639 $ hg ci -ma3
640 created new head
640 created new head
641 $ hg up 3
641 $ hg up 3
642 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
642 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
643 $ hg branch -f A
643 $ hg branch -f A
644 marked working directory as branch A
644 marked working directory as branch A
645 $ echo b3 >b
645 $ echo b3 >b
646 $ hg ci -mb3
646 $ hg ci -mb3
647 created new head
647 created new head
648
648
649 glog of local:
649 glog of local:
650
650
651 $ hg glog --template "{rev}: {branches} {desc}\n"
651 $ hg glog --template "{rev}: {branches} {desc}\n"
652 @ 5: A b3
652 @ 5: A b3
653 |
653 |
654 | o 4: B a3
654 | o 4: B a3
655 | |
655 | |
656 o | 3: B b1
656 o | 3: B b1
657 | |
657 | |
658 o | 2: B b0
658 o | 2: B b0
659 /
659 /
660 o 1: A a1
660 o 1: A a1
661 |
661 |
662 o 0: A a0
662 o 0: A a0
663
663
664 glog of remote:
664 glog of remote:
665
665
666 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
666 $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
667 @ 3: B b1
667 @ 3: B b1
668 |
668 |
669 o 2: B b0
669 o 2: B b0
670
670
671 o 1: A a1
671 o 1: A a1
672 |
672 |
673 o 0: A a0
673 o 0: A a0
674
674
675 outgoing:
675 outgoing:
676
676
677 $ hg out inner --template "{rev}: {branches} {desc}\n"
677 $ hg out inner --template "{rev}: {branches} {desc}\n"
678 comparing with inner
678 comparing with inner
679 searching for changes
679 searching for changes
680 4: B a3
680 4: B a3
681 5: A b3
681 5: A b3
682
682
683 $ hg push inner
683 $ hg push inner
684 pushing to inner
684 pushing to inner
685 searching for changes
685 searching for changes
686 abort: push creates new remote heads on branch 'A'!
686 abort: push creates new remote heads on branch 'A'!
687 (did you forget to merge? use push -f to force)
687 (did you forget to merge? use push -f to force)
688 [255]
688 [255]
689
689
690 $ hg push inner -r4 -r5
690 $ hg push inner -r4 -r5
691 pushing to inner
691 pushing to inner
692 searching for changes
692 searching for changes
693 abort: push creates new remote heads on branch 'A'!
693 abort: push creates new remote heads on branch 'A'!
694 (did you forget to merge? use push -f to force)
694 (did you forget to merge? use push -f to force)
695 [255]
695 [255]
696
696
697 $ hg in inner
697 $ hg in inner
698 comparing with inner
698 comparing with inner
699 searching for changes
699 searching for changes
700 no changes found
700 no changes found
701 [1]
701 [1]
@@ -1,136 +1,136 b''
1 This emulates the effects of an hg pull --rebase in which the remote repo
1 This emulates the effects of an hg pull --rebase in which the remote repo
2 already has one local mq patch
2 already has one local mq patch
3
3
4 $ cat >> $HGRCPATH <<EOF
4 $ cat >> $HGRCPATH <<EOF
5 > [extensions]
5 > [extensions]
6 > graphlog=
6 > graphlog=
7 > rebase=
7 > rebase=
8 > mq=
8 > mq=
9 >
9 >
10 > [alias]
10 > [alias]
11 > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
11 > tglog = log -G --template "{rev}: '{desc}' tags: {tags}\n"
12 > EOF
12 > EOF
13
13
14
14
15 $ hg init a
15 $ hg init a
16 $ cd a
16 $ cd a
17 $ hg qinit -c
17 $ hg qinit -c
18
18
19 $ echo c1 > c1
19 $ echo c1 > c1
20 $ hg add c1
20 $ hg add c1
21 $ hg ci -m C1
21 $ hg ci -m C1
22
22
23 $ echo r1 > r1
23 $ echo r1 > r1
24 $ hg add r1
24 $ hg add r1
25 $ hg ci -m R1
25 $ hg ci -m R1
26
26
27 $ hg up -q 0
27 $ hg up -q 0
28
28
29 $ hg qnew p0.patch
29 $ hg qnew p0.patch
30 $ echo p0 > p0
30 $ echo p0 > p0
31 $ hg add p0
31 $ hg add p0
32 $ hg qref -m P0
32 $ hg qref -m P0
33
33
34 $ hg qnew p1.patch
34 $ hg qnew p1.patch
35 $ echo p1 > p1
35 $ echo p1 > p1
36 $ hg add p1
36 $ hg add p1
37 $ hg qref -m P1
37 $ hg qref -m P1
38
38
39 $ hg export qtip > p1.patch
39 $ hg export qtip > p1.patch
40
40
41 $ hg up -q -C 1
41 $ hg up -q -C 1
42
42
43 $ hg import p1.patch
43 $ hg import p1.patch
44 applying p1.patch
44 applying p1.patch
45
45
46 $ rm p1.patch
46 $ rm p1.patch
47
47
48 $ hg up -q -C qtip
48 $ hg up -q -C qtip
49
49
50 $ hg rebase
50 $ hg rebase
51 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
51 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
52
52
53 $ hg tglog
53 $ hg tglog
54 @ 3: 'P0' tags: p0.patch qbase qtip tip
54 @ 3: 'P0' tags: p0.patch qbase qtip tip
55 |
55 |
56 o 2: 'P1' tags: qparent
56 o 2: 'P1' tags: qparent
57 |
57 |
58 o 1: 'R1' tags:
58 o 1: 'R1' tags:
59 |
59 |
60 o 0: 'C1' tags:
60 o 0: 'C1' tags:
61
61
62 $ cd ..
62 $ cd ..
63
63
64
64
65 $ hg init b
65 $ hg init b
66 $ cd b
66 $ cd b
67 $ hg qinit -c
67 $ hg qinit -c
68
68
69 $ for i in r0 r1 r2 r3 r4 r5 r6;
69 $ for i in r0 r1 r2 r3 r4 r5 r6;
70 > do
70 > do
71 > echo $i > $i
71 > echo $i > $i
72 > hg ci -Am $i
72 > hg ci -Am $i
73 > done
73 > done
74 adding r0
74 adding r0
75 adding r1
75 adding r1
76 adding r2
76 adding r2
77 adding r3
77 adding r3
78 adding r4
78 adding r4
79 adding r5
79 adding r5
80 adding r6
80 adding r6
81
81
82 $ hg qimport -r 1:tip
82 $ hg qimport -r 1:tip
83
83
84 $ hg up -q 0
84 $ hg up -q 0
85
85
86 $ for i in r1 r3 r7 r8;
86 $ for i in r1 r3 r7 r8;
87 > do
87 > do
88 > echo $i > $i
88 > echo $i > $i
89 > hg ci -Am branch2-$i
89 > hg ci -Am branch2-$i
90 > done
90 > done
91 adding r1
91 adding r1
92 created new head
92 created new head
93 adding r3
93 adding r3
94 adding r7
94 adding r7
95 adding r8
95 adding r8
96
96
97 $ echo somethingelse > r4
97 $ echo somethingelse > r4
98 $ hg ci -Am branch2-r4
98 $ hg ci -Am branch2-r4
99 adding r4
99 adding r4
100
100
101 $ echo r6 > r6
101 $ echo r6 > r6
102 $ hg ci -Am branch2-r6
102 $ hg ci -Am branch2-r6
103 adding r6
103 adding r6
104
104
105 $ hg up -q qtip
105 $ hg up -q qtip
106
106
107 $ HGMERGE=internal:fail hg rebase
107 $ HGMERGE=internal:fail hg rebase
108 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
108 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
109 [255]
109 [255]
110
110
111 $ HGMERGE=internal:local hg resolve --all
111 $ HGMERGE=internal:local hg resolve --all
112
112
113 $ hg rebase --continue
113 $ hg rebase --continue
114 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
114 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
115
115
116 $ hg tglog
116 $ hg tglog
117 @ 9: 'r5' tags: 5.diff qtip tip
117 @ 9: 'r5' tags: 5.diff qtip tip
118 |
118 |
119 o 8: 'r4' tags: 4.diff
119 o 8: 'r4' tags: 4.diff
120 |
120 |
121 o 7: 'r2' tags: 2.diff qbase
121 o 7: 'r2' tags: 2.diff qbase
122 |
122 |
123 o 6: 'branch2-r6' tags: qparent
123 o 6: 'branch2-r6' tags: qparent
124 |
124 |
125 o 5: 'branch2-r4' tags:
125 o 5: 'branch2-r4' tags:
126 |
126 |
127 o 4: 'branch2-r8' tags:
127 o 4: 'branch2-r8' tags:
128 |
128 |
129 o 3: 'branch2-r7' tags:
129 o 3: 'branch2-r7' tags:
130 |
130 |
131 o 2: 'branch2-r3' tags:
131 o 2: 'branch2-r3' tags:
132 |
132 |
133 o 1: 'branch2-r1' tags:
133 o 1: 'branch2-r1' tags:
134 |
134 |
135 o 0: 'r0' tags:
135 o 0: 'r0' tags:
136
136
General Comments 0
You need to be logged in to leave comments. Login now