##// END OF EJS Templates
tests: drop a bunch of sed calls from unified tests
Matt Mackall -
r12366:c01dc908 default
parent child Browse files
Show More
@@ -1,290 +1,291 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 ]
66 ]
67
67
68 testfilters = [
68 testfilters = [
69 (r"( *)(#([^\n]*\S)?)", repcomment),
69 (r"( *)(#([^\n]*\S)?)", repcomment),
70 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
70 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
71 ]
71 ]
72
72
73 uprefix = r"^ \$ "
73 uprefix = r"^ \$ "
74 utestpats = [
74 utestpats = [
75 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
75 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
76 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
76 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
77 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
77 (uprefix + r'.*\|\| echo.*(fail|error)',
78 (uprefix + r'.*\|\| echo.*(fail|error)',
78 "explicit exit code checks unnecessary"),
79 "explicit exit code checks unnecessary"),
79 (uprefix + r'set -e', "don't use set -e"),
80 (uprefix + r'set -e', "don't use set -e"),
80 ]
81 ]
81
82
82 for p, m in testpats:
83 for p, m in testpats:
83 if p.startswith('^'):
84 if p.startswith('^'):
84 p = uprefix + p[1:]
85 p = uprefix + p[1:]
85 else:
86 else:
86 p = uprefix + p
87 p = uprefix + p
87 utestpats.append((p, m))
88 utestpats.append((p, m))
88
89
89 utestfilters = [
90 utestfilters = [
90 (r"( *)(#([^\n]*\S)?)", repcomment),
91 (r"( *)(#([^\n]*\S)?)", repcomment),
91 ]
92 ]
92
93
93 pypats = [
94 pypats = [
94 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
95 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
95 "tuple parameter unpacking not available in Python 3+"),
96 "tuple parameter unpacking not available in Python 3+"),
96 (r'lambda\s*\(.*,.*\)',
97 (r'lambda\s*\(.*,.*\)',
97 "tuple parameter unpacking not available in Python 3+"),
98 "tuple parameter unpacking not available in Python 3+"),
98 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
99 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
99 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
100 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
100 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
101 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
101 (r'^\s*\t', "don't use tabs"),
102 (r'^\s*\t', "don't use tabs"),
102 (r'\S;\s*\n', "semicolon"),
103 (r'\S;\s*\n', "semicolon"),
103 (r'\w,\w', "missing whitespace after ,"),
104 (r'\w,\w', "missing whitespace after ,"),
104 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
105 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
105 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
106 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
106 (r'.{85}', "line too long"),
107 (r'.{85}', "line too long"),
107 (r'.{81}', "warning: line over 80 characters"),
108 (r'.{81}', "warning: line over 80 characters"),
108 (r'[^\n]\Z', "no trailing newline"),
109 (r'[^\n]\Z', "no trailing newline"),
109 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
110 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
110 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
111 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
111 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
112 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
112 "linebreak after :"),
113 "linebreak after :"),
113 (r'class\s[^(]:', "old-style class, use class foo(object)"),
114 (r'class\s[^(]:', "old-style class, use class foo(object)"),
114 (r'^\s+del\(', "del isn't a function"),
115 (r'^\s+del\(', "del isn't a function"),
115 (r'^\s+except\(', "except isn't a function"),
116 (r'^\s+except\(', "except isn't a function"),
116 (r',]', "unneeded trailing ',' in list"),
117 (r',]', "unneeded trailing ',' in list"),
117 # (r'class\s[A-Z][^\(]*\((?!Exception)',
118 # (r'class\s[A-Z][^\(]*\((?!Exception)',
118 # "don't capitalize non-exception classes"),
119 # "don't capitalize non-exception classes"),
119 # (r'in range\(', "use xrange"),
120 # (r'in range\(', "use xrange"),
120 # (r'^\s*print\s+', "avoid using print in core and extensions"),
121 # (r'^\s*print\s+', "avoid using print in core and extensions"),
121 (r'[\x80-\xff]', "non-ASCII character literal"),
122 (r'[\x80-\xff]', "non-ASCII character literal"),
122 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
123 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
123 (r'^\s*with\s+', "with not available in Python 2.4"),
124 (r'^\s*with\s+', "with not available in Python 2.4"),
124 (r'(?<!def)\s+(any|all|format)\(',
125 (r'(?<!def)\s+(any|all|format)\(',
125 "any/all/format not available in Python 2.4"),
126 "any/all/format not available in Python 2.4"),
126 (r'(?<!def)\s+(callable)\(',
127 (r'(?<!def)\s+(callable)\(',
127 "callable not available in Python 3, use hasattr(f, '__call__')"),
128 "callable not available in Python 3, use hasattr(f, '__call__')"),
128 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
129 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
129 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
130 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
130 # (r'\s\s=', "gratuitous whitespace before ="),
131 # (r'\s\s=', "gratuitous whitespace before ="),
131 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
132 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
132 "missing whitespace around operator"),
133 "missing whitespace around operator"),
133 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
134 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
134 "missing whitespace around operator"),
135 "missing whitespace around operator"),
135 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
136 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
136 "missing whitespace around operator"),
137 "missing whitespace around operator"),
137 (r'[^+=*!<>&| -](\s=|=\s)[^= ]',
138 (r'[^+=*!<>&| -](\s=|=\s)[^= ]',
138 "wrong whitespace around ="),
139 "wrong whitespace around ="),
139 (r'raise Exception', "don't raise generic exceptions"),
140 (r'raise Exception', "don't raise generic exceptions"),
140 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
141 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
141 "warning: unwrapped ui message"),
142 "warning: unwrapped ui message"),
142 ]
143 ]
143
144
144 pyfilters = [
145 pyfilters = [
145 (r"""(?msx)(?P<comment>\#.*?$)|
146 (r"""(?msx)(?P<comment>\#.*?$)|
146 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
147 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
147 (?P<text>(([^\\]|\\.)*?))
148 (?P<text>(([^\\]|\\.)*?))
148 (?P=quote))""", reppython),
149 (?P=quote))""", reppython),
149 ]
150 ]
150
151
151 cpats = [
152 cpats = [
152 (r'//', "don't use //-style comments"),
153 (r'//', "don't use //-style comments"),
153 (r'^ ', "don't use spaces to indent"),
154 (r'^ ', "don't use spaces to indent"),
154 (r'\S\t', "don't use tabs except for indent"),
155 (r'\S\t', "don't use tabs except for indent"),
155 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
156 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
156 (r'.{85}', "line too long"),
157 (r'.{85}', "line too long"),
157 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
158 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
158 (r'return\(', "return is not a function"),
159 (r'return\(', "return is not a function"),
159 (r' ;', "no space before ;"),
160 (r' ;', "no space before ;"),
160 (r'\w+\* \w+', "use int *foo, not int* foo"),
161 (r'\w+\* \w+', "use int *foo, not int* foo"),
161 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
162 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
162 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
163 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
163 (r'\w,\w', "missing whitespace after ,"),
164 (r'\w,\w', "missing whitespace after ,"),
164 (r'\w[+/*]\w', "missing whitespace in expression"),
165 (r'\w[+/*]\w', "missing whitespace in expression"),
165 (r'^#\s+\w', "use #foo, not # foo"),
166 (r'^#\s+\w', "use #foo, not # foo"),
166 (r'[^\n]\Z', "no trailing newline"),
167 (r'[^\n]\Z', "no trailing newline"),
167 ]
168 ]
168
169
169 cfilters = [
170 cfilters = [
170 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
171 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
171 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
172 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
172 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
173 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
173 (r'(\()([^)]+\))', repcallspaces),
174 (r'(\()([^)]+\))', repcallspaces),
174 ]
175 ]
175
176
176 checks = [
177 checks = [
177 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
178 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
178 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
179 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
179 ('c', r'.*\.c$', cfilters, cpats),
180 ('c', r'.*\.c$', cfilters, cpats),
180 ('unified test', r'.*\.t$', utestfilters, utestpats),
181 ('unified test', r'.*\.t$', utestfilters, utestpats),
181 ]
182 ]
182
183
183 class norepeatlogger(object):
184 class norepeatlogger(object):
184 def __init__(self):
185 def __init__(self):
185 self._lastseen = None
186 self._lastseen = None
186
187
187 def log(self, fname, lineno, line, msg, blame):
188 def log(self, fname, lineno, line, msg, blame):
188 """print error related a to given line of a given file.
189 """print error related a to given line of a given file.
189
190
190 The faulty line will also be printed but only once in the case
191 The faulty line will also be printed but only once in the case
191 of multiple errors.
192 of multiple errors.
192
193
193 :fname: filename
194 :fname: filename
194 :lineno: line number
195 :lineno: line number
195 :line: actual content of the line
196 :line: actual content of the line
196 :msg: error message
197 :msg: error message
197 """
198 """
198 msgid = fname, lineno, line
199 msgid = fname, lineno, line
199 if msgid != self._lastseen:
200 if msgid != self._lastseen:
200 if blame:
201 if blame:
201 print "%s:%d (%s):" % (fname, lineno, blame)
202 print "%s:%d (%s):" % (fname, lineno, blame)
202 else:
203 else:
203 print "%s:%d:" % (fname, lineno)
204 print "%s:%d:" % (fname, lineno)
204 print " > %s" % line
205 print " > %s" % line
205 self._lastseen = msgid
206 self._lastseen = msgid
206 print " " + msg
207 print " " + msg
207
208
208 _defaultlogger = norepeatlogger()
209 _defaultlogger = norepeatlogger()
209
210
210 def getblame(f):
211 def getblame(f):
211 lines = []
212 lines = []
212 for l in os.popen('hg annotate -un %s' % f):
213 for l in os.popen('hg annotate -un %s' % f):
213 start, line = l.split(':', 1)
214 start, line = l.split(':', 1)
214 user, rev = start.split()
215 user, rev = start.split()
215 lines.append((line[1:-1], user, rev))
216 lines.append((line[1:-1], user, rev))
216 return lines
217 return lines
217
218
218 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
219 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
219 blame=False):
220 blame=False):
220 """checks style and portability of a given file
221 """checks style and portability of a given file
221
222
222 :f: filepath
223 :f: filepath
223 :logfunc: function used to report error
224 :logfunc: function used to report error
224 logfunc(filename, linenumber, linecontent, errormessage)
225 logfunc(filename, linenumber, linecontent, errormessage)
225 :maxerr: number of error to display before arborting.
226 :maxerr: number of error to display before arborting.
226 Set to None (default) to report all errors
227 Set to None (default) to report all errors
227
228
228 return True if no error is found, False otherwise.
229 return True if no error is found, False otherwise.
229 """
230 """
230 blamecache = None
231 blamecache = None
231 result = True
232 result = True
232 for name, match, filters, pats in checks:
233 for name, match, filters, pats in checks:
233 fc = 0
234 fc = 0
234 if not re.match(match, f):
235 if not re.match(match, f):
235 continue
236 continue
236 pre = post = open(f).read()
237 pre = post = open(f).read()
237 if "no-" + "check-code" in pre:
238 if "no-" + "check-code" in pre:
238 break
239 break
239 for p, r in filters:
240 for p, r in filters:
240 post = re.sub(p, r, post)
241 post = re.sub(p, r, post)
241 # print post # uncomment to show filtered version
242 # print post # uncomment to show filtered version
242 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
243 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
243 for n, l in z:
244 for n, l in z:
244 if "check-code" + "-ignore" in l[0]:
245 if "check-code" + "-ignore" in l[0]:
245 continue
246 continue
246 for p, msg in pats:
247 for p, msg in pats:
247 if not warnings and msg.startswith("warning"):
248 if not warnings and msg.startswith("warning"):
248 continue
249 continue
249 if re.search(p, l[1]):
250 if re.search(p, l[1]):
250 bd = ""
251 bd = ""
251 if blame:
252 if blame:
252 bd = 'working directory'
253 bd = 'working directory'
253 if not blamecache:
254 if not blamecache:
254 blamecache = getblame(f)
255 blamecache = getblame(f)
255 if n < len(blamecache):
256 if n < len(blamecache):
256 bl, bu, br = blamecache[n]
257 bl, bu, br = blamecache[n]
257 if bl == l[0]:
258 if bl == l[0]:
258 bd = '%s@%s' % (bu, br)
259 bd = '%s@%s' % (bu, br)
259 logfunc(f, n + 1, l[0], msg, bd)
260 logfunc(f, n + 1, l[0], msg, bd)
260 fc += 1
261 fc += 1
261 result = False
262 result = False
262 if maxerr is not None and fc >= maxerr:
263 if maxerr is not None and fc >= maxerr:
263 print " (too many errors, giving up)"
264 print " (too many errors, giving up)"
264 break
265 break
265 break
266 break
266 return result
267 return result
267
268
268 if __name__ == "__main__":
269 if __name__ == "__main__":
269 parser = optparse.OptionParser("%prog [options] [files]")
270 parser = optparse.OptionParser("%prog [options] [files]")
270 parser.add_option("-w", "--warnings", action="store_true",
271 parser.add_option("-w", "--warnings", action="store_true",
271 help="include warning-level checks")
272 help="include warning-level checks")
272 parser.add_option("-p", "--per-file", type="int",
273 parser.add_option("-p", "--per-file", type="int",
273 help="max warnings per file")
274 help="max warnings per file")
274 parser.add_option("-b", "--blame", action="store_true",
275 parser.add_option("-b", "--blame", action="store_true",
275 help="use annotate to generate blame info")
276 help="use annotate to generate blame info")
276
277
277 parser.set_defaults(per_file=15, warnings=False, blame=False)
278 parser.set_defaults(per_file=15, warnings=False, blame=False)
278 (options, args) = parser.parse_args()
279 (options, args) = parser.parse_args()
279
280
280 if len(args) == 0:
281 if len(args) == 0:
281 check = glob.glob("*")
282 check = glob.glob("*")
282 else:
283 else:
283 check = args
284 check = args
284
285
285 for f in check:
286 for f in check:
286 ret = 0
287 ret = 0
287 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
288 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
288 blame=options.blame):
289 blame=options.blame):
289 ret = 1
290 ret = 1
290 sys.exit(ret)
291 sys.exit(ret)
@@ -1,235 +1,235 b''
1 $ mkdir test
1 $ mkdir test
2 $ cd test
2 $ cd test
3 $ hg init
3 $ hg init
4 $ echo foo>foo
4 $ echo foo>foo
5 $ hg commit -Am 1 -d '1 0'
5 $ hg commit -Am 1 -d '1 0'
6 adding foo
6 adding foo
7 $ echo bar>bar
7 $ echo bar>bar
8 $ hg commit -Am 2 -d '2 0'
8 $ hg commit -Am 2 -d '2 0'
9 adding bar
9 adding bar
10 $ mkdir baz
10 $ mkdir baz
11 $ echo bletch>baz/bletch
11 $ echo bletch>baz/bletch
12 $ hg commit -Am 3 -d '1000000000 0'
12 $ hg commit -Am 3 -d '1000000000 0'
13 adding baz/bletch
13 adding baz/bletch
14 $ echo "[web]" >> .hg/hgrc
14 $ echo "[web]" >> .hg/hgrc
15 $ echo "name = test-archive" >> .hg/hgrc
15 $ echo "name = test-archive" >> .hg/hgrc
16 $ cp .hg/hgrc .hg/hgrc-base
16 $ cp .hg/hgrc .hg/hgrc-base
17 > test_archtype() {
17 > test_archtype() {
18 > echo "allow_archive = $1" >> .hg/hgrc
18 > echo "allow_archive = $1" >> .hg/hgrc
19 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
19 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
20 > cat hg.pid >> $DAEMON_PIDS
20 > cat hg.pid >> $DAEMON_PIDS
21 > echo % $1 allowed should give 200
21 > echo % $1 allowed should give 200
22 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$2" | head -n 1
22 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$2" | head -n 1
23 > echo % $3 and $4 disallowed should both give 403
23 > echo % $3 and $4 disallowed should both give 403
24 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1
24 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$3" | head -n 1
25 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1
25 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.$4" | head -n 1
26 > "$TESTDIR/killdaemons.py"
26 > "$TESTDIR/killdaemons.py"
27 > cat errors.log
27 > cat errors.log
28 > cp .hg/hgrc-base .hg/hgrc
28 > cp .hg/hgrc-base .hg/hgrc
29 > }
29 > }
30
30
31 check http return codes
31 check http return codes
32
32
33
33
34 $ test_archtype gz tar.gz tar.bz2 zip
34 $ test_archtype gz tar.gz tar.bz2 zip
35 % gz allowed should give 200
35 % gz allowed should give 200
36 200 Script output follows
36 200 Script output follows
37 % tar.bz2 and zip disallowed should both give 403
37 % tar.bz2 and zip disallowed should both give 403
38 403 Archive type not allowed: bz2
38 403 Archive type not allowed: bz2
39 403 Archive type not allowed: zip
39 403 Archive type not allowed: zip
40 $ test_archtype bz2 tar.bz2 zip tar.gz
40 $ test_archtype bz2 tar.bz2 zip tar.gz
41 % bz2 allowed should give 200
41 % bz2 allowed should give 200
42 200 Script output follows
42 200 Script output follows
43 % zip and tar.gz disallowed should both give 403
43 % zip and tar.gz disallowed should both give 403
44 403 Archive type not allowed: zip
44 403 Archive type not allowed: zip
45 403 Archive type not allowed: gz
45 403 Archive type not allowed: gz
46 $ test_archtype zip zip tar.gz tar.bz2
46 $ test_archtype zip zip tar.gz tar.bz2
47 % zip allowed should give 200
47 % zip allowed should give 200
48 200 Script output follows
48 200 Script output follows
49 % tar.gz and tar.bz2 disallowed should both give 403
49 % tar.gz and tar.bz2 disallowed should both give 403
50 403 Archive type not allowed: gz
50 403 Archive type not allowed: gz
51 403 Archive type not allowed: bz2
51 403 Archive type not allowed: bz2
52
52
53 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
53 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
54 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
54 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
55 $ cat hg.pid >> $DAEMON_PIDS
55 $ cat hg.pid >> $DAEMON_PIDS
56
56
57 invalid arch type should give 404
57 invalid arch type should give 404
58
58
59 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.invalid" | head -n 1
59 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/archive/tip.invalid" | head -n 1
60 404 Unsupported archive type: None
60 404 Unsupported archive type: None
61
61
62 $ TIP=`hg id -v | cut -f1 -d' '`
62 $ TIP=`hg id -v | cut -f1 -d' '`
63 $ QTIP=`hg id -q`
63 $ QTIP=`hg id -q`
64 $ cat > getarchive.py <<EOF
64 $ cat > getarchive.py <<EOF
65 > import os, sys, urllib2
65 > import os, sys, urllib2
66 > try:
66 > try:
67 > # Set stdout to binary mode for win32 platforms
67 > # Set stdout to binary mode for win32 platforms
68 > import msvcrt
68 > import msvcrt
69 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
69 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
70 > except ImportError:
70 > except ImportError:
71 > pass
71 > pass
72 > node, archive = sys.argv[1:]
72 > node, archive = sys.argv[1:]
73 > f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
73 > f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
74 > % (os.environ['HGPORT'], node, archive))
74 > % (os.environ['HGPORT'], node, archive))
75 > sys.stdout.write(f.read())
75 > sys.stdout.write(f.read())
76 > EOF
76 > EOF
77 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
77 $ python getarchive.py "$TIP" gz | gunzip | tar tf - 2>/dev/null
78 test-archive-TIP/.hg_archival.txt
78 test-archive-2c0277f05ed4/.hg_archival.txt
79 test-archive-TIP/bar
79 test-archive-2c0277f05ed4/bar
80 test-archive-TIP/baz/bletch
80 test-archive-2c0277f05ed4/baz/bletch
81 test-archive-TIP/foo
81 test-archive-2c0277f05ed4/foo
82 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
82 $ python getarchive.py "$TIP" bz2 | bunzip2 | tar tf - 2>/dev/null
83 test-archive-TIP/.hg_archival.txt
83 test-archive-2c0277f05ed4/.hg_archival.txt
84 test-archive-TIP/bar
84 test-archive-2c0277f05ed4/bar
85 test-archive-TIP/baz/bletch
85 test-archive-2c0277f05ed4/baz/bletch
86 test-archive-TIP/foo
86 test-archive-2c0277f05ed4/foo
87 $ python getarchive.py "$TIP" zip > archive.zip
87 $ python getarchive.py "$TIP" zip > archive.zip
88 $ unzip -t archive.zip | sed "s/$QTIP/TIP/"
88 $ unzip -t archive.zip
89 Archive: archive.zip
89 Archive: archive.zip
90 testing: test-archive-TIP/.hg_archival.txt OK
90 testing: test-archive-2c0277f05ed4/.hg_archival.txt OK
91 testing: test-archive-TIP/bar OK
91 testing: test-archive-2c0277f05ed4/bar OK
92 testing: test-archive-TIP/baz/bletch OK
92 testing: test-archive-2c0277f05ed4/baz/bletch OK
93 testing: test-archive-TIP/foo OK
93 testing: test-archive-2c0277f05ed4/foo OK
94 No errors detected in compressed data of archive.zip.
94 No errors detected in compressed data of archive.zip.
95
95
96 $ "$TESTDIR/killdaemons.py"
96 $ "$TESTDIR/killdaemons.py"
97
97
98 $ hg archive -t tar test.tar
98 $ hg archive -t tar test.tar
99 $ tar tf test.tar
99 $ tar tf test.tar
100 test/.hg_archival.txt
100 test/.hg_archival.txt
101 test/bar
101 test/bar
102 test/baz/bletch
102 test/baz/bletch
103 test/foo
103 test/foo
104
104
105 $ hg archive -t tbz2 -X baz test.tar.bz2
105 $ hg archive -t tbz2 -X baz test.tar.bz2
106 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
106 $ bunzip2 -dc test.tar.bz2 | tar tf - 2>/dev/null
107 test/.hg_archival.txt
107 test/.hg_archival.txt
108 test/bar
108 test/bar
109 test/foo
109 test/foo
110
110
111 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
111 $ hg archive -t tgz -p %b-%h test-%h.tar.gz
112 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
112 $ gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null
113 test-TIP/.hg_archival.txt
113 test-2c0277f05ed4/.hg_archival.txt
114 test-TIP/bar
114 test-2c0277f05ed4/bar
115 test-TIP/baz/bletch
115 test-2c0277f05ed4/baz/bletch
116 test-TIP/foo
116 test-2c0277f05ed4/foo
117
117
118 $ hg archive autodetected_test.tar
118 $ hg archive autodetected_test.tar
119 $ tar tf autodetected_test.tar
119 $ tar tf autodetected_test.tar
120 autodetected_test/.hg_archival.txt
120 autodetected_test/.hg_archival.txt
121 autodetected_test/bar
121 autodetected_test/bar
122 autodetected_test/baz/bletch
122 autodetected_test/baz/bletch
123 autodetected_test/foo
123 autodetected_test/foo
124
124
125 The '-t' should override autodetection
125 The '-t' should override autodetection
126
126
127 $ hg archive -t tar autodetect_override_test.zip
127 $ hg archive -t tar autodetect_override_test.zip
128 $ tar tf autodetect_override_test.zip
128 $ tar tf autodetect_override_test.zip
129 autodetect_override_test.zip/.hg_archival.txt
129 autodetect_override_test.zip/.hg_archival.txt
130 autodetect_override_test.zip/bar
130 autodetect_override_test.zip/bar
131 autodetect_override_test.zip/baz/bletch
131 autodetect_override_test.zip/baz/bletch
132 autodetect_override_test.zip/foo
132 autodetect_override_test.zip/foo
133
133
134 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
134 $ for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do
135 > hg archive auto_test.$ext
135 > hg archive auto_test.$ext
136 > if [ -d auto_test.$ext ]; then
136 > if [ -d auto_test.$ext ]; then
137 > echo "extension $ext was not autodetected."
137 > echo "extension $ext was not autodetected."
138 > fi
138 > fi
139 > done
139 > done
140
140
141 $ cat > md5comp.py <<EOF
141 $ cat > md5comp.py <<EOF
142 > try:
142 > try:
143 > from hashlib import md5
143 > from hashlib import md5
144 > except ImportError:
144 > except ImportError:
145 > from md5 import md5
145 > from md5 import md5
146 > import sys
146 > import sys
147 > f1, f2 = sys.argv[1:3]
147 > f1, f2 = sys.argv[1:3]
148 > h1 = md5(file(f1, 'rb').read()).hexdigest()
148 > h1 = md5(file(f1, 'rb').read()).hexdigest()
149 > h2 = md5(file(f2, 'rb').read()).hexdigest()
149 > h2 = md5(file(f2, 'rb').read()).hexdigest()
150 > print h1 == h2 or "md5 differ: " + repr((h1, h2))
150 > print h1 == h2 or "md5 differ: " + repr((h1, h2))
151 > EOF
151 > EOF
152
152
153 archive name is stored in the archive, so create similar
153 archive name is stored in the archive, so create similar
154
154
155 archives and rename them afterwards.
155 archives and rename them afterwards.
156
156
157 $ hg archive -t tgz tip.tar.gz
157 $ hg archive -t tgz tip.tar.gz
158 $ mv tip.tar.gz tip1.tar.gz
158 $ mv tip.tar.gz tip1.tar.gz
159 $ sleep 1
159 $ sleep 1
160 $ hg archive -t tgz tip.tar.gz
160 $ hg archive -t tgz tip.tar.gz
161 $ mv tip.tar.gz tip2.tar.gz
161 $ mv tip.tar.gz tip2.tar.gz
162 $ python md5comp.py tip1.tar.gz tip2.tar.gz
162 $ python md5comp.py tip1.tar.gz tip2.tar.gz
163 True
163 True
164
164
165 $ hg archive -t zip -p /illegal test.zip
165 $ hg archive -t zip -p /illegal test.zip
166 abort: archive prefix contains illegal components
166 abort: archive prefix contains illegal components
167 [255]
167 [255]
168 $ hg archive -t zip -p very/../bad test.zip
168 $ hg archive -t zip -p very/../bad test.zip
169
169
170 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
170 $ hg archive --config ui.archivemeta=false -t zip -r 2 test.zip
171 $ unzip -t test.zip
171 $ unzip -t test.zip
172 Archive: test.zip
172 Archive: test.zip
173 testing: test/bar OK
173 testing: test/bar OK
174 testing: test/baz/bletch OK
174 testing: test/baz/bletch OK
175 testing: test/foo OK
175 testing: test/foo OK
176 No errors detected in compressed data of test.zip.
176 No errors detected in compressed data of test.zip.
177
177
178 $ hg archive -t tar - | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/"
178 $ hg archive -t tar - | tar tf - 2>/dev/null
179 test-TIP/.hg_archival.txt
179 test-2c0277f05ed4/.hg_archival.txt
180 test-TIP/bar
180 test-2c0277f05ed4/bar
181 test-TIP/baz/bletch
181 test-2c0277f05ed4/baz/bletch
182 test-TIP/foo
182 test-2c0277f05ed4/foo
183
183
184 $ hg archive -r 0 -t tar rev-%r.tar
184 $ hg archive -r 0 -t tar rev-%r.tar
185 $ if [ -f rev-0.tar ]; then
185 $ if [ -f rev-0.tar ]; then
186 $ fi
186 $ fi
187
187
188 test .hg_archival.txt
188 test .hg_archival.txt
189
189
190 $ hg archive ../test-tags
190 $ hg archive ../test-tags
191 $ cat ../test-tags/.hg_archival.txt
191 $ cat ../test-tags/.hg_archival.txt
192 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
192 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
193 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
193 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
194 branch: default
194 branch: default
195 latesttag: null
195 latesttag: null
196 latesttagdistance: 3
196 latesttagdistance: 3
197 $ hg tag -r 2 mytag
197 $ hg tag -r 2 mytag
198 $ hg tag -r 2 anothertag
198 $ hg tag -r 2 anothertag
199 $ hg archive -r 2 ../test-lasttag
199 $ hg archive -r 2 ../test-lasttag
200 $ cat ../test-lasttag/.hg_archival.txt
200 $ cat ../test-lasttag/.hg_archival.txt
201 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
201 repo: daa7f7c60e0a224faa4ff77ca41b2760562af264
202 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
202 node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e
203 branch: default
203 branch: default
204 tag: anothertag
204 tag: anothertag
205 tag: mytag
205 tag: mytag
206
206
207 $ hg archive -t bogus test.bogus
207 $ hg archive -t bogus test.bogus
208 abort: unknown archive type 'bogus'
208 abort: unknown archive type 'bogus'
209 [255]
209 [255]
210
210
211 server errors
211 server errors
212
212
213 $ cat errors.log
213 $ cat errors.log
214
214
215 empty repo
215 empty repo
216
216
217 $ hg init ../empty
217 $ hg init ../empty
218 $ cd ../empty
218 $ cd ../empty
219 $ hg archive ../test-empty
219 $ hg archive ../test-empty
220 abort: no working directory: please specify a revision
220 abort: no working directory: please specify a revision
221 [255]
221 [255]
222 old file -- date clamped to 1980
222 old file -- date clamped to 1980
223
223
224 $ touch -d 1975-01-01 old
224 $ touch -d 1975-01-01 old
225 $ hg add old
225 $ hg add old
226 $ hg commit -m old
226 $ hg commit -m old
227 $ hg archive ../old.zip
227 $ hg archive ../old.zip
228 $ unzip -l ../old.zip
228 $ unzip -l ../old.zip
229 Archive: ../old.zip
229 Archive: ../old.zip
230 \s*Length.*
230 \s*Length.*
231 .*-----.*
231 .*-----.*
232 .*147.*80.*00:00.*old/.hg_archival.txt
232 .*147.*80.*00:00.*old/.hg_archival.txt
233 .*0.*80.*00:00.*old/old
233 .*0.*80.*00:00.*old/old
234 .*-----.*
234 .*-----.*
235 \s*147\s+2 files
235 \s*147\s+2 files
@@ -1,419 +1,421 b''
1 $ hg init
1 $ hg init
2
2
3
3
4 committing changes
4 committing changes
5
5
6 $ count=0
6 $ count=0
7 $ echo > a
7 $ echo > a
8 $ while test $count -lt 32 ; do
8 $ while test $count -lt 32 ; do
9 > echo 'a' >> a
9 > echo 'a' >> a
10 > test $count -eq 0 && hg add
10 > test $count -eq 0 && hg add
11 > hg ci -m "msg $count" -d "$count 0"
11 > hg ci -m "msg $count" -d "$count 0"
12 > count=`expr $count + 1`
12 > count=`expr $count + 1`
13 > done
13 > done
14 adding a
14 adding a
15
15
16
16
17 $ hg log
17 $ hg log
18 changeset: 31:58c80a7c8a40
18 changeset: 31:58c80a7c8a40
19 tag: tip
19 tag: tip
20 user: test
20 user: test
21 date: Thu Jan 01 00:00:31 1970 +0000
21 date: Thu Jan 01 00:00:31 1970 +0000
22 summary: msg 31
22 summary: msg 31
23
23
24 changeset: 30:ed2d2f24b11c
24 changeset: 30:ed2d2f24b11c
25 user: test
25 user: test
26 date: Thu Jan 01 00:00:30 1970 +0000
26 date: Thu Jan 01 00:00:30 1970 +0000
27 summary: msg 30
27 summary: msg 30
28
28
29 changeset: 29:b5bd63375ab9
29 changeset: 29:b5bd63375ab9
30 user: test
30 user: test
31 date: Thu Jan 01 00:00:29 1970 +0000
31 date: Thu Jan 01 00:00:29 1970 +0000
32 summary: msg 29
32 summary: msg 29
33
33
34 changeset: 28:8e0c2264c8af
34 changeset: 28:8e0c2264c8af
35 user: test
35 user: test
36 date: Thu Jan 01 00:00:28 1970 +0000
36 date: Thu Jan 01 00:00:28 1970 +0000
37 summary: msg 28
37 summary: msg 28
38
38
39 changeset: 27:288867a866e9
39 changeset: 27:288867a866e9
40 user: test
40 user: test
41 date: Thu Jan 01 00:00:27 1970 +0000
41 date: Thu Jan 01 00:00:27 1970 +0000
42 summary: msg 27
42 summary: msg 27
43
43
44 changeset: 26:3efc6fd51aeb
44 changeset: 26:3efc6fd51aeb
45 user: test
45 user: test
46 date: Thu Jan 01 00:00:26 1970 +0000
46 date: Thu Jan 01 00:00:26 1970 +0000
47 summary: msg 26
47 summary: msg 26
48
48
49 changeset: 25:02a84173a97a
49 changeset: 25:02a84173a97a
50 user: test
50 user: test
51 date: Thu Jan 01 00:00:25 1970 +0000
51 date: Thu Jan 01 00:00:25 1970 +0000
52 summary: msg 25
52 summary: msg 25
53
53
54 changeset: 24:10e0acd3809e
54 changeset: 24:10e0acd3809e
55 user: test
55 user: test
56 date: Thu Jan 01 00:00:24 1970 +0000
56 date: Thu Jan 01 00:00:24 1970 +0000
57 summary: msg 24
57 summary: msg 24
58
58
59 changeset: 23:5ec79163bff4
59 changeset: 23:5ec79163bff4
60 user: test
60 user: test
61 date: Thu Jan 01 00:00:23 1970 +0000
61 date: Thu Jan 01 00:00:23 1970 +0000
62 summary: msg 23
62 summary: msg 23
63
63
64 changeset: 22:06c7993750ce
64 changeset: 22:06c7993750ce
65 user: test
65 user: test
66 date: Thu Jan 01 00:00:22 1970 +0000
66 date: Thu Jan 01 00:00:22 1970 +0000
67 summary: msg 22
67 summary: msg 22
68
68
69 changeset: 21:e5db6aa3fe2a
69 changeset: 21:e5db6aa3fe2a
70 user: test
70 user: test
71 date: Thu Jan 01 00:00:21 1970 +0000
71 date: Thu Jan 01 00:00:21 1970 +0000
72 summary: msg 21
72 summary: msg 21
73
73
74 changeset: 20:7128fb4fdbc9
74 changeset: 20:7128fb4fdbc9
75 user: test
75 user: test
76 date: Thu Jan 01 00:00:20 1970 +0000
76 date: Thu Jan 01 00:00:20 1970 +0000
77 summary: msg 20
77 summary: msg 20
78
78
79 changeset: 19:52798545b482
79 changeset: 19:52798545b482
80 user: test
80 user: test
81 date: Thu Jan 01 00:00:19 1970 +0000
81 date: Thu Jan 01 00:00:19 1970 +0000
82 summary: msg 19
82 summary: msg 19
83
83
84 changeset: 18:86977a90077e
84 changeset: 18:86977a90077e
85 user: test
85 user: test
86 date: Thu Jan 01 00:00:18 1970 +0000
86 date: Thu Jan 01 00:00:18 1970 +0000
87 summary: msg 18
87 summary: msg 18
88
88
89 changeset: 17:03515f4a9080
89 changeset: 17:03515f4a9080
90 user: test
90 user: test
91 date: Thu Jan 01 00:00:17 1970 +0000
91 date: Thu Jan 01 00:00:17 1970 +0000
92 summary: msg 17
92 summary: msg 17
93
93
94 changeset: 16:a2e6ea4973e9
94 changeset: 16:a2e6ea4973e9
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:16 1970 +0000
96 date: Thu Jan 01 00:00:16 1970 +0000
97 summary: msg 16
97 summary: msg 16
98
98
99 changeset: 15:e7fa0811edb0
99 changeset: 15:e7fa0811edb0
100 user: test
100 user: test
101 date: Thu Jan 01 00:00:15 1970 +0000
101 date: Thu Jan 01 00:00:15 1970 +0000
102 summary: msg 15
102 summary: msg 15
103
103
104 changeset: 14:ce8f0998e922
104 changeset: 14:ce8f0998e922
105 user: test
105 user: test
106 date: Thu Jan 01 00:00:14 1970 +0000
106 date: Thu Jan 01 00:00:14 1970 +0000
107 summary: msg 14
107 summary: msg 14
108
108
109 changeset: 13:9d7d07bc967c
109 changeset: 13:9d7d07bc967c
110 user: test
110 user: test
111 date: Thu Jan 01 00:00:13 1970 +0000
111 date: Thu Jan 01 00:00:13 1970 +0000
112 summary: msg 13
112 summary: msg 13
113
113
114 changeset: 12:1941b52820a5
114 changeset: 12:1941b52820a5
115 user: test
115 user: test
116 date: Thu Jan 01 00:00:12 1970 +0000
116 date: Thu Jan 01 00:00:12 1970 +0000
117 summary: msg 12
117 summary: msg 12
118
118
119 changeset: 11:7b4cd9578619
119 changeset: 11:7b4cd9578619
120 user: test
120 user: test
121 date: Thu Jan 01 00:00:11 1970 +0000
121 date: Thu Jan 01 00:00:11 1970 +0000
122 summary: msg 11
122 summary: msg 11
123
123
124 changeset: 10:7c5eff49a6b6
124 changeset: 10:7c5eff49a6b6
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:10 1970 +0000
126 date: Thu Jan 01 00:00:10 1970 +0000
127 summary: msg 10
127 summary: msg 10
128
128
129 changeset: 9:eb44510ef29a
129 changeset: 9:eb44510ef29a
130 user: test
130 user: test
131 date: Thu Jan 01 00:00:09 1970 +0000
131 date: Thu Jan 01 00:00:09 1970 +0000
132 summary: msg 9
132 summary: msg 9
133
133
134 changeset: 8:453eb4dba229
134 changeset: 8:453eb4dba229
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:08 1970 +0000
136 date: Thu Jan 01 00:00:08 1970 +0000
137 summary: msg 8
137 summary: msg 8
138
138
139 changeset: 7:03750880c6b5
139 changeset: 7:03750880c6b5
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:07 1970 +0000
141 date: Thu Jan 01 00:00:07 1970 +0000
142 summary: msg 7
142 summary: msg 7
143
143
144 changeset: 6:a3d5c6fdf0d3
144 changeset: 6:a3d5c6fdf0d3
145 user: test
145 user: test
146 date: Thu Jan 01 00:00:06 1970 +0000
146 date: Thu Jan 01 00:00:06 1970 +0000
147 summary: msg 6
147 summary: msg 6
148
148
149 changeset: 5:7874a09ea728
149 changeset: 5:7874a09ea728
150 user: test
150 user: test
151 date: Thu Jan 01 00:00:05 1970 +0000
151 date: Thu Jan 01 00:00:05 1970 +0000
152 summary: msg 5
152 summary: msg 5
153
153
154 changeset: 4:9b2ba8336a65
154 changeset: 4:9b2ba8336a65
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:04 1970 +0000
156 date: Thu Jan 01 00:00:04 1970 +0000
157 summary: msg 4
157 summary: msg 4
158
158
159 changeset: 3:b53bea5e2fcb
159 changeset: 3:b53bea5e2fcb
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:03 1970 +0000
161 date: Thu Jan 01 00:00:03 1970 +0000
162 summary: msg 3
162 summary: msg 3
163
163
164 changeset: 2:db07c04beaca
164 changeset: 2:db07c04beaca
165 user: test
165 user: test
166 date: Thu Jan 01 00:00:02 1970 +0000
166 date: Thu Jan 01 00:00:02 1970 +0000
167 summary: msg 2
167 summary: msg 2
168
168
169 changeset: 1:5cd978ea5149
169 changeset: 1:5cd978ea5149
170 user: test
170 user: test
171 date: Thu Jan 01 00:00:01 1970 +0000
171 date: Thu Jan 01 00:00:01 1970 +0000
172 summary: msg 1
172 summary: msg 1
173
173
174 changeset: 0:b99c7b9c8e11
174 changeset: 0:b99c7b9c8e11
175 user: test
175 user: test
176 date: Thu Jan 01 00:00:00 1970 +0000
176 date: Thu Jan 01 00:00:00 1970 +0000
177 summary: msg 0
177 summary: msg 0
178
178
179
179
180 $ hg up -C
180 $ hg up -C
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182
182
183 bisect test
183 bisect test
184
184
185 $ hg bisect -r
185 $ hg bisect -r
186 $ hg bisect -b
186 $ hg bisect -b
187 $ hg bisect -g 1
187 $ hg bisect -g 1
188 Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests)
188 Testing changeset 16:a2e6ea4973e9 (30 changesets remaining, ~4 tests)
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ hg bisect -g
190 $ hg bisect -g
191 Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests)
191 Testing changeset 23:5ec79163bff4 (15 changesets remaining, ~3 tests)
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193
193
194 skip
194 skip
195
195
196 $ hg bisect -s
196 $ hg bisect -s
197 Testing changeset 24:10e0acd3809e (15 changesets remaining, ~3 tests)
197 Testing changeset 24:10e0acd3809e (15 changesets remaining, ~3 tests)
198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
198 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
199 $ hg bisect -g
199 $ hg bisect -g
200 Testing changeset 27:288867a866e9 (7 changesets remaining, ~2 tests)
200 Testing changeset 27:288867a866e9 (7 changesets remaining, ~2 tests)
201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 $ hg bisect -g
202 $ hg bisect -g
203 Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests)
203 Testing changeset 29:b5bd63375ab9 (4 changesets remaining, ~2 tests)
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 $ hg bisect -b
205 $ hg bisect -b
206 Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests)
206 Testing changeset 28:8e0c2264c8af (2 changesets remaining, ~1 tests)
207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208 $ hg bisect -g
208 $ hg bisect -g
209 The first bad revision is:
209 The first bad revision is:
210 changeset: 29:b5bd63375ab9
210 changeset: 29:b5bd63375ab9
211 user: test
211 user: test
212 date: Thu Jan 01 00:00:29 1970 +0000
212 date: Thu Jan 01 00:00:29 1970 +0000
213 summary: msg 29
213 summary: msg 29
214
214
215
215
216 mark revsets instead of single revs
216 mark revsets instead of single revs
217
217
218 $ hg bisect -r
218 $ hg bisect -r
219 $ hg bisect -b "0::3"
219 $ hg bisect -b "0::3"
220 $ hg bisect -s "13::16"
220 $ hg bisect -s "13::16"
221 $ hg bisect -g "26::tip"
221 $ hg bisect -g "26::tip"
222 Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests)
222 Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests)
223 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 $ cat .hg/bisect.state
224 $ cat .hg/bisect.state
225 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
225 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
226 skip ce8f0998e922c179e80819d5066fbe46e2998784
226 skip ce8f0998e922c179e80819d5066fbe46e2998784
227 skip e7fa0811edb063f6319531f0d0a865882138e180
227 skip e7fa0811edb063f6319531f0d0a865882138e180
228 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
228 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
229 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
229 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
230 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
230 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
231 bad db07c04beaca44cf24832541e7f4a2346a95275b
231 bad db07c04beaca44cf24832541e7f4a2346a95275b
232 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
232 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
233 good 3efc6fd51aeb8594398044c6c846ca59ae021203
233 good 3efc6fd51aeb8594398044c6c846ca59ae021203
234 good 288867a866e9adb7a29880b66936c874b80f4651
234 good 288867a866e9adb7a29880b66936c874b80f4651
235 good 8e0c2264c8af790daf3585ada0669d93dee09c83
235 good 8e0c2264c8af790daf3585ada0669d93dee09c83
236 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
236 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
237 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
237 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
238 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
238 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
239
239
240 bisect reverse test
240 bisect reverse test
241
241
242 $ hg bisect -r
242 $ hg bisect -r
243 $ hg bisect -b null
243 $ hg bisect -b null
244 $ hg bisect -g tip
244 $ hg bisect -g tip
245 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
245 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 $ hg bisect -g
247 $ hg bisect -g
248 Testing changeset 7:03750880c6b5 (16 changesets remaining, ~4 tests)
248 Testing changeset 7:03750880c6b5 (16 changesets remaining, ~4 tests)
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
250
250
251 skip
251 skip
252
252
253 $ hg bisect -s
253 $ hg bisect -s
254 Testing changeset 6:a3d5c6fdf0d3 (16 changesets remaining, ~4 tests)
254 Testing changeset 6:a3d5c6fdf0d3 (16 changesets remaining, ~4 tests)
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
256 $ hg bisect -g
256 $ hg bisect -g
257 Testing changeset 2:db07c04beaca (7 changesets remaining, ~2 tests)
257 Testing changeset 2:db07c04beaca (7 changesets remaining, ~2 tests)
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
259 $ hg bisect -g
259 $ hg bisect -g
260 Testing changeset 0:b99c7b9c8e11 (3 changesets remaining, ~1 tests)
260 Testing changeset 0:b99c7b9c8e11 (3 changesets remaining, ~1 tests)
261 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
262 $ hg bisect -b
262 $ hg bisect -b
263 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
263 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
264 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
264 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 $ hg bisect -g
265 $ hg bisect -g
266 The first good revision is:
266 The first good revision is:
267 changeset: 1:5cd978ea5149
267 changeset: 1:5cd978ea5149
268 user: test
268 user: test
269 date: Thu Jan 01 00:00:01 1970 +0000
269 date: Thu Jan 01 00:00:01 1970 +0000
270 summary: msg 1
270 summary: msg 1
271
271
272 $ false
272 $ false
273 [1]
273 [1]
274
274
275
275
276 $ hg bisect -r
276 $ hg bisect -r
277 $ hg bisect -g tip
277 $ hg bisect -g tip
278 $ hg bisect -b tip
278 $ hg bisect -b tip
279 abort: starting revisions are not directly related
279 abort: starting revisions are not directly related
280 [255]
280
281
281 $ hg bisect -r
282 $ hg bisect -r
282 $ hg bisect -g null
283 $ hg bisect -g null
283 $ hg bisect -bU tip
284 $ hg bisect -bU tip
284 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
285 Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests)
285 $ hg id
286 $ hg id
286 5cd978ea5149
287 5cd978ea5149
287
288
288
289
289 reproduce AssertionError, issue1228 and issue1182
290 reproduce AssertionError, issue1228 and issue1182
290
291
291 $ hg bisect -r
292 $ hg bisect -r
292 $ hg bisect -b 4
293 $ hg bisect -b 4
293 $ hg bisect -g 0
294 $ hg bisect -g 0
294 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests)
295 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests)
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ hg bisect -s
297 $ hg bisect -s
297 Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests)
298 Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests)
298 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
299 $ hg bisect -s
300 $ hg bisect -s
300 Testing changeset 3:b53bea5e2fcb (4 changesets remaining, ~2 tests)
301 Testing changeset 3:b53bea5e2fcb (4 changesets remaining, ~2 tests)
301 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 $ hg bisect -s
303 $ hg bisect -s
303 Due to skipped revisions, the first bad revision could be any of:
304 Due to skipped revisions, the first bad revision could be any of:
304 changeset: 1:5cd978ea5149
305 changeset: 1:5cd978ea5149
305 user: test
306 user: test
306 date: Thu Jan 01 00:00:01 1970 +0000
307 date: Thu Jan 01 00:00:01 1970 +0000
307 summary: msg 1
308 summary: msg 1
308
309
309 changeset: 2:db07c04beaca
310 changeset: 2:db07c04beaca
310 user: test
311 user: test
311 date: Thu Jan 01 00:00:02 1970 +0000
312 date: Thu Jan 01 00:00:02 1970 +0000
312 summary: msg 2
313 summary: msg 2
313
314
314 changeset: 3:b53bea5e2fcb
315 changeset: 3:b53bea5e2fcb
315 user: test
316 user: test
316 date: Thu Jan 01 00:00:03 1970 +0000
317 date: Thu Jan 01 00:00:03 1970 +0000
317 summary: msg 3
318 summary: msg 3
318
319
319 changeset: 4:9b2ba8336a65
320 changeset: 4:9b2ba8336a65
320 user: test
321 user: test
321 date: Thu Jan 01 00:00:04 1970 +0000
322 date: Thu Jan 01 00:00:04 1970 +0000
322 summary: msg 4
323 summary: msg 4
323
324
324
325
325
326
326 reproduce non converging bisect, issue1182
327 reproduce non converging bisect, issue1182
327
328
328 $ hg bisect -r
329 $ hg bisect -r
329 $ hg bisect -g 0
330 $ hg bisect -g 0
330 $ hg bisect -b 2
331 $ hg bisect -b 2
331 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
332 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests)
332 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
333 $ hg bisect -s
334 $ hg bisect -s
334 Due to skipped revisions, the first bad revision could be any of:
335 Due to skipped revisions, the first bad revision could be any of:
335 changeset: 1:5cd978ea5149
336 changeset: 1:5cd978ea5149
336 user: test
337 user: test
337 date: Thu Jan 01 00:00:01 1970 +0000
338 date: Thu Jan 01 00:00:01 1970 +0000
338 summary: msg 1
339 summary: msg 1
339
340
340 changeset: 2:db07c04beaca
341 changeset: 2:db07c04beaca
341 user: test
342 user: test
342 date: Thu Jan 01 00:00:02 1970 +0000
343 date: Thu Jan 01 00:00:02 1970 +0000
343 summary: msg 2
344 summary: msg 2
344
345
345
346
346
347
347 test no action
348 test no action
348
349
349 $ hg bisect -r
350 $ hg bisect -r
350 $ hg bisect
351 $ hg bisect
351 abort: cannot bisect (no known good revisions)
352 abort: cannot bisect (no known good revisions)
353 [255]
352
354
353
355
354 reproduce AssertionError, issue1445
356 reproduce AssertionError, issue1445
355
357
356 $ hg bisect -r
358 $ hg bisect -r
357 $ hg bisect -b 6
359 $ hg bisect -b 6
358 $ hg bisect -g 0
360 $ hg bisect -g 0
359 Testing changeset 3:b53bea5e2fcb (6 changesets remaining, ~2 tests)
361 Testing changeset 3:b53bea5e2fcb (6 changesets remaining, ~2 tests)
360 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
361 $ hg bisect -s
363 $ hg bisect -s
362 Testing changeset 2:db07c04beaca (6 changesets remaining, ~2 tests)
364 Testing changeset 2:db07c04beaca (6 changesets remaining, ~2 tests)
363 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
365 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 $ hg bisect -s
366 $ hg bisect -s
365 Testing changeset 4:9b2ba8336a65 (6 changesets remaining, ~2 tests)
367 Testing changeset 4:9b2ba8336a65 (6 changesets remaining, ~2 tests)
366 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ hg bisect -s
369 $ hg bisect -s
368 Testing changeset 1:5cd978ea5149 (6 changesets remaining, ~2 tests)
370 Testing changeset 1:5cd978ea5149 (6 changesets remaining, ~2 tests)
369 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 $ hg bisect -s
372 $ hg bisect -s
371 Testing changeset 5:7874a09ea728 (6 changesets remaining, ~2 tests)
373 Testing changeset 5:7874a09ea728 (6 changesets remaining, ~2 tests)
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 $ hg bisect -g
375 $ hg bisect -g
374 The first bad revision is:
376 The first bad revision is:
375 changeset: 6:a3d5c6fdf0d3
377 changeset: 6:a3d5c6fdf0d3
376 user: test
378 user: test
377 date: Thu Jan 01 00:00:06 1970 +0000
379 date: Thu Jan 01 00:00:06 1970 +0000
378 summary: msg 6
380 summary: msg 6
379
381
380
382
381 $ set +e
383 $ set +e
382
384
383 test invalid command
385 test invalid command
384 assuming that the shell returns 127 if command not found ...
386 assuming that the shell returns 127 if command not found ...
385
387
386 $ hg bisect -r
388 $ hg bisect -r
387 $ hg bisect --command 'exit 127'
389 $ hg bisect --command 'exit 127'
388 abort: failed to execute exit 127
390 abort: failed to execute exit 127
389 [255]
391 [255]
390
392
391
393
392 test bisecting command
394 test bisecting command
393
395
394 $ cat > script.py <<EOF
396 $ cat > script.py <<EOF
395 > #!/usr/bin/env python
397 > #!/usr/bin/env python
396 > import sys
398 > import sys
397 > from mercurial import ui, hg
399 > from mercurial import ui, hg
398 > repo = hg.repository(ui.ui(), '.')
400 > repo = hg.repository(ui.ui(), '.')
399 > if repo['.'].rev() < 6:
401 > if repo['.'].rev() < 6:
400 > sys.exit(1)
402 > sys.exit(1)
401 > EOF
403 > EOF
402 $ chmod +x script.py
404 $ chmod +x script.py
403 $ hg bisect -r
405 $ hg bisect -r
404 $ hg bisect --good tip
406 $ hg bisect --good tip
405 $ hg bisect --bad 0
407 $ hg bisect --bad 0
406 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
408 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
409 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 $ hg bisect --command "'`pwd`/script.py' and some parameters"
410 $ hg bisect --command "'`pwd`/script.py' and some parameters"
409 Changeset 15:e7fa0811edb0: good
411 Changeset 15:e7fa0811edb0: good
410 Changeset 7:03750880c6b5: good
412 Changeset 7:03750880c6b5: good
411 Changeset 3:b53bea5e2fcb: bad
413 Changeset 3:b53bea5e2fcb: bad
412 Changeset 5:7874a09ea728: bad
414 Changeset 5:7874a09ea728: bad
413 Changeset 6:a3d5c6fdf0d3: good
415 Changeset 6:a3d5c6fdf0d3: good
414 The first good revision is:
416 The first good revision is:
415 changeset: 6:a3d5c6fdf0d3
417 changeset: 6:a3d5c6fdf0d3
416 user: test
418 user: test
417 date: Thu Jan 01 00:00:06 1970 +0000
419 date: Thu Jan 01 00:00:06 1970 +0000
418 summary: msg 6
420 summary: msg 6
419
421
@@ -1,110 +1,110 b''
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3 $ touch foo
3 $ touch foo
4 $ hg add foo
4 $ hg add foo
5 $ for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
5 $ for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
6 > echo "foo-$i" >> foo
6 > echo "foo-$i" >> foo
7 > hg ci -m "foo-$i"
7 > hg ci -m "foo-$i"
8 > done
8 > done
9
9
10 $ for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r"; do
10 $ for out in "%nof%N" "%%%H" "%b-%R" "%h" "%r"; do
11 > echo
11 > echo
12 > echo "# foo-$out.patch"
12 > echo "# foo-$out.patch"
13 > hg export -v -o "foo-$out.patch" 2:tip
13 > hg export -v -o "foo-$out.patch" 2:tip
14 > done
14 > done
15
15
16 # foo-%nof%N.patch
16 # foo-%nof%N.patch
17 exporting patches:
17 exporting patches:
18 foo-01of10.patch
18 foo-01of10.patch
19 foo-02of10.patch
19 foo-02of10.patch
20 foo-03of10.patch
20 foo-03of10.patch
21 foo-04of10.patch
21 foo-04of10.patch
22 foo-05of10.patch
22 foo-05of10.patch
23 foo-06of10.patch
23 foo-06of10.patch
24 foo-07of10.patch
24 foo-07of10.patch
25 foo-08of10.patch
25 foo-08of10.patch
26 foo-09of10.patch
26 foo-09of10.patch
27 foo-10of10.patch
27 foo-10of10.patch
28
28
29 # foo-%%%H.patch
29 # foo-%%%H.patch
30 exporting patches:
30 exporting patches:
31 foo-%617188a1c80f869a7b66c85134da88a6fb145f67.patch
31 foo-%617188a1c80f869a7b66c85134da88a6fb145f67.patch
32 foo-%dd41a5ff707a5225204105611ba49cc5c229d55f.patch
32 foo-%dd41a5ff707a5225204105611ba49cc5c229d55f.patch
33 foo-%f95a5410f8664b6e1490a4af654e4b7d41a7b321.patch
33 foo-%f95a5410f8664b6e1490a4af654e4b7d41a7b321.patch
34 foo-%4346bcfde53b4d9042489078bcfa9c3e28201db2.patch
34 foo-%4346bcfde53b4d9042489078bcfa9c3e28201db2.patch
35 foo-%afda8c3a009cc99449a05ad8aa4655648c4ecd34.patch
35 foo-%afda8c3a009cc99449a05ad8aa4655648c4ecd34.patch
36 foo-%35284ce2b6b99c9d2ac66268fe99e68e1974e1aa.patch
36 foo-%35284ce2b6b99c9d2ac66268fe99e68e1974e1aa.patch
37 foo-%9688c41894e6931305fa7165a37f6568050b4e9b.patch
37 foo-%9688c41894e6931305fa7165a37f6568050b4e9b.patch
38 foo-%747d3c68f8ec44bb35816bfcd59aeb50b9654c2f.patch
38 foo-%747d3c68f8ec44bb35816bfcd59aeb50b9654c2f.patch
39 foo-%5f17a83f5fbd9414006a5e563eab4c8a00729efd.patch
39 foo-%5f17a83f5fbd9414006a5e563eab4c8a00729efd.patch
40 foo-%f3acbafac161ec68f1598af38f794f28847ca5d3.patch
40 foo-%f3acbafac161ec68f1598af38f794f28847ca5d3.patch
41
41
42 # foo-%b-%R.patch
42 # foo-%b-%R.patch
43 exporting patches:
43 exporting patches:
44 foo-repo-2.patch
44 foo-repo-2.patch
45 foo-repo-3.patch
45 foo-repo-3.patch
46 foo-repo-4.patch
46 foo-repo-4.patch
47 foo-repo-5.patch
47 foo-repo-5.patch
48 foo-repo-6.patch
48 foo-repo-6.patch
49 foo-repo-7.patch
49 foo-repo-7.patch
50 foo-repo-8.patch
50 foo-repo-8.patch
51 foo-repo-9.patch
51 foo-repo-9.patch
52 foo-repo-10.patch
52 foo-repo-10.patch
53 foo-repo-11.patch
53 foo-repo-11.patch
54
54
55 # foo-%h.patch
55 # foo-%h.patch
56 exporting patches:
56 exporting patches:
57 foo-617188a1c80f.patch
57 foo-617188a1c80f.patch
58 foo-dd41a5ff707a.patch
58 foo-dd41a5ff707a.patch
59 foo-f95a5410f866.patch
59 foo-f95a5410f866.patch
60 foo-4346bcfde53b.patch
60 foo-4346bcfde53b.patch
61 foo-afda8c3a009c.patch
61 foo-afda8c3a009c.patch
62 foo-35284ce2b6b9.patch
62 foo-35284ce2b6b9.patch
63 foo-9688c41894e6.patch
63 foo-9688c41894e6.patch
64 foo-747d3c68f8ec.patch
64 foo-747d3c68f8ec.patch
65 foo-5f17a83f5fbd.patch
65 foo-5f17a83f5fbd.patch
66 foo-f3acbafac161.patch
66 foo-f3acbafac161.patch
67
67
68 # foo-%r.patch
68 # foo-%r.patch
69 exporting patches:
69 exporting patches:
70 foo-02.patch
70 foo-02.patch
71 foo-03.patch
71 foo-03.patch
72 foo-04.patch
72 foo-04.patch
73 foo-05.patch
73 foo-05.patch
74 foo-06.patch
74 foo-06.patch
75 foo-07.patch
75 foo-07.patch
76 foo-08.patch
76 foo-08.patch
77 foo-09.patch
77 foo-09.patch
78 foo-10.patch
78 foo-10.patch
79 foo-11.patch
79 foo-11.patch
80
80
81 Exporting 4 changesets to a file:
81 Exporting 4 changesets to a file:
82
82
83 $ hg export -o export_internal 1 2 3 4
83 $ hg export -o export_internal 1 2 3 4
84 $ grep HG export_internal | wc -l | sed -e 's/^ *//'
84 $ grep HG export_internal | wc -l
85 4
85 \s*4
86
86
87 Exporting 4 changesets to a file:
87 Exporting 4 changesets to a file:
88
88
89 $ hg export 1 2 3 4 | grep HG | wc -l | sed -e 's/^ *//'
89 $ hg export 1 2 3 4 | grep HG | wc -l
90 4
90 \s*4
91
91
92 Exporting revision -2 to a file:
92 Exporting revision -2 to a file:
93
93
94 $ hg export -- -2
94 $ hg export -- -2
95 # HG changeset patch
95 # HG changeset patch
96 # User test
96 # User test
97 # Date 0 0
97 # Date 0 0
98 # Node ID 5f17a83f5fbd9414006a5e563eab4c8a00729efd
98 # Node ID 5f17a83f5fbd9414006a5e563eab4c8a00729efd
99 # Parent 747d3c68f8ec44bb35816bfcd59aeb50b9654c2f
99 # Parent 747d3c68f8ec44bb35816bfcd59aeb50b9654c2f
100 foo-10
100 foo-10
101
101
102 diff -r 747d3c68f8ec -r 5f17a83f5fbd foo
102 diff -r 747d3c68f8ec -r 5f17a83f5fbd foo
103 --- a/foo Thu Jan 01 00:00:00 1970 +0000
103 --- a/foo Thu Jan 01 00:00:00 1970 +0000
104 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
104 +++ b/foo Thu Jan 01 00:00:00 1970 +0000
105 @@ -8,3 +8,4 @@
105 @@ -8,3 +8,4 @@
106 foo-7
106 foo-7
107 foo-8
107 foo-8
108 foo-9
108 foo-9
109 +foo-10
109 +foo-10
110
110
@@ -1,121 +1,122 b''
1 $ hg init
1 $ hg init
2
2
3 Test issue 562: .hgignore requires newline at end:
3 Test issue 562: .hgignore requires newline at end:
4
4
5 $ touch foo
5 $ touch foo
6 $ touch bar
6 $ touch bar
7 $ touch baz
7 $ touch baz
8 $ cat > makeignore.py <<EOF
8 $ cat > makeignore.py <<EOF
9 > f = open(".hgignore", "w")
9 > f = open(".hgignore", "w")
10 > f.write("ignore\n")
10 > f.write("ignore\n")
11 > f.write("foo\n")
11 > f.write("foo\n")
12 > # No EOL here
12 > # No EOL here
13 > f.write("bar")
13 > f.write("bar")
14 > f.close()
14 > f.close()
15 > EOF
15 > EOF
16
16
17 $ python makeignore.py
17 $ python makeignore.py
18
18
19 Should display baz only:
19 Should display baz only:
20
20
21 $ hg status
21 $ hg status
22 ? baz
22 ? baz
23
23
24 $ rm foo bar baz .hgignore makeignore.py
24 $ rm foo bar baz .hgignore makeignore.py
25
25
26 $ touch a.o
26 $ touch a.o
27 $ touch a.c
27 $ touch a.c
28 $ touch syntax
28 $ touch syntax
29 $ mkdir dir
29 $ mkdir dir
30 $ touch dir/a.o
30 $ touch dir/a.o
31 $ touch dir/b.o
31 $ touch dir/b.o
32 $ touch dir/c.o
32 $ touch dir/c.o
33
33
34 $ hg add dir/a.o
34 $ hg add dir/a.o
35 $ hg commit -m 0
35 $ hg commit -m 0
36 $ hg add dir/b.o
36 $ hg add dir/b.o
37
37
38 $ hg status
38 $ hg status
39 A dir/b.o
39 A dir/b.o
40 ? a.c
40 ? a.c
41 ? a.o
41 ? a.o
42 ? dir/c.o
42 ? dir/c.o
43 ? syntax
43 ? syntax
44
44
45 $ echo "*.o" > .hgignore
45 $ echo "*.o" > .hgignore
46 $ hg status 2>&1 | sed -e 's/abort: .*\.hgignore:/abort: .hgignore:/'
46 $ hg status
47 abort: .hgignore: invalid pattern (relre): *.o
47 abort: .*/.hgignore: invalid pattern \(relre\): \*.o
48 [255]
48
49
49 $ echo ".*\.o" > .hgignore
50 $ echo ".*\.o" > .hgignore
50 $ hg status
51 $ hg status
51 A dir/b.o
52 A dir/b.o
52 ? .hgignore
53 ? .hgignore
53 ? a.c
54 ? a.c
54 ? syntax
55 ? syntax
55
56
56 Check it does not ignore the current directory '.':
57 Check it does not ignore the current directory '.':
57
58
58 $ echo "^\." > .hgignore
59 $ echo "^\." > .hgignore
59 $ hg status
60 $ hg status
60 A dir/b.o
61 A dir/b.o
61 ? a.c
62 ? a.c
62 ? a.o
63 ? a.o
63 ? dir/c.o
64 ? dir/c.o
64 ? syntax
65 ? syntax
65
66
66 $ echo "glob:**.o" > .hgignore
67 $ echo "glob:**.o" > .hgignore
67 $ hg status
68 $ hg status
68 A dir/b.o
69 A dir/b.o
69 ? .hgignore
70 ? .hgignore
70 ? a.c
71 ? a.c
71 ? syntax
72 ? syntax
72
73
73 $ echo "glob:*.o" > .hgignore
74 $ echo "glob:*.o" > .hgignore
74 $ hg status
75 $ hg status
75 A dir/b.o
76 A dir/b.o
76 ? .hgignore
77 ? .hgignore
77 ? a.c
78 ? a.c
78 ? syntax
79 ? syntax
79
80
80 $ echo "syntax: glob" > .hgignore
81 $ echo "syntax: glob" > .hgignore
81 $ echo "re:.*\.o" >> .hgignore
82 $ echo "re:.*\.o" >> .hgignore
82 $ hg status
83 $ hg status
83 A dir/b.o
84 A dir/b.o
84 ? .hgignore
85 ? .hgignore
85 ? a.c
86 ? a.c
86 ? syntax
87 ? syntax
87
88
88 $ echo "syntax: invalid" > .hgignore
89 $ echo "syntax: invalid" > .hgignore
89 $ hg status 2>&1 | sed -e 's/.*\.hgignore:/.hgignore:/'
90 $ hg status
90 .hgignore: ignoring invalid syntax 'invalid'
91 .*/.hgignore: ignoring invalid syntax 'invalid'
91 A dir/b.o
92 A dir/b.o
92 ? .hgignore
93 ? .hgignore
93 ? a.c
94 ? a.c
94 ? a.o
95 ? a.o
95 ? dir/c.o
96 ? dir/c.o
96 ? syntax
97 ? syntax
97
98
98 $ echo "syntax: glob" > .hgignore
99 $ echo "syntax: glob" > .hgignore
99 $ echo "*.o" >> .hgignore
100 $ echo "*.o" >> .hgignore
100 $ hg status
101 $ hg status
101 A dir/b.o
102 A dir/b.o
102 ? .hgignore
103 ? .hgignore
103 ? a.c
104 ? a.c
104 ? syntax
105 ? syntax
105
106
106 $ echo "relglob:syntax*" > .hgignore
107 $ echo "relglob:syntax*" > .hgignore
107 $ hg status
108 $ hg status
108 A dir/b.o
109 A dir/b.o
109 ? .hgignore
110 ? .hgignore
110 ? a.c
111 ? a.c
111 ? a.o
112 ? a.o
112 ? dir/c.o
113 ? dir/c.o
113
114
114 $ echo "relglob:*" > .hgignore
115 $ echo "relglob:*" > .hgignore
115 $ hg status
116 $ hg status
116 A dir/b.o
117 A dir/b.o
117
118
118 $ cd dir
119 $ cd dir
119 $ hg status .
120 $ hg status .
120 A b.o
121 A b.o
121
122
@@ -1,110 +1,113 b''
1 $ echo "invalid" > $HGRCPATH
1 $ echo "invalid" > $HGRCPATH
2 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
2 $ hg version
3 hg: parse error at $HGRCPATH:1: invalid
3 hg: parse error at .*/\.hgrc:1: invalid
4 [255]
4 $ echo "" > $HGRCPATH
5 $ echo "" > $HGRCPATH
5
6
6 issue1199: escaping
7 issue1199: escaping
7
8
8 $ hg init "foo%bar"
9 $ hg init "foo%bar"
9 $ hg clone "foo%bar" foobar
10 $ hg clone "foo%bar" foobar
10 updating to branch default
11 updating to branch default
11 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ p=`pwd`
13 $ p=`pwd`
13 $ cd foobar
14 $ cd foobar
14 $ cat .hg/hgrc | sed -e "s:$p:...:"
15 $ cat .hg/hgrc
15 [paths]
16 [paths]
16 default = .../foo%bar
17 default = .*/foo%bar
17 $ hg paths | sed -e "s:$p:...:"
18 $ hg paths
18 default = .../foo%bar
19 default = .*/foo%bar
19 $ hg showconfig | sed -e "s:$p:...:"
20 $ hg showconfig
20 bundle.mainreporoot=.../foobar
21 bundle.mainreporoot=.*/foobar
21 paths.default=.../foo%bar
22 paths.default=.*/foo%bar
22 $ cd ..
23 $ cd ..
23
24
24 issue1829: wrong indentation
25 issue1829: wrong indentation
25
26
26 $ echo '[foo]' > $HGRCPATH
27 $ echo '[foo]' > $HGRCPATH
27 $ echo ' x = y' >> $HGRCPATH
28 $ echo ' x = y' >> $HGRCPATH
28 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
29 $ hg version
29 hg: parse error at $HGRCPATH:2: x = y
30 hg: parse error at .*/\.hgrc:2: x = y
31 [255]
30
32
31 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
33 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
32 > > $HGRCPATH
34 > > $HGRCPATH
33 $ hg showconfig foo
35 $ hg showconfig foo
34 foo.bar=a\nb\nc\nde\nfg
36 foo.bar=a\nb\nc\nde\nfg
35 foo.baz=bif cb
37 foo.baz=bif cb
36
38
37 $ FAKEPATH=/path/to/nowhere
39 $ FAKEPATH=/path/to/nowhere
38 $ export FAKEPATH
40 $ export FAKEPATH
39 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
41 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
40 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
42 $ hg version
41 hg: parse error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
43 hg: parse error at .*/.hgrc:1: cannot include /path/to/nowhere/no-such-file \(No such file or directory\)
44 [255]
42 $ unset FAKEPATH
45 $ unset FAKEPATH
43
46
44 username expansion
47 username expansion
45
48
46 $ olduser=$HGUSER
49 $ olduser=$HGUSER
47 $ unset HGUSER
50 $ unset HGUSER
48
51
49 $ FAKEUSER='John Doe'
52 $ FAKEUSER='John Doe'
50 $ export FAKEUSER
53 $ export FAKEUSER
51 $ echo '[ui]' > $HGRCPATH
54 $ echo '[ui]' > $HGRCPATH
52 $ echo 'username = $FAKEUSER' >> $HGRCPATH
55 $ echo 'username = $FAKEUSER' >> $HGRCPATH
53
56
54 $ hg init usertest
57 $ hg init usertest
55 $ cd usertest
58 $ cd usertest
56 $ touch bar
59 $ touch bar
57 $ hg commit --addremove --quiet -m "added bar"
60 $ hg commit --addremove --quiet -m "added bar"
58 $ hg log --template "{author}\n"
61 $ hg log --template "{author}\n"
59 John Doe
62 John Doe
60 $ cd ..
63 $ cd ..
61
64
62 $ hg showconfig
65 $ hg showconfig
63 ui.username=$FAKEUSER
66 ui.username=$FAKEUSER
64
67
65 $ unset FAKEUSER
68 $ unset FAKEUSER
66 $ HGUSER=$olduser
69 $ HGUSER=$olduser
67 $ export HGUSER
70 $ export HGUSER
68
71
69 HGPLAIN
72 HGPLAIN
70
73
71 $ cd ..
74 $ cd ..
72 $ p=`pwd`
75 $ p=`pwd`
73 $ echo "[ui]" > $HGRCPATH
76 $ echo "[ui]" > $HGRCPATH
74 $ echo "debug=true" >> $HGRCPATH
77 $ echo "debug=true" >> $HGRCPATH
75 $ echo "fallbackencoding=ASCII" >> $HGRCPATH
78 $ echo "fallbackencoding=ASCII" >> $HGRCPATH
76 $ echo "quiet=true" >> $HGRCPATH
79 $ echo "quiet=true" >> $HGRCPATH
77 $ echo "slash=true" >> $HGRCPATH
80 $ echo "slash=true" >> $HGRCPATH
78 $ echo "traceback=true" >> $HGRCPATH
81 $ echo "traceback=true" >> $HGRCPATH
79 $ echo "verbose=true" >> $HGRCPATH
82 $ echo "verbose=true" >> $HGRCPATH
80 $ echo "style=~/.hgstyle" >> $HGRCPATH
83 $ echo "style=~/.hgstyle" >> $HGRCPATH
81 $ echo "logtemplate={node}" >> $HGRCPATH
84 $ echo "logtemplate={node}" >> $HGRCPATH
82 $ echo "[defaults]" >> $HGRCPATH
85 $ echo "[defaults]" >> $HGRCPATH
83 $ echo "identify=-n" >> $HGRCPATH
86 $ echo "identify=-n" >> $HGRCPATH
84 $ echo "[alias]" >> $HGRCPATH
87 $ echo "[alias]" >> $HGRCPATH
85 $ echo "log=log -g" >> $HGRCPATH
88 $ echo "log=log -g" >> $HGRCPATH
86
89
87 customized hgrc
90 customized hgrc
88
91
89 $ hg showconfig | sed -e "s:$p:...:"
92 $ hg showconfig
90 read config from: .../.hgrc
93 read config from: .*/.hgrc
91 .../.hgrc:13: alias.log=log -g
94 .*/.hgrc:13: alias.log=log -g
92 .../.hgrc:11: defaults.identify=-n
95 .*/.hgrc:11: defaults.identify=-n
93 .../.hgrc:2: ui.debug=true
96 .*/.hgrc:2: ui.debug=true
94 .../.hgrc:3: ui.fallbackencoding=ASCII
97 .*/.hgrc:3: ui.fallbackencoding=ASCII
95 .../.hgrc:4: ui.quiet=true
98 .*/.hgrc:4: ui.quiet=true
96 .../.hgrc:5: ui.slash=true
99 .*/.hgrc:5: ui.slash=true
97 .../.hgrc:6: ui.traceback=true
100 .*/.hgrc:6: ui.traceback=true
98 .../.hgrc:7: ui.verbose=true
101 .*/.hgrc:7: ui.verbose=true
99 .../.hgrc:8: ui.style=~/.hgstyle
102 .*/.hgrc:8: ui.style=~/.hgstyle
100 .../.hgrc:9: ui.logtemplate={node}
103 .*/.hgrc:9: ui.logtemplate={node}
101
104
102 plain hgrc
105 plain hgrc
103
106
104 $ HGPLAIN=; export HGPLAIN
107 $ HGPLAIN=; export HGPLAIN
105 $ hg showconfig --config ui.traceback=True --debug | sed -e "s:$p:...:"
108 $ hg showconfig --config ui.traceback=True --debug
106 read config from: .../.hgrc
109 read config from: .*/.hgrc
107 none: ui.traceback=True
110 none: ui.traceback=True
108 none: ui.verbose=False
111 none: ui.verbose=False
109 none: ui.debug=True
112 none: ui.debug=True
110 none: ui.quiet=False
113 none: ui.quiet=False
@@ -1,919 +1,920 b''
1 $ hg init a
1 $ hg init a
2 $ mkdir a/d1
2 $ mkdir a/d1
3 $ mkdir a/d1/d2
3 $ mkdir a/d1/d2
4 $ echo line 1 > a/a
4 $ echo line 1 > a/a
5 $ echo line 1 > a/d1/d2/a
5 $ echo line 1 > a/d1/d2/a
6 $ hg --cwd a ci -Ama
6 $ hg --cwd a ci -Ama
7 adding a
7 adding a
8 adding d1/d2/a
8 adding d1/d2/a
9
9
10 $ echo line 2 >> a/a
10 $ echo line 2 >> a/a
11 $ hg --cwd a ci -u someone -d '1 0' -m'second change'
11 $ hg --cwd a ci -u someone -d '1 0' -m'second change'
12
12
13
13
14 import exported patch
14 import exported patch
15
15
16 $ hg clone -r0 a b
16 $ hg clone -r0 a b
17 requesting all changes
17 requesting all changes
18 adding changesets
18 adding changesets
19 adding manifests
19 adding manifests
20 adding file changes
20 adding file changes
21 added 1 changesets with 2 changes to 2 files
21 added 1 changesets with 2 changes to 2 files
22 updating to branch default
22 updating to branch default
23 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 $ hg --cwd a export tip > tip.patch
24 $ hg --cwd a export tip > tip.patch
25 $ hg --cwd b import ../tip.patch
25 $ hg --cwd b import ../tip.patch
26 applying ../tip.patch
26 applying ../tip.patch
27
27
28 message should be same
28 message should be same
29
29
30 $ hg --cwd b tip | grep 'second change'
30 $ hg --cwd b tip | grep 'second change'
31 summary: second change
31 summary: second change
32
32
33 committer should be same
33 committer should be same
34
34
35 $ hg --cwd b tip | grep someone
35 $ hg --cwd b tip | grep someone
36 user: someone
36 user: someone
37 $ rm -r b
37 $ rm -r b
38
38
39
39
40 import exported patch with external patcher
40 import exported patch with external patcher
41
41
42 $ cat > dummypatch.py <<EOF
42 $ cat > dummypatch.py <<EOF
43 > print 'patching file a'
43 > print 'patching file a'
44 > file('a', 'wb').write('line2\n')
44 > file('a', 'wb').write('line2\n')
45 > EOF
45 > EOF
46 $ chmod +x dummypatch.py
46 $ chmod +x dummypatch.py
47 $ hg clone -r0 a b
47 $ hg clone -r0 a b
48 requesting all changes
48 requesting all changes
49 adding changesets
49 adding changesets
50 adding manifests
50 adding manifests
51 adding file changes
51 adding file changes
52 added 1 changesets with 2 changes to 2 files
52 added 1 changesets with 2 changes to 2 files
53 updating to branch default
53 updating to branch default
54 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 $ hg --cwd a export tip > tip.patch
55 $ hg --cwd a export tip > tip.patch
56 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
56 $ hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
57 applying ../tip.patch
57 applying ../tip.patch
58 $ cat b/a
58 $ cat b/a
59 line2
59 line2
60 $ rm -r b
60 $ rm -r b
61
61
62
62
63 import of plain diff should fail without message
63 import of plain diff should fail without message
64
64
65 $ hg clone -r0 a b
65 $ hg clone -r0 a b
66 requesting all changes
66 requesting all changes
67 adding changesets
67 adding changesets
68 adding manifests
68 adding manifests
69 adding file changes
69 adding file changes
70 added 1 changesets with 2 changes to 2 files
70 added 1 changesets with 2 changes to 2 files
71 updating to branch default
71 updating to branch default
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 $ hg --cwd a diff -r0:1 > tip.patch
73 $ hg --cwd a diff -r0:1 > tip.patch
74 $ hg --cwd b import ../tip.patch
74 $ hg --cwd b import ../tip.patch
75 applying ../tip.patch
75 applying ../tip.patch
76 abort: empty commit message
76 abort: empty commit message
77 [255]
77 [255]
78 $ rm -r b
78 $ rm -r b
79
79
80
80
81 import of plain diff should be ok with message
81 import of plain diff should be ok with message
82
82
83 $ hg clone -r0 a b
83 $ hg clone -r0 a b
84 requesting all changes
84 requesting all changes
85 adding changesets
85 adding changesets
86 adding manifests
86 adding manifests
87 adding file changes
87 adding file changes
88 added 1 changesets with 2 changes to 2 files
88 added 1 changesets with 2 changes to 2 files
89 updating to branch default
89 updating to branch default
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 $ hg --cwd a diff -r0:1 > tip.patch
91 $ hg --cwd a diff -r0:1 > tip.patch
92 $ hg --cwd b import -mpatch ../tip.patch
92 $ hg --cwd b import -mpatch ../tip.patch
93 applying ../tip.patch
93 applying ../tip.patch
94 $ rm -r b
94 $ rm -r b
95
95
96
96
97 import of plain diff with specific date and user
97 import of plain diff with specific date and user
98
98
99 $ hg clone -r0 a b
99 $ hg clone -r0 a b
100 requesting all changes
100 requesting all changes
101 adding changesets
101 adding changesets
102 adding manifests
102 adding manifests
103 adding file changes
103 adding file changes
104 added 1 changesets with 2 changes to 2 files
104 added 1 changesets with 2 changes to 2 files
105 updating to branch default
105 updating to branch default
106 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 $ hg --cwd a diff -r0:1 > tip.patch
107 $ hg --cwd a diff -r0:1 > tip.patch
108 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
108 $ hg --cwd b import -mpatch -d '1 0' -u 'user@nowhere.net' ../tip.patch
109 applying ../tip.patch
109 applying ../tip.patch
110 $ hg -R b tip -pv
110 $ hg -R b tip -pv
111 changeset: 1:ca68f19f3a40
111 changeset: 1:ca68f19f3a40
112 tag: tip
112 tag: tip
113 user: user@nowhere.net
113 user: user@nowhere.net
114 date: Thu Jan 01 00:00:01 1970 +0000
114 date: Thu Jan 01 00:00:01 1970 +0000
115 files: a
115 files: a
116 description:
116 description:
117 patch
117 patch
118
118
119
119
120 diff -r 80971e65b431 -r ca68f19f3a40 a
120 diff -r 80971e65b431 -r ca68f19f3a40 a
121 --- a/a Thu Jan 01 00:00:00 1970 +0000
121 --- a/a Thu Jan 01 00:00:00 1970 +0000
122 +++ b/a Thu Jan 01 00:00:01 1970 +0000
122 +++ b/a Thu Jan 01 00:00:01 1970 +0000
123 @@ -1,1 +1,2 @@
123 @@ -1,1 +1,2 @@
124 line 1
124 line 1
125 +line 2
125 +line 2
126
126
127 $ rm -r b
127 $ rm -r b
128
128
129
129
130 import of plain diff should be ok with --no-commit
130 import of plain diff should be ok with --no-commit
131
131
132 $ hg clone -r0 a b
132 $ hg clone -r0 a b
133 requesting all changes
133 requesting all changes
134 adding changesets
134 adding changesets
135 adding manifests
135 adding manifests
136 adding file changes
136 adding file changes
137 added 1 changesets with 2 changes to 2 files
137 added 1 changesets with 2 changes to 2 files
138 updating to branch default
138 updating to branch default
139 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ hg --cwd a diff -r0:1 > tip.patch
140 $ hg --cwd a diff -r0:1 > tip.patch
141 $ hg --cwd b import --no-commit ../tip.patch
141 $ hg --cwd b import --no-commit ../tip.patch
142 applying ../tip.patch
142 applying ../tip.patch
143 $ hg --cwd b diff --nodates
143 $ hg --cwd b diff --nodates
144 diff -r 80971e65b431 a
144 diff -r 80971e65b431 a
145 --- a/a
145 --- a/a
146 +++ b/a
146 +++ b/a
147 @@ -1,1 +1,2 @@
147 @@ -1,1 +1,2 @@
148 line 1
148 line 1
149 +line 2
149 +line 2
150 $ rm -r b
150 $ rm -r b
151
151
152
152
153 hg -R repo import
153 hg -R repo import
154 put the clone in a subdir - having a directory named "a"
154 put the clone in a subdir - having a directory named "a"
155 used to hide a bug.
155 used to hide a bug.
156
156
157 $ mkdir dir
157 $ mkdir dir
158 $ hg clone -r0 a dir/b
158 $ hg clone -r0 a dir/b
159 requesting all changes
159 requesting all changes
160 adding changesets
160 adding changesets
161 adding manifests
161 adding manifests
162 adding file changes
162 adding file changes
163 added 1 changesets with 2 changes to 2 files
163 added 1 changesets with 2 changes to 2 files
164 updating to branch default
164 updating to branch default
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ hg --cwd a export tip > dir/tip.patch
166 $ hg --cwd a export tip > dir/tip.patch
167 $ cd dir
167 $ cd dir
168 $ hg -R b import tip.patch
168 $ hg -R b import tip.patch
169 applying tip.patch
169 applying tip.patch
170 $ cd ..
170 $ cd ..
171 $ rm -r dir
171 $ rm -r dir
172
172
173
173
174 import from stdin
174 import from stdin
175
175
176 $ hg clone -r0 a b
176 $ hg clone -r0 a b
177 requesting all changes
177 requesting all changes
178 adding changesets
178 adding changesets
179 adding manifests
179 adding manifests
180 adding file changes
180 adding file changes
181 added 1 changesets with 2 changes to 2 files
181 added 1 changesets with 2 changes to 2 files
182 updating to branch default
182 updating to branch default
183 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 $ hg --cwd a export tip | hg --cwd b import -
184 $ hg --cwd a export tip | hg --cwd b import -
185 applying patch from stdin
185 applying patch from stdin
186 $ rm -r b
186 $ rm -r b
187
187
188
188
189 import two patches in one stream
189 import two patches in one stream
190
190
191 $ hg init b
191 $ hg init b
192 $ hg --cwd a export 0:tip | hg --cwd b import -
192 $ hg --cwd a export 0:tip | hg --cwd b import -
193 applying patch from stdin
193 applying patch from stdin
194 applied 80971e65b431
194 applied 80971e65b431
195 $ hg --cwd a id
195 $ hg --cwd a id
196 1d4bd90af0e4 tip
196 1d4bd90af0e4 tip
197 $ hg --cwd b id
197 $ hg --cwd b id
198 1d4bd90af0e4 tip
198 1d4bd90af0e4 tip
199 $ rm -r b
199 $ rm -r b
200
200
201
201
202 override commit message
202 override commit message
203
203
204 $ hg clone -r0 a b
204 $ hg clone -r0 a b
205 requesting all changes
205 requesting all changes
206 adding changesets
206 adding changesets
207 adding manifests
207 adding manifests
208 adding file changes
208 adding file changes
209 added 1 changesets with 2 changes to 2 files
209 added 1 changesets with 2 changes to 2 files
210 updating to branch default
210 updating to branch default
211 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
211 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 $ hg --cwd a export tip | hg --cwd b import -m 'override' -
212 $ hg --cwd a export tip | hg --cwd b import -m 'override' -
213 applying patch from stdin
213 applying patch from stdin
214 $ hg --cwd b tip | grep override
214 $ hg --cwd b tip | grep override
215 summary: override
215 summary: override
216 $ rm -r b
216 $ rm -r b
217
217
218 $ cat > mkmsg.py <<EOF
218 $ cat > mkmsg.py <<EOF
219 > import email.Message, sys
219 > import email.Message, sys
220 > msg = email.Message.Message()
220 > msg = email.Message.Message()
221 > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
221 > msg.set_payload('email commit message\n' + open('tip.patch', 'rb').read())
222 > msg['Subject'] = 'email patch'
222 > msg['Subject'] = 'email patch'
223 > msg['From'] = 'email patcher'
223 > msg['From'] = 'email patcher'
224 > sys.stdout.write(msg.as_string())
224 > sys.stdout.write(msg.as_string())
225 > EOF
225 > EOF
226
226
227
227
228 plain diff in email, subject, message body
228 plain diff in email, subject, message body
229
229
230 $ hg clone -r0 a b
230 $ hg clone -r0 a b
231 requesting all changes
231 requesting all changes
232 adding changesets
232 adding changesets
233 adding manifests
233 adding manifests
234 adding file changes
234 adding file changes
235 added 1 changesets with 2 changes to 2 files
235 added 1 changesets with 2 changes to 2 files
236 updating to branch default
236 updating to branch default
237 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 $ hg --cwd a diff -r0:1 > tip.patch
238 $ hg --cwd a diff -r0:1 > tip.patch
239 $ python mkmsg.py > msg.patch
239 $ python mkmsg.py > msg.patch
240 $ hg --cwd b import ../msg.patch
240 $ hg --cwd b import ../msg.patch
241 applying ../msg.patch
241 applying ../msg.patch
242 $ hg --cwd b tip | grep email
242 $ hg --cwd b tip | grep email
243 user: email patcher
243 user: email patcher
244 summary: email patch
244 summary: email patch
245 $ rm -r b
245 $ rm -r b
246
246
247
247
248 plain diff in email, no subject, message body
248 plain diff in email, no subject, message body
249
249
250 $ hg clone -r0 a b
250 $ hg clone -r0 a b
251 requesting all changes
251 requesting all changes
252 adding changesets
252 adding changesets
253 adding manifests
253 adding manifests
254 adding file changes
254 adding file changes
255 added 1 changesets with 2 changes to 2 files
255 added 1 changesets with 2 changes to 2 files
256 updating to branch default
256 updating to branch default
257 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
258 $ grep -v '^Subject:' msg.patch | hg --cwd b import -
259 applying patch from stdin
259 applying patch from stdin
260 $ rm -r b
260 $ rm -r b
261
261
262
262
263 plain diff in email, subject, no message body
263 plain diff in email, subject, no message body
264
264
265 $ hg clone -r0 a b
265 $ hg clone -r0 a b
266 requesting all changes
266 requesting all changes
267 adding changesets
267 adding changesets
268 adding manifests
268 adding manifests
269 adding file changes
269 adding file changes
270 added 1 changesets with 2 changes to 2 files
270 added 1 changesets with 2 changes to 2 files
271 updating to branch default
271 updating to branch default
272 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
273 $ grep -v '^email ' msg.patch | hg --cwd b import -
273 $ grep -v '^email ' msg.patch | hg --cwd b import -
274 applying patch from stdin
274 applying patch from stdin
275 $ rm -r b
275 $ rm -r b
276
276
277
277
278 plain diff in email, no subject, no message body, should fail
278 plain diff in email, no subject, no message body, should fail
279
279
280 $ hg clone -r0 a b
280 $ hg clone -r0 a b
281 requesting all changes
281 requesting all changes
282 adding changesets
282 adding changesets
283 adding manifests
283 adding manifests
284 adding file changes
284 adding file changes
285 added 1 changesets with 2 changes to 2 files
285 added 1 changesets with 2 changes to 2 files
286 updating to branch default
286 updating to branch default
287 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
288 $ egrep -v '^(Subject|email)' msg.patch | hg --cwd b import -
289 applying patch from stdin
289 applying patch from stdin
290 abort: empty commit message
290 abort: empty commit message
291 [255]
291 [255]
292 $ rm -r b
292 $ rm -r b
293
293
294
294
295 hg export in email, should use patch header
295 hg export in email, should use patch header
296
296
297 $ hg clone -r0 a b
297 $ hg clone -r0 a b
298 requesting all changes
298 requesting all changes
299 adding changesets
299 adding changesets
300 adding manifests
300 adding manifests
301 adding file changes
301 adding file changes
302 added 1 changesets with 2 changes to 2 files
302 added 1 changesets with 2 changes to 2 files
303 updating to branch default
303 updating to branch default
304 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
304 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
305 $ hg --cwd a export tip > tip.patch
305 $ hg --cwd a export tip > tip.patch
306 $ python mkmsg.py | hg --cwd b import -
306 $ python mkmsg.py | hg --cwd b import -
307 applying patch from stdin
307 applying patch from stdin
308 $ hg --cwd b tip | grep second
308 $ hg --cwd b tip | grep second
309 summary: second change
309 summary: second change
310 $ rm -r b
310 $ rm -r b
311
311
312
312
313 subject: duplicate detection, removal of [PATCH]
313 subject: duplicate detection, removal of [PATCH]
314 The '---' tests the gitsendmail handling without proper mail headers
314 The '---' tests the gitsendmail handling without proper mail headers
315
315
316 $ cat > mkmsg2.py <<EOF
316 $ cat > mkmsg2.py <<EOF
317 > import email.Message, sys
317 > import email.Message, sys
318 > msg = email.Message.Message()
318 > msg = email.Message.Message()
319 > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
319 > msg.set_payload('email patch\n\nnext line\n---\n' + open('tip.patch').read())
320 > msg['Subject'] = '[PATCH] email patch'
320 > msg['Subject'] = '[PATCH] email patch'
321 > msg['From'] = 'email patcher'
321 > msg['From'] = 'email patcher'
322 > sys.stdout.write(msg.as_string())
322 > sys.stdout.write(msg.as_string())
323 > EOF
323 > EOF
324
324
325
325
326 plain diff in email, [PATCH] subject, message body with subject
326 plain diff in email, [PATCH] subject, message body with subject
327
327
328 $ hg clone -r0 a b
328 $ hg clone -r0 a b
329 requesting all changes
329 requesting all changes
330 adding changesets
330 adding changesets
331 adding manifests
331 adding manifests
332 adding file changes
332 adding file changes
333 added 1 changesets with 2 changes to 2 files
333 added 1 changesets with 2 changes to 2 files
334 updating to branch default
334 updating to branch default
335 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
335 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 $ hg --cwd a diff -r0:1 > tip.patch
336 $ hg --cwd a diff -r0:1 > tip.patch
337 $ python mkmsg2.py | hg --cwd b import -
337 $ python mkmsg2.py | hg --cwd b import -
338 applying patch from stdin
338 applying patch from stdin
339 $ hg --cwd b tip --template '{desc}\n'
339 $ hg --cwd b tip --template '{desc}\n'
340 email patch
340 email patch
341
341
342 next line
342 next line
343 ---
343 ---
344 $ rm -r b
344 $ rm -r b
345
345
346
346
347 We weren't backing up the correct dirstate file when importing many patches
347 We weren't backing up the correct dirstate file when importing many patches
348 (issue963)
348 (issue963)
349 import patch1 patch2; rollback
349 import patch1 patch2; rollback
350
350
351 $ echo line 3 >> a/a
351 $ echo line 3 >> a/a
352 $ hg --cwd a ci -m'third change'
352 $ hg --cwd a ci -m'third change'
353 $ hg --cwd a export -o '../patch%R' 1 2
353 $ hg --cwd a export -o '../patch%R' 1 2
354 $ hg clone -qr0 a b
354 $ hg clone -qr0 a b
355 $ hg --cwd b parents --template 'parent: {rev}\n'
355 $ hg --cwd b parents --template 'parent: {rev}\n'
356 parent: 0
356 parent: 0
357 $ hg --cwd b import ../patch1 ../patch2
357 $ hg --cwd b import ../patch1 ../patch2
358 applying ../patch1
358 applying ../patch1
359 applying ../patch2
359 applying ../patch2
360 applied 1d4bd90af0e4
360 applied 1d4bd90af0e4
361 $ hg --cwd b rollback
361 $ hg --cwd b rollback
362 rolling back to revision 1 (undo commit)
362 rolling back to revision 1 (undo commit)
363 $ hg --cwd b parents --template 'parent: {rev}\n'
363 $ hg --cwd b parents --template 'parent: {rev}\n'
364 parent: 1
364 parent: 1
365 $ rm -r b
365 $ rm -r b
366
366
367
367
368 importing a patch in a subdirectory failed at the commit stage
368 importing a patch in a subdirectory failed at the commit stage
369
369
370 $ echo line 2 >> a/d1/d2/a
370 $ echo line 2 >> a/d1/d2/a
371 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
371 $ hg --cwd a ci -u someoneelse -d '1 0' -m'subdir change'
372
372
373 hg import in a subdirectory
373 hg import in a subdirectory
374
374
375 $ hg clone -r0 a b
375 $ hg clone -r0 a b
376 requesting all changes
376 requesting all changes
377 adding changesets
377 adding changesets
378 adding manifests
378 adding manifests
379 adding file changes
379 adding file changes
380 added 1 changesets with 2 changes to 2 files
380 added 1 changesets with 2 changes to 2 files
381 updating to branch default
381 updating to branch default
382 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 $ hg --cwd a export tip | sed -e 's/d1\/d2\///' > tip.patch
383 $ hg --cwd a export tip > tmp
384 $ sed -e 's/d1\/d2\///' < tmp > tip.patch
384 $ dir=`pwd`
385 $ dir=`pwd`
385 $ cd b/d1/d2 2>&1 > /dev/null
386 $ cd b/d1/d2 2>&1 > /dev/null
386 $ hg import ../../../tip.patch
387 $ hg import ../../../tip.patch
387 applying ../../../tip.patch
388 applying ../../../tip.patch
388 $ cd "$dir"
389 $ cd "$dir"
389
390
390 message should be 'subdir change'
391 message should be 'subdir change'
391
392
392 $ hg --cwd b tip | grep 'subdir change'
393 $ hg --cwd b tip | grep 'subdir change'
393 summary: subdir change
394 summary: subdir change
394
395
395 committer should be 'someoneelse'
396 committer should be 'someoneelse'
396
397
397 $ hg --cwd b tip | grep someoneelse
398 $ hg --cwd b tip | grep someoneelse
398 user: someoneelse
399 user: someoneelse
399
400
400 should be empty
401 should be empty
401
402
402 $ hg --cwd b status
403 $ hg --cwd b status
403
404
404
405
405 Test fuzziness (ambiguous patch location, fuzz=2)
406 Test fuzziness (ambiguous patch location, fuzz=2)
406
407
407 $ hg init fuzzy
408 $ hg init fuzzy
408 $ cd fuzzy
409 $ cd fuzzy
409 $ echo line1 > a
410 $ echo line1 > a
410 $ echo line0 >> a
411 $ echo line0 >> a
411 $ echo line3 >> a
412 $ echo line3 >> a
412 $ hg ci -Am adda
413 $ hg ci -Am adda
413 adding a
414 adding a
414 $ echo line1 > a
415 $ echo line1 > a
415 $ echo line2 >> a
416 $ echo line2 >> a
416 $ echo line0 >> a
417 $ echo line0 >> a
417 $ echo line3 >> a
418 $ echo line3 >> a
418 $ hg ci -m change a
419 $ hg ci -m change a
419 $ hg export tip > tip.patch
420 $ hg export tip > tip.patch
420 $ hg up -C 0
421 $ hg up -C 0
421 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
422 $ echo line1 > a
423 $ echo line1 > a
423 $ echo line0 >> a
424 $ echo line0 >> a
424 $ echo line1 >> a
425 $ echo line1 >> a
425 $ echo line0 >> a
426 $ echo line0 >> a
426 $ hg ci -m brancha
427 $ hg ci -m brancha
427 created new head
428 created new head
428 $ hg import --no-commit -v tip.patch
429 $ hg import --no-commit -v tip.patch
429 applying tip.patch
430 applying tip.patch
430 patching file a
431 patching file a
431 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
432 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
432 $ hg revert -a
433 $ hg revert -a
433 reverting a
434 reverting a
434
435
435 test fuzziness with eol=auto
436 test fuzziness with eol=auto
436
437
437 $ hg --config patch.eol=auto import --no-commit -v tip.patch
438 $ hg --config patch.eol=auto import --no-commit -v tip.patch
438 applying tip.patch
439 applying tip.patch
439 patching file a
440 patching file a
440 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
441 Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines).
441 $ cd ..
442 $ cd ..
442
443
443
444
444 Test hunk touching empty files (issue906)
445 Test hunk touching empty files (issue906)
445
446
446 $ hg init empty
447 $ hg init empty
447 $ cd empty
448 $ cd empty
448 $ touch a
449 $ touch a
449 $ touch b1
450 $ touch b1
450 $ touch c1
451 $ touch c1
451 $ echo d > d
452 $ echo d > d
452 $ hg ci -Am init
453 $ hg ci -Am init
453 adding a
454 adding a
454 adding b1
455 adding b1
455 adding c1
456 adding c1
456 adding d
457 adding d
457 $ echo a > a
458 $ echo a > a
458 $ echo b > b1
459 $ echo b > b1
459 $ hg mv b1 b2
460 $ hg mv b1 b2
460 $ echo c > c1
461 $ echo c > c1
461 $ hg copy c1 c2
462 $ hg copy c1 c2
462 $ rm d
463 $ rm d
463 $ touch d
464 $ touch d
464 $ hg diff --git
465 $ hg diff --git
465 diff --git a/a b/a
466 diff --git a/a b/a
466 --- a/a
467 --- a/a
467 +++ b/a
468 +++ b/a
468 @@ -0,0 +1,1 @@
469 @@ -0,0 +1,1 @@
469 +a
470 +a
470 diff --git a/b1 b/b2
471 diff --git a/b1 b/b2
471 rename from b1
472 rename from b1
472 rename to b2
473 rename to b2
473 --- a/b1
474 --- a/b1
474 +++ b/b2
475 +++ b/b2
475 @@ -0,0 +1,1 @@
476 @@ -0,0 +1,1 @@
476 +b
477 +b
477 diff --git a/c1 b/c1
478 diff --git a/c1 b/c1
478 --- a/c1
479 --- a/c1
479 +++ b/c1
480 +++ b/c1
480 @@ -0,0 +1,1 @@
481 @@ -0,0 +1,1 @@
481 +c
482 +c
482 diff --git a/c1 b/c2
483 diff --git a/c1 b/c2
483 copy from c1
484 copy from c1
484 copy to c2
485 copy to c2
485 --- a/c1
486 --- a/c1
486 +++ b/c2
487 +++ b/c2
487 @@ -0,0 +1,1 @@
488 @@ -0,0 +1,1 @@
488 +c
489 +c
489 diff --git a/d b/d
490 diff --git a/d b/d
490 --- a/d
491 --- a/d
491 +++ b/d
492 +++ b/d
492 @@ -1,1 +0,0 @@
493 @@ -1,1 +0,0 @@
493 -d
494 -d
494 $ hg ci -m empty
495 $ hg ci -m empty
495 $ hg export --git tip > empty.diff
496 $ hg export --git tip > empty.diff
496 $ hg up -C 0
497 $ hg up -C 0
497 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
498 4 files updated, 0 files merged, 2 files removed, 0 files unresolved
498 $ hg import empty.diff
499 $ hg import empty.diff
499 applying empty.diff
500 applying empty.diff
500 $ for name in a b1 b2 c1 c2 d; do
501 $ for name in a b1 b2 c1 c2 d; do
501 > echo % $name file
502 > echo % $name file
502 > test -f $name && cat $name
503 > test -f $name && cat $name
503 > done
504 > done
504 % a file
505 % a file
505 a
506 a
506 % b1 file
507 % b1 file
507 % b2 file
508 % b2 file
508 b
509 b
509 % c1 file
510 % c1 file
510 c
511 c
511 % c2 file
512 % c2 file
512 c
513 c
513 % d file
514 % d file
514 $ cd ..
515 $ cd ..
515
516
516
517
517 Test importing a patch ending with a binary file removal
518 Test importing a patch ending with a binary file removal
518
519
519 $ hg init binaryremoval
520 $ hg init binaryremoval
520 $ cd binaryremoval
521 $ cd binaryremoval
521 $ echo a > a
522 $ echo a > a
522 $ python -c "file('b', 'wb').write('a\x00b')"
523 $ python -c "file('b', 'wb').write('a\x00b')"
523 $ hg ci -Am addall
524 $ hg ci -Am addall
524 adding a
525 adding a
525 adding b
526 adding b
526 $ hg rm a
527 $ hg rm a
527 $ hg rm b
528 $ hg rm b
528 $ hg st
529 $ hg st
529 R a
530 R a
530 R b
531 R b
531 $ hg ci -m remove
532 $ hg ci -m remove
532 $ hg export --git . > remove.diff
533 $ hg export --git . > remove.diff
533 $ cat remove.diff | grep git
534 $ cat remove.diff | grep git
534 diff --git a/a b/a
535 diff --git a/a b/a
535 diff --git a/b b/b
536 diff --git a/b b/b
536 $ hg up -C 0
537 $ hg up -C 0
537 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
538 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
538 $ hg import remove.diff
539 $ hg import remove.diff
539 applying remove.diff
540 applying remove.diff
540 $ hg manifest
541 $ hg manifest
541 $ cd ..
542 $ cd ..
542
543
543
544
544 test update+rename with common name (issue 927)
545 test update+rename with common name (issue 927)
545
546
546 $ hg init t
547 $ hg init t
547 $ cd t
548 $ cd t
548 $ touch a
549 $ touch a
549 $ hg ci -Am t
550 $ hg ci -Am t
550 adding a
551 adding a
551 $ echo a > a
552 $ echo a > a
552
553
553 Here, bfile.startswith(afile)
554 Here, bfile.startswith(afile)
554
555
555 $ hg copy a a2
556 $ hg copy a a2
556 $ hg ci -m copya
557 $ hg ci -m copya
557 $ hg export --git tip > copy.diff
558 $ hg export --git tip > copy.diff
558 $ hg up -C 0
559 $ hg up -C 0
559 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
560 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
560 $ hg import copy.diff
561 $ hg import copy.diff
561 applying copy.diff
562 applying copy.diff
562
563
563 a should contain an 'a'
564 a should contain an 'a'
564
565
565 $ cat a
566 $ cat a
566 a
567 a
567
568
568 and a2 should have duplicated it
569 and a2 should have duplicated it
569
570
570 $ cat a2
571 $ cat a2
571 a
572 a
572 $ cd ..
573 $ cd ..
573
574
574
575
575 test -p0
576 test -p0
576
577
577 $ hg init p0
578 $ hg init p0
578 $ cd p0
579 $ cd p0
579 $ echo a > a
580 $ echo a > a
580 $ hg ci -Am t
581 $ hg ci -Am t
581 adding a
582 adding a
582 $ hg import -p0 - << EOF
583 $ hg import -p0 - << EOF
583 > foobar
584 > foobar
584 > --- a Sat Apr 12 22:43:58 2008 -0400
585 > --- a Sat Apr 12 22:43:58 2008 -0400
585 > +++ a Sat Apr 12 22:44:05 2008 -0400
586 > +++ a Sat Apr 12 22:44:05 2008 -0400
586 > @@ -1,1 +1,1 @@
587 > @@ -1,1 +1,1 @@
587 > -a
588 > -a
588 > +bb
589 > +bb
589 > EOF
590 > EOF
590 applying patch from stdin
591 applying patch from stdin
591 $ hg status
592 $ hg status
592 $ cat a
593 $ cat a
593 bb
594 bb
594 $ cd ..
595 $ cd ..
595
596
596
597
597 test paths outside repo root
598 test paths outside repo root
598
599
599 $ mkdir outside
600 $ mkdir outside
600 $ touch outside/foo
601 $ touch outside/foo
601 $ hg init inside
602 $ hg init inside
602 $ cd inside
603 $ cd inside
603 $ hg import - <<EOF
604 $ hg import - <<EOF
604 > diff --git a/a b/b
605 > diff --git a/a b/b
605 > rename from ../outside/foo
606 > rename from ../outside/foo
606 > rename to bar
607 > rename to bar
607 > EOF
608 > EOF
608 applying patch from stdin
609 applying patch from stdin
609 abort: ../outside/foo not under root
610 abort: ../outside/foo not under root
610 [255]
611 [255]
611 $ cd ..
612 $ cd ..
612
613
613
614
614 test import with similarity and git and strip (issue295 et al.)
615 test import with similarity and git and strip (issue295 et al.)
615
616
616 $ hg init sim
617 $ hg init sim
617 $ cd sim
618 $ cd sim
618 $ echo 'this is a test' > a
619 $ echo 'this is a test' > a
619 $ hg ci -Ama
620 $ hg ci -Ama
620 adding a
621 adding a
621 $ cat > ../rename.diff <<EOF
622 $ cat > ../rename.diff <<EOF
622 > diff --git a/foo/a b/foo/a
623 > diff --git a/foo/a b/foo/a
623 > deleted file mode 100644
624 > deleted file mode 100644
624 > --- a/foo/a
625 > --- a/foo/a
625 > +++ /dev/null
626 > +++ /dev/null
626 > @@ -1,1 +0,0 @@
627 > @@ -1,1 +0,0 @@
627 > -this is a test
628 > -this is a test
628 > diff --git a/foo/b b/foo/b
629 > diff --git a/foo/b b/foo/b
629 > new file mode 100644
630 > new file mode 100644
630 > --- /dev/null
631 > --- /dev/null
631 > +++ b/foo/b
632 > +++ b/foo/b
632 > @@ -0,0 +1,2 @@
633 > @@ -0,0 +1,2 @@
633 > +this is a test
634 > +this is a test
634 > +foo
635 > +foo
635 > EOF
636 > EOF
636 $ hg import --no-commit -v -s 1 ../rename.diff -p2
637 $ hg import --no-commit -v -s 1 ../rename.diff -p2
637 applying ../rename.diff
638 applying ../rename.diff
638 patching file a
639 patching file a
639 patching file b
640 patching file b
640 removing a
641 removing a
641 adding b
642 adding b
642 recording removal of a as rename to b (88% similar)
643 recording removal of a as rename to b (88% similar)
643 $ hg st -C
644 $ hg st -C
644 A b
645 A b
645 a
646 a
646 R a
647 R a
647 $ hg revert -a
648 $ hg revert -a
648 undeleting a
649 undeleting a
649 forgetting b
650 forgetting b
650 $ rm b
651 $ rm b
651 $ hg import --no-commit -v -s 100 ../rename.diff -p2
652 $ hg import --no-commit -v -s 100 ../rename.diff -p2
652 applying ../rename.diff
653 applying ../rename.diff
653 patching file a
654 patching file a
654 patching file b
655 patching file b
655 removing a
656 removing a
656 adding b
657 adding b
657 $ hg st -C
658 $ hg st -C
658 A b
659 A b
659 R a
660 R a
660 $ cd ..
661 $ cd ..
661
662
662
663
663 add empty file from the end of patch (issue 1495)
664 add empty file from the end of patch (issue 1495)
664
665
665 $ hg init addemptyend
666 $ hg init addemptyend
666 $ cd addemptyend
667 $ cd addemptyend
667 $ touch a
668 $ touch a
668 $ hg addremove
669 $ hg addremove
669 adding a
670 adding a
670 $ hg ci -m "commit"
671 $ hg ci -m "commit"
671 $ cat > a.patch <<EOF
672 $ cat > a.patch <<EOF
672 > diff --git a/a b/a
673 > diff --git a/a b/a
673 > --- a/a
674 > --- a/a
674 > +++ b/a
675 > +++ b/a
675 > @@ -0,0 +1,1 @@
676 > @@ -0,0 +1,1 @@
676 > +a
677 > +a
677 > diff --git a/b b/b
678 > diff --git a/b b/b
678 > new file mode 100644
679 > new file mode 100644
679 > EOF
680 > EOF
680 $ hg import --no-commit a.patch
681 $ hg import --no-commit a.patch
681 applying a.patch
682 applying a.patch
682 $ cd ..
683 $ cd ..
683
684
684
685
685 create file when source is not /dev/null
686 create file when source is not /dev/null
686
687
687 $ cat > create.patch <<EOF
688 $ cat > create.patch <<EOF
688 > diff -Naur proj-orig/foo proj-new/foo
689 > diff -Naur proj-orig/foo proj-new/foo
689 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
690 > --- proj-orig/foo 1969-12-31 16:00:00.000000000 -0800
690 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
691 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
691 > @@ -0,0 +1,1 @@
692 > @@ -0,0 +1,1 @@
692 > +a
693 > +a
693 > EOF
694 > EOF
694
695
695 some people have patches like the following too
696 some people have patches like the following too
696
697
697 $ cat > create2.patch <<EOF
698 $ cat > create2.patch <<EOF
698 > diff -Naur proj-orig/foo proj-new/foo
699 > diff -Naur proj-orig/foo proj-new/foo
699 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
700 > --- proj-orig/foo.orig 1969-12-31 16:00:00.000000000 -0800
700 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
701 > +++ proj-new/foo 2009-07-17 16:50:45.801368000 -0700
701 > @@ -0,0 +1,1 @@
702 > @@ -0,0 +1,1 @@
702 > +a
703 > +a
703 > EOF
704 > EOF
704 $ hg init oddcreate
705 $ hg init oddcreate
705 $ cd oddcreate
706 $ cd oddcreate
706 $ hg import --no-commit ../create.patch
707 $ hg import --no-commit ../create.patch
707 applying ../create.patch
708 applying ../create.patch
708 $ cat foo
709 $ cat foo
709 a
710 a
710 $ rm foo
711 $ rm foo
711 $ hg revert foo
712 $ hg revert foo
712 $ hg import --no-commit ../create2.patch
713 $ hg import --no-commit ../create2.patch
713 applying ../create2.patch
714 applying ../create2.patch
714 $ cat foo
715 $ cat foo
715 a
716 a
716
717
717
718
718 first line mistaken for email headers (issue 1859)
719 first line mistaken for email headers (issue 1859)
719
720
720 $ hg init emailconfusion
721 $ hg init emailconfusion
721 $ cd emailconfusion
722 $ cd emailconfusion
722 $ cat > a.patch <<EOF
723 $ cat > a.patch <<EOF
723 > module: summary
724 > module: summary
724 >
725 >
725 > description
726 > description
726 >
727 >
727 >
728 >
728 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
729 > diff -r 000000000000 -r 9b4c1e343b55 test.txt
729 > --- /dev/null
730 > --- /dev/null
730 > +++ b/a
731 > +++ b/a
731 > @@ -0,0 +1,1 @@
732 > @@ -0,0 +1,1 @@
732 > +a
733 > +a
733 > EOF
734 > EOF
734 $ hg import -d '0 0' a.patch
735 $ hg import -d '0 0' a.patch
735 applying a.patch
736 applying a.patch
736 $ hg parents -v
737 $ hg parents -v
737 changeset: 0:5a681217c0ad
738 changeset: 0:5a681217c0ad
738 tag: tip
739 tag: tip
739 user: test
740 user: test
740 date: Thu Jan 01 00:00:00 1970 +0000
741 date: Thu Jan 01 00:00:00 1970 +0000
741 files: a
742 files: a
742 description:
743 description:
743 module: summary
744 module: summary
744
745
745 description
746 description
746
747
747
748
748 $ cd ..
749 $ cd ..
749
750
750
751
751 --- in commit message
752 --- in commit message
752
753
753 $ hg init commitconfusion
754 $ hg init commitconfusion
754 $ cd commitconfusion
755 $ cd commitconfusion
755 $ cat > a.patch <<EOF
756 $ cat > a.patch <<EOF
756 > module: summary
757 > module: summary
757 >
758 >
758 > --- description
759 > --- description
759 >
760 >
760 > diff --git a/a b/a
761 > diff --git a/a b/a
761 > new file mode 100644
762 > new file mode 100644
762 > --- /dev/null
763 > --- /dev/null
763 > +++ b/a
764 > +++ b/a
764 > @@ -0,0 +1,1 @@
765 > @@ -0,0 +1,1 @@
765 > +a
766 > +a
766 > EOF
767 > EOF
767 > hg import -d '0 0' a.patch
768 > hg import -d '0 0' a.patch
768 > hg parents -v
769 > hg parents -v
769 > cd ..
770 > cd ..
770 >
771 >
771 > echo '% tricky header splitting'
772 > echo '% tricky header splitting'
772 > cat > trickyheaders.patch <<EOF
773 > cat > trickyheaders.patch <<EOF
773 > From: User A <user@a>
774 > From: User A <user@a>
774 > Subject: [PATCH] from: tricky!
775 > Subject: [PATCH] from: tricky!
775 >
776 >
776 > # HG changeset patch
777 > # HG changeset patch
777 > # User User B
778 > # User User B
778 > # Date 1266264441 18000
779 > # Date 1266264441 18000
779 > # Branch stable
780 > # Branch stable
780 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
781 > # Node ID f2be6a1170ac83bf31cb4ae0bad00d7678115bc0
781 > # Parent 0000000000000000000000000000000000000000
782 > # Parent 0000000000000000000000000000000000000000
782 > from: tricky!
783 > from: tricky!
783 >
784 >
784 > That is not a header.
785 > That is not a header.
785 >
786 >
786 > diff -r 000000000000 -r f2be6a1170ac foo
787 > diff -r 000000000000 -r f2be6a1170ac foo
787 > --- /dev/null
788 > --- /dev/null
788 > +++ b/foo
789 > +++ b/foo
789 > @@ -0,0 +1,1 @@
790 > @@ -0,0 +1,1 @@
790 > +foo
791 > +foo
791 > EOF
792 > EOF
792 applying a.patch
793 applying a.patch
793 changeset: 0:f34d9187897d
794 changeset: 0:f34d9187897d
794 tag: tip
795 tag: tip
795 user: test
796 user: test
796 date: Thu Jan 01 00:00:00 1970 +0000
797 date: Thu Jan 01 00:00:00 1970 +0000
797 files: a
798 files: a
798 description:
799 description:
799 module: summary
800 module: summary
800
801
801
802
802 % tricky header splitting
803 % tricky header splitting
803
804
804 $ hg init trickyheaders
805 $ hg init trickyheaders
805 $ cd trickyheaders
806 $ cd trickyheaders
806 $ hg import -d '0 0' ../trickyheaders.patch
807 $ hg import -d '0 0' ../trickyheaders.patch
807 applying ../trickyheaders.patch
808 applying ../trickyheaders.patch
808 $ hg export --git tip
809 $ hg export --git tip
809 # HG changeset patch
810 # HG changeset patch
810 # User User B
811 # User User B
811 # Date 0 0
812 # Date 0 0
812 # Node ID eb56ab91903632294ac504838508cb370c0901d2
813 # Node ID eb56ab91903632294ac504838508cb370c0901d2
813 # Parent 0000000000000000000000000000000000000000
814 # Parent 0000000000000000000000000000000000000000
814 from: tricky!
815 from: tricky!
815
816
816 That is not a header.
817 That is not a header.
817
818
818 diff --git a/foo b/foo
819 diff --git a/foo b/foo
819 new file mode 100644
820 new file mode 100644
820 --- /dev/null
821 --- /dev/null
821 +++ b/foo
822 +++ b/foo
822 @@ -0,0 +1,1 @@
823 @@ -0,0 +1,1 @@
823 +foo
824 +foo
824 $ cd ..
825 $ cd ..
825
826
826
827
827 issue2102
828 issue2102
828
829
829 $ hg init issue2102
830 $ hg init issue2102
830 $ cd issue2102
831 $ cd issue2102
831 $ mkdir -p src/cmd/gc
832 $ mkdir -p src/cmd/gc
832 $ touch src/cmd/gc/mksys.bash
833 $ touch src/cmd/gc/mksys.bash
833 $ hg ci -Am init
834 $ hg ci -Am init
834 adding src/cmd/gc/mksys.bash
835 adding src/cmd/gc/mksys.bash
835 $ hg import - <<EOF
836 $ hg import - <<EOF
836 > # HG changeset patch
837 > # HG changeset patch
837 > # User Rob Pike
838 > # User Rob Pike
838 > # Date 1216685449 25200
839 > # Date 1216685449 25200
839 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
840 > # Node ID 03aa2b206f499ad6eb50e6e207b9e710d6409c98
840 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
841 > # Parent 93d10138ad8df586827ca90b4ddb5033e21a3a84
841 > help management of empty pkg and lib directories in perforce
842 > help management of empty pkg and lib directories in perforce
842 >
843 >
843 > R=gri
844 > R=gri
844 > DELTA=4 (4 added, 0 deleted, 0 changed)
845 > DELTA=4 (4 added, 0 deleted, 0 changed)
845 > OCL=13328
846 > OCL=13328
846 > CL=13328
847 > CL=13328
847 >
848 >
848 > diff --git a/lib/place-holder b/lib/place-holder
849 > diff --git a/lib/place-holder b/lib/place-holder
849 > new file mode 100644
850 > new file mode 100644
850 > --- /dev/null
851 > --- /dev/null
851 > +++ b/lib/place-holder
852 > +++ b/lib/place-holder
852 > @@ -0,0 +1,2 @@
853 > @@ -0,0 +1,2 @@
853 > +perforce does not maintain empty directories.
854 > +perforce does not maintain empty directories.
854 > +this file helps.
855 > +this file helps.
855 > diff --git a/pkg/place-holder b/pkg/place-holder
856 > diff --git a/pkg/place-holder b/pkg/place-holder
856 > new file mode 100644
857 > new file mode 100644
857 > --- /dev/null
858 > --- /dev/null
858 > +++ b/pkg/place-holder
859 > +++ b/pkg/place-holder
859 > @@ -0,0 +1,2 @@
860 > @@ -0,0 +1,2 @@
860 > +perforce does not maintain empty directories.
861 > +perforce does not maintain empty directories.
861 > +this file helps.
862 > +this file helps.
862 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
863 > diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
863 > old mode 100644
864 > old mode 100644
864 > new mode 100755
865 > new mode 100755
865 > EOF
866 > EOF
866 applying patch from stdin
867 applying patch from stdin
867 $ hg sum
868 $ hg sum
868 parent: 1:d59915696727 tip
869 parent: 1:d59915696727 tip
869 help management of empty pkg and lib directories in perforce
870 help management of empty pkg and lib directories in perforce
870 branch: default
871 branch: default
871 commit: (clean)
872 commit: (clean)
872 update: (current)
873 update: (current)
873 $ hg diff --git -c tip
874 $ hg diff --git -c tip
874 diff --git a/lib/place-holder b/lib/place-holder
875 diff --git a/lib/place-holder b/lib/place-holder
875 new file mode 100644
876 new file mode 100644
876 --- /dev/null
877 --- /dev/null
877 +++ b/lib/place-holder
878 +++ b/lib/place-holder
878 @@ -0,0 +1,2 @@
879 @@ -0,0 +1,2 @@
879 +perforce does not maintain empty directories.
880 +perforce does not maintain empty directories.
880 +this file helps.
881 +this file helps.
881 diff --git a/pkg/place-holder b/pkg/place-holder
882 diff --git a/pkg/place-holder b/pkg/place-holder
882 new file mode 100644
883 new file mode 100644
883 --- /dev/null
884 --- /dev/null
884 +++ b/pkg/place-holder
885 +++ b/pkg/place-holder
885 @@ -0,0 +1,2 @@
886 @@ -0,0 +1,2 @@
886 +perforce does not maintain empty directories.
887 +perforce does not maintain empty directories.
887 +this file helps.
888 +this file helps.
888 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
889 diff --git a/src/cmd/gc/mksys.bash b/src/cmd/gc/mksys.bash
889 old mode 100644
890 old mode 100644
890 new mode 100755
891 new mode 100755
891 $ cd ..
892 $ cd ..
892
893
893
894
894 diff lines looking like headers
895 diff lines looking like headers
895
896
896 $ hg init difflineslikeheaders
897 $ hg init difflineslikeheaders
897 $ cd difflineslikeheaders
898 $ cd difflineslikeheaders
898 $ echo a >a
899 $ echo a >a
899 $ echo b >b
900 $ echo b >b
900 $ echo c >c
901 $ echo c >c
901 $ hg ci -Am1
902 $ hg ci -Am1
902 adding a
903 adding a
903 adding b
904 adding b
904 adding c
905 adding c
905
906
906 $ echo "key: value" >>a
907 $ echo "key: value" >>a
907 $ echo "key: value" >>b
908 $ echo "key: value" >>b
908 $ echo "foo" >>c
909 $ echo "foo" >>c
909 $ hg ci -m2
910 $ hg ci -m2
910
911
911 $ hg up -C 0
912 $ hg up -C 0
912 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
913 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
913 $ hg diff --git -c1 >want
914 $ hg diff --git -c1 >want
914 $ hg diff -c1 | hg import --no-commit -
915 $ hg diff -c1 | hg import --no-commit -
915 applying patch from stdin
916 applying patch from stdin
916 $ hg diff --git >have
917 $ hg diff --git >have
917 $ diff want have
918 $ diff want have
918 $ cd ..
919 $ cd ..
919
920
@@ -1,468 +1,468 b''
1 $ mkdir test
1 $ mkdir test
2 $ cd test
2 $ cd test
3 $ hg init
3 $ hg init
4 $ for i in 0 1 2 3 4 5 6 7 8; do
4 $ for i in 0 1 2 3 4 5 6 7 8; do
5 > echo $i >> foo
5 > echo $i >> foo
6 > hg commit -A -m $i
6 > hg commit -A -m $i
7 > done
7 > done
8 adding foo
8 adding foo
9 $ hg verify
9 $ hg verify
10 checking changesets
10 checking changesets
11 checking manifests
11 checking manifests
12 crosschecking files in changesets and manifests
12 crosschecking files in changesets and manifests
13 checking files
13 checking files
14 1 files, 9 changesets, 9 total revisions
14 1 files, 9 changesets, 9 total revisions
15 $ hg serve -p $HGPORT -d --pid-file=hg.pid
15 $ hg serve -p $HGPORT -d --pid-file=hg.pid
16 $ cat hg.pid >> $DAEMON_PIDS
16 $ cat hg.pid >> $DAEMON_PIDS
17 $ cd ..
17 $ cd ..
18
18
19 $ hg init new
19 $ hg init new
20
20
21 http incoming
21 http incoming
22
22
23 $ hg -R new incoming http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
23 $ hg -R new incoming http://localhost:$HGPORT/
24 comparing with http://localhost:$HGPORT/
24 comparing with http://localhost:\d+/
25 changeset: 0:00a43fa82f62
25 changeset: 0:00a43fa82f62
26 user: test
26 user: test
27 date: Thu Jan 01 00:00:00 1970 +0000
27 date: Thu Jan 01 00:00:00 1970 +0000
28 summary: 0
28 summary: 0
29
29
30 changeset: 1:5460a410df01
30 changeset: 1:5460a410df01
31 user: test
31 user: test
32 date: Thu Jan 01 00:00:00 1970 +0000
32 date: Thu Jan 01 00:00:00 1970 +0000
33 summary: 1
33 summary: 1
34
34
35 changeset: 2:d9f42cd1a1ec
35 changeset: 2:d9f42cd1a1ec
36 user: test
36 user: test
37 date: Thu Jan 01 00:00:00 1970 +0000
37 date: Thu Jan 01 00:00:00 1970 +0000
38 summary: 2
38 summary: 2
39
39
40 changeset: 3:376476025137
40 changeset: 3:376476025137
41 user: test
41 user: test
42 date: Thu Jan 01 00:00:00 1970 +0000
42 date: Thu Jan 01 00:00:00 1970 +0000
43 summary: 3
43 summary: 3
44
44
45 changeset: 4:70d7eb252d49
45 changeset: 4:70d7eb252d49
46 user: test
46 user: test
47 date: Thu Jan 01 00:00:00 1970 +0000
47 date: Thu Jan 01 00:00:00 1970 +0000
48 summary: 4
48 summary: 4
49
49
50 changeset: 5:ad284ee3b5ee
50 changeset: 5:ad284ee3b5ee
51 user: test
51 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
52 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: 5
53 summary: 5
54
54
55 changeset: 6:e9229f2de384
55 changeset: 6:e9229f2de384
56 user: test
56 user: test
57 date: Thu Jan 01 00:00:00 1970 +0000
57 date: Thu Jan 01 00:00:00 1970 +0000
58 summary: 6
58 summary: 6
59
59
60 changeset: 7:d152815bb8db
60 changeset: 7:d152815bb8db
61 user: test
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: 7
63 summary: 7
64
64
65 changeset: 8:e4feb4ac9035
65 changeset: 8:e4feb4ac9035
66 tag: tip
66 tag: tip
67 user: test
67 user: test
68 date: Thu Jan 01 00:00:00 1970 +0000
68 date: Thu Jan 01 00:00:00 1970 +0000
69 summary: 8
69 summary: 8
70
70
71 $ hg -R new incoming -r 4 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
71 $ hg -R new incoming -r 4 http://localhost:$HGPORT/
72 comparing with http://localhost:$HGPORT/
72 comparing with http://localhost:\d+/
73 changeset: 0:00a43fa82f62
73 changeset: 0:00a43fa82f62
74 user: test
74 user: test
75 date: Thu Jan 01 00:00:00 1970 +0000
75 date: Thu Jan 01 00:00:00 1970 +0000
76 summary: 0
76 summary: 0
77
77
78 changeset: 1:5460a410df01
78 changeset: 1:5460a410df01
79 user: test
79 user: test
80 date: Thu Jan 01 00:00:00 1970 +0000
80 date: Thu Jan 01 00:00:00 1970 +0000
81 summary: 1
81 summary: 1
82
82
83 changeset: 2:d9f42cd1a1ec
83 changeset: 2:d9f42cd1a1ec
84 user: test
84 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
85 date: Thu Jan 01 00:00:00 1970 +0000
86 summary: 2
86 summary: 2
87
87
88 changeset: 3:376476025137
88 changeset: 3:376476025137
89 user: test
89 user: test
90 date: Thu Jan 01 00:00:00 1970 +0000
90 date: Thu Jan 01 00:00:00 1970 +0000
91 summary: 3
91 summary: 3
92
92
93 changeset: 4:70d7eb252d49
93 changeset: 4:70d7eb252d49
94 tag: tip
94 tag: tip
95 user: test
95 user: test
96 date: Thu Jan 01 00:00:00 1970 +0000
96 date: Thu Jan 01 00:00:00 1970 +0000
97 summary: 4
97 summary: 4
98
98
99
99
100 local incoming
100 local incoming
101
101
102 $ hg -R new incoming test
102 $ hg -R new incoming test
103 comparing with test
103 comparing with test
104 changeset: 0:00a43fa82f62
104 changeset: 0:00a43fa82f62
105 user: test
105 user: test
106 date: Thu Jan 01 00:00:00 1970 +0000
106 date: Thu Jan 01 00:00:00 1970 +0000
107 summary: 0
107 summary: 0
108
108
109 changeset: 1:5460a410df01
109 changeset: 1:5460a410df01
110 user: test
110 user: test
111 date: Thu Jan 01 00:00:00 1970 +0000
111 date: Thu Jan 01 00:00:00 1970 +0000
112 summary: 1
112 summary: 1
113
113
114 changeset: 2:d9f42cd1a1ec
114 changeset: 2:d9f42cd1a1ec
115 user: test
115 user: test
116 date: Thu Jan 01 00:00:00 1970 +0000
116 date: Thu Jan 01 00:00:00 1970 +0000
117 summary: 2
117 summary: 2
118
118
119 changeset: 3:376476025137
119 changeset: 3:376476025137
120 user: test
120 user: test
121 date: Thu Jan 01 00:00:00 1970 +0000
121 date: Thu Jan 01 00:00:00 1970 +0000
122 summary: 3
122 summary: 3
123
123
124 changeset: 4:70d7eb252d49
124 changeset: 4:70d7eb252d49
125 user: test
125 user: test
126 date: Thu Jan 01 00:00:00 1970 +0000
126 date: Thu Jan 01 00:00:00 1970 +0000
127 summary: 4
127 summary: 4
128
128
129 changeset: 5:ad284ee3b5ee
129 changeset: 5:ad284ee3b5ee
130 user: test
130 user: test
131 date: Thu Jan 01 00:00:00 1970 +0000
131 date: Thu Jan 01 00:00:00 1970 +0000
132 summary: 5
132 summary: 5
133
133
134 changeset: 6:e9229f2de384
134 changeset: 6:e9229f2de384
135 user: test
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: 6
137 summary: 6
138
138
139 changeset: 7:d152815bb8db
139 changeset: 7:d152815bb8db
140 user: test
140 user: test
141 date: Thu Jan 01 00:00:00 1970 +0000
141 date: Thu Jan 01 00:00:00 1970 +0000
142 summary: 7
142 summary: 7
143
143
144 changeset: 8:e4feb4ac9035
144 changeset: 8:e4feb4ac9035
145 tag: tip
145 tag: tip
146 user: test
146 user: test
147 date: Thu Jan 01 00:00:00 1970 +0000
147 date: Thu Jan 01 00:00:00 1970 +0000
148 summary: 8
148 summary: 8
149
149
150 $ hg -R new incoming -r 4 test
150 $ hg -R new incoming -r 4 test
151 comparing with test
151 comparing with test
152 changeset: 0:00a43fa82f62
152 changeset: 0:00a43fa82f62
153 user: test
153 user: test
154 date: Thu Jan 01 00:00:00 1970 +0000
154 date: Thu Jan 01 00:00:00 1970 +0000
155 summary: 0
155 summary: 0
156
156
157 changeset: 1:5460a410df01
157 changeset: 1:5460a410df01
158 user: test
158 user: test
159 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
160 summary: 1
160 summary: 1
161
161
162 changeset: 2:d9f42cd1a1ec
162 changeset: 2:d9f42cd1a1ec
163 user: test
163 user: test
164 date: Thu Jan 01 00:00:00 1970 +0000
164 date: Thu Jan 01 00:00:00 1970 +0000
165 summary: 2
165 summary: 2
166
166
167 changeset: 3:376476025137
167 changeset: 3:376476025137
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: 3
170 summary: 3
171
171
172 changeset: 4:70d7eb252d49
172 changeset: 4:70d7eb252d49
173 user: test
173 user: test
174 date: Thu Jan 01 00:00:00 1970 +0000
174 date: Thu Jan 01 00:00:00 1970 +0000
175 summary: 4
175 summary: 4
176
176
177
177
178 limit to 2 changesets
178 limit to 2 changesets
179
179
180 $ hg -R new incoming -l 2 test
180 $ hg -R new incoming -l 2 test
181 comparing with test
181 comparing with test
182 changeset: 0:00a43fa82f62
182 changeset: 0:00a43fa82f62
183 user: test
183 user: test
184 date: Thu Jan 01 00:00:00 1970 +0000
184 date: Thu Jan 01 00:00:00 1970 +0000
185 summary: 0
185 summary: 0
186
186
187 changeset: 1:5460a410df01
187 changeset: 1:5460a410df01
188 user: test
188 user: test
189 date: Thu Jan 01 00:00:00 1970 +0000
189 date: Thu Jan 01 00:00:00 1970 +0000
190 summary: 1
190 summary: 1
191
191
192
192
193 limit to 2 changesets, test with -p --git
193 limit to 2 changesets, test with -p --git
194
194
195 $ hg -R new incoming -l 2 -p --git test
195 $ hg -R new incoming -l 2 -p --git test
196 comparing with test
196 comparing with test
197 changeset: 0:00a43fa82f62
197 changeset: 0:00a43fa82f62
198 user: test
198 user: test
199 date: Thu Jan 01 00:00:00 1970 +0000
199 date: Thu Jan 01 00:00:00 1970 +0000
200 summary: 0
200 summary: 0
201
201
202 diff --git a/foo b/foo
202 diff --git a/foo b/foo
203 new file mode 100644
203 new file mode 100644
204 --- /dev/null
204 --- /dev/null
205 +++ b/foo
205 +++ b/foo
206 @@ -0,0 +1,1 @@
206 @@ -0,0 +1,1 @@
207 +0
207 +0
208
208
209 changeset: 1:5460a410df01
209 changeset: 1:5460a410df01
210 user: test
210 user: test
211 date: Thu Jan 01 00:00:00 1970 +0000
211 date: Thu Jan 01 00:00:00 1970 +0000
212 summary: 1
212 summary: 1
213
213
214 diff --git a/foo b/foo
214 diff --git a/foo b/foo
215 --- a/foo
215 --- a/foo
216 +++ b/foo
216 +++ b/foo
217 @@ -1,1 +1,2 @@
217 @@ -1,1 +1,2 @@
218 0
218 0
219 +1
219 +1
220
220
221
221
222 test with --bundle
222 test with --bundle
223
223
224 $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
224 $ hg -R new incoming --bundle test.hg http://localhost:$HGPORT/
225 comparing with http://localhost:$HGPORT/
225 comparing with http://localhost:.*/
226 changeset: 0:00a43fa82f62
226 changeset: 0:00a43fa82f62
227 user: test
227 user: test
228 date: Thu Jan 01 00:00:00 1970 +0000
228 date: Thu Jan 01 00:00:00 1970 +0000
229 summary: 0
229 summary: 0
230
230
231 changeset: 1:5460a410df01
231 changeset: 1:5460a410df01
232 user: test
232 user: test
233 date: Thu Jan 01 00:00:00 1970 +0000
233 date: Thu Jan 01 00:00:00 1970 +0000
234 summary: 1
234 summary: 1
235
235
236 changeset: 2:d9f42cd1a1ec
236 changeset: 2:d9f42cd1a1ec
237 user: test
237 user: test
238 date: Thu Jan 01 00:00:00 1970 +0000
238 date: Thu Jan 01 00:00:00 1970 +0000
239 summary: 2
239 summary: 2
240
240
241 changeset: 3:376476025137
241 changeset: 3:376476025137
242 user: test
242 user: test
243 date: Thu Jan 01 00:00:00 1970 +0000
243 date: Thu Jan 01 00:00:00 1970 +0000
244 summary: 3
244 summary: 3
245
245
246 changeset: 4:70d7eb252d49
246 changeset: 4:70d7eb252d49
247 user: test
247 user: test
248 date: Thu Jan 01 00:00:00 1970 +0000
248 date: Thu Jan 01 00:00:00 1970 +0000
249 summary: 4
249 summary: 4
250
250
251 changeset: 5:ad284ee3b5ee
251 changeset: 5:ad284ee3b5ee
252 user: test
252 user: test
253 date: Thu Jan 01 00:00:00 1970 +0000
253 date: Thu Jan 01 00:00:00 1970 +0000
254 summary: 5
254 summary: 5
255
255
256 changeset: 6:e9229f2de384
256 changeset: 6:e9229f2de384
257 user: test
257 user: test
258 date: Thu Jan 01 00:00:00 1970 +0000
258 date: Thu Jan 01 00:00:00 1970 +0000
259 summary: 6
259 summary: 6
260
260
261 changeset: 7:d152815bb8db
261 changeset: 7:d152815bb8db
262 user: test
262 user: test
263 date: Thu Jan 01 00:00:00 1970 +0000
263 date: Thu Jan 01 00:00:00 1970 +0000
264 summary: 7
264 summary: 7
265
265
266 changeset: 8:e4feb4ac9035
266 changeset: 8:e4feb4ac9035
267 tag: tip
267 tag: tip
268 user: test
268 user: test
269 date: Thu Jan 01 00:00:00 1970 +0000
269 date: Thu Jan 01 00:00:00 1970 +0000
270 summary: 8
270 summary: 8
271
271
272 $ hg -R new incoming --bundle test2.hg test
272 $ hg -R new incoming --bundle test2.hg test
273 comparing with test
273 comparing with test
274 changeset: 0:00a43fa82f62
274 changeset: 0:00a43fa82f62
275 user: test
275 user: test
276 date: Thu Jan 01 00:00:00 1970 +0000
276 date: Thu Jan 01 00:00:00 1970 +0000
277 summary: 0
277 summary: 0
278
278
279 changeset: 1:5460a410df01
279 changeset: 1:5460a410df01
280 user: test
280 user: test
281 date: Thu Jan 01 00:00:00 1970 +0000
281 date: Thu Jan 01 00:00:00 1970 +0000
282 summary: 1
282 summary: 1
283
283
284 changeset: 2:d9f42cd1a1ec
284 changeset: 2:d9f42cd1a1ec
285 user: test
285 user: test
286 date: Thu Jan 01 00:00:00 1970 +0000
286 date: Thu Jan 01 00:00:00 1970 +0000
287 summary: 2
287 summary: 2
288
288
289 changeset: 3:376476025137
289 changeset: 3:376476025137
290 user: test
290 user: test
291 date: Thu Jan 01 00:00:00 1970 +0000
291 date: Thu Jan 01 00:00:00 1970 +0000
292 summary: 3
292 summary: 3
293
293
294 changeset: 4:70d7eb252d49
294 changeset: 4:70d7eb252d49
295 user: test
295 user: test
296 date: Thu Jan 01 00:00:00 1970 +0000
296 date: Thu Jan 01 00:00:00 1970 +0000
297 summary: 4
297 summary: 4
298
298
299 changeset: 5:ad284ee3b5ee
299 changeset: 5:ad284ee3b5ee
300 user: test
300 user: test
301 date: Thu Jan 01 00:00:00 1970 +0000
301 date: Thu Jan 01 00:00:00 1970 +0000
302 summary: 5
302 summary: 5
303
303
304 changeset: 6:e9229f2de384
304 changeset: 6:e9229f2de384
305 user: test
305 user: test
306 date: Thu Jan 01 00:00:00 1970 +0000
306 date: Thu Jan 01 00:00:00 1970 +0000
307 summary: 6
307 summary: 6
308
308
309 changeset: 7:d152815bb8db
309 changeset: 7:d152815bb8db
310 user: test
310 user: test
311 date: Thu Jan 01 00:00:00 1970 +0000
311 date: Thu Jan 01 00:00:00 1970 +0000
312 summary: 7
312 summary: 7
313
313
314 changeset: 8:e4feb4ac9035
314 changeset: 8:e4feb4ac9035
315 tag: tip
315 tag: tip
316 user: test
316 user: test
317 date: Thu Jan 01 00:00:00 1970 +0000
317 date: Thu Jan 01 00:00:00 1970 +0000
318 summary: 8
318 summary: 8
319
319
320
320
321
321
322 test the resulting bundles
322 test the resulting bundles
323
323
324 $ hg init temp
324 $ hg init temp
325 $ hg init temp2
325 $ hg init temp2
326 $ hg -R temp unbundle test.hg
326 $ hg -R temp unbundle test.hg
327 adding changesets
327 adding changesets
328 adding manifests
328 adding manifests
329 adding file changes
329 adding file changes
330 added 9 changesets with 9 changes to 1 files
330 added 9 changesets with 9 changes to 1 files
331 (run 'hg update' to get a working copy)
331 (run 'hg update' to get a working copy)
332 $ hg -R temp2 unbundle test2.hg
332 $ hg -R temp2 unbundle test2.hg
333 adding changesets
333 adding changesets
334 adding manifests
334 adding manifests
335 adding file changes
335 adding file changes
336 added 9 changesets with 9 changes to 1 files
336 added 9 changesets with 9 changes to 1 files
337 (run 'hg update' to get a working copy)
337 (run 'hg update' to get a working copy)
338 $ hg -R temp tip
338 $ hg -R temp tip
339 changeset: 8:e4feb4ac9035
339 changeset: 8:e4feb4ac9035
340 tag: tip
340 tag: tip
341 user: test
341 user: test
342 date: Thu Jan 01 00:00:00 1970 +0000
342 date: Thu Jan 01 00:00:00 1970 +0000
343 summary: 8
343 summary: 8
344
344
345 $ hg -R temp2 tip
345 $ hg -R temp2 tip
346 changeset: 8:e4feb4ac9035
346 changeset: 8:e4feb4ac9035
347 tag: tip
347 tag: tip
348 user: test
348 user: test
349 date: Thu Jan 01 00:00:00 1970 +0000
349 date: Thu Jan 01 00:00:00 1970 +0000
350 summary: 8
350 summary: 8
351
351
352
352
353 $ rm -r temp temp2 new
353 $ rm -r temp temp2 new
354
354
355 test outgoing
355 test outgoing
356
356
357 $ hg clone test test-dev
357 $ hg clone test test-dev
358 updating to branch default
358 updating to branch default
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 $ cd test-dev
360 $ cd test-dev
361 $ for i in 9 10 11 12 13; do
361 $ for i in 9 10 11 12 13; do
362 > echo $i >> foo
362 > echo $i >> foo
363 > hg commit -A -m $i
363 > hg commit -A -m $i
364 > done
364 > done
365 $ hg verify
365 $ hg verify
366 checking changesets
366 checking changesets
367 checking manifests
367 checking manifests
368 crosschecking files in changesets and manifests
368 crosschecking files in changesets and manifests
369 checking files
369 checking files
370 1 files, 14 changesets, 14 total revisions
370 1 files, 14 changesets, 14 total revisions
371 $ cd ..
371 $ cd ..
372 $ hg -R test-dev outgoing test
372 $ hg -R test-dev outgoing test
373 comparing with test
373 comparing with test
374 searching for changes
374 searching for changes
375 changeset: 9:d89d4abea5bc
375 changeset: 9:d89d4abea5bc
376 user: test
376 user: test
377 date: Thu Jan 01 00:00:00 1970 +0000
377 date: Thu Jan 01 00:00:00 1970 +0000
378 summary: 9
378 summary: 9
379
379
380 changeset: 10:820095aa7158
380 changeset: 10:820095aa7158
381 user: test
381 user: test
382 date: Thu Jan 01 00:00:00 1970 +0000
382 date: Thu Jan 01 00:00:00 1970 +0000
383 summary: 10
383 summary: 10
384
384
385 changeset: 11:09ede2f3a638
385 changeset: 11:09ede2f3a638
386 user: test
386 user: test
387 date: Thu Jan 01 00:00:00 1970 +0000
387 date: Thu Jan 01 00:00:00 1970 +0000
388 summary: 11
388 summary: 11
389
389
390 changeset: 12:e576b1bed305
390 changeset: 12:e576b1bed305
391 user: test
391 user: test
392 date: Thu Jan 01 00:00:00 1970 +0000
392 date: Thu Jan 01 00:00:00 1970 +0000
393 summary: 12
393 summary: 12
394
394
395 changeset: 13:96bbff09a7cc
395 changeset: 13:96bbff09a7cc
396 tag: tip
396 tag: tip
397 user: test
397 user: test
398 date: Thu Jan 01 00:00:00 1970 +0000
398 date: Thu Jan 01 00:00:00 1970 +0000
399 summary: 13
399 summary: 13
400
400
401
401
402 limit to 3 changesets
402 limit to 3 changesets
403
403
404 $ hg -R test-dev outgoing -l 3 test
404 $ hg -R test-dev outgoing -l 3 test
405 comparing with test
405 comparing with test
406 searching for changes
406 searching for changes
407 changeset: 9:d89d4abea5bc
407 changeset: 9:d89d4abea5bc
408 user: test
408 user: test
409 date: Thu Jan 01 00:00:00 1970 +0000
409 date: Thu Jan 01 00:00:00 1970 +0000
410 summary: 9
410 summary: 9
411
411
412 changeset: 10:820095aa7158
412 changeset: 10:820095aa7158
413 user: test
413 user: test
414 date: Thu Jan 01 00:00:00 1970 +0000
414 date: Thu Jan 01 00:00:00 1970 +0000
415 summary: 10
415 summary: 10
416
416
417 changeset: 11:09ede2f3a638
417 changeset: 11:09ede2f3a638
418 user: test
418 user: test
419 date: Thu Jan 01 00:00:00 1970 +0000
419 date: Thu Jan 01 00:00:00 1970 +0000
420 summary: 11
420 summary: 11
421
421
422 $ hg -R test-dev outgoing http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
422 $ hg -R test-dev outgoing http://localhost:$HGPORT/
423 comparing with http://localhost:$HGPORT/
423 comparing with http://localhost:.*/
424 searching for changes
424 searching for changes
425 changeset: 9:d89d4abea5bc
425 changeset: 9:d89d4abea5bc
426 user: test
426 user: test
427 date: Thu Jan 01 00:00:00 1970 +0000
427 date: Thu Jan 01 00:00:00 1970 +0000
428 summary: 9
428 summary: 9
429
429
430 changeset: 10:820095aa7158
430 changeset: 10:820095aa7158
431 user: test
431 user: test
432 date: Thu Jan 01 00:00:00 1970 +0000
432 date: Thu Jan 01 00:00:00 1970 +0000
433 summary: 10
433 summary: 10
434
434
435 changeset: 11:09ede2f3a638
435 changeset: 11:09ede2f3a638
436 user: test
436 user: test
437 date: Thu Jan 01 00:00:00 1970 +0000
437 date: Thu Jan 01 00:00:00 1970 +0000
438 summary: 11
438 summary: 11
439
439
440 changeset: 12:e576b1bed305
440 changeset: 12:e576b1bed305
441 user: test
441 user: test
442 date: Thu Jan 01 00:00:00 1970 +0000
442 date: Thu Jan 01 00:00:00 1970 +0000
443 summary: 12
443 summary: 12
444
444
445 changeset: 13:96bbff09a7cc
445 changeset: 13:96bbff09a7cc
446 tag: tip
446 tag: tip
447 user: test
447 user: test
448 date: Thu Jan 01 00:00:00 1970 +0000
448 date: Thu Jan 01 00:00:00 1970 +0000
449 summary: 13
449 summary: 13
450
450
451 $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/ | sed -e "s,:$HGPORT/,:\$HGPORT/,"
451 $ hg -R test-dev outgoing -r 11 http://localhost:$HGPORT/
452 comparing with http://localhost:$HGPORT/
452 comparing with http://localhost:.*/
453 searching for changes
453 searching for changes
454 changeset: 9:d89d4abea5bc
454 changeset: 9:d89d4abea5bc
455 user: test
455 user: test
456 date: Thu Jan 01 00:00:00 1970 +0000
456 date: Thu Jan 01 00:00:00 1970 +0000
457 summary: 9
457 summary: 9
458
458
459 changeset: 10:820095aa7158
459 changeset: 10:820095aa7158
460 user: test
460 user: test
461 date: Thu Jan 01 00:00:00 1970 +0000
461 date: Thu Jan 01 00:00:00 1970 +0000
462 summary: 10
462 summary: 10
463
463
464 changeset: 11:09ede2f3a638
464 changeset: 11:09ede2f3a638
465 user: test
465 user: test
466 date: Thu Jan 01 00:00:00 1970 +0000
466 date: Thu Jan 01 00:00:00 1970 +0000
467 summary: 11
467 summary: 11
468
468
@@ -1,166 +1,166 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
3 $ echo "[mq]" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
4 $ echo "git=keep" >> $HGRCPATH
5
5
6 $ hg init a
6 $ hg init a
7 $ cd a
7 $ cd a
8
8
9 $ echo 'base' > base
9 $ echo 'base' > base
10 $ hg ci -Ambase
10 $ hg ci -Ambase
11 adding base
11 adding base
12
12
13 $ hg qnew -mmqbase mqbase
13 $ hg qnew -mmqbase mqbase
14
14
15 $ echo 'patched' > base
15 $ echo 'patched' > base
16 $ hg qrefresh
16 $ hg qrefresh
17
17
18 qdiff:
18 qdiff:
19
19
20 $ hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
20 $ hg qdiff
21 diff -r d20a80d4def3 base
21 diff -r d20a80d4def3 base
22 --- a/base Thu Jan 01 00:00:00 1970 +0000
22 --- a/base Thu Jan 01 00:00:00 1970 +0000
23 +++ b/base
23 \+\+\+ b/base.*
24 @@ -1,1 +1,1 @@
24 @@ -1,1 +1,1 @@
25 -base
25 -base
26 +patched
26 +patched
27
27
28 qdiff dirname:
28 qdiff dirname:
29
29
30 $ hg qdiff --nodates .
30 $ hg qdiff --nodates .
31 diff -r d20a80d4def3 base
31 diff -r d20a80d4def3 base
32 --- a/base
32 --- a/base
33 +++ b/base
33 +++ b/base
34 @@ -1,1 +1,1 @@
34 @@ -1,1 +1,1 @@
35 -base
35 -base
36 +patched
36 +patched
37
37
38 qdiff filename:
38 qdiff filename:
39
39
40 $ hg qdiff --nodates base
40 $ hg qdiff --nodates base
41 diff -r d20a80d4def3 base
41 diff -r d20a80d4def3 base
42 --- a/base
42 --- a/base
43 +++ b/base
43 +++ b/base
44 @@ -1,1 +1,1 @@
44 @@ -1,1 +1,1 @@
45 -base
45 -base
46 +patched
46 +patched
47
47
48 $ hg revert -a
48 $ hg revert -a
49
49
50 $ hg qpop
50 $ hg qpop
51 popping mqbase
51 popping mqbase
52 patch queue now empty
52 patch queue now empty
53
53
54 $ hg qdelete mqbase
54 $ hg qdelete mqbase
55
55
56 $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
56 $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
57 $ hg ci -Amlines -d '2 0'
57 $ hg ci -Amlines -d '2 0'
58 adding lines
58 adding lines
59
59
60 $ hg qnew -mmqbase2 mqbase2
60 $ hg qnew -mmqbase2 mqbase2
61 $ printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines
61 $ printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines
62
62
63 $ hg qdiff --nodates -U 1
63 $ hg qdiff --nodates -U 1
64 diff -r b0c220e1cf43 lines
64 diff -r b0c220e1cf43 lines
65 --- a/lines
65 --- a/lines
66 +++ b/lines
66 +++ b/lines
67 @@ -1,1 +1,3 @@
67 @@ -1,1 +1,3 @@
68 +
68 +
69 +
69 +
70 1
70 1
71 @@ -4,4 +6,4 @@
71 @@ -4,4 +6,4 @@
72 4
72 4
73 -hello world
73 -hello world
74 -goodbye world
74 -goodbye world
75 +hello world
75 +hello world
76 + goodbye world
76 + goodbye world
77 7
77 7
78
78
79 $ hg qdiff --nodates -b
79 $ hg qdiff --nodates -b
80 diff -r b0c220e1cf43 lines
80 diff -r b0c220e1cf43 lines
81 --- a/lines
81 --- a/lines
82 +++ b/lines
82 +++ b/lines
83 @@ -1,9 +1,11 @@
83 @@ -1,9 +1,11 @@
84 +
84 +
85 +
85 +
86 1
86 1
87 2
87 2
88 3
88 3
89 4
89 4
90 hello world
90 hello world
91 -goodbye world
91 -goodbye world
92 + goodbye world
92 + goodbye world
93 7
93 7
94 8
94 8
95 9
95 9
96
96
97 $ hg qdiff --nodates -U 1 -B
97 $ hg qdiff --nodates -U 1 -B
98 diff -r b0c220e1cf43 lines
98 diff -r b0c220e1cf43 lines
99 --- a/lines
99 --- a/lines
100 +++ b/lines
100 +++ b/lines
101 @@ -4,4 +6,4 @@
101 @@ -4,4 +6,4 @@
102 4
102 4
103 -hello world
103 -hello world
104 -goodbye world
104 -goodbye world
105 +hello world
105 +hello world
106 + goodbye world
106 + goodbye world
107 7
107 7
108
108
109 $ hg qdiff --nodates -w
109 $ hg qdiff --nodates -w
110 diff -r b0c220e1cf43 lines
110 diff -r b0c220e1cf43 lines
111 --- a/lines
111 --- a/lines
112 +++ b/lines
112 +++ b/lines
113 @@ -1,3 +1,5 @@
113 @@ -1,3 +1,5 @@
114 +
114 +
115 +
115 +
116 1
116 1
117 2
117 2
118 3
118 3
119
119
120 $ hg qdiff --nodates --reverse
120 $ hg qdiff --nodates --reverse
121 diff -r b0c220e1cf43 lines
121 diff -r b0c220e1cf43 lines
122 --- a/lines
122 --- a/lines
123 +++ b/lines
123 +++ b/lines
124 @@ -1,11 +1,9 @@
124 @@ -1,11 +1,9 @@
125 -
125 -
126 -
126 -
127 1
127 1
128 2
128 2
129 3
129 3
130 4
130 4
131 -hello world
131 -hello world
132 - goodbye world
132 - goodbye world
133 +hello world
133 +hello world
134 +goodbye world
134 +goodbye world
135 7
135 7
136 8
136 8
137 9
137 9
138
138
139 qdiff preserve existing git flag:
139 qdiff preserve existing git flag:
140
140
141 $ hg qrefresh --git
141 $ hg qrefresh --git
142 $ echo a >> lines
142 $ echo a >> lines
143 $ hg qdiff
143 $ hg qdiff
144 diff --git a/lines b/lines
144 diff --git a/lines b/lines
145 --- a/lines
145 --- a/lines
146 +++ b/lines
146 +++ b/lines
147 @@ -1,9 +1,12 @@
147 @@ -1,9 +1,12 @@
148 +
148 +
149 +
149 +
150 1
150 1
151 2
151 2
152 3
152 3
153 4
153 4
154 -hello world
154 -hello world
155 -goodbye world
155 -goodbye world
156 +hello world
156 +hello world
157 + goodbye world
157 + goodbye world
158 7
158 7
159 8
159 8
160 9
160 9
161 +a
161 +a
162
162
163 $ hg qdiff --stat
163 $ hg qdiff --stat
164 lines | 7 +++++--
164 lines | 7 +++++--
165 1 files changed, 5 insertions(+), 2 deletions(-)
165 1 files changed, 5 insertions(+), 2 deletions(-)
166
166
@@ -1,81 +1,81 b''
1 $ mkdir test
1 $ mkdir test
2 $ cd test
2 $ cd test
3
3
4 $ echo foo>foo
4 $ echo foo>foo
5 $ hg init
5 $ hg init
6 $ hg addremove
6 $ hg addremove
7 adding foo
7 adding foo
8 $ hg commit -m 1
8 $ hg commit -m 1
9
9
10 $ hg verify
10 $ hg verify
11 checking changesets
11 checking changesets
12 checking manifests
12 checking manifests
13 crosschecking files in changesets and manifests
13 crosschecking files in changesets and manifests
14 checking files
14 checking files
15 1 files, 1 changesets, 1 total revisions
15 1 files, 1 changesets, 1 total revisions
16
16
17 $ hg serve -p $HGPORT -d --pid-file=hg.pid
17 $ hg serve -p $HGPORT -d --pid-file=hg.pid
18 $ cat hg.pid >> $DAEMON_PIDS
18 $ cat hg.pid >> $DAEMON_PIDS
19 $ cd ..
19 $ cd ..
20
20
21 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/,"
21 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
22 requesting all changes
22 requesting all changes
23 adding changesets
23 adding changesets
24 adding manifests
24 adding manifests
25 adding file changes
25 adding file changes
26 added 1 changesets with 1 changes to 1 files
26 added 1 changesets with 1 changes to 1 files
27 updating to branch default
27 updating to branch default
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29
29
30 $ cd copy
30 $ cd copy
31 $ hg verify
31 $ hg verify
32 checking changesets
32 checking changesets
33 checking manifests
33 checking manifests
34 crosschecking files in changesets and manifests
34 crosschecking files in changesets and manifests
35 checking files
35 checking files
36 1 files, 1 changesets, 1 total revisions
36 1 files, 1 changesets, 1 total revisions
37
37
38 $ hg co
38 $ hg co
39 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 $ cat foo
40 $ cat foo
41 foo
41 foo
42
42
43 $ hg manifest --debug
43 $ hg manifest --debug
44 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
44 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
45
45
46 $ hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
46 $ hg pull
47 pulling from http://foo:***@localhost:$HGPORT/
47 pulling from http://foo:\*\*\*@localhost:.*/
48 searching for changes
48 searching for changes
49 no changes found
49 no changes found
50
50
51 $ hg rollback --dry-run --verbose | sed -e "s,:$HGPORT/,:\$HGPORT/,"
51 $ hg rollback --dry-run --verbose
52 rolling back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
52 rolling back to revision -1 \(undo pull: http://foo:\*\*\*@localhost:.*/\)
53
53
54 Issue 622:
54 Issue 622:
55
55
56 $ cd ..
56 $ cd ..
57 $ hg init empty
57 $ hg init empty
58 $ cd empty
58 $ cd empty
59 $ hg pull -u ../test
59 $ hg pull -u ../test
60 pulling from ../test
60 pulling from ../test
61 requesting all changes
61 requesting all changes
62 adding changesets
62 adding changesets
63 adding manifests
63 adding manifests
64 adding file changes
64 adding file changes
65 added 1 changesets with 1 changes to 1 files
65 added 1 changesets with 1 changes to 1 files
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67
67
68 Test 'file:' uri handling:
68 Test 'file:' uri handling:
69
69
70 $ hg pull -q file://../test-doesnt-exist
70 $ hg pull -q file://../test-doesnt-exist
71 abort: repository /test-doesnt-exist not found!
71 abort: repository /test-doesnt-exist not found!
72 [255]
72 [255]
73
73
74 $ hg pull -q file:../test
74 $ hg pull -q file:../test
75
75
76 It's tricky to make file:// URLs working on every platform with
76 It's tricky to make file:// URLs working on every platform with
77 regular shell commands.
77 regular shell commands.
78
78
79 $ URL=`python -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
79 $ URL=`python -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
80 $ hg pull -q "$URL"
80 $ hg pull -q "$URL"
81
81
@@ -1,203 +1,201 b''
1 $ "$TESTDIR/hghave" svn || exit 80
1 $ "$TESTDIR/hghave" svn || exit 80
2
2
3 $ fix_path()
3 $ fix_path()
4 > {
4 > {
5 > tr '\\' /
5 > tr '\\' /
6 > }
6 > }
7
7
8 $ escapedwd=`pwd | fix_path`
9
10 SVN wants all paths to start with a slash. Unfortunately, Windows ones
8 SVN wants all paths to start with a slash. Unfortunately, Windows ones
11 don't. Handle that.
9 don't. Handle that.
12
10
11 $ escapedwd=`pwd | fix_path`
13 $ expr "$escapedwd" : / > /dev/null || escapedwd="/$escapedwd"
12 $ expr "$escapedwd" : / > /dev/null || escapedwd="/$escapedwd"
14 $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
13 $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"`
15 $ filterpath="s|$escapedwd|/root|"
16 $ filteroutofdate='s/ in transaction.*/ is out of date/;s/Out of date: /File /'
17
14
18 create subversion repo
15 create subversion repo
19
16
20 $ SVNREPO="file://$escapedwd/svn-repo"
17 $ SVNREPO="file://$escapedwd/svn-repo"
21 $ WCROOT="`pwd`/svn-wc"
18 $ WCROOT="`pwd`/svn-wc"
22 $ svnadmin create svn-repo
19 $ svnadmin create svn-repo
23 $ svn co "$SVNREPO" svn-wc
20 $ svn co "$SVNREPO" svn-wc
24 Checked out revision 0.
21 Checked out revision 0.
25 $ cd svn-wc
22 $ cd svn-wc
26 $ mkdir src
23 $ mkdir src
27 $ echo alpha > src/alpha
24 $ echo alpha > src/alpha
28 $ svn add src
25 $ svn add src
29 A src
26 A src
30 A src/alpha
27 A src/alpha
31 $ mkdir externals
28 $ mkdir externals
32 $ echo other > externals/other
29 $ echo other > externals/other
33 $ svn add externals
30 $ svn add externals
34 A externals
31 A externals
35 A externals/other
32 A externals/other
36 $ svn ci -m 'Add alpha'
33 $ svn ci -m 'Add alpha'
37 Adding externals
34 Adding externals
38 Adding externals/other
35 Adding externals/other
39 Adding src
36 Adding src
40 Adding src/alpha
37 Adding src/alpha
41 Transmitting file data ..
38 Transmitting file data ..
42 Committed revision 1.
39 Committed revision 1.
43 $ svn up
40 $ svn up
44 At revision 1.
41 At revision 1.
45 $ echo "externals -r1 $SVNREPO/externals" > extdef
42 $ echo "externals -r1 $SVNREPO/externals" > extdef
46 $ svn propset -F extdef svn:externals src
43 $ svn propset -F extdef svn:externals src
47 property 'svn:externals' set on 'src'
44 property 'svn:externals' set on 'src'
48 $ svn ci -m 'Setting externals'
45 $ svn ci -m 'Setting externals'
49 Sending src
46 Sending src
50
47
51 Committed revision 2.
48 Committed revision 2.
52 $ cd ..
49 $ cd ..
53
50
54 create hg repo
51 create hg repo
55
52
56 $ mkdir sub
53 $ mkdir sub
57 $ cd sub
54 $ cd sub
58 $ hg init t
55 $ hg init t
59 $ cd t
56 $ cd t
60
57
61 first revision, no sub
58 first revision, no sub
62
59
63 $ echo a > a
60 $ echo a > a
64 $ hg ci -Am0
61 $ hg ci -Am0
65 adding a
62 adding a
66
63
67 add first svn sub with leading whitespaces
64 add first svn sub with leading whitespaces
68
65
69 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
66 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
70 $ svn co --quiet "$SVNREPO"/src s
67 $ svn co --quiet "$SVNREPO"/src s
71 $ hg add .hgsub
68 $ hg add .hgsub
72 $ hg ci -m1
69 $ hg ci -m1
73 committing subrepository s
70 committing subrepository s
74
71
75 debugsub
72 debugsub
76
73
77 $ hg debugsub | sed "$filterpath"
74 $ hg debugsub
78 path s
75 path s
79 source file:///root/svn-repo/src
76 source file:///.*/svn-repo/src
80 revision 2
77 revision 2
81
78
82 change file in svn and hg, commit
79 change file in svn and hg, commit
83
80
84 $ echo a >> a
81 $ echo a >> a
85 $ echo alpha >> s/alpha
82 $ echo alpha >> s/alpha
86 $ hg commit -m 'Message!' \
83 $ hg commit -m 'Message!'
87 > | sed 's:Sending.*s/alpha:Sending s/alpha:g'
88 committing subrepository s
84 committing subrepository s
89 Sending s/alpha
85 Sending.*s/alpha
90 Transmitting file data .
86 Transmitting file data .
91 Committed revision 3.
87 Committed revision 3.
92
88
93 Fetching external item into '.*/s/externals'
89 Fetching external item into '.*/s/externals'
94 External at revision 1.
90 External at revision 1.
95
91
96 At revision 3.
92 At revision 3.
97 $ hg debugsub | sed "$filterpath"
93 $ hg debugsub
98 path s
94 path s
99 source file:///root/svn-repo/src
95 source file:///.*/svn-repo/src
100 revision 3
96 revision 3
101
97
102 $ echo a > s/a
98 $ echo a > s/a
103
99
104 should be empty despite change to s/a
100 should be empty despite change to s/a
105
101
106 $ hg st
102 $ hg st
107
103
108 add a commit from svn
104 add a commit from svn
109
105
110 $ cd "$WCROOT"/src
106 $ cd "$WCROOT"/src
111 $ svn up
107 $ svn up
112 U alpha
108 U alpha
113
109
114 Fetching external item into 'externals'
110 Fetching external item into 'externals'
115 A externals/other
111 A externals/other
116 Updated external to revision 1.
112 Updated external to revision 1.
117
113
118 Updated to revision 3.
114 Updated to revision 3.
119 $ echo xyz >> alpha
115 $ echo xyz >> alpha
120 $ svn propset svn:mime-type 'text/xml' alpha
116 $ svn propset svn:mime-type 'text/xml' alpha
121 property 'svn:mime-type' set on 'alpha'
117 property 'svn:mime-type' set on 'alpha'
122 $ svn ci -m 'amend a from svn'
118 $ svn ci -m 'amend a from svn'
123 Sending src/alpha
119 Sending src/alpha
124 Transmitting file data .
120 Transmitting file data .
125 Committed revision 4.
121 Committed revision 4.
126 $ cd ../../sub/t
122 $ cd ../../sub/t
127
123
128 this commit from hg will fail
124 this commit from hg will fail
129
125
130 $ echo zzz >> s/alpha
126 $ echo zzz >> s/alpha
131 $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
127 $ hg ci -m 'amend alpha from hg'
132 committing subrepository s
128 committing subrepository s
133 abort: svn: Commit failed (details follow):
129 abort: svn: Commit failed (details follow):
134 svn: File '/src/alpha' is out of date
130 svn: (Out of date)?.*/src/alpha.*(is out of date)?
131 [255]
135 $ svn revert -q s/alpha
132 $ svn revert -q s/alpha
136
133
137 this commit fails because of meta changes
134 this commit fails because of meta changes
138
135
139 $ svn propset svn:mime-type 'text/html' s/alpha
136 $ svn propset svn:mime-type 'text/html' s/alpha
140 property 'svn:mime-type' set on 's/alpha'
137 property 'svn:mime-type' set on 's/alpha'
141 $ hg ci -m 'amend alpha from hg' 2>&1 | sed "$filteroutofdate"
138 $ hg ci -m 'amend alpha from hg'
142 committing subrepository s
139 committing subrepository s
143 abort: svn: Commit failed (details follow):
140 abort: svn: Commit failed (details follow):
144 svn: File '/src/alpha' is out of date
141 svn: (Out of date)?.*/src/alpha.*(is out of date)?
142 [255]
145 $ svn revert -q s/alpha
143 $ svn revert -q s/alpha
146
144
147 this commit fails because of externals changes
145 this commit fails because of externals changes
148
146
149 $ echo zzz > s/externals/other
147 $ echo zzz > s/externals/other
150 $ hg ci -m 'amend externals from hg'
148 $ hg ci -m 'amend externals from hg'
151 committing subrepository s
149 committing subrepository s
152 abort: cannot commit svn externals
150 abort: cannot commit svn externals
153 [255]
151 [255]
154 $ hg diff --subrepos -r 1:2 | grep -v diff
152 $ hg diff --subrepos -r 1:2 | grep -v diff
155 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
153 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
156 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
154 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
157 @@ -1,1 +1,1 @@
155 @@ -1,1 +1,1 @@
158 -2 s
156 -2 s
159 +3 s
157 +3 s
160 --- a/a Thu Jan 01 00:00:00 1970 +0000
158 --- a/a Thu Jan 01 00:00:00 1970 +0000
161 +++ b/a Thu Jan 01 00:00:00 1970 +0000
159 +++ b/a Thu Jan 01 00:00:00 1970 +0000
162 @@ -1,1 +1,2 @@
160 @@ -1,1 +1,2 @@
163 a
161 a
164 +a
162 +a
165 $ svn revert -q s/externals/other
163 $ svn revert -q s/externals/other
166
164
167 this commit fails because of externals meta changes
165 this commit fails because of externals meta changes
168
166
169 $ svn propset svn:mime-type 'text/html' s/externals/other
167 $ svn propset svn:mime-type 'text/html' s/externals/other
170 property 'svn:mime-type' set on 's/externals/other'
168 property 'svn:mime-type' set on 's/externals/other'
171 $ hg ci -m 'amend externals from hg'
169 $ hg ci -m 'amend externals from hg'
172 committing subrepository s
170 committing subrepository s
173 abort: cannot commit svn externals
171 abort: cannot commit svn externals
174 [255]
172 [255]
175 $ svn revert -q s/externals/other
173 $ svn revert -q s/externals/other
176
174
177 clone
175 clone
178
176
179 $ cd ..
177 $ cd ..
180 $ hg clone t tc | fix_path
178 $ hg clone t tc | fix_path
181 updating to branch default
179 updating to branch default
182 A tc/s/alpha
180 A tc/s/alpha
183 U tc/s
181 U tc/s
184
182
185 Fetching external item into 'tc/s/externals'
183 Fetching external item into 'tc/s/externals'
186 A tc/s/externals/other
184 A tc/s/externals/other
187 Checked out external at revision 1.
185 Checked out external at revision 1.
188
186
189 Checked out revision 3.
187 Checked out revision 3.
190 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
188 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 $ cd tc
189 $ cd tc
192
190
193 debugsub in clone
191 debugsub in clone
194
192
195 $ hg debugsub | sed "$filterpath"
193 $ hg debugsub
196 path s
194 path s
197 source file:///root/svn-repo/src
195 source file:///.*/svn-repo/src
198 revision 3
196 revision 3
199
197
200 verify subrepo is contained within the repo directory
198 verify subrepo is contained within the repo directory
201
199
202 $ python -c "import os.path; print os.path.exists('s')"
200 $ python -c "import os.path; print os.path.exists('s')"
203 True
201 True
@@ -1,370 +1,370 b''
1 Helper functions:
1 Helper functions:
2
2
3 $ cacheexists() {
3 $ cacheexists() {
4 > [ -f .hg/tags.cache ] && echo "tag cache exists" || echo "no tag cache"
4 > [ -f .hg/tags.cache ] && echo "tag cache exists" || echo "no tag cache"
5 > }
5 > }
6
6
7 $ dumptags() {
7 $ dumptags() {
8 > rev=$1
8 > rev=$1
9 > echo "rev $rev: .hgtags:"
9 > echo "rev $rev: .hgtags:"
10 > hg cat -r$rev .hgtags
10 > hg cat -r$rev .hgtags
11 > }
11 > }
12
12
13 # XXX need to test that the tag cache works when we strip an old head
13 # XXX need to test that the tag cache works when we strip an old head
14 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
14 # and add a new one rooted off non-tip: i.e. node and rev of tip are the
15 # same, but stuff has changed behind tip.
15 # same, but stuff has changed behind tip.
16
16
17 Setup:
17 Setup:
18
18
19 $ hg init t
19 $ hg init t
20 $ cd t
20 $ cd t
21 $ cacheexists
21 $ cacheexists
22 no tag cache
22 no tag cache
23 $ hg id
23 $ hg id
24 000000000000 tip
24 000000000000 tip
25 $ cacheexists
25 $ cacheexists
26 no tag cache
26 no tag cache
27 $ echo a > a
27 $ echo a > a
28 $ hg add a
28 $ hg add a
29 $ hg commit -m "test"
29 $ hg commit -m "test"
30 $ hg co
30 $ hg co
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 $ hg identify
32 $ hg identify
33 acb14030fe0a tip
33 acb14030fe0a tip
34 $ cacheexists
34 $ cacheexists
35 tag cache exists
35 tag cache exists
36
36
37 Create local tag with long name:
37 Create local tag with long name:
38
38
39 $ T=`hg identify --debug --id`
39 $ T=`hg identify --debug --id`
40 $ hg tag -l "This is a local tag with a really long name!"
40 $ hg tag -l "This is a local tag with a really long name!"
41 $ hg tags
41 $ hg tags
42 tip 0:acb14030fe0a
42 tip 0:acb14030fe0a
43 This is a local tag with a really long name! 0:acb14030fe0a
43 This is a local tag with a really long name! 0:acb14030fe0a
44 $ rm .hg/localtags
44 $ rm .hg/localtags
45
45
46 Create a tag behind hg's back:
46 Create a tag behind hg's back:
47
47
48 $ echo "$T first" > .hgtags
48 $ echo "$T first" > .hgtags
49 $ cat .hgtags
49 $ cat .hgtags
50 acb14030fe0a21b60322c440ad2d20cf7685a376 first
50 acb14030fe0a21b60322c440ad2d20cf7685a376 first
51 $ hg add .hgtags
51 $ hg add .hgtags
52 $ hg commit -m "add tags"
52 $ hg commit -m "add tags"
53 $ hg tags
53 $ hg tags
54 tip 1:b9154636be93
54 tip 1:b9154636be93
55 first 0:acb14030fe0a
55 first 0:acb14030fe0a
56 $ hg identify
56 $ hg identify
57 b9154636be93 tip
57 b9154636be93 tip
58
58
59 Repeat with cold tag cache:
59 Repeat with cold tag cache:
60
60
61 $ rm -f .hg/tags.cache
61 $ rm -f .hg/tags.cache
62 $ hg identify
62 $ hg identify
63 b9154636be93 tip
63 b9154636be93 tip
64
64
65 And again, but now unable to write tag cache:
65 And again, but now unable to write tag cache:
66
66
67 $ rm -f .hg/tags.cache
67 $ rm -f .hg/tags.cache
68 $ chmod 555 .hg
68 $ chmod 555 .hg
69 $ hg identify
69 $ hg identify
70 b9154636be93 tip
70 b9154636be93 tip
71 $ chmod 755 .hg
71 $ chmod 755 .hg
72
72
73 Create a branch:
73 Create a branch:
74
74
75 $ echo bb > a
75 $ echo bb > a
76 $ hg status
76 $ hg status
77 M a
77 M a
78 $ hg identify
78 $ hg identify
79 b9154636be93+ tip
79 b9154636be93+ tip
80 $ hg co first
80 $ hg co first
81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 $ hg id
82 $ hg id
83 acb14030fe0a+ first
83 acb14030fe0a+ first
84 $ hg -v id
84 $ hg -v id
85 acb14030fe0a+ first
85 acb14030fe0a+ first
86 $ hg status
86 $ hg status
87 M a
87 M a
88 $ echo 1 > b
88 $ echo 1 > b
89 $ hg add b
89 $ hg add b
90 $ hg commit -m "branch"
90 $ hg commit -m "branch"
91 created new head
91 created new head
92 $ hg id
92 $ hg id
93 c8edf04160c7 tip
93 c8edf04160c7 tip
94
94
95 Merge the two heads:
95 Merge the two heads:
96
96
97 $ hg merge 1
97 $ hg merge 1
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 (branch merge, don't forget to commit)
99 (branch merge, don't forget to commit)
100 $ hg id
100 $ hg id
101 c8edf04160c7+b9154636be93+ tip
101 c8edf04160c7+b9154636be93+ tip
102 $ hg status
102 $ hg status
103 M .hgtags
103 M .hgtags
104 $ hg commit -m "merge"
104 $ hg commit -m "merge"
105
105
106 Create a fake head, make sure tag not visible afterwards:
106 Create a fake head, make sure tag not visible afterwards:
107
107
108 $ cp .hgtags tags
108 $ cp .hgtags tags
109 $ hg tag last
109 $ hg tag last
110 $ hg rm .hgtags
110 $ hg rm .hgtags
111 $ hg commit -m "remove"
111 $ hg commit -m "remove"
112
112
113 $ mv tags .hgtags
113 $ mv tags .hgtags
114 $ hg add .hgtags
114 $ hg add .hgtags
115 $ hg commit -m "readd"
115 $ hg commit -m "readd"
116 $
116 $
117 $ hg tags
117 $ hg tags
118 tip 6:35ff301afafe
118 tip 6:35ff301afafe
119 first 0:acb14030fe0a
119 first 0:acb14030fe0a
120
120
121 Add invalid tags:
121 Add invalid tags:
122
122
123 $ echo "spam" >> .hgtags
123 $ echo "spam" >> .hgtags
124 $ echo >> .hgtags
124 $ echo >> .hgtags
125 $ echo "foo bar" >> .hgtags
125 $ echo "foo bar" >> .hgtags
126 $ echo "$T invalid" | sed "s/..../a5a5/" >> .hg/localtags
126 $ echo "a5a5 invalid" >> .hg/localtags
127 $ echo "committing .hgtags:"
127 $ echo "committing .hgtags:"
128 committing .hgtags:
128 committing .hgtags:
129 $ cat .hgtags
129 $ cat .hgtags
130 acb14030fe0a21b60322c440ad2d20cf7685a376 first
130 acb14030fe0a21b60322c440ad2d20cf7685a376 first
131 spam
131 spam
132
132
133 foo bar
133 foo bar
134 $ hg commit -m "tags"
134 $ hg commit -m "tags"
135
135
136 Report tag parse error on other head:
136 Report tag parse error on other head:
137
137
138 $ hg up 3
138 $ hg up 3
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ echo 'x y' >> .hgtags
140 $ echo 'x y' >> .hgtags
141 $ hg commit -m "head"
141 $ hg commit -m "head"
142 created new head
142 created new head
143
143
144 $ hg tags
144 $ hg tags
145 .hgtags@75d9f02dfe28, line 2: cannot parse entry
145 .hgtags@75d9f02dfe28, line 2: cannot parse entry
146 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
146 .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed
147 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
147 .hgtags@c4be69a18c11, line 2: node 'x' is not well formed
148 tip 8:c4be69a18c11
148 tip 8:c4be69a18c11
149 first 0:acb14030fe0a
149 first 0:acb14030fe0a
150 $ hg tip
150 $ hg tip
151 changeset: 8:c4be69a18c11
151 changeset: 8:c4be69a18c11
152 tag: tip
152 tag: tip
153 parent: 3:ac5e980c4dc0
153 parent: 3:ac5e980c4dc0
154 user: test
154 user: test
155 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
156 summary: head
156 summary: head
157
157
158
158
159 Test tag precedence rules:
159 Test tag precedence rules:
160
160
161 $ cd ..
161 $ cd ..
162 $ hg init t2
162 $ hg init t2
163 $ cd t2
163 $ cd t2
164 $ echo foo > foo
164 $ echo foo > foo
165 $ hg add foo
165 $ hg add foo
166 $ hg ci -m 'add foo' # rev 0
166 $ hg ci -m 'add foo' # rev 0
167 $ hg tag bar # rev 1
167 $ hg tag bar # rev 1
168 $ echo >> foo
168 $ echo >> foo
169 $ hg ci -m 'change foo 1' # rev 2
169 $ hg ci -m 'change foo 1' # rev 2
170 $ hg up -C 1
170 $ hg up -C 1
171 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
172 $ hg tag -r 1 -f bar # rev 3
172 $ hg tag -r 1 -f bar # rev 3
173 $ hg up -C 1
173 $ hg up -C 1
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 $ echo >> foo
175 $ echo >> foo
176 $ hg ci -m 'change foo 2' # rev 4
176 $ hg ci -m 'change foo 2' # rev 4
177 created new head
177 created new head
178 $ hg tags
178 $ hg tags
179 tip 4:0c192d7d5e6b
179 tip 4:0c192d7d5e6b
180 bar 1:78391a272241
180 bar 1:78391a272241
181
181
182 Repeat in case of cache effects:
182 Repeat in case of cache effects:
183
183
184 $ hg tags
184 $ hg tags
185 tip 4:0c192d7d5e6b
185 tip 4:0c192d7d5e6b
186 bar 1:78391a272241
186 bar 1:78391a272241
187
187
188 Detailed dump of tag info:
188 Detailed dump of tag info:
189
189
190 $ hg heads -q # expect 4, 3, 2
190 $ hg heads -q # expect 4, 3, 2
191 4:0c192d7d5e6b
191 4:0c192d7d5e6b
192 3:6fa450212aeb
192 3:6fa450212aeb
193 2:7a94127795a3
193 2:7a94127795a3
194 $ dumptags 2
194 $ dumptags 2
195 rev 2: .hgtags:
195 rev 2: .hgtags:
196 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
196 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
197 $ dumptags 3
197 $ dumptags 3
198 rev 3: .hgtags:
198 rev 3: .hgtags:
199 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
199 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
200 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
200 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
201 78391a272241d70354aa14c874552cad6b51bb42 bar
201 78391a272241d70354aa14c874552cad6b51bb42 bar
202 $ dumptags 4
202 $ dumptags 4
203 rev 4: .hgtags:
203 rev 4: .hgtags:
204 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
204 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
205
205
206 Dump cache:
206 Dump cache:
207
207
208 $ cat .hg/tags.cache
208 $ cat .hg/tags.cache
209 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
209 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d
210 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
210 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0
211 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
211 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d
212
212
213 78391a272241d70354aa14c874552cad6b51bb42 bar
213 78391a272241d70354aa14c874552cad6b51bb42 bar
214
214
215 Test tag removal:
215 Test tag removal:
216
216
217 $ hg tag --remove bar # rev 5
217 $ hg tag --remove bar # rev 5
218 $ hg tip -vp
218 $ hg tip -vp
219 changeset: 5:5f6e8655b1c7
219 changeset: 5:5f6e8655b1c7
220 tag: tip
220 tag: tip
221 user: test
221 user: test
222 date: Thu Jan 01 00:00:00 1970 +0000
222 date: Thu Jan 01 00:00:00 1970 +0000
223 files: .hgtags
223 files: .hgtags
224 description:
224 description:
225 Removed tag bar
225 Removed tag bar
226
226
227
227
228 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
228 diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags
229 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
229 --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000
230 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
230 +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000
231 @@ -1,1 +1,3 @@
231 @@ -1,1 +1,3 @@
232 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
232 bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar
233 +78391a272241d70354aa14c874552cad6b51bb42 bar
233 +78391a272241d70354aa14c874552cad6b51bb42 bar
234 +0000000000000000000000000000000000000000 bar
234 +0000000000000000000000000000000000000000 bar
235
235
236 $ hg tags
236 $ hg tags
237 tip 5:5f6e8655b1c7
237 tip 5:5f6e8655b1c7
238 $ hg tags # again, try to expose cache bugs
238 $ hg tags # again, try to expose cache bugs
239 tip 5:5f6e8655b1c7
239 tip 5:5f6e8655b1c7
240
240
241 Remove nonexistent tag:
241 Remove nonexistent tag:
242
242
243 $ hg tag --remove foobar
243 $ hg tag --remove foobar
244 abort: tag 'foobar' does not exist
244 abort: tag 'foobar' does not exist
245 [255]
245 [255]
246 $ hg tip
246 $ hg tip
247 changeset: 5:5f6e8655b1c7
247 changeset: 5:5f6e8655b1c7
248 tag: tip
248 tag: tip
249 user: test
249 user: test
250 date: Thu Jan 01 00:00:00 1970 +0000
250 date: Thu Jan 01 00:00:00 1970 +0000
251 summary: Removed tag bar
251 summary: Removed tag bar
252
252
253
253
254 Undo a tag with rollback:
254 Undo a tag with rollback:
255
255
256 $ hg rollback # destroy rev 5 (restore bar)
256 $ hg rollback # destroy rev 5 (restore bar)
257 rolling back to revision 4 (undo commit)
257 rolling back to revision 4 (undo commit)
258 $ hg tags
258 $ hg tags
259 tip 4:0c192d7d5e6b
259 tip 4:0c192d7d5e6b
260 bar 1:78391a272241
260 bar 1:78391a272241
261 $ hg tags
261 $ hg tags
262 tip 4:0c192d7d5e6b
262 tip 4:0c192d7d5e6b
263 bar 1:78391a272241
263 bar 1:78391a272241
264
264
265 Test tag rank:
265 Test tag rank:
266
266
267 $ cd ..
267 $ cd ..
268 $ hg init t3
268 $ hg init t3
269 $ cd t3
269 $ cd t3
270 $ echo foo > foo
270 $ echo foo > foo
271 $ hg add foo
271 $ hg add foo
272 $ hg ci -m 'add foo' # rev 0
272 $ hg ci -m 'add foo' # rev 0
273 $ hg tag -f bar # rev 1 bar -> 0
273 $ hg tag -f bar # rev 1 bar -> 0
274 $ hg tag -f bar # rev 2 bar -> 1
274 $ hg tag -f bar # rev 2 bar -> 1
275 $ hg tag -fr 0 bar # rev 3 bar -> 0
275 $ hg tag -fr 0 bar # rev 3 bar -> 0
276 $ hg tag -fr 1 bar # rev 4 bar -> 1
276 $ hg tag -fr 1 bar # rev 4 bar -> 1
277 $ hg tag -fr 0 bar # rev 5 bar -> 0
277 $ hg tag -fr 0 bar # rev 5 bar -> 0
278 $ hg tags
278 $ hg tags
279 tip 5:85f05169d91d
279 tip 5:85f05169d91d
280 bar 0:bbd179dfa0a7
280 bar 0:bbd179dfa0a7
281 $ hg co 3
281 $ hg co 3
282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 $ echo barbar > foo
283 $ echo barbar > foo
284 $ hg ci -m 'change foo' # rev 6
284 $ hg ci -m 'change foo' # rev 6
285 created new head
285 created new head
286 $ hg tags
286 $ hg tags
287 tip 6:735c3ca72986
287 tip 6:735c3ca72986
288 bar 0:bbd179dfa0a7
288 bar 0:bbd179dfa0a7
289
289
290 Don't allow moving tag without -f:
290 Don't allow moving tag without -f:
291
291
292 $ hg tag -r 3 bar
292 $ hg tag -r 3 bar
293 abort: tag 'bar' already exists (use -f to force)
293 abort: tag 'bar' already exists (use -f to force)
294 [255]
294 [255]
295 $ hg tags
295 $ hg tags
296 tip 6:735c3ca72986
296 tip 6:735c3ca72986
297 bar 0:bbd179dfa0a7
297 bar 0:bbd179dfa0a7
298
298
299 Strip 1: expose an old head:
299 Strip 1: expose an old head:
300
300
301 $ hg --config extensions.mq= strip 5
301 $ hg --config extensions.mq= strip 5
302 saved backup bundle to .*
302 saved backup bundle to .*
303 $ hg tags # partly stale cache
303 $ hg tags # partly stale cache
304 tip 5:735c3ca72986
304 tip 5:735c3ca72986
305 bar 1:78391a272241
305 bar 1:78391a272241
306 $ hg tags # up-to-date cache
306 $ hg tags # up-to-date cache
307 tip 5:735c3ca72986
307 tip 5:735c3ca72986
308 bar 1:78391a272241
308 bar 1:78391a272241
309
309
310 Strip 2: destroy whole branch, no old head exposed
310 Strip 2: destroy whole branch, no old head exposed
311
311
312 $ hg --config extensions.mq= strip 4
312 $ hg --config extensions.mq= strip 4
313 saved backup bundle to .*
313 saved backup bundle to .*
314 $ hg tags # partly stale
314 $ hg tags # partly stale
315 tip 4:735c3ca72986
315 tip 4:735c3ca72986
316 bar 0:bbd179dfa0a7
316 bar 0:bbd179dfa0a7
317 $ rm -f .hg/tags.cache
317 $ rm -f .hg/tags.cache
318 $ hg tags # cold cache
318 $ hg tags # cold cache
319 tip 4:735c3ca72986
319 tip 4:735c3ca72986
320 bar 0:bbd179dfa0a7
320 bar 0:bbd179dfa0a7
321
321
322 Test tag rank with 3 heads:
322 Test tag rank with 3 heads:
323
323
324 $ cd ..
324 $ cd ..
325 $ hg init t4
325 $ hg init t4
326 $ cd t4
326 $ cd t4
327 $ echo foo > foo
327 $ echo foo > foo
328 $ hg add
328 $ hg add
329 adding foo
329 adding foo
330 $ hg ci -m 'add foo' # rev 0
330 $ hg ci -m 'add foo' # rev 0
331 $ hg tag bar # rev 1 bar -> 0
331 $ hg tag bar # rev 1 bar -> 0
332 $ hg tag -f bar # rev 2 bar -> 1
332 $ hg tag -f bar # rev 2 bar -> 1
333 $ hg up -qC 0
333 $ hg up -qC 0
334 $ hg tag -fr 2 bar # rev 3 bar -> 2
334 $ hg tag -fr 2 bar # rev 3 bar -> 2
335 $ hg tags
335 $ hg tags
336 tip 3:197c21bbbf2c
336 tip 3:197c21bbbf2c
337 bar 2:6fa450212aeb
337 bar 2:6fa450212aeb
338 $ hg up -qC 0
338 $ hg up -qC 0
339 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
339 $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2
340
340
341 Bar should still point to rev 2:
341 Bar should still point to rev 2:
342
342
343 $ hg tags
343 $ hg tags
344 tip 4:3b4b14ed0202
344 tip 4:3b4b14ed0202
345 bar 2:6fa450212aeb
345 bar 2:6fa450212aeb
346
346
347 Test that removing global/local tags does not get confused when trying
347 Test that removing global/local tags does not get confused when trying
348 to remove a tag of type X which actually only exists as a type Y:
348 to remove a tag of type X which actually only exists as a type Y:
349
349
350 $ cd ..
350 $ cd ..
351 $ hg init t5
351 $ hg init t5
352 $ cd t5
352 $ cd t5
353 $ echo foo > foo
353 $ echo foo > foo
354 $ hg add
354 $ hg add
355 adding foo
355 adding foo
356 $ hg ci -m 'add foo' # rev 0
356 $ hg ci -m 'add foo' # rev 0
357
357
358 $ hg tag -r 0 -l localtag
358 $ hg tag -r 0 -l localtag
359 $ hg tag --remove localtag
359 $ hg tag --remove localtag
360 abort: tag 'localtag' is not a global tag
360 abort: tag 'localtag' is not a global tag
361 [255]
361 [255]
362 $
362 $
363 $ hg tag -r 0 globaltag
363 $ hg tag -r 0 globaltag
364 $ hg tag --remove -l globaltag
364 $ hg tag --remove -l globaltag
365 abort: tag 'globaltag' is not a local tag
365 abort: tag 'globaltag' is not a local tag
366 [255]
366 [255]
367 $ hg tags -v
367 $ hg tags -v
368 tip 1:a0b6fe111088
368 tip 1:a0b6fe111088
369 localtag 0:bbd179dfa0a7 local
369 localtag 0:bbd179dfa0a7 local
370 globaltag 0:bbd179dfa0a7
370 globaltag 0:bbd179dfa0a7
General Comments 0
You need to be logged in to leave comments. Login now