##// END OF EJS Templates
tests: omit -p for external diff via extdiff extension for portability...
FUJIWARA Katsunori -
r28033:0707bbec default
parent child Browse files
Show More
@@ -1,587 +1,589 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 """style and portability checker for Mercurial
10 """style and portability checker for Mercurial
11
11
12 when a rule triggers wrong, do one of the following (prefer one from top):
12 when a rule triggers wrong, do one of the following (prefer one from top):
13 * do the work-around the rule suggests
13 * do the work-around the rule suggests
14 * doublecheck that it is a false match
14 * doublecheck that it is a false match
15 * improve the rule pattern
15 * improve the rule pattern
16 * add an ignore pattern to the rule (3rd arg) which matches your good line
16 * add an ignore pattern to the rule (3rd arg) which matches your good line
17 (you can append a short comment and match this, like: #re-raises, # no-py24)
17 (you can append a short comment and match this, like: #re-raises, # no-py24)
18 * change the pattern to a warning and list the exception in test-check-code-hg
18 * change the pattern to a warning and list the exception in test-check-code-hg
19 * ONLY use no--check-code for skipping entire files from external sources
19 * ONLY use no--check-code for skipping entire files from external sources
20 """
20 """
21
21
22 import re, glob, os, sys
22 import re, glob, os, sys
23 import keyword
23 import keyword
24 import optparse
24 import optparse
25 try:
25 try:
26 import re2
26 import re2
27 except ImportError:
27 except ImportError:
28 re2 = None
28 re2 = None
29
29
30 def compilere(pat, multiline=False):
30 def compilere(pat, multiline=False):
31 if multiline:
31 if multiline:
32 pat = '(?m)' + pat
32 pat = '(?m)' + pat
33 if re2:
33 if re2:
34 try:
34 try:
35 return re2.compile(pat)
35 return re2.compile(pat)
36 except re2.error:
36 except re2.error:
37 pass
37 pass
38 return re.compile(pat)
38 return re.compile(pat)
39
39
40 def repquote(m):
40 def repquote(m):
41 fromc = '.:'
41 fromc = '.:'
42 tochr = 'pq'
42 tochr = 'pq'
43 def encodechr(i):
43 def encodechr(i):
44 if i > 255:
44 if i > 255:
45 return 'u'
45 return 'u'
46 c = chr(i)
46 c = chr(i)
47 if c in ' \n':
47 if c in ' \n':
48 return c
48 return c
49 if c.isalpha():
49 if c.isalpha():
50 return 'x'
50 return 'x'
51 if c.isdigit():
51 if c.isdigit():
52 return 'n'
52 return 'n'
53 try:
53 try:
54 return tochr[fromc.find(c)]
54 return tochr[fromc.find(c)]
55 except (ValueError, IndexError):
55 except (ValueError, IndexError):
56 return 'o'
56 return 'o'
57 t = m.group('text')
57 t = m.group('text')
58 tt = ''.join(encodechr(i) for i in xrange(256))
58 tt = ''.join(encodechr(i) for i in xrange(256))
59 t = t.translate(tt)
59 t = t.translate(tt)
60 return m.group('quote') + t + m.group('quote')
60 return m.group('quote') + t + m.group('quote')
61
61
62 def reppython(m):
62 def reppython(m):
63 comment = m.group('comment')
63 comment = m.group('comment')
64 if comment:
64 if comment:
65 l = len(comment.rstrip())
65 l = len(comment.rstrip())
66 return "#" * l + comment[l:]
66 return "#" * l + comment[l:]
67 return repquote(m)
67 return repquote(m)
68
68
69 def repcomment(m):
69 def repcomment(m):
70 return m.group(1) + "#" * len(m.group(2))
70 return m.group(1) + "#" * len(m.group(2))
71
71
72 def repccomment(m):
72 def repccomment(m):
73 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
73 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
74 return m.group(1) + t + "*/"
74 return m.group(1) + t + "*/"
75
75
76 def repcallspaces(m):
76 def repcallspaces(m):
77 t = re.sub(r"\n\s+", "\n", m.group(2))
77 t = re.sub(r"\n\s+", "\n", m.group(2))
78 return m.group(1) + t
78 return m.group(1) + t
79
79
80 def repinclude(m):
80 def repinclude(m):
81 return m.group(1) + "<foo>"
81 return m.group(1) + "<foo>"
82
82
83 def rephere(m):
83 def rephere(m):
84 t = re.sub(r"\S", "x", m.group(2))
84 t = re.sub(r"\S", "x", m.group(2))
85 return m.group(1) + t
85 return m.group(1) + t
86
86
87
87
88 testpats = [
88 testpats = [
89 [
89 [
90 (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
90 (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"),
91 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
91 (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
92 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
92 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
93 (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),
93 (r'(?<!hg )grep.* -a', "don't use 'grep -a', use in-line python"),
94 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
94 (r'sed.*-i', "don't use 'sed -i', use a temporary file"),
95 (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"),
95 (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"),
96 (r'echo -n', "don't use 'echo -n', use printf"),
96 (r'echo -n', "don't use 'echo -n', use printf"),
97 (r'(^|\|\s*)\bwc\b[^|]*$\n(?!.*\(re\))', "filter wc output"),
97 (r'(^|\|\s*)\bwc\b[^|]*$\n(?!.*\(re\))', "filter wc output"),
98 (r'head -c', "don't use 'head -c', use 'dd'"),
98 (r'head -c', "don't use 'head -c', use 'dd'"),
99 (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"),
99 (r'tail -n', "don't use the '-n' option to tail, just use '-<num>'"),
100 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
100 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
101 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
101 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
102 (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),
102 (r'printf.*[^\\]\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),
103 (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"),
103 (r'printf.*[^\\]\\x', "don't use printf \\x, use Python"),
104 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
104 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
105 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
105 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
106 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
106 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
107 "use egrep for extended grep syntax"),
107 "use egrep for extended grep syntax"),
108 (r'/bin/', "don't use explicit paths for tools"),
108 (r'/bin/', "don't use explicit paths for tools"),
109 (r'[^\n]\Z', "no trailing newline"),
109 (r'[^\n]\Z', "no trailing newline"),
110 (r'export .*=', "don't export and assign at once"),
110 (r'export .*=', "don't export and assign at once"),
111 (r'^source\b', "don't use 'source', use '.'"),
111 (r'^source\b', "don't use 'source', use '.'"),
112 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
112 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
113 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
113 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
114 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
114 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
115 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
115 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
116 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
116 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
117 (r'\[\[\s+[^\]]*\]\]', "don't use '[[ ]]', use '[ ]'"),
117 (r'\[\[\s+[^\]]*\]\]', "don't use '[[ ]]', use '[ ]'"),
118 (r'^alias\b.*=', "don't use alias, use a function"),
118 (r'^alias\b.*=', "don't use alias, use a function"),
119 (r'if\s*!', "don't use '!' to negate exit status"),
119 (r'if\s*!', "don't use '!' to negate exit status"),
120 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
120 (r'/dev/u?random', "don't use entropy, use /dev/zero"),
121 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
121 (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
122 (r'^( *)\t', "don't use tabs to indent"),
122 (r'^( *)\t', "don't use tabs to indent"),
123 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
123 (r'sed (-e )?\'(\d+|/[^/]*/)i(?!\\\n)',
124 "put a backslash-escaped newline after sed 'i' command"),
124 "put a backslash-escaped newline after sed 'i' command"),
125 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"),
125 (r'^diff *-\w*[uU].*$\n(^ \$ |^$)', "prefix diff -u/-U with cmp"),
126 (r'^\s+(if)? diff *-\w*[uU]', "prefix diff -u/-U with cmp"),
126 (r'^\s+(if)? diff *-\w*[uU]', "prefix diff -u/-U with cmp"),
127 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
127 (r'seq ', "don't use 'seq', use $TESTDIR/seq.py"),
128 (r'\butil\.Abort\b', "directly use error.Abort"),
128 (r'\butil\.Abort\b', "directly use error.Abort"),
129 (r'\|&', "don't use |&, use 2>&1"),
129 (r'\|&', "don't use |&, use 2>&1"),
130 (r'\w = +\w', "only one space after = allowed"),
130 (r'\w = +\w', "only one space after = allowed"),
131 ],
131 ],
132 # warnings
132 # warnings
133 [
133 [
134 (r'^function', "don't use 'function', use old style"),
134 (r'^function', "don't use 'function', use old style"),
135 (r'^diff.*-\w*N', "don't use 'diff -N'"),
135 (r'^diff.*-\w*N', "don't use 'diff -N'"),
136 (r'\$PWD|\${PWD}', "don't use $PWD, use `pwd`"),
136 (r'\$PWD|\${PWD}', "don't use $PWD, use `pwd`"),
137 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
137 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
138 (r'kill (`|\$\()', "don't use kill, use killdaemons.py")
138 (r'kill (`|\$\()', "don't use kill, use killdaemons.py")
139 ]
139 ]
140 ]
140 ]
141
141
142 testfilters = [
142 testfilters = [
143 (r"( *)(#([^\n]*\S)?)", repcomment),
143 (r"( *)(#([^\n]*\S)?)", repcomment),
144 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
144 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
145 ]
145 ]
146
146
147 winglobmsg = "use (glob) to match Windows paths too"
147 winglobmsg = "use (glob) to match Windows paths too"
148 uprefix = r"^ \$ "
148 uprefix = r"^ \$ "
149 utestpats = [
149 utestpats = [
150 [
150 [
151 (r'^(\S.*|| [$>] \S.*)[ \t]\n', "trailing whitespace on non-output"),
151 (r'^(\S.*|| [$>] \S.*)[ \t]\n', "trailing whitespace on non-output"),
152 (uprefix + r'.*\|\s*sed[^|>\n]*\n',
152 (uprefix + r'.*\|\s*sed[^|>\n]*\n',
153 "use regex test output patterns instead of sed"),
153 "use regex test output patterns instead of sed"),
154 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
154 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
155 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
155 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
156 (uprefix + r'.*\|\| echo.*(fail|error)',
156 (uprefix + r'.*\|\| echo.*(fail|error)',
157 "explicit exit code checks unnecessary"),
157 "explicit exit code checks unnecessary"),
158 (uprefix + r'set -e', "don't use set -e"),
158 (uprefix + r'set -e', "don't use set -e"),
159 (uprefix + r'(\s|fi\b|done\b)', "use > for continued lines"),
159 (uprefix + r'(\s|fi\b|done\b)', "use > for continued lines"),
160 (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite "
160 (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite "
161 "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx
161 "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx
162 '# no-msys'), # in test-pull.t which is skipped on windows
162 '# no-msys'), # in test-pull.t which is skipped on windows
163 (r'^ saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg),
163 (r'^ saved backup bundle to \$TESTTMP.*\.hg$', winglobmsg),
164 (r'^ changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$',
164 (r'^ changeset .* references (corrupted|missing) \$TESTTMP/.*[^)]$',
165 winglobmsg),
165 winglobmsg),
166 (r'^ pulling from \$TESTTMP/.*[^)]$', winglobmsg,
166 (r'^ pulling from \$TESTTMP/.*[^)]$', winglobmsg,
167 '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows
167 '\$TESTTMP/unix-repo$'), # in test-issue1802.t which skipped on windows
168 (r'^ reverting (?!subrepo ).*/.*[^)]$', winglobmsg),
168 (r'^ reverting (?!subrepo ).*/.*[^)]$', winglobmsg),
169 (r'^ cloning subrepo \S+/.*[^)]$', winglobmsg),
169 (r'^ cloning subrepo \S+/.*[^)]$', winglobmsg),
170 (r'^ pushing to \$TESTTMP/.*[^)]$', winglobmsg),
170 (r'^ pushing to \$TESTTMP/.*[^)]$', winglobmsg),
171 (r'^ pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg),
171 (r'^ pushing subrepo \S+/\S+ to.*[^)]$', winglobmsg),
172 (r'^ moving \S+/.*[^)]$', winglobmsg),
172 (r'^ moving \S+/.*[^)]$', winglobmsg),
173 (r'^ no changes made to subrepo since.*/.*[^)]$', winglobmsg),
173 (r'^ no changes made to subrepo since.*/.*[^)]$', winglobmsg),
174 (r'^ .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
174 (r'^ .*: largefile \S+ not available from file:.*/.*[^)]$', winglobmsg),
175 (r'^ .*file://\$TESTTMP',
175 (r'^ .*file://\$TESTTMP',
176 'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
176 'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
177 (r'^ (cat|find): .*: No such file or directory',
177 (r'^ (cat|find): .*: No such file or directory',
178 'use test -f to test for file existence'),
178 'use test -f to test for file existence'),
179 (r'^ diff -[^ -]*p',
180 "don't use (external) diff with -p for portability"),
179 ],
181 ],
180 # warnings
182 # warnings
181 [
183 [
182 (r'^ [^*?/\n]* \(glob\)$',
184 (r'^ [^*?/\n]* \(glob\)$',
183 "glob match with no glob character (?*/)"),
185 "glob match with no glob character (?*/)"),
184 ]
186 ]
185 ]
187 ]
186
188
187 for i in [0, 1]:
189 for i in [0, 1]:
188 for tp in testpats[i]:
190 for tp in testpats[i]:
189 p = tp[0]
191 p = tp[0]
190 m = tp[1]
192 m = tp[1]
191 if p.startswith(r'^'):
193 if p.startswith(r'^'):
192 p = r"^ [$>] (%s)" % p[1:]
194 p = r"^ [$>] (%s)" % p[1:]
193 else:
195 else:
194 p = r"^ [$>] .*(%s)" % p
196 p = r"^ [$>] .*(%s)" % p
195 utestpats[i].append((p, m) + tp[2:])
197 utestpats[i].append((p, m) + tp[2:])
196
198
197 utestfilters = [
199 utestfilters = [
198 (r"<<(\S+)((.|\n)*?\n > \1)", rephere),
200 (r"<<(\S+)((.|\n)*?\n > \1)", rephere),
199 (r"( *)(#([^\n]*\S)?)", repcomment),
201 (r"( *)(#([^\n]*\S)?)", repcomment),
200 ]
202 ]
201
203
202 pypats = [
204 pypats = [
203 [
205 [
204 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
206 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
205 "tuple parameter unpacking not available in Python 3+"),
207 "tuple parameter unpacking not available in Python 3+"),
206 (r'lambda\s*\(.*,.*\)',
208 (r'lambda\s*\(.*,.*\)',
207 "tuple parameter unpacking not available in Python 3+"),
209 "tuple parameter unpacking not available in Python 3+"),
208 (r'import (.+,[^.]+\.[^.]+|[^.]+\.[^.]+,)',
210 (r'import (.+,[^.]+\.[^.]+|[^.]+\.[^.]+,)',
209 '2to3 can\'t always rewrite "import qux, foo.bar", '
211 '2to3 can\'t always rewrite "import qux, foo.bar", '
210 'use "import foo.bar" on its own line instead.'),
212 'use "import foo.bar" on its own line instead.'),
211 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
213 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
212 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
214 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
213 (r'dict\(.*=', 'dict() is different in Py2 and 3 and is slower than {}',
215 (r'dict\(.*=', 'dict() is different in Py2 and 3 and is slower than {}',
214 'dict-from-generator'),
216 'dict-from-generator'),
215 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
217 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
216 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
218 (r'\s<>\s', '<> operator is not available in Python 3+, use !='),
217 (r'^\s*\t', "don't use tabs"),
219 (r'^\s*\t', "don't use tabs"),
218 (r'\S;\s*\n', "semicolon"),
220 (r'\S;\s*\n', "semicolon"),
219 (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"),
221 (r'[^_]_\([ \t\n]*(?:"[^"]+"[ \t\n+]*)+%', "don't use % inside _()"),
220 (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
222 (r"[^_]_\([ \t\n]*(?:'[^']+'[ \t\n+]*)+%", "don't use % inside _()"),
221 (r'(\w|\)),\w', "missing whitespace after ,"),
223 (r'(\w|\)),\w', "missing whitespace after ,"),
222 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
224 (r'(\w|\))[+/*\-<>]\w', "missing whitespace in expression"),
223 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
225 (r'^\s+(\w|\.)+=\w[^,()\n]*$', "missing whitespace in assignment"),
224 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
226 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
225 (r'.{81}', "line too long"),
227 (r'.{81}', "line too long"),
226 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
228 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
227 (r'[^\n]\Z', "no trailing newline"),
229 (r'[^\n]\Z', "no trailing newline"),
228 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
230 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
229 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
231 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
230 # "don't use underbars in identifiers"),
232 # "don't use underbars in identifiers"),
231 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
233 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
232 "don't use camelcase in identifiers"),
234 "don't use camelcase in identifiers"),
233 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
235 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
234 "linebreak after :"),
236 "linebreak after :"),
235 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
237 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
236 (r'class\s[^( \n]+\(\):',
238 (r'class\s[^( \n]+\(\):',
237 "class foo() creates old style object, use class foo(object)"),
239 "class foo() creates old style object, use class foo(object)"),
238 (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist
240 (r'\b(%s)\(' % '|'.join(k for k in keyword.kwlist
239 if k not in ('print', 'exec')),
241 if k not in ('print', 'exec')),
240 "Python keyword is not a function"),
242 "Python keyword is not a function"),
241 (r',]', "unneeded trailing ',' in list"),
243 (r',]', "unneeded trailing ',' in list"),
242 # (r'class\s[A-Z][^\(]*\((?!Exception)',
244 # (r'class\s[A-Z][^\(]*\((?!Exception)',
243 # "don't capitalize non-exception classes"),
245 # "don't capitalize non-exception classes"),
244 # (r'in range\(', "use xrange"),
246 # (r'in range\(', "use xrange"),
245 # (r'^\s*print\s+', "avoid using print in core and extensions"),
247 # (r'^\s*print\s+', "avoid using print in core and extensions"),
246 (r'[\x80-\xff]', "non-ASCII character literal"),
248 (r'[\x80-\xff]', "non-ASCII character literal"),
247 (r'("\')\.format\(', "str.format() has no bytes counterpart, use %"),
249 (r'("\')\.format\(', "str.format() has no bytes counterpart, use %"),
248 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
250 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
249 "gratuitous whitespace after Python keyword"),
251 "gratuitous whitespace after Python keyword"),
250 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
252 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
251 # (r'\s\s=', "gratuitous whitespace before ="),
253 # (r'\s\s=', "gratuitous whitespace before ="),
252 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
254 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
253 "missing whitespace around operator"),
255 "missing whitespace around operator"),
254 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s',
256 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s',
255 "missing whitespace around operator"),
257 "missing whitespace around operator"),
256 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
258 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
257 "missing whitespace around operator"),
259 "missing whitespace around operator"),
258 (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]',
260 (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]',
259 "wrong whitespace around ="),
261 "wrong whitespace around ="),
260 (r'\([^()]*( =[^=]|[^<>!=]= )',
262 (r'\([^()]*( =[^=]|[^<>!=]= )',
261 "no whitespace around = for named parameters"),
263 "no whitespace around = for named parameters"),
262 (r'raise Exception', "don't raise generic exceptions"),
264 (r'raise Exception', "don't raise generic exceptions"),
263 (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$',
265 (r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$',
264 "don't use old-style two-argument raise, use Exception(message)"),
266 "don't use old-style two-argument raise, use Exception(message)"),
265 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
267 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
266 (r' [=!]=\s+(True|False|None)',
268 (r' [=!]=\s+(True|False|None)',
267 "comparison with singleton, use 'is' or 'is not' instead"),
269 "comparison with singleton, use 'is' or 'is not' instead"),
268 (r'^\s*(while|if) [01]:',
270 (r'^\s*(while|if) [01]:',
269 "use True/False for constant Boolean expression"),
271 "use True/False for constant Boolean expression"),
270 (r'(?:(?<!def)\s+|\()hasattr',
272 (r'(?:(?<!def)\s+|\()hasattr',
271 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
273 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
272 (r'opener\([^)]*\).read\(',
274 (r'opener\([^)]*\).read\(',
273 "use opener.read() instead"),
275 "use opener.read() instead"),
274 (r'opener\([^)]*\).write\(',
276 (r'opener\([^)]*\).write\(',
275 "use opener.write() instead"),
277 "use opener.write() instead"),
276 (r'[\s\(](open|file)\([^)]*\)\.read\(',
278 (r'[\s\(](open|file)\([^)]*\)\.read\(',
277 "use util.readfile() instead"),
279 "use util.readfile() instead"),
278 (r'[\s\(](open|file)\([^)]*\)\.write\(',
280 (r'[\s\(](open|file)\([^)]*\)\.write\(',
279 "use util.writefile() instead"),
281 "use util.writefile() instead"),
280 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
282 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
281 "always assign an opened file to a variable, and close it afterwards"),
283 "always assign an opened file to a variable, and close it afterwards"),
282 (r'[\s\(](open|file)\([^)]*\)\.',
284 (r'[\s\(](open|file)\([^)]*\)\.',
283 "always assign an opened file to a variable, and close it afterwards"),
285 "always assign an opened file to a variable, and close it afterwards"),
284 (r'(?i)descend[e]nt', "the proper spelling is descendAnt"),
286 (r'(?i)descend[e]nt', "the proper spelling is descendAnt"),
285 (r'\.debug\(\_', "don't mark debug messages for translation"),
287 (r'\.debug\(\_', "don't mark debug messages for translation"),
286 (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
288 (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
287 (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'),
289 (r'^\s*except\s*:', "naked except clause", r'#.*re-raises'),
288 (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,',
290 (r'^\s*except\s([^\(,]+|\([^\)]+\))\s*,',
289 'legacy exception syntax; use "as" instead of ","'),
291 'legacy exception syntax; use "as" instead of ","'),
290 (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"),
292 (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"),
291 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
293 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
292 "missing _() in ui message (use () to hide false-positives)"),
294 "missing _() in ui message (use () to hide false-positives)"),
293 (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
295 (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
294 (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
296 (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
295 (r'os\.path\.join\(.*, *(""|\'\')\)',
297 (r'os\.path\.join\(.*, *(""|\'\')\)',
296 "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
298 "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
297 (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
299 (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
298 # XXX only catch mutable arguments on the first line of the definition
300 # XXX only catch mutable arguments on the first line of the definition
299 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
301 (r'def.*[( ]\w+=\{\}', "don't use mutable default arguments"),
300 (r'\butil\.Abort\b', "directly use error.Abort"),
302 (r'\butil\.Abort\b', "directly use error.Abort"),
301 ],
303 ],
302 # warnings
304 # warnings
303 [
305 [
304 (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"),
306 (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"),
305 ]
307 ]
306 ]
308 ]
307
309
308 pyfilters = [
310 pyfilters = [
309 (r"""(?msx)(?P<comment>\#.*?$)|
311 (r"""(?msx)(?P<comment>\#.*?$)|
310 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
312 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
311 (?P<text>(([^\\]|\\.)*?))
313 (?P<text>(([^\\]|\\.)*?))
312 (?P=quote))""", reppython),
314 (?P=quote))""", reppython),
313 ]
315 ]
314
316
315 txtfilters = []
317 txtfilters = []
316
318
317 txtpats = [
319 txtpats = [
318 [
320 [
319 ('\s$', 'trailing whitespace'),
321 ('\s$', 'trailing whitespace'),
320 ('.. note::[ \n][^\n]', 'add two newlines after note::')
322 ('.. note::[ \n][^\n]', 'add two newlines after note::')
321 ],
323 ],
322 []
324 []
323 ]
325 ]
324
326
325 cpats = [
327 cpats = [
326 [
328 [
327 (r'//', "don't use //-style comments"),
329 (r'//', "don't use //-style comments"),
328 (r'^ ', "don't use spaces to indent"),
330 (r'^ ', "don't use spaces to indent"),
329 (r'\S\t', "don't use tabs except for indent"),
331 (r'\S\t', "don't use tabs except for indent"),
330 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
332 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
331 (r'.{81}', "line too long"),
333 (r'.{81}', "line too long"),
332 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
334 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
333 (r'return\(', "return is not a function"),
335 (r'return\(', "return is not a function"),
334 (r' ;', "no space before ;"),
336 (r' ;', "no space before ;"),
335 (r'[^;] \)', "no space before )"),
337 (r'[^;] \)', "no space before )"),
336 (r'[)][{]', "space between ) and {"),
338 (r'[)][{]', "space between ) and {"),
337 (r'\w+\* \w+', "use int *foo, not int* foo"),
339 (r'\w+\* \w+', "use int *foo, not int* foo"),
338 (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
340 (r'\W\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
339 (r'\w+ (\+\+|--)', "use foo++, not foo ++"),
341 (r'\w+ (\+\+|--)', "use foo++, not foo ++"),
340 (r'\w,\w', "missing whitespace after ,"),
342 (r'\w,\w', "missing whitespace after ,"),
341 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
343 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
342 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
344 (r'\w\s=\s\s+\w', "gratuitous whitespace after ="),
343 (r'^#\s+\w', "use #foo, not # foo"),
345 (r'^#\s+\w', "use #foo, not # foo"),
344 (r'[^\n]\Z', "no trailing newline"),
346 (r'[^\n]\Z', "no trailing newline"),
345 (r'^\s*#import\b', "use only #include in standard C code"),
347 (r'^\s*#import\b', "use only #include in standard C code"),
346 ],
348 ],
347 # warnings
349 # warnings
348 []
350 []
349 ]
351 ]
350
352
351 cfilters = [
353 cfilters = [
352 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
354 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
353 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
355 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
354 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
356 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
355 (r'(\()([^)]+\))', repcallspaces),
357 (r'(\()([^)]+\))', repcallspaces),
356 ]
358 ]
357
359
358 inutilpats = [
360 inutilpats = [
359 [
361 [
360 (r'\bui\.', "don't use ui in util"),
362 (r'\bui\.', "don't use ui in util"),
361 ],
363 ],
362 # warnings
364 # warnings
363 []
365 []
364 ]
366 ]
365
367
366 inrevlogpats = [
368 inrevlogpats = [
367 [
369 [
368 (r'\brepo\.', "don't use repo in revlog"),
370 (r'\brepo\.', "don't use repo in revlog"),
369 ],
371 ],
370 # warnings
372 # warnings
371 []
373 []
372 ]
374 ]
373
375
374 webtemplatefilters = []
376 webtemplatefilters = []
375
377
376 webtemplatepats = [
378 webtemplatepats = [
377 [],
379 [],
378 [
380 [
379 (r'{desc(\|(?!websub|firstline)[^\|]*)+}',
381 (r'{desc(\|(?!websub|firstline)[^\|]*)+}',
380 'follow desc keyword with either firstline or websub'),
382 'follow desc keyword with either firstline or websub'),
381 ]
383 ]
382 ]
384 ]
383
385
384 checks = [
386 checks = [
385 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
387 ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
386 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
388 ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
387 ('c', r'.*\.[ch]$', '', cfilters, cpats),
389 ('c', r'.*\.[ch]$', '', cfilters, cpats),
388 ('unified test', r'.*\.t$', '', utestfilters, utestpats),
390 ('unified test', r'.*\.t$', '', utestfilters, utestpats),
389 ('layering violation repo in revlog', r'mercurial/revlog\.py', '',
391 ('layering violation repo in revlog', r'mercurial/revlog\.py', '',
390 pyfilters, inrevlogpats),
392 pyfilters, inrevlogpats),
391 ('layering violation ui in util', r'mercurial/util\.py', '', pyfilters,
393 ('layering violation ui in util', r'mercurial/util\.py', '', pyfilters,
392 inutilpats),
394 inutilpats),
393 ('txt', r'.*\.txt$', '', txtfilters, txtpats),
395 ('txt', r'.*\.txt$', '', txtfilters, txtpats),
394 ('web template', r'mercurial/templates/.*\.tmpl', '',
396 ('web template', r'mercurial/templates/.*\.tmpl', '',
395 webtemplatefilters, webtemplatepats),
397 webtemplatefilters, webtemplatepats),
396 ]
398 ]
397
399
398 def _preparepats():
400 def _preparepats():
399 for c in checks:
401 for c in checks:
400 failandwarn = c[-1]
402 failandwarn = c[-1]
401 for pats in failandwarn:
403 for pats in failandwarn:
402 for i, pseq in enumerate(pats):
404 for i, pseq in enumerate(pats):
403 # fix-up regexes for multi-line searches
405 # fix-up regexes for multi-line searches
404 p = pseq[0]
406 p = pseq[0]
405 # \s doesn't match \n
407 # \s doesn't match \n
406 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
408 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
407 # [^...] doesn't match newline
409 # [^...] doesn't match newline
408 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
410 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
409
411
410 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
412 pats[i] = (re.compile(p, re.MULTILINE),) + pseq[1:]
411 filters = c[3]
413 filters = c[3]
412 for i, flt in enumerate(filters):
414 for i, flt in enumerate(filters):
413 filters[i] = re.compile(flt[0]), flt[1]
415 filters[i] = re.compile(flt[0]), flt[1]
414 _preparepats()
416 _preparepats()
415
417
416 class norepeatlogger(object):
418 class norepeatlogger(object):
417 def __init__(self):
419 def __init__(self):
418 self._lastseen = None
420 self._lastseen = None
419
421
420 def log(self, fname, lineno, line, msg, blame):
422 def log(self, fname, lineno, line, msg, blame):
421 """print error related a to given line of a given file.
423 """print error related a to given line of a given file.
422
424
423 The faulty line will also be printed but only once in the case
425 The faulty line will also be printed but only once in the case
424 of multiple errors.
426 of multiple errors.
425
427
426 :fname: filename
428 :fname: filename
427 :lineno: line number
429 :lineno: line number
428 :line: actual content of the line
430 :line: actual content of the line
429 :msg: error message
431 :msg: error message
430 """
432 """
431 msgid = fname, lineno, line
433 msgid = fname, lineno, line
432 if msgid != self._lastseen:
434 if msgid != self._lastseen:
433 if blame:
435 if blame:
434 print "%s:%d (%s):" % (fname, lineno, blame)
436 print "%s:%d (%s):" % (fname, lineno, blame)
435 else:
437 else:
436 print "%s:%d:" % (fname, lineno)
438 print "%s:%d:" % (fname, lineno)
437 print " > %s" % line
439 print " > %s" % line
438 self._lastseen = msgid
440 self._lastseen = msgid
439 print " " + msg
441 print " " + msg
440
442
441 _defaultlogger = norepeatlogger()
443 _defaultlogger = norepeatlogger()
442
444
443 def getblame(f):
445 def getblame(f):
444 lines = []
446 lines = []
445 for l in os.popen('hg annotate -un %s' % f):
447 for l in os.popen('hg annotate -un %s' % f):
446 start, line = l.split(':', 1)
448 start, line = l.split(':', 1)
447 user, rev = start.split()
449 user, rev = start.split()
448 lines.append((line[1:-1], user, rev))
450 lines.append((line[1:-1], user, rev))
449 return lines
451 return lines
450
452
451 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
453 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
452 blame=False, debug=False, lineno=True):
454 blame=False, debug=False, lineno=True):
453 """checks style and portability of a given file
455 """checks style and portability of a given file
454
456
455 :f: filepath
457 :f: filepath
456 :logfunc: function used to report error
458 :logfunc: function used to report error
457 logfunc(filename, linenumber, linecontent, errormessage)
459 logfunc(filename, linenumber, linecontent, errormessage)
458 :maxerr: number of error to display before aborting.
460 :maxerr: number of error to display before aborting.
459 Set to false (default) to report all errors
461 Set to false (default) to report all errors
460
462
461 return True if no error is found, False otherwise.
463 return True if no error is found, False otherwise.
462 """
464 """
463 blamecache = None
465 blamecache = None
464 result = True
466 result = True
465
467
466 try:
468 try:
467 fp = open(f)
469 fp = open(f)
468 except IOError as e:
470 except IOError as e:
469 print "Skipping %s, %s" % (f, str(e).split(':', 1)[0])
471 print "Skipping %s, %s" % (f, str(e).split(':', 1)[0])
470 return result
472 return result
471 pre = post = fp.read()
473 pre = post = fp.read()
472 fp.close()
474 fp.close()
473
475
474 for name, match, magic, filters, pats in checks:
476 for name, match, magic, filters, pats in checks:
475 if debug:
477 if debug:
476 print name, f
478 print name, f
477 fc = 0
479 fc = 0
478 if not (re.match(match, f) or (magic and re.search(magic, f))):
480 if not (re.match(match, f) or (magic and re.search(magic, f))):
479 if debug:
481 if debug:
480 print "Skipping %s for %s it doesn't match %s" % (
482 print "Skipping %s for %s it doesn't match %s" % (
481 name, match, f)
483 name, match, f)
482 continue
484 continue
483 if "no-" "check-code" in pre:
485 if "no-" "check-code" in pre:
484 # If you're looking at this line, it's because a file has:
486 # If you're looking at this line, it's because a file has:
485 # no- check- code
487 # no- check- code
486 # but the reason to output skipping is to make life for
488 # but the reason to output skipping is to make life for
487 # tests easier. So, instead of writing it with a normal
489 # tests easier. So, instead of writing it with a normal
488 # spelling, we write it with the expected spelling from
490 # spelling, we write it with the expected spelling from
489 # tests/test-check-code.t
491 # tests/test-check-code.t
490 print "Skipping %s it has no-che?k-code (glob)" % f
492 print "Skipping %s it has no-che?k-code (glob)" % f
491 return "Skip" # skip checking this file
493 return "Skip" # skip checking this file
492 for p, r in filters:
494 for p, r in filters:
493 post = re.sub(p, r, post)
495 post = re.sub(p, r, post)
494 nerrs = len(pats[0]) # nerr elements are errors
496 nerrs = len(pats[0]) # nerr elements are errors
495 if warnings:
497 if warnings:
496 pats = pats[0] + pats[1]
498 pats = pats[0] + pats[1]
497 else:
499 else:
498 pats = pats[0]
500 pats = pats[0]
499 # print post # uncomment to show filtered version
501 # print post # uncomment to show filtered version
500
502
501 if debug:
503 if debug:
502 print "Checking %s for %s" % (name, f)
504 print "Checking %s for %s" % (name, f)
503
505
504 prelines = None
506 prelines = None
505 errors = []
507 errors = []
506 for i, pat in enumerate(pats):
508 for i, pat in enumerate(pats):
507 if len(pat) == 3:
509 if len(pat) == 3:
508 p, msg, ignore = pat
510 p, msg, ignore = pat
509 else:
511 else:
510 p, msg = pat
512 p, msg = pat
511 ignore = None
513 ignore = None
512 if i >= nerrs:
514 if i >= nerrs:
513 msg = "warning: " + msg
515 msg = "warning: " + msg
514
516
515 pos = 0
517 pos = 0
516 n = 0
518 n = 0
517 for m in p.finditer(post):
519 for m in p.finditer(post):
518 if prelines is None:
520 if prelines is None:
519 prelines = pre.splitlines()
521 prelines = pre.splitlines()
520 postlines = post.splitlines(True)
522 postlines = post.splitlines(True)
521
523
522 start = m.start()
524 start = m.start()
523 while n < len(postlines):
525 while n < len(postlines):
524 step = len(postlines[n])
526 step = len(postlines[n])
525 if pos + step > start:
527 if pos + step > start:
526 break
528 break
527 pos += step
529 pos += step
528 n += 1
530 n += 1
529 l = prelines[n]
531 l = prelines[n]
530
532
531 if ignore and re.search(ignore, l, re.MULTILINE):
533 if ignore and re.search(ignore, l, re.MULTILINE):
532 if debug:
534 if debug:
533 print "Skipping %s for %s:%s (ignore pattern)" % (
535 print "Skipping %s for %s:%s (ignore pattern)" % (
534 name, f, n)
536 name, f, n)
535 continue
537 continue
536 bd = ""
538 bd = ""
537 if blame:
539 if blame:
538 bd = 'working directory'
540 bd = 'working directory'
539 if not blamecache:
541 if not blamecache:
540 blamecache = getblame(f)
542 blamecache = getblame(f)
541 if n < len(blamecache):
543 if n < len(blamecache):
542 bl, bu, br = blamecache[n]
544 bl, bu, br = blamecache[n]
543 if bl == l:
545 if bl == l:
544 bd = '%s@%s' % (bu, br)
546 bd = '%s@%s' % (bu, br)
545
547
546 errors.append((f, lineno and n + 1, l, msg, bd))
548 errors.append((f, lineno and n + 1, l, msg, bd))
547 result = False
549 result = False
548
550
549 errors.sort()
551 errors.sort()
550 for e in errors:
552 for e in errors:
551 logfunc(*e)
553 logfunc(*e)
552 fc += 1
554 fc += 1
553 if maxerr and fc >= maxerr:
555 if maxerr and fc >= maxerr:
554 print " (too many errors, giving up)"
556 print " (too many errors, giving up)"
555 break
557 break
556
558
557 return result
559 return result
558
560
559 if __name__ == "__main__":
561 if __name__ == "__main__":
560 parser = optparse.OptionParser("%prog [options] [files]")
562 parser = optparse.OptionParser("%prog [options] [files]")
561 parser.add_option("-w", "--warnings", action="store_true",
563 parser.add_option("-w", "--warnings", action="store_true",
562 help="include warning-level checks")
564 help="include warning-level checks")
563 parser.add_option("-p", "--per-file", type="int",
565 parser.add_option("-p", "--per-file", type="int",
564 help="max warnings per file")
566 help="max warnings per file")
565 parser.add_option("-b", "--blame", action="store_true",
567 parser.add_option("-b", "--blame", action="store_true",
566 help="use annotate to generate blame info")
568 help="use annotate to generate blame info")
567 parser.add_option("", "--debug", action="store_true",
569 parser.add_option("", "--debug", action="store_true",
568 help="show debug information")
570 help="show debug information")
569 parser.add_option("", "--nolineno", action="store_false",
571 parser.add_option("", "--nolineno", action="store_false",
570 dest='lineno', help="don't show line numbers")
572 dest='lineno', help="don't show line numbers")
571
573
572 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
574 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
573 lineno=True)
575 lineno=True)
574 (options, args) = parser.parse_args()
576 (options, args) = parser.parse_args()
575
577
576 if len(args) == 0:
578 if len(args) == 0:
577 check = glob.glob("*")
579 check = glob.glob("*")
578 else:
580 else:
579 check = args
581 check = args
580
582
581 ret = 0
583 ret = 0
582 for f in check:
584 for f in check:
583 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
585 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
584 blame=options.blame, debug=options.debug,
586 blame=options.blame, debug=options.debug,
585 lineno=options.lineno):
587 lineno=options.lineno):
586 ret = 1
588 ret = 1
587 sys.exit(ret)
589 sys.exit(ret)
@@ -1,830 +1,836 b''
1 $ cat >> $HGRCPATH <<EOF
2 > [defaults]
3 > # for portability
4 > extdiff = --option -Nru
5 > EOF
6
1 Create a repo with some stuff in it:
7 Create a repo with some stuff in it:
2
8
3 $ hg init a
9 $ hg init a
4 $ cd a
10 $ cd a
5 $ echo a > a
11 $ echo a > a
6 $ echo a > d
12 $ echo a > d
7 $ echo a > e
13 $ echo a > e
8 $ hg ci -qAm0
14 $ hg ci -qAm0
9 $ echo b > a
15 $ echo b > a
10 $ hg ci -m1 -u bar
16 $ hg ci -m1 -u bar
11 $ hg mv a b
17 $ hg mv a b
12 $ hg ci -m2
18 $ hg ci -m2
13 $ hg cp b c
19 $ hg cp b c
14 $ hg ci -m3 -u baz
20 $ hg ci -m3 -u baz
15 $ echo b > d
21 $ echo b > d
16 $ echo f > e
22 $ echo f > e
17 $ hg ci -m4
23 $ hg ci -m4
18 $ hg up -q 3
24 $ hg up -q 3
19 $ echo b > e
25 $ echo b > e
20 $ hg branch -q stable
26 $ hg branch -q stable
21 $ hg ci -m5
27 $ hg ci -m5
22 $ hg merge -q default --tool internal:local
28 $ hg merge -q default --tool internal:local
23 $ hg branch -q default
29 $ hg branch -q default
24 $ hg ci -m6
30 $ hg ci -m6
25 $ hg phase --public 3
31 $ hg phase --public 3
26 $ hg phase --force --secret 6
32 $ hg phase --force --secret 6
27
33
28 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
29 @ test@6.secret: 6
35 @ test@6.secret: 6
30 |\
36 |\
31 | o test@5.draft: 5
37 | o test@5.draft: 5
32 | |
38 | |
33 o | test@4.draft: 4
39 o | test@4.draft: 4
34 |/
40 |/
35 o baz@3.public: 3
41 o baz@3.public: 3
36 |
42 |
37 o test@2.public: 2
43 o test@2.public: 2
38 |
44 |
39 o bar@1.public: 1
45 o bar@1.public: 1
40 |
46 |
41 o test@0.public: 0
47 o test@0.public: 0
42
48
43
49
44 Need to specify a rev:
50 Need to specify a rev:
45
51
46 $ hg graft
52 $ hg graft
47 abort: no revisions specified
53 abort: no revisions specified
48 [255]
54 [255]
49
55
50 Can't graft ancestor:
56 Can't graft ancestor:
51
57
52 $ hg graft 1 2
58 $ hg graft 1 2
53 skipping ancestor revision 1:5d205f8b35b6
59 skipping ancestor revision 1:5d205f8b35b6
54 skipping ancestor revision 2:5c095ad7e90f
60 skipping ancestor revision 2:5c095ad7e90f
55 [255]
61 [255]
56
62
57 Specify revisions with -r:
63 Specify revisions with -r:
58
64
59 $ hg graft -r 1 -r 2
65 $ hg graft -r 1 -r 2
60 skipping ancestor revision 1:5d205f8b35b6
66 skipping ancestor revision 1:5d205f8b35b6
61 skipping ancestor revision 2:5c095ad7e90f
67 skipping ancestor revision 2:5c095ad7e90f
62 [255]
68 [255]
63
69
64 $ hg graft -r 1 2
70 $ hg graft -r 1 2
65 warning: inconsistent use of --rev might give unexpected revision ordering!
71 warning: inconsistent use of --rev might give unexpected revision ordering!
66 skipping ancestor revision 2:5c095ad7e90f
72 skipping ancestor revision 2:5c095ad7e90f
67 skipping ancestor revision 1:5d205f8b35b6
73 skipping ancestor revision 1:5d205f8b35b6
68 [255]
74 [255]
69
75
70 Can't graft with dirty wd:
76 Can't graft with dirty wd:
71
77
72 $ hg up -q 0
78 $ hg up -q 0
73 $ echo foo > a
79 $ echo foo > a
74 $ hg graft 1
80 $ hg graft 1
75 abort: uncommitted changes
81 abort: uncommitted changes
76 [255]
82 [255]
77 $ hg revert a
83 $ hg revert a
78
84
79 Graft a rename:
85 Graft a rename:
80 (this also tests that editor is invoked if '--edit' is specified)
86 (this also tests that editor is invoked if '--edit' is specified)
81
87
82 $ hg status --rev "2^1" --rev 2
88 $ hg status --rev "2^1" --rev 2
83 A b
89 A b
84 R a
90 R a
85 $ HGEDITOR=cat hg graft 2 -u foo --edit
91 $ HGEDITOR=cat hg graft 2 -u foo --edit
86 grafting 2:5c095ad7e90f "2"
92 grafting 2:5c095ad7e90f "2"
87 merging a and b to b
93 merging a and b to b
88 2
94 2
89
95
90
96
91 HG: Enter commit message. Lines beginning with 'HG:' are removed.
97 HG: Enter commit message. Lines beginning with 'HG:' are removed.
92 HG: Leave message empty to abort commit.
98 HG: Leave message empty to abort commit.
93 HG: --
99 HG: --
94 HG: user: foo
100 HG: user: foo
95 HG: branch 'default'
101 HG: branch 'default'
96 HG: added b
102 HG: added b
97 HG: removed a
103 HG: removed a
98 $ hg export tip --git
104 $ hg export tip --git
99 # HG changeset patch
105 # HG changeset patch
100 # User foo
106 # User foo
101 # Date 0 0
107 # Date 0 0
102 # Thu Jan 01 00:00:00 1970 +0000
108 # Thu Jan 01 00:00:00 1970 +0000
103 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
109 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
104 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
110 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
105 2
111 2
106
112
107 diff --git a/a b/b
113 diff --git a/a b/b
108 rename from a
114 rename from a
109 rename to b
115 rename to b
110
116
111 Look for extra:source
117 Look for extra:source
112
118
113 $ hg log --debug -r tip
119 $ hg log --debug -r tip
114 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
120 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
115 tag: tip
121 tag: tip
116 phase: draft
122 phase: draft
117 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
123 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
118 parent: -1:0000000000000000000000000000000000000000
124 parent: -1:0000000000000000000000000000000000000000
119 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
125 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
120 user: foo
126 user: foo
121 date: Thu Jan 01 00:00:00 1970 +0000
127 date: Thu Jan 01 00:00:00 1970 +0000
122 files+: b
128 files+: b
123 files-: a
129 files-: a
124 extra: branch=default
130 extra: branch=default
125 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
131 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
126 description:
132 description:
127 2
133 2
128
134
129
135
130
136
131 Graft out of order, skipping a merge and a duplicate
137 Graft out of order, skipping a merge and a duplicate
132 (this also tests that editor is not invoked if '--edit' is not specified)
138 (this also tests that editor is not invoked if '--edit' is not specified)
133
139
134 $ hg graft 1 5 4 3 'merge()' 2 -n
140 $ hg graft 1 5 4 3 'merge()' 2 -n
135 skipping ungraftable merge revision 6
141 skipping ungraftable merge revision 6
136 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
142 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
137 grafting 1:5d205f8b35b6 "1"
143 grafting 1:5d205f8b35b6 "1"
138 grafting 5:97f8bfe72746 "5"
144 grafting 5:97f8bfe72746 "5"
139 grafting 4:9c233e8e184d "4"
145 grafting 4:9c233e8e184d "4"
140 grafting 3:4c60f11aa304 "3"
146 grafting 3:4c60f11aa304 "3"
141
147
142 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
148 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
143 skipping ungraftable merge revision 6
149 skipping ungraftable merge revision 6
144 scanning for duplicate grafts
150 scanning for duplicate grafts
145 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
151 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
146 grafting 1:5d205f8b35b6 "1"
152 grafting 1:5d205f8b35b6 "1"
147 searching for copies back to rev 1
153 searching for copies back to rev 1
148 unmatched files in local:
154 unmatched files in local:
149 b
155 b
150 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
156 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
151 src: 'a' -> dst: 'b' *
157 src: 'a' -> dst: 'b' *
152 checking for directory renames
158 checking for directory renames
153 resolving manifests
159 resolving manifests
154 branchmerge: True, force: True, partial: False
160 branchmerge: True, force: True, partial: False
155 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
161 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
156 preserving b for resolve of b
162 preserving b for resolve of b
157 b: local copied/moved from a -> m (premerge)
163 b: local copied/moved from a -> m (premerge)
158 picked tool ':merge' for b (binary False symlink False changedelete False)
164 picked tool ':merge' for b (binary False symlink False changedelete False)
159 merging b and a to b
165 merging b and a to b
160 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
166 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
161 premerge successful
167 premerge successful
162 committing files:
168 committing files:
163 b
169 b
164 committing manifest
170 committing manifest
165 committing changelog
171 committing changelog
166 grafting 5:97f8bfe72746 "5"
172 grafting 5:97f8bfe72746 "5"
167 searching for copies back to rev 1
173 searching for copies back to rev 1
168 resolving manifests
174 resolving manifests
169 branchmerge: True, force: True, partial: False
175 branchmerge: True, force: True, partial: False
170 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
176 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
171 e: remote is newer -> g
177 e: remote is newer -> g
172 getting e
178 getting e
173 b: remote unchanged -> k
179 b: remote unchanged -> k
174 committing files:
180 committing files:
175 e
181 e
176 committing manifest
182 committing manifest
177 committing changelog
183 committing changelog
178 $ HGEDITOR=cat hg graft 4 3 --log --debug
184 $ HGEDITOR=cat hg graft 4 3 --log --debug
179 scanning for duplicate grafts
185 scanning for duplicate grafts
180 grafting 4:9c233e8e184d "4"
186 grafting 4:9c233e8e184d "4"
181 searching for copies back to rev 1
187 searching for copies back to rev 1
182 resolving manifests
188 resolving manifests
183 branchmerge: True, force: True, partial: False
189 branchmerge: True, force: True, partial: False
184 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
190 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
185 preserving e for resolve of e
191 preserving e for resolve of e
186 d: remote is newer -> g
192 d: remote is newer -> g
187 getting d
193 getting d
188 b: remote unchanged -> k
194 b: remote unchanged -> k
189 e: versions differ -> m (premerge)
195 e: versions differ -> m (premerge)
190 picked tool ':merge' for e (binary False symlink False changedelete False)
196 picked tool ':merge' for e (binary False symlink False changedelete False)
191 merging e
197 merging e
192 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
198 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
193 e: versions differ -> m (merge)
199 e: versions differ -> m (merge)
194 picked tool ':merge' for e (binary False symlink False changedelete False)
200 picked tool ':merge' for e (binary False symlink False changedelete False)
195 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
201 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
196 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
202 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
197 abort: unresolved conflicts, can't continue
203 abort: unresolved conflicts, can't continue
198 (use hg resolve and hg graft --continue --log)
204 (use hg resolve and hg graft --continue --log)
199 [255]
205 [255]
200
206
201 Summary should mention graft:
207 Summary should mention graft:
202
208
203 $ hg summary |grep graft
209 $ hg summary |grep graft
204 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
210 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
205
211
206 Commit while interrupted should fail:
212 Commit while interrupted should fail:
207
213
208 $ hg ci -m 'commit interrupted graft'
214 $ hg ci -m 'commit interrupted graft'
209 abort: graft in progress
215 abort: graft in progress
210 (use 'hg graft --continue' or 'hg update' to abort)
216 (use 'hg graft --continue' or 'hg update' to abort)
211 [255]
217 [255]
212
218
213 Abort the graft and try committing:
219 Abort the graft and try committing:
214
220
215 $ hg up -C .
221 $ hg up -C .
216 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 $ echo c >> e
223 $ echo c >> e
218 $ hg ci -mtest
224 $ hg ci -mtest
219
225
220 $ hg strip . --config extensions.strip=
226 $ hg strip . --config extensions.strip=
221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
228 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
223
229
224 Graft again:
230 Graft again:
225
231
226 $ hg graft 1 5 4 3 'merge()' 2
232 $ hg graft 1 5 4 3 'merge()' 2
227 skipping ungraftable merge revision 6
233 skipping ungraftable merge revision 6
228 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
234 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
229 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
235 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
230 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
236 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
231 grafting 4:9c233e8e184d "4"
237 grafting 4:9c233e8e184d "4"
232 merging e
238 merging e
233 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
239 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
234 abort: unresolved conflicts, can't continue
240 abort: unresolved conflicts, can't continue
235 (use hg resolve and hg graft --continue)
241 (use hg resolve and hg graft --continue)
236 [255]
242 [255]
237
243
238 Continue without resolve should fail:
244 Continue without resolve should fail:
239
245
240 $ hg graft -c
246 $ hg graft -c
241 grafting 4:9c233e8e184d "4"
247 grafting 4:9c233e8e184d "4"
242 abort: unresolved merge conflicts (see "hg help resolve")
248 abort: unresolved merge conflicts (see "hg help resolve")
243 [255]
249 [255]
244
250
245 Fix up:
251 Fix up:
246
252
247 $ echo b > e
253 $ echo b > e
248 $ hg resolve -m e
254 $ hg resolve -m e
249 (no more unresolved files)
255 (no more unresolved files)
250 continue: hg graft --continue
256 continue: hg graft --continue
251
257
252 Continue with a revision should fail:
258 Continue with a revision should fail:
253
259
254 $ hg graft -c 6
260 $ hg graft -c 6
255 abort: can't specify --continue and revisions
261 abort: can't specify --continue and revisions
256 [255]
262 [255]
257
263
258 $ hg graft -c -r 6
264 $ hg graft -c -r 6
259 abort: can't specify --continue and revisions
265 abort: can't specify --continue and revisions
260 [255]
266 [255]
261
267
262 Continue for real, clobber usernames
268 Continue for real, clobber usernames
263
269
264 $ hg graft -c -U
270 $ hg graft -c -U
265 grafting 4:9c233e8e184d "4"
271 grafting 4:9c233e8e184d "4"
266 grafting 3:4c60f11aa304 "3"
272 grafting 3:4c60f11aa304 "3"
267
273
268 Compare with original:
274 Compare with original:
269
275
270 $ hg diff -r 6
276 $ hg diff -r 6
271 $ hg status --rev 0:. -C
277 $ hg status --rev 0:. -C
272 M d
278 M d
273 M e
279 M e
274 A b
280 A b
275 a
281 a
276 A c
282 A c
277 a
283 a
278 R a
284 R a
279
285
280 View graph:
286 View graph:
281
287
282 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
288 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
283 @ test@11.draft: 3
289 @ test@11.draft: 3
284 |
290 |
285 o test@10.draft: 4
291 o test@10.draft: 4
286 |
292 |
287 o test@9.draft: 5
293 o test@9.draft: 5
288 |
294 |
289 o bar@8.draft: 1
295 o bar@8.draft: 1
290 |
296 |
291 o foo@7.draft: 2
297 o foo@7.draft: 2
292 |
298 |
293 | o test@6.secret: 6
299 | o test@6.secret: 6
294 | |\
300 | |\
295 | | o test@5.draft: 5
301 | | o test@5.draft: 5
296 | | |
302 | | |
297 | o | test@4.draft: 4
303 | o | test@4.draft: 4
298 | |/
304 | |/
299 | o baz@3.public: 3
305 | o baz@3.public: 3
300 | |
306 | |
301 | o test@2.public: 2
307 | o test@2.public: 2
302 | |
308 | |
303 | o bar@1.public: 1
309 | o bar@1.public: 1
304 |/
310 |/
305 o test@0.public: 0
311 o test@0.public: 0
306
312
307 Graft again onto another branch should preserve the original source
313 Graft again onto another branch should preserve the original source
308 $ hg up -q 0
314 $ hg up -q 0
309 $ echo 'g'>g
315 $ echo 'g'>g
310 $ hg add g
316 $ hg add g
311 $ hg ci -m 7
317 $ hg ci -m 7
312 created new head
318 created new head
313 $ hg graft 7
319 $ hg graft 7
314 grafting 7:ef0ef43d49e7 "2"
320 grafting 7:ef0ef43d49e7 "2"
315
321
316 $ hg log -r 7 --template '{rev}:{node}\n'
322 $ hg log -r 7 --template '{rev}:{node}\n'
317 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
323 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
318 $ hg log -r 2 --template '{rev}:{node}\n'
324 $ hg log -r 2 --template '{rev}:{node}\n'
319 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
325 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
320
326
321 $ hg log --debug -r tip
327 $ hg log --debug -r tip
322 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
328 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
323 tag: tip
329 tag: tip
324 phase: draft
330 phase: draft
325 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
331 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
326 parent: -1:0000000000000000000000000000000000000000
332 parent: -1:0000000000000000000000000000000000000000
327 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
333 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
328 user: foo
334 user: foo
329 date: Thu Jan 01 00:00:00 1970 +0000
335 date: Thu Jan 01 00:00:00 1970 +0000
330 files+: b
336 files+: b
331 files-: a
337 files-: a
332 extra: branch=default
338 extra: branch=default
333 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
339 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
334 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
340 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
335 description:
341 description:
336 2
342 2
337
343
338
344
339 Disallow grafting an already grafted cset onto its original branch
345 Disallow grafting an already grafted cset onto its original branch
340 $ hg up -q 6
346 $ hg up -q 6
341 $ hg graft 7
347 $ hg graft 7
342 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
348 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
343 [255]
349 [255]
344
350
345 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13
351 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13
346 --- */hg-5c095ad7e90f.patch * +0000 (glob)
352 --- */hg-5c095ad7e90f.patch * +0000 (glob)
347 +++ */hg-7a4785234d87.patch * +0000 (glob)
353 +++ */hg-7a4785234d87.patch * +0000 (glob)
348 @@ -1,18 +1,18 @@
354 @@ -1,18 +1,18 @@
349 # HG changeset patch
355 # HG changeset patch
350 -# User test
356 -# User test
351 +# User foo
357 +# User foo
352 # Date 0 0
358 # Date 0 0
353 # Thu Jan 01 00:00:00 1970 +0000
359 # Thu Jan 01 00:00:00 1970 +0000
354 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
360 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
355 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
361 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
356 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
362 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
357 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
363 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
358 2
364 2
359
365
360 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
366 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
361 +diff -r b592ea63bb0c -r 7a4785234d87 a
367 +diff -r b592ea63bb0c -r 7a4785234d87 a
362 --- a/a Thu Jan 01 00:00:00 1970 +0000
368 --- a/a Thu Jan 01 00:00:00 1970 +0000
363 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
369 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
364 @@ -1,1 +0,0 @@
370 @@ -1,1 +0,0 @@
365 --b
371 --b
366 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
372 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
367 +-a
373 +-a
368 +diff -r b592ea63bb0c -r 7a4785234d87 b
374 +diff -r b592ea63bb0c -r 7a4785234d87 b
369 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
375 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
370 +++ b/b Thu Jan 01 00:00:00 1970 +0000
376 +++ b/b Thu Jan 01 00:00:00 1970 +0000
371 @@ -0,0 +1,1 @@
377 @@ -0,0 +1,1 @@
372 -+b
378 -+b
373 ++a
379 ++a
374 [1]
380 [1]
375
381
376 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
382 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
377 --- */hg-5c095ad7e90f.patch * +0000 (glob)
383 --- */hg-5c095ad7e90f.patch * +0000 (glob)
378 +++ */hg-7a4785234d87.patch * +0000 (glob)
384 +++ */hg-7a4785234d87.patch * +0000 (glob)
379 @@ -1,8 +1,8 @@
385 @@ -1,8 +1,8 @@
380 # HG changeset patch
386 # HG changeset patch
381 -# User test
387 -# User test
382 +# User foo
388 +# User foo
383 # Date 0 0
389 # Date 0 0
384 # Thu Jan 01 00:00:00 1970 +0000
390 # Thu Jan 01 00:00:00 1970 +0000
385 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
391 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
386 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
392 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
387 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
393 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
388 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
394 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
389 2
395 2
390
396
391 [1]
397 [1]
392
398
393 Disallow grafting already grafted csets with the same origin onto each other
399 Disallow grafting already grafted csets with the same origin onto each other
394 $ hg up -q 13
400 $ hg up -q 13
395 $ hg graft 2
401 $ hg graft 2
396 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
402 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
397 [255]
403 [255]
398 $ hg graft 7
404 $ hg graft 7
399 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
405 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
400 [255]
406 [255]
401
407
402 $ hg up -q 7
408 $ hg up -q 7
403 $ hg graft 2
409 $ hg graft 2
404 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
410 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
405 [255]
411 [255]
406 $ hg graft tip
412 $ hg graft tip
407 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
413 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
408 [255]
414 [255]
409
415
410 Graft with --log
416 Graft with --log
411
417
412 $ hg up -Cq 1
418 $ hg up -Cq 1
413 $ hg graft 3 --log -u foo
419 $ hg graft 3 --log -u foo
414 grafting 3:4c60f11aa304 "3"
420 grafting 3:4c60f11aa304 "3"
415 warning: can't find ancestor for 'c' copied from 'b'!
421 warning: can't find ancestor for 'c' copied from 'b'!
416 $ hg log --template '{rev} {parents} {desc}\n' -r tip
422 $ hg log --template '{rev} {parents} {desc}\n' -r tip
417 14 1:5d205f8b35b6 3
423 14 1:5d205f8b35b6 3
418 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
424 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
419
425
420 Resolve conflicted graft
426 Resolve conflicted graft
421 $ hg up -q 0
427 $ hg up -q 0
422 $ echo b > a
428 $ echo b > a
423 $ hg ci -m 8
429 $ hg ci -m 8
424 created new head
430 created new head
425 $ echo c > a
431 $ echo c > a
426 $ hg ci -m 9
432 $ hg ci -m 9
427 $ hg graft 1 --tool internal:fail
433 $ hg graft 1 --tool internal:fail
428 grafting 1:5d205f8b35b6 "1"
434 grafting 1:5d205f8b35b6 "1"
429 abort: unresolved conflicts, can't continue
435 abort: unresolved conflicts, can't continue
430 (use hg resolve and hg graft --continue)
436 (use hg resolve and hg graft --continue)
431 [255]
437 [255]
432 $ hg resolve --all
438 $ hg resolve --all
433 merging a
439 merging a
434 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
440 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
435 [1]
441 [1]
436 $ cat a
442 $ cat a
437 <<<<<<< local: aaa4406d4f0a - test: 9
443 <<<<<<< local: aaa4406d4f0a - test: 9
438 c
444 c
439 =======
445 =======
440 b
446 b
441 >>>>>>> other: 5d205f8b35b6 - bar: 1
447 >>>>>>> other: 5d205f8b35b6 - bar: 1
442 $ echo b > a
448 $ echo b > a
443 $ hg resolve -m a
449 $ hg resolve -m a
444 (no more unresolved files)
450 (no more unresolved files)
445 continue: hg graft --continue
451 continue: hg graft --continue
446 $ hg graft -c
452 $ hg graft -c
447 grafting 1:5d205f8b35b6 "1"
453 grafting 1:5d205f8b35b6 "1"
448 $ hg export tip --git
454 $ hg export tip --git
449 # HG changeset patch
455 # HG changeset patch
450 # User bar
456 # User bar
451 # Date 0 0
457 # Date 0 0
452 # Thu Jan 01 00:00:00 1970 +0000
458 # Thu Jan 01 00:00:00 1970 +0000
453 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
459 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
454 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
460 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
455 1
461 1
456
462
457 diff --git a/a b/a
463 diff --git a/a b/a
458 --- a/a
464 --- a/a
459 +++ b/a
465 +++ b/a
460 @@ -1,1 +1,1 @@
466 @@ -1,1 +1,1 @@
461 -c
467 -c
462 +b
468 +b
463
469
464 Resolve conflicted graft with rename
470 Resolve conflicted graft with rename
465 $ echo c > a
471 $ echo c > a
466 $ hg ci -m 10
472 $ hg ci -m 10
467 $ hg graft 2 --tool internal:fail
473 $ hg graft 2 --tool internal:fail
468 grafting 2:5c095ad7e90f "2"
474 grafting 2:5c095ad7e90f "2"
469 abort: unresolved conflicts, can't continue
475 abort: unresolved conflicts, can't continue
470 (use hg resolve and hg graft --continue)
476 (use hg resolve and hg graft --continue)
471 [255]
477 [255]
472 $ hg resolve --all
478 $ hg resolve --all
473 merging a and b to b
479 merging a and b to b
474 (no more unresolved files)
480 (no more unresolved files)
475 continue: hg graft --continue
481 continue: hg graft --continue
476 $ hg graft -c
482 $ hg graft -c
477 grafting 2:5c095ad7e90f "2"
483 grafting 2:5c095ad7e90f "2"
478 $ hg export tip --git
484 $ hg export tip --git
479 # HG changeset patch
485 # HG changeset patch
480 # User test
486 # User test
481 # Date 0 0
487 # Date 0 0
482 # Thu Jan 01 00:00:00 1970 +0000
488 # Thu Jan 01 00:00:00 1970 +0000
483 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
489 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
484 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
490 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
485 2
491 2
486
492
487 diff --git a/a b/b
493 diff --git a/a b/b
488 rename from a
494 rename from a
489 rename to b
495 rename to b
490
496
491 Test simple origin(), with and without args
497 Test simple origin(), with and without args
492 $ hg log -r 'origin()'
498 $ hg log -r 'origin()'
493 changeset: 1:5d205f8b35b6
499 changeset: 1:5d205f8b35b6
494 user: bar
500 user: bar
495 date: Thu Jan 01 00:00:00 1970 +0000
501 date: Thu Jan 01 00:00:00 1970 +0000
496 summary: 1
502 summary: 1
497
503
498 changeset: 2:5c095ad7e90f
504 changeset: 2:5c095ad7e90f
499 user: test
505 user: test
500 date: Thu Jan 01 00:00:00 1970 +0000
506 date: Thu Jan 01 00:00:00 1970 +0000
501 summary: 2
507 summary: 2
502
508
503 changeset: 3:4c60f11aa304
509 changeset: 3:4c60f11aa304
504 user: baz
510 user: baz
505 date: Thu Jan 01 00:00:00 1970 +0000
511 date: Thu Jan 01 00:00:00 1970 +0000
506 summary: 3
512 summary: 3
507
513
508 changeset: 4:9c233e8e184d
514 changeset: 4:9c233e8e184d
509 user: test
515 user: test
510 date: Thu Jan 01 00:00:00 1970 +0000
516 date: Thu Jan 01 00:00:00 1970 +0000
511 summary: 4
517 summary: 4
512
518
513 changeset: 5:97f8bfe72746
519 changeset: 5:97f8bfe72746
514 branch: stable
520 branch: stable
515 parent: 3:4c60f11aa304
521 parent: 3:4c60f11aa304
516 user: test
522 user: test
517 date: Thu Jan 01 00:00:00 1970 +0000
523 date: Thu Jan 01 00:00:00 1970 +0000
518 summary: 5
524 summary: 5
519
525
520 $ hg log -r 'origin(7)'
526 $ hg log -r 'origin(7)'
521 changeset: 2:5c095ad7e90f
527 changeset: 2:5c095ad7e90f
522 user: test
528 user: test
523 date: Thu Jan 01 00:00:00 1970 +0000
529 date: Thu Jan 01 00:00:00 1970 +0000
524 summary: 2
530 summary: 2
525
531
526 Now transplant a graft to test following through copies
532 Now transplant a graft to test following through copies
527 $ hg up -q 0
533 $ hg up -q 0
528 $ hg branch -q dev
534 $ hg branch -q dev
529 $ hg ci -qm "dev branch"
535 $ hg ci -qm "dev branch"
530 $ hg --config extensions.transplant= transplant -q 7
536 $ hg --config extensions.transplant= transplant -q 7
531 $ hg log -r 'origin(.)'
537 $ hg log -r 'origin(.)'
532 changeset: 2:5c095ad7e90f
538 changeset: 2:5c095ad7e90f
533 user: test
539 user: test
534 date: Thu Jan 01 00:00:00 1970 +0000
540 date: Thu Jan 01 00:00:00 1970 +0000
535 summary: 2
541 summary: 2
536
542
537 Test that the graft and transplant markers in extra are converted, allowing
543 Test that the graft and transplant markers in extra are converted, allowing
538 origin() to still work. Note that these recheck the immediately preceeding two
544 origin() to still work. Note that these recheck the immediately preceeding two
539 tests.
545 tests.
540 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
546 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
541
547
542 The graft case
548 The graft case
543 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
549 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
544 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
550 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
545 branch=default
551 branch=default
546 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
552 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
547 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
553 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
548 $ hg -R ../converted log -r 'origin(7)'
554 $ hg -R ../converted log -r 'origin(7)'
549 changeset: 2:e0213322b2c1
555 changeset: 2:e0213322b2c1
550 user: test
556 user: test
551 date: Thu Jan 01 00:00:00 1970 +0000
557 date: Thu Jan 01 00:00:00 1970 +0000
552 summary: 2
558 summary: 2
553
559
554 Test that template correctly expands more than one 'extra' (issue4362), and that
560 Test that template correctly expands more than one 'extra' (issue4362), and that
555 'intermediate-source' is converted.
561 'intermediate-source' is converted.
556 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
562 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
557 Extra: branch=default
563 Extra: branch=default
558 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
564 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
559 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
565 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
560 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
566 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
561
567
562 The transplant case
568 The transplant case
563 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
569 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
564 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
570 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
565 branch=dev
571 branch=dev
566 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
572 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
567 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac (esc)
573 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac (esc)
568 `h\x9b (esc)
574 `h\x9b (esc)
569 $ hg -R ../converted log -r 'origin(tip)'
575 $ hg -R ../converted log -r 'origin(tip)'
570 changeset: 2:e0213322b2c1
576 changeset: 2:e0213322b2c1
571 user: test
577 user: test
572 date: Thu Jan 01 00:00:00 1970 +0000
578 date: Thu Jan 01 00:00:00 1970 +0000
573 summary: 2
579 summary: 2
574
580
575
581
576 Test simple destination
582 Test simple destination
577 $ hg log -r 'destination()'
583 $ hg log -r 'destination()'
578 changeset: 7:ef0ef43d49e7
584 changeset: 7:ef0ef43d49e7
579 parent: 0:68795b066622
585 parent: 0:68795b066622
580 user: foo
586 user: foo
581 date: Thu Jan 01 00:00:00 1970 +0000
587 date: Thu Jan 01 00:00:00 1970 +0000
582 summary: 2
588 summary: 2
583
589
584 changeset: 8:6b9e5368ca4e
590 changeset: 8:6b9e5368ca4e
585 user: bar
591 user: bar
586 date: Thu Jan 01 00:00:00 1970 +0000
592 date: Thu Jan 01 00:00:00 1970 +0000
587 summary: 1
593 summary: 1
588
594
589 changeset: 9:1905859650ec
595 changeset: 9:1905859650ec
590 user: test
596 user: test
591 date: Thu Jan 01 00:00:00 1970 +0000
597 date: Thu Jan 01 00:00:00 1970 +0000
592 summary: 5
598 summary: 5
593
599
594 changeset: 10:52dc0b4c6907
600 changeset: 10:52dc0b4c6907
595 user: test
601 user: test
596 date: Thu Jan 01 00:00:00 1970 +0000
602 date: Thu Jan 01 00:00:00 1970 +0000
597 summary: 4
603 summary: 4
598
604
599 changeset: 11:882b35362a6b
605 changeset: 11:882b35362a6b
600 user: test
606 user: test
601 date: Thu Jan 01 00:00:00 1970 +0000
607 date: Thu Jan 01 00:00:00 1970 +0000
602 summary: 3
608 summary: 3
603
609
604 changeset: 13:7a4785234d87
610 changeset: 13:7a4785234d87
605 user: foo
611 user: foo
606 date: Thu Jan 01 00:00:00 1970 +0000
612 date: Thu Jan 01 00:00:00 1970 +0000
607 summary: 2
613 summary: 2
608
614
609 changeset: 14:f64defefacee
615 changeset: 14:f64defefacee
610 parent: 1:5d205f8b35b6
616 parent: 1:5d205f8b35b6
611 user: foo
617 user: foo
612 date: Thu Jan 01 00:00:00 1970 +0000
618 date: Thu Jan 01 00:00:00 1970 +0000
613 summary: 3
619 summary: 3
614
620
615 changeset: 17:f67661df0c48
621 changeset: 17:f67661df0c48
616 user: bar
622 user: bar
617 date: Thu Jan 01 00:00:00 1970 +0000
623 date: Thu Jan 01 00:00:00 1970 +0000
618 summary: 1
624 summary: 1
619
625
620 changeset: 19:9627f653b421
626 changeset: 19:9627f653b421
621 user: test
627 user: test
622 date: Thu Jan 01 00:00:00 1970 +0000
628 date: Thu Jan 01 00:00:00 1970 +0000
623 summary: 2
629 summary: 2
624
630
625 changeset: 21:7e61b508e709
631 changeset: 21:7e61b508e709
626 branch: dev
632 branch: dev
627 tag: tip
633 tag: tip
628 user: foo
634 user: foo
629 date: Thu Jan 01 00:00:00 1970 +0000
635 date: Thu Jan 01 00:00:00 1970 +0000
630 summary: 2
636 summary: 2
631
637
632 $ hg log -r 'destination(2)'
638 $ hg log -r 'destination(2)'
633 changeset: 7:ef0ef43d49e7
639 changeset: 7:ef0ef43d49e7
634 parent: 0:68795b066622
640 parent: 0:68795b066622
635 user: foo
641 user: foo
636 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
637 summary: 2
643 summary: 2
638
644
639 changeset: 13:7a4785234d87
645 changeset: 13:7a4785234d87
640 user: foo
646 user: foo
641 date: Thu Jan 01 00:00:00 1970 +0000
647 date: Thu Jan 01 00:00:00 1970 +0000
642 summary: 2
648 summary: 2
643
649
644 changeset: 19:9627f653b421
650 changeset: 19:9627f653b421
645 user: test
651 user: test
646 date: Thu Jan 01 00:00:00 1970 +0000
652 date: Thu Jan 01 00:00:00 1970 +0000
647 summary: 2
653 summary: 2
648
654
649 changeset: 21:7e61b508e709
655 changeset: 21:7e61b508e709
650 branch: dev
656 branch: dev
651 tag: tip
657 tag: tip
652 user: foo
658 user: foo
653 date: Thu Jan 01 00:00:00 1970 +0000
659 date: Thu Jan 01 00:00:00 1970 +0000
654 summary: 2
660 summary: 2
655
661
656 Transplants of grafts can find a destination...
662 Transplants of grafts can find a destination...
657 $ hg log -r 'destination(7)'
663 $ hg log -r 'destination(7)'
658 changeset: 21:7e61b508e709
664 changeset: 21:7e61b508e709
659 branch: dev
665 branch: dev
660 tag: tip
666 tag: tip
661 user: foo
667 user: foo
662 date: Thu Jan 01 00:00:00 1970 +0000
668 date: Thu Jan 01 00:00:00 1970 +0000
663 summary: 2
669 summary: 2
664
670
665 ... grafts of grafts unfortunately can't
671 ... grafts of grafts unfortunately can't
666 $ hg graft -q 13
672 $ hg graft -q 13
667 warning: can't find ancestor for 'b' copied from 'a'!
673 warning: can't find ancestor for 'b' copied from 'a'!
668 $ hg log -r 'destination(13)'
674 $ hg log -r 'destination(13)'
669 All copies of a cset
675 All copies of a cset
670 $ hg log -r 'origin(13) or destination(origin(13))'
676 $ hg log -r 'origin(13) or destination(origin(13))'
671 changeset: 2:5c095ad7e90f
677 changeset: 2:5c095ad7e90f
672 user: test
678 user: test
673 date: Thu Jan 01 00:00:00 1970 +0000
679 date: Thu Jan 01 00:00:00 1970 +0000
674 summary: 2
680 summary: 2
675
681
676 changeset: 7:ef0ef43d49e7
682 changeset: 7:ef0ef43d49e7
677 parent: 0:68795b066622
683 parent: 0:68795b066622
678 user: foo
684 user: foo
679 date: Thu Jan 01 00:00:00 1970 +0000
685 date: Thu Jan 01 00:00:00 1970 +0000
680 summary: 2
686 summary: 2
681
687
682 changeset: 13:7a4785234d87
688 changeset: 13:7a4785234d87
683 user: foo
689 user: foo
684 date: Thu Jan 01 00:00:00 1970 +0000
690 date: Thu Jan 01 00:00:00 1970 +0000
685 summary: 2
691 summary: 2
686
692
687 changeset: 19:9627f653b421
693 changeset: 19:9627f653b421
688 user: test
694 user: test
689 date: Thu Jan 01 00:00:00 1970 +0000
695 date: Thu Jan 01 00:00:00 1970 +0000
690 summary: 2
696 summary: 2
691
697
692 changeset: 21:7e61b508e709
698 changeset: 21:7e61b508e709
693 branch: dev
699 branch: dev
694 user: foo
700 user: foo
695 date: Thu Jan 01 00:00:00 1970 +0000
701 date: Thu Jan 01 00:00:00 1970 +0000
696 summary: 2
702 summary: 2
697
703
698 changeset: 22:d1cb6591fa4b
704 changeset: 22:d1cb6591fa4b
699 branch: dev
705 branch: dev
700 tag: tip
706 tag: tip
701 user: foo
707 user: foo
702 date: Thu Jan 01 00:00:00 1970 +0000
708 date: Thu Jan 01 00:00:00 1970 +0000
703 summary: 2
709 summary: 2
704
710
705
711
706 graft works on complex revset
712 graft works on complex revset
707
713
708 $ hg graft 'origin(13) or destination(origin(13))'
714 $ hg graft 'origin(13) or destination(origin(13))'
709 skipping ancestor revision 21:7e61b508e709
715 skipping ancestor revision 21:7e61b508e709
710 skipping ancestor revision 22:d1cb6591fa4b
716 skipping ancestor revision 22:d1cb6591fa4b
711 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
717 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
712 grafting 7:ef0ef43d49e7 "2"
718 grafting 7:ef0ef43d49e7 "2"
713 warning: can't find ancestor for 'b' copied from 'a'!
719 warning: can't find ancestor for 'b' copied from 'a'!
714 grafting 13:7a4785234d87 "2"
720 grafting 13:7a4785234d87 "2"
715 warning: can't find ancestor for 'b' copied from 'a'!
721 warning: can't find ancestor for 'b' copied from 'a'!
716 grafting 19:9627f653b421 "2"
722 grafting 19:9627f653b421 "2"
717 merging b
723 merging b
718 warning: can't find ancestor for 'b' copied from 'a'!
724 warning: can't find ancestor for 'b' copied from 'a'!
719
725
720 graft with --force (still doesn't graft merges)
726 graft with --force (still doesn't graft merges)
721
727
722 $ hg graft 19 0 6
728 $ hg graft 19 0 6
723 skipping ungraftable merge revision 6
729 skipping ungraftable merge revision 6
724 skipping ancestor revision 0:68795b066622
730 skipping ancestor revision 0:68795b066622
725 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
731 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
726 [255]
732 [255]
727 $ hg graft 19 0 6 --force
733 $ hg graft 19 0 6 --force
728 skipping ungraftable merge revision 6
734 skipping ungraftable merge revision 6
729 grafting 19:9627f653b421 "2"
735 grafting 19:9627f653b421 "2"
730 merging b
736 merging b
731 warning: can't find ancestor for 'b' copied from 'a'!
737 warning: can't find ancestor for 'b' copied from 'a'!
732 grafting 0:68795b066622 "0"
738 grafting 0:68795b066622 "0"
733
739
734 graft --force after backout
740 graft --force after backout
735
741
736 $ echo abc > a
742 $ echo abc > a
737 $ hg ci -m 28
743 $ hg ci -m 28
738 $ hg backout 28
744 $ hg backout 28
739 reverting a
745 reverting a
740 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
746 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
741 $ hg graft 28
747 $ hg graft 28
742 skipping ancestor revision 28:50a516bb8b57
748 skipping ancestor revision 28:50a516bb8b57
743 [255]
749 [255]
744 $ hg graft 28 --force
750 $ hg graft 28 --force
745 grafting 28:50a516bb8b57 "28"
751 grafting 28:50a516bb8b57 "28"
746 merging a
752 merging a
747 $ cat a
753 $ cat a
748 abc
754 abc
749
755
750 graft --continue after --force
756 graft --continue after --force
751
757
752 $ echo def > a
758 $ echo def > a
753 $ hg ci -m 31
759 $ hg ci -m 31
754 $ hg graft 28 --force --tool internal:fail
760 $ hg graft 28 --force --tool internal:fail
755 grafting 28:50a516bb8b57 "28"
761 grafting 28:50a516bb8b57 "28"
756 abort: unresolved conflicts, can't continue
762 abort: unresolved conflicts, can't continue
757 (use hg resolve and hg graft --continue)
763 (use hg resolve and hg graft --continue)
758 [255]
764 [255]
759 $ hg resolve --all
765 $ hg resolve --all
760 merging a
766 merging a
761 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
767 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
762 [1]
768 [1]
763 $ echo abc > a
769 $ echo abc > a
764 $ hg resolve -m a
770 $ hg resolve -m a
765 (no more unresolved files)
771 (no more unresolved files)
766 continue: hg graft --continue
772 continue: hg graft --continue
767 $ hg graft -c
773 $ hg graft -c
768 grafting 28:50a516bb8b57 "28"
774 grafting 28:50a516bb8b57 "28"
769 $ cat a
775 $ cat a
770 abc
776 abc
771
777
772 Continue testing same origin policy, using revision numbers from test above
778 Continue testing same origin policy, using revision numbers from test above
773 but do some destructive editing of the repo:
779 but do some destructive editing of the repo:
774
780
775 $ hg up -qC 7
781 $ hg up -qC 7
776 $ hg tag -l -r 13 tmp
782 $ hg tag -l -r 13 tmp
777 $ hg --config extensions.strip= strip 2
783 $ hg --config extensions.strip= strip 2
778 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg (glob)
784 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg (glob)
779 $ hg graft tmp
785 $ hg graft tmp
780 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
786 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
781 [255]
787 [255]
782
788
783 Empty graft
789 Empty graft
784
790
785 $ hg up -qr 26
791 $ hg up -qr 26
786 $ hg tag -f something
792 $ hg tag -f something
787 $ hg graft -qr 27
793 $ hg graft -qr 27
788 $ hg graft -f 27
794 $ hg graft -f 27
789 grafting 27:ed6c7e54e319 "28"
795 grafting 27:ed6c7e54e319 "28"
790 note: graft of 27:ed6c7e54e319 created no changes to commit
796 note: graft of 27:ed6c7e54e319 created no changes to commit
791
797
792 $ cd ..
798 $ cd ..
793
799
794 Graft to duplicate a commit
800 Graft to duplicate a commit
795
801
796 $ hg init graftsibling
802 $ hg init graftsibling
797 $ cd graftsibling
803 $ cd graftsibling
798 $ touch a
804 $ touch a
799 $ hg commit -qAm a
805 $ hg commit -qAm a
800 $ touch b
806 $ touch b
801 $ hg commit -qAm b
807 $ hg commit -qAm b
802 $ hg log -G -T '{rev}\n'
808 $ hg log -G -T '{rev}\n'
803 @ 1
809 @ 1
804 |
810 |
805 o 0
811 o 0
806
812
807 $ hg up -q 0
813 $ hg up -q 0
808 $ hg graft -r 1
814 $ hg graft -r 1
809 grafting 1:0e067c57feba "b" (tip)
815 grafting 1:0e067c57feba "b" (tip)
810 $ hg log -G -T '{rev}\n'
816 $ hg log -G -T '{rev}\n'
811 @ 2
817 @ 2
812 |
818 |
813 | o 1
819 | o 1
814 |/
820 |/
815 o 0
821 o 0
816
822
817 Graft to duplicate a commit twice
823 Graft to duplicate a commit twice
818
824
819 $ hg up -q 0
825 $ hg up -q 0
820 $ hg graft -r 2
826 $ hg graft -r 2
821 grafting 2:044ec77f6389 "b" (tip)
827 grafting 2:044ec77f6389 "b" (tip)
822 $ hg log -G -T '{rev}\n'
828 $ hg log -G -T '{rev}\n'
823 @ 3
829 @ 3
824 |
830 |
825 | o 2
831 | o 2
826 |/
832 |/
827 | o 1
833 | o 1
828 |/
834 |/
829 o 0
835 o 0
830
836
@@ -1,741 +1,744 b''
1 This file focuses mainly on updating largefiles in the working
1 This file focuses mainly on updating largefiles in the working
2 directory (and ".hg/largefiles/dirstate")
2 directory (and ".hg/largefiles/dirstate")
3
3
4 $ cat >> $HGRCPATH <<EOF
4 $ cat >> $HGRCPATH <<EOF
5 > [ui]
5 > [ui]
6 > merge = internal:fail
6 > merge = internal:fail
7 > [extensions]
7 > [extensions]
8 > largefiles =
8 > largefiles =
9 > [defaults]
10 > # for portability
11 > extdiff = --option -Nru
9 > EOF
12 > EOF
10
13
11 $ hg init repo
14 $ hg init repo
12 $ cd repo
15 $ cd repo
13
16
14 $ echo large1 > large1
17 $ echo large1 > large1
15 $ echo large2 > large2
18 $ echo large2 > large2
16 $ hg add --large large1 large2
19 $ hg add --large large1 large2
17 $ echo normal1 > normal1
20 $ echo normal1 > normal1
18 $ hg add normal1
21 $ hg add normal1
19 $ hg commit -m '#0'
22 $ hg commit -m '#0'
20 $ echo 'large1 in #1' > large1
23 $ echo 'large1 in #1' > large1
21 $ echo 'normal1 in #1' > normal1
24 $ echo 'normal1 in #1' > normal1
22 $ hg commit -m '#1'
25 $ hg commit -m '#1'
23 $ hg extdiff -r '.^' --config extensions.extdiff=
26 $ hg extdiff -r '.^' --config extensions.extdiff=
24 diff -Npru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
27 diff -Nru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
25 --- repo.0d9d9b8dc9a3/.hglf/large1 * (glob)
28 --- repo.0d9d9b8dc9a3/.hglf/large1 * (glob)
26 +++ repo/.hglf/large1 * (glob)
29 +++ repo/.hglf/large1 * (glob)
27 @@ -1 +1 @@
30 @@ -1 +1 @@
28 -4669e532d5b2c093a78eca010077e708a071bb64
31 -4669e532d5b2c093a78eca010077e708a071bb64
29 +58e24f733a964da346e2407a2bee99d9001184f5
32 +58e24f733a964da346e2407a2bee99d9001184f5
30 diff -Npru repo.0d9d9b8dc9a3/normal1 repo/normal1
33 diff -Nru repo.0d9d9b8dc9a3/normal1 repo/normal1
31 --- repo.0d9d9b8dc9a3/normal1 * (glob)
34 --- repo.0d9d9b8dc9a3/normal1 * (glob)
32 +++ repo/normal1 * (glob)
35 +++ repo/normal1 * (glob)
33 @@ -1 +1 @@
36 @@ -1 +1 @@
34 -normal1
37 -normal1
35 +normal1 in #1
38 +normal1 in #1
36 [1]
39 [1]
37 $ hg update -q -C 0
40 $ hg update -q -C 0
38 $ echo 'large2 in #2' > large2
41 $ echo 'large2 in #2' > large2
39 $ hg commit -m '#2'
42 $ hg commit -m '#2'
40 created new head
43 created new head
41
44
42 Test that update also updates the lfdirstate of 'unsure' largefiles after
45 Test that update also updates the lfdirstate of 'unsure' largefiles after
43 hashing them:
46 hashing them:
44
47
45 The previous operations will usually have left us with largefiles with a mtime
48 The previous operations will usually have left us with largefiles with a mtime
46 within the same second as the dirstate was written.
49 within the same second as the dirstate was written.
47 The lfdirstate entries will thus have been written with an invalidated/unset
50 The lfdirstate entries will thus have been written with an invalidated/unset
48 mtime to make sure further changes within the same second is detected.
51 mtime to make sure further changes within the same second is detected.
49 We will however occasionally be "lucky" and get a tick between writing
52 We will however occasionally be "lucky" and get a tick between writing
50 largefiles and writing dirstate so we get valid lfdirstate timestamps. The
53 largefiles and writing dirstate so we get valid lfdirstate timestamps. The
51 following verification is thus disabled but can be verified manually.
54 following verification is thus disabled but can be verified manually.
52
55
53 #if false
56 #if false
54 $ hg debugdirstate --large --nodate
57 $ hg debugdirstate --large --nodate
55 n 644 7 unset large1
58 n 644 7 unset large1
56 n 644 13 unset large2
59 n 644 13 unset large2
57 #endif
60 #endif
58
61
59 Wait to make sure we get a tick so the mtime of the largefiles become valid.
62 Wait to make sure we get a tick so the mtime of the largefiles become valid.
60
63
61 $ sleep 1
64 $ sleep 1
62
65
63 A linear merge will update standins before performing the actual merge. It will
66 A linear merge will update standins before performing the actual merge. It will
64 do a lfdirstate status walk and find 'unset'/'unsure' files, hash them, and
67 do a lfdirstate status walk and find 'unset'/'unsure' files, hash them, and
65 update the corresponding standins.
68 update the corresponding standins.
66 Verify that it actually marks the clean files as clean in lfdirstate so
69 Verify that it actually marks the clean files as clean in lfdirstate so
67 we don't have to hash them again next time we update.
70 we don't have to hash them again next time we update.
68
71
69 $ hg up
72 $ hg up
70 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 1 other heads for branch "default"
74 1 other heads for branch "default"
72 $ hg debugdirstate --large --nodate
75 $ hg debugdirstate --large --nodate
73 n 644 7 set large1
76 n 644 7 set large1
74 n 644 13 set large2
77 n 644 13 set large2
75
78
76 Test that lfdirstate keeps track of last modification of largefiles and
79 Test that lfdirstate keeps track of last modification of largefiles and
77 prevents unnecessary hashing of content - also after linear/noop update
80 prevents unnecessary hashing of content - also after linear/noop update
78
81
79 $ sleep 1
82 $ sleep 1
80 $ hg st
83 $ hg st
81 $ hg debugdirstate --large --nodate
84 $ hg debugdirstate --large --nodate
82 n 644 7 set large1
85 n 644 7 set large1
83 n 644 13 set large2
86 n 644 13 set large2
84 $ hg up
87 $ hg up
85 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 1 other heads for branch "default"
89 1 other heads for branch "default"
87 $ hg debugdirstate --large --nodate
90 $ hg debugdirstate --large --nodate
88 n 644 7 set large1
91 n 644 7 set large1
89 n 644 13 set large2
92 n 644 13 set large2
90
93
91 Test that "hg merge" updates largefiles from "other" correctly
94 Test that "hg merge" updates largefiles from "other" correctly
92
95
93 (getting largefiles from "other" normally)
96 (getting largefiles from "other" normally)
94
97
95 $ hg status -A large1
98 $ hg status -A large1
96 C large1
99 C large1
97 $ cat large1
100 $ cat large1
98 large1
101 large1
99 $ cat .hglf/large1
102 $ cat .hglf/large1
100 4669e532d5b2c093a78eca010077e708a071bb64
103 4669e532d5b2c093a78eca010077e708a071bb64
101 $ hg merge --config debug.dirstate.delaywrite=2
104 $ hg merge --config debug.dirstate.delaywrite=2
102 getting changed largefiles
105 getting changed largefiles
103 1 largefiles updated, 0 removed
106 1 largefiles updated, 0 removed
104 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 (branch merge, don't forget to commit)
108 (branch merge, don't forget to commit)
106 $ hg status -A large1
109 $ hg status -A large1
107 M large1
110 M large1
108 $ cat large1
111 $ cat large1
109 large1 in #1
112 large1 in #1
110 $ cat .hglf/large1
113 $ cat .hglf/large1
111 58e24f733a964da346e2407a2bee99d9001184f5
114 58e24f733a964da346e2407a2bee99d9001184f5
112 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
115 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
113 -4669e532d5b2c093a78eca010077e708a071bb64
116 -4669e532d5b2c093a78eca010077e708a071bb64
114 +58e24f733a964da346e2407a2bee99d9001184f5
117 +58e24f733a964da346e2407a2bee99d9001184f5
115
118
116 (getting largefiles from "other" via conflict prompt)
119 (getting largefiles from "other" via conflict prompt)
117
120
118 $ hg update -q -C 2
121 $ hg update -q -C 2
119 $ echo 'large1 in #3' > large1
122 $ echo 'large1 in #3' > large1
120 $ echo 'normal1 in #3' > normal1
123 $ echo 'normal1 in #3' > normal1
121 $ hg commit -m '#3'
124 $ hg commit -m '#3'
122 $ cat .hglf/large1
125 $ cat .hglf/large1
123 e5bb990443d6a92aaf7223813720f7566c9dd05b
126 e5bb990443d6a92aaf7223813720f7566c9dd05b
124 $ hg merge --config debug.dirstate.delaywrite=2 --config ui.interactive=True <<EOF
127 $ hg merge --config debug.dirstate.delaywrite=2 --config ui.interactive=True <<EOF
125 > o
128 > o
126 > EOF
129 > EOF
127 largefile large1 has a merge conflict
130 largefile large1 has a merge conflict
128 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
131 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
129 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
132 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
130 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
133 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
131 merging normal1
134 merging normal1
132 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
135 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
133 getting changed largefiles
136 getting changed largefiles
134 1 largefiles updated, 0 removed
137 1 largefiles updated, 0 removed
135 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
138 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
136 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
139 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
137 [1]
140 [1]
138 $ hg status -A large1
141 $ hg status -A large1
139 M large1
142 M large1
140 $ cat large1
143 $ cat large1
141 large1 in #1
144 large1 in #1
142 $ cat .hglf/large1
145 $ cat .hglf/large1
143 58e24f733a964da346e2407a2bee99d9001184f5
146 58e24f733a964da346e2407a2bee99d9001184f5
144
147
145 (merge non-existing largefiles from "other" via conflict prompt -
148 (merge non-existing largefiles from "other" via conflict prompt -
146 make sure the following commit doesn't abort in a confusing way when trying to
149 make sure the following commit doesn't abort in a confusing way when trying to
147 mark the non-existing file as normal in lfdirstate)
150 mark the non-existing file as normal in lfdirstate)
148
151
149 $ mv .hg/largefiles/58e24f733a964da346e2407a2bee99d9001184f5 .
152 $ mv .hg/largefiles/58e24f733a964da346e2407a2bee99d9001184f5 .
150 $ hg update -q -C 3
153 $ hg update -q -C 3
151 $ hg merge --config largefiles.usercache=not --config debug.dirstate.delaywrite=2 --tool :local --config ui.interactive=True <<EOF
154 $ hg merge --config largefiles.usercache=not --config debug.dirstate.delaywrite=2 --tool :local --config ui.interactive=True <<EOF
152 > o
155 > o
153 > EOF
156 > EOF
154 largefile large1 has a merge conflict
157 largefile large1 has a merge conflict
155 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
158 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
156 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
159 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
157 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
160 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
158 getting changed largefiles
161 getting changed largefiles
159 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
162 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
160 0 largefiles updated, 0 removed
163 0 largefiles updated, 0 removed
161 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
164 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
162 (branch merge, don't forget to commit)
165 (branch merge, don't forget to commit)
163 $ hg commit -m '1-2-3 testing' --config largefiles.usercache=not
166 $ hg commit -m '1-2-3 testing' --config largefiles.usercache=not
164 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from local store
167 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from local store
165 $ hg up -C . --config largefiles.usercache=not
168 $ hg up -C . --config largefiles.usercache=not
166 getting changed largefiles
169 getting changed largefiles
167 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
170 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
168 0 largefiles updated, 0 removed
171 0 largefiles updated, 0 removed
169 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
172 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 $ hg st large1
173 $ hg st large1
171 ! large1
174 ! large1
172 $ hg rollback -q
175 $ hg rollback -q
173 $ mv 58e24f733a964da346e2407a2bee99d9001184f5 .hg/largefiles/
176 $ mv 58e24f733a964da346e2407a2bee99d9001184f5 .hg/largefiles/
174
177
175 Test that "hg revert -r REV" updates largefiles from "REV" correctly
178 Test that "hg revert -r REV" updates largefiles from "REV" correctly
176
179
177 $ hg update -q -C 3
180 $ hg update -q -C 3
178 $ hg status -A large1
181 $ hg status -A large1
179 C large1
182 C large1
180 $ cat large1
183 $ cat large1
181 large1 in #3
184 large1 in #3
182 $ cat .hglf/large1
185 $ cat .hglf/large1
183 e5bb990443d6a92aaf7223813720f7566c9dd05b
186 e5bb990443d6a92aaf7223813720f7566c9dd05b
184 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
187 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
185 -4669e532d5b2c093a78eca010077e708a071bb64
188 -4669e532d5b2c093a78eca010077e708a071bb64
186 +58e24f733a964da346e2407a2bee99d9001184f5
189 +58e24f733a964da346e2407a2bee99d9001184f5
187 $ hg revert --no-backup -r 1 --config debug.dirstate.delaywrite=2 large1
190 $ hg revert --no-backup -r 1 --config debug.dirstate.delaywrite=2 large1
188 $ hg status -A large1
191 $ hg status -A large1
189 M large1
192 M large1
190 $ cat large1
193 $ cat large1
191 large1 in #1
194 large1 in #1
192 $ cat .hglf/large1
195 $ cat .hglf/large1
193 58e24f733a964da346e2407a2bee99d9001184f5
196 58e24f733a964da346e2407a2bee99d9001184f5
194
197
195 Test that "hg rollback" restores status of largefiles correctly
198 Test that "hg rollback" restores status of largefiles correctly
196
199
197 $ hg update -C -q
200 $ hg update -C -q
198 $ hg remove large1
201 $ hg remove large1
199 $ test -f .hglf/large1
202 $ test -f .hglf/large1
200 [1]
203 [1]
201 $ hg forget large2
204 $ hg forget large2
202 $ test -f .hglf/large2
205 $ test -f .hglf/large2
203 [1]
206 [1]
204 $ echo largeX > largeX
207 $ echo largeX > largeX
205 $ hg add --large largeX
208 $ hg add --large largeX
206 $ cat .hglf/largeX
209 $ cat .hglf/largeX
207
210
208 $ hg commit -m 'will be rollback-ed soon'
211 $ hg commit -m 'will be rollback-ed soon'
209 $ echo largeY > largeY
212 $ echo largeY > largeY
210 $ hg add --large largeY
213 $ hg add --large largeY
211 #if windows
214 #if windows
212 $ hg status -A large1
215 $ hg status -A large1
213 large1: * (glob)
216 large1: * (glob)
214 #else
217 #else
215 $ hg status -A large1
218 $ hg status -A large1
216 large1: No such file or directory
219 large1: No such file or directory
217 #endif
220 #endif
218 $ hg status -A large2
221 $ hg status -A large2
219 ? large2
222 ? large2
220 $ hg status -A largeX
223 $ hg status -A largeX
221 C largeX
224 C largeX
222 $ hg status -A largeY
225 $ hg status -A largeY
223 A largeY
226 A largeY
224 $ hg rollback
227 $ hg rollback
225 repository tip rolled back to revision 3 (undo commit)
228 repository tip rolled back to revision 3 (undo commit)
226 working directory now based on revision 3
229 working directory now based on revision 3
227 $ hg status -A large1
230 $ hg status -A large1
228 R large1
231 R large1
229 $ test -f .hglf/large1
232 $ test -f .hglf/large1
230 [1]
233 [1]
231 $ hg status -A large2
234 $ hg status -A large2
232 R large2
235 R large2
233 $ test -f .hglf/large2
236 $ test -f .hglf/large2
234 [1]
237 [1]
235 $ hg status -A largeX
238 $ hg status -A largeX
236 A largeX
239 A largeX
237 $ cat .hglf/largeX
240 $ cat .hglf/largeX
238
241
239 $ hg status -A largeY
242 $ hg status -A largeY
240 ? largeY
243 ? largeY
241 $ test -f .hglf/largeY
244 $ test -f .hglf/largeY
242 [1]
245 [1]
243
246
244 Test that "hg rollback" restores standins correctly
247 Test that "hg rollback" restores standins correctly
245
248
246 $ hg commit -m 'will be rollback-ed soon'
249 $ hg commit -m 'will be rollback-ed soon'
247 $ hg update -q -C 2
250 $ hg update -q -C 2
248 $ cat large1
251 $ cat large1
249 large1
252 large1
250 $ cat .hglf/large1
253 $ cat .hglf/large1
251 4669e532d5b2c093a78eca010077e708a071bb64
254 4669e532d5b2c093a78eca010077e708a071bb64
252 $ cat large2
255 $ cat large2
253 large2 in #2
256 large2 in #2
254 $ cat .hglf/large2
257 $ cat .hglf/large2
255 3cfce6277e7668985707b6887ce56f9f62f6ccd9
258 3cfce6277e7668985707b6887ce56f9f62f6ccd9
256
259
257 $ hg rollback -q -f
260 $ hg rollback -q -f
258 $ cat large1
261 $ cat large1
259 large1
262 large1
260 $ cat .hglf/large1
263 $ cat .hglf/large1
261 4669e532d5b2c093a78eca010077e708a071bb64
264 4669e532d5b2c093a78eca010077e708a071bb64
262 $ cat large2
265 $ cat large2
263 large2 in #2
266 large2 in #2
264 $ cat .hglf/large2
267 $ cat .hglf/large2
265 3cfce6277e7668985707b6887ce56f9f62f6ccd9
268 3cfce6277e7668985707b6887ce56f9f62f6ccd9
266
269
267 (rollback the parent of the working directory, when the parent of it
270 (rollback the parent of the working directory, when the parent of it
268 is not branch-tip)
271 is not branch-tip)
269
272
270 $ hg update -q -C 1
273 $ hg update -q -C 1
271 $ cat .hglf/large1
274 $ cat .hglf/large1
272 58e24f733a964da346e2407a2bee99d9001184f5
275 58e24f733a964da346e2407a2bee99d9001184f5
273 $ cat .hglf/large2
276 $ cat .hglf/large2
274 1deebade43c8c498a3c8daddac0244dc55d1331d
277 1deebade43c8c498a3c8daddac0244dc55d1331d
275
278
276 $ echo normalX > normalX
279 $ echo normalX > normalX
277 $ hg add normalX
280 $ hg add normalX
278 $ hg commit -m 'will be rollback-ed soon'
281 $ hg commit -m 'will be rollback-ed soon'
279 $ hg rollback -q
282 $ hg rollback -q
280
283
281 $ cat .hglf/large1
284 $ cat .hglf/large1
282 58e24f733a964da346e2407a2bee99d9001184f5
285 58e24f733a964da346e2407a2bee99d9001184f5
283 $ cat .hglf/large2
286 $ cat .hglf/large2
284 1deebade43c8c498a3c8daddac0244dc55d1331d
287 1deebade43c8c498a3c8daddac0244dc55d1331d
285
288
286 Test that "hg status" shows status of largefiles correctly just after
289 Test that "hg status" shows status of largefiles correctly just after
287 automated commit like rebase/transplant
290 automated commit like rebase/transplant
288
291
289 $ cat >> .hg/hgrc <<EOF
292 $ cat >> .hg/hgrc <<EOF
290 > [extensions]
293 > [extensions]
291 > rebase =
294 > rebase =
292 > strip =
295 > strip =
293 > transplant =
296 > transplant =
294 > EOF
297 > EOF
295 $ hg update -q -C 1
298 $ hg update -q -C 1
296 $ hg remove large1
299 $ hg remove large1
297 $ echo largeX > largeX
300 $ echo largeX > largeX
298 $ hg add --large largeX
301 $ hg add --large largeX
299 $ hg commit -m '#4'
302 $ hg commit -m '#4'
300
303
301 $ hg rebase -s 1 -d 2 --keep
304 $ hg rebase -s 1 -d 2 --keep
302 rebasing 1:72518492caa6 "#1"
305 rebasing 1:72518492caa6 "#1"
303 rebasing 4:07d6153b5c04 "#4" (tip)
306 rebasing 4:07d6153b5c04 "#4" (tip)
304 #if windows
307 #if windows
305 $ hg status -A large1
308 $ hg status -A large1
306 large1: * (glob)
309 large1: * (glob)
307 #else
310 #else
308 $ hg status -A large1
311 $ hg status -A large1
309 large1: No such file or directory
312 large1: No such file or directory
310 #endif
313 #endif
311 $ hg status -A largeX
314 $ hg status -A largeX
312 C largeX
315 C largeX
313 $ hg strip -q 5
316 $ hg strip -q 5
314
317
315 $ hg update -q -C 2
318 $ hg update -q -C 2
316 $ hg transplant -q 1 4
319 $ hg transplant -q 1 4
317 #if windows
320 #if windows
318 $ hg status -A large1
321 $ hg status -A large1
319 large1: * (glob)
322 large1: * (glob)
320 #else
323 #else
321 $ hg status -A large1
324 $ hg status -A large1
322 large1: No such file or directory
325 large1: No such file or directory
323 #endif
326 #endif
324 $ hg status -A largeX
327 $ hg status -A largeX
325 C largeX
328 C largeX
326 $ hg strip -q 5
329 $ hg strip -q 5
327
330
328 $ hg update -q -C 2
331 $ hg update -q -C 2
329 $ hg transplant -q --merge 1 --merge 4
332 $ hg transplant -q --merge 1 --merge 4
330 #if windows
333 #if windows
331 $ hg status -A large1
334 $ hg status -A large1
332 large1: * (glob)
335 large1: * (glob)
333 #else
336 #else
334 $ hg status -A large1
337 $ hg status -A large1
335 large1: No such file or directory
338 large1: No such file or directory
336 #endif
339 #endif
337 $ hg status -A largeX
340 $ hg status -A largeX
338 C largeX
341 C largeX
339 $ hg strip -q 5
342 $ hg strip -q 5
340
343
341 Test that linear merge can detect modification (and conflict) correctly
344 Test that linear merge can detect modification (and conflict) correctly
342
345
343 (linear merge without conflict)
346 (linear merge without conflict)
344
347
345 $ echo 'large2 for linear merge (no conflict)' > large2
348 $ echo 'large2 for linear merge (no conflict)' > large2
346 $ hg update 3 --config debug.dirstate.delaywrite=2
349 $ hg update 3 --config debug.dirstate.delaywrite=2
347 getting changed largefiles
350 getting changed largefiles
348 1 largefiles updated, 0 removed
351 1 largefiles updated, 0 removed
349 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
352 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
350 $ hg status -A large2
353 $ hg status -A large2
351 M large2
354 M large2
352 $ cat large2
355 $ cat large2
353 large2 for linear merge (no conflict)
356 large2 for linear merge (no conflict)
354 $ cat .hglf/large2
357 $ cat .hglf/large2
355 9c4bf8f1b33536d6e5f89447e10620cfe52ea710
358 9c4bf8f1b33536d6e5f89447e10620cfe52ea710
356
359
357 (linear merge with conflict, choosing "other")
360 (linear merge with conflict, choosing "other")
358
361
359 $ hg update -q -C 2
362 $ hg update -q -C 2
360 $ echo 'large1 for linear merge (conflict)' > large1
363 $ echo 'large1 for linear merge (conflict)' > large1
361 $ hg update 3 --config ui.interactive=True <<EOF
364 $ hg update 3 --config ui.interactive=True <<EOF
362 > o
365 > o
363 > EOF
366 > EOF
364 largefile large1 has a merge conflict
367 largefile large1 has a merge conflict
365 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
368 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
366 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
369 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
367 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? o
370 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? o
368 getting changed largefiles
371 getting changed largefiles
369 1 largefiles updated, 0 removed
372 1 largefiles updated, 0 removed
370 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
373 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
371 $ hg status -A large1
374 $ hg status -A large1
372 C large1
375 C large1
373 $ cat large1
376 $ cat large1
374 large1 in #3
377 large1 in #3
375 $ cat .hglf/large1
378 $ cat .hglf/large1
376 e5bb990443d6a92aaf7223813720f7566c9dd05b
379 e5bb990443d6a92aaf7223813720f7566c9dd05b
377
380
378 (linear merge with conflict, choosing "local")
381 (linear merge with conflict, choosing "local")
379
382
380 $ hg update -q -C 2
383 $ hg update -q -C 2
381 $ echo 'large1 for linear merge (conflict)' > large1
384 $ echo 'large1 for linear merge (conflict)' > large1
382 $ hg update 3 --config debug.dirstate.delaywrite=2
385 $ hg update 3 --config debug.dirstate.delaywrite=2
383 largefile large1 has a merge conflict
386 largefile large1 has a merge conflict
384 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
387 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
385 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
388 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
386 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
389 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
387 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
390 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
388 $ hg status -A large1
391 $ hg status -A large1
389 M large1
392 M large1
390 $ cat large1
393 $ cat large1
391 large1 for linear merge (conflict)
394 large1 for linear merge (conflict)
392 $ cat .hglf/large1
395 $ cat .hglf/large1
393 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
396 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
394
397
395 Test a linear merge to a revision containing same-name normal file
398 Test a linear merge to a revision containing same-name normal file
396
399
397 $ hg update -q -C 3
400 $ hg update -q -C 3
398 $ hg remove large2
401 $ hg remove large2
399 $ echo 'large2 as normal file' > large2
402 $ echo 'large2 as normal file' > large2
400 $ hg add large2
403 $ hg add large2
401 $ echo 'large3 as normal file' > large3
404 $ echo 'large3 as normal file' > large3
402 $ hg add large3
405 $ hg add large3
403 $ hg commit -m '#5'
406 $ hg commit -m '#5'
404 $ hg manifest
407 $ hg manifest
405 .hglf/large1
408 .hglf/large1
406 large2
409 large2
407 large3
410 large3
408 normal1
411 normal1
409
412
410 (modified largefile is already switched to normal)
413 (modified largefile is already switched to normal)
411
414
412 $ hg update -q -C 2
415 $ hg update -q -C 2
413 $ echo 'modified large2 for linear merge' > large2
416 $ echo 'modified large2 for linear merge' > large2
414 $ hg update -q 5
417 $ hg update -q 5
415 remote turned local largefile large2 into a normal file
418 remote turned local largefile large2 into a normal file
416 keep (l)argefile or use (n)ormal file? l
419 keep (l)argefile or use (n)ormal file? l
417 $ hg debugdirstate --nodates | grep large2
420 $ hg debugdirstate --nodates | grep large2
418 a 0 -1 unset .hglf/large2
421 a 0 -1 unset .hglf/large2
419 r 0 0 set large2
422 r 0 0 set large2
420 $ hg status -A large2
423 $ hg status -A large2
421 A large2
424 A large2
422 $ cat large2
425 $ cat large2
423 modified large2 for linear merge
426 modified large2 for linear merge
424
427
425 (added largefile is already committed as normal)
428 (added largefile is already committed as normal)
426
429
427 $ hg update -q -C 2
430 $ hg update -q -C 2
428 $ echo 'large3 as large file for linear merge' > large3
431 $ echo 'large3 as large file for linear merge' > large3
429 $ hg add --large large3
432 $ hg add --large large3
430 $ hg update -q 5
433 $ hg update -q 5
431 remote turned local largefile large3 into a normal file
434 remote turned local largefile large3 into a normal file
432 keep (l)argefile or use (n)ormal file? l
435 keep (l)argefile or use (n)ormal file? l
433 $ hg debugdirstate --nodates | grep large3
436 $ hg debugdirstate --nodates | grep large3
434 a 0 -1 unset .hglf/large3
437 a 0 -1 unset .hglf/large3
435 r 0 0 set large3
438 r 0 0 set large3
436 $ hg status -A large3
439 $ hg status -A large3
437 A large3
440 A large3
438 $ cat large3
441 $ cat large3
439 large3 as large file for linear merge
442 large3 as large file for linear merge
440 $ rm -f large3 .hglf/large3
443 $ rm -f large3 .hglf/large3
441
444
442 Test that the internal linear merging works correctly
445 Test that the internal linear merging works correctly
443 (both heads are stripped to keep pairing of revision number and commit log)
446 (both heads are stripped to keep pairing of revision number and commit log)
444
447
445 $ hg update -q -C 2
448 $ hg update -q -C 2
446 $ hg strip 3 4
449 $ hg strip 3 4
447 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-2e7b195d-backup.hg (glob)
450 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-2e7b195d-backup.hg (glob)
448 $ mv .hg/strip-backup/9530e27857f7-2e7b195d-backup.hg $TESTTMP
451 $ mv .hg/strip-backup/9530e27857f7-2e7b195d-backup.hg $TESTTMP
449
452
450 (internal linear merging at "hg pull --update")
453 (internal linear merging at "hg pull --update")
451
454
452 $ echo 'large1 for linear merge (conflict)' > large1
455 $ echo 'large1 for linear merge (conflict)' > large1
453 $ echo 'large2 for linear merge (conflict with normal file)' > large2
456 $ echo 'large2 for linear merge (conflict with normal file)' > large2
454 $ hg pull --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
457 $ hg pull --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
455 pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg (glob)
458 pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg (glob)
456 searching for changes
459 searching for changes
457 adding changesets
460 adding changesets
458 adding manifests
461 adding manifests
459 adding file changes
462 adding file changes
460 added 3 changesets with 5 changes to 5 files
463 added 3 changesets with 5 changes to 5 files
461 remote turned local largefile large2 into a normal file
464 remote turned local largefile large2 into a normal file
462 keep (l)argefile or use (n)ormal file? l
465 keep (l)argefile or use (n)ormal file? l
463 largefile large1 has a merge conflict
466 largefile large1 has a merge conflict
464 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
467 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
465 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
468 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
466 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
469 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
467 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
470 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
468 1 other heads for branch "default"
471 1 other heads for branch "default"
469
472
470 $ hg status -A large1
473 $ hg status -A large1
471 M large1
474 M large1
472 $ cat large1
475 $ cat large1
473 large1 for linear merge (conflict)
476 large1 for linear merge (conflict)
474 $ cat .hglf/large1
477 $ cat .hglf/large1
475 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
478 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
476 $ hg status -A large2
479 $ hg status -A large2
477 A large2
480 A large2
478 $ cat large2
481 $ cat large2
479 large2 for linear merge (conflict with normal file)
482 large2 for linear merge (conflict with normal file)
480 $ cat .hglf/large2
483 $ cat .hglf/large2
481 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
484 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
482
485
483 (internal linear merging at "hg unbundle --update")
486 (internal linear merging at "hg unbundle --update")
484
487
485 $ hg update -q -C 2
488 $ hg update -q -C 2
486 $ hg rollback -q
489 $ hg rollback -q
487
490
488 $ echo 'large1 for linear merge (conflict)' > large1
491 $ echo 'large1 for linear merge (conflict)' > large1
489 $ echo 'large2 for linear merge (conflict with normal file)' > large2
492 $ echo 'large2 for linear merge (conflict with normal file)' > large2
490 $ hg unbundle --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
493 $ hg unbundle --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
491 adding changesets
494 adding changesets
492 adding manifests
495 adding manifests
493 adding file changes
496 adding file changes
494 added 3 changesets with 5 changes to 5 files
497 added 3 changesets with 5 changes to 5 files
495 remote turned local largefile large2 into a normal file
498 remote turned local largefile large2 into a normal file
496 keep (l)argefile or use (n)ormal file? l
499 keep (l)argefile or use (n)ormal file? l
497 largefile large1 has a merge conflict
500 largefile large1 has a merge conflict
498 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
501 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
499 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
502 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
500 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
503 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
501 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
504 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
502 1 other heads for branch "default"
505 1 other heads for branch "default"
503
506
504 $ hg status -A large1
507 $ hg status -A large1
505 M large1
508 M large1
506 $ cat large1
509 $ cat large1
507 large1 for linear merge (conflict)
510 large1 for linear merge (conflict)
508 $ cat .hglf/large1
511 $ cat .hglf/large1
509 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
512 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
510 $ hg status -A large2
513 $ hg status -A large2
511 A large2
514 A large2
512 $ cat large2
515 $ cat large2
513 large2 for linear merge (conflict with normal file)
516 large2 for linear merge (conflict with normal file)
514 $ cat .hglf/large2
517 $ cat .hglf/large2
515 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
518 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
516
519
517 (internal linear merging in subrepo at "hg update")
520 (internal linear merging in subrepo at "hg update")
518
521
519 $ cd ..
522 $ cd ..
520 $ hg init subparent
523 $ hg init subparent
521 $ cd subparent
524 $ cd subparent
522
525
523 $ hg clone -q -u 2 ../repo sub
526 $ hg clone -q -u 2 ../repo sub
524 $ cat > .hgsub <<EOF
527 $ cat > .hgsub <<EOF
525 > sub = sub
528 > sub = sub
526 > EOF
529 > EOF
527 $ hg add .hgsub
530 $ hg add .hgsub
528 $ hg commit -m '#0@parent'
531 $ hg commit -m '#0@parent'
529 $ cat .hgsubstate
532 $ cat .hgsubstate
530 f74e50bd9e5594b7cf1e6c5cbab86ddd25f3ca2f sub
533 f74e50bd9e5594b7cf1e6c5cbab86ddd25f3ca2f sub
531 $ hg -R sub update -q
534 $ hg -R sub update -q
532 $ hg commit -m '#1@parent'
535 $ hg commit -m '#1@parent'
533 $ cat .hgsubstate
536 $ cat .hgsubstate
534 d65e59e952a9638e2ce863b41a420ca723dd3e8d sub
537 d65e59e952a9638e2ce863b41a420ca723dd3e8d sub
535 $ hg update -q 0
538 $ hg update -q 0
536
539
537 $ echo 'large1 for linear merge (conflict)' > sub/large1
540 $ echo 'large1 for linear merge (conflict)' > sub/large1
538 $ echo 'large2 for linear merge (conflict with normal file)' > sub/large2
541 $ echo 'large2 for linear merge (conflict with normal file)' > sub/large2
539 $ hg update --config ui.interactive=True --config debug.dirstate.delaywrite=2 <<EOF
542 $ hg update --config ui.interactive=True --config debug.dirstate.delaywrite=2 <<EOF
540 > m
543 > m
541 > r
544 > r
542 > l
545 > l
543 > l
546 > l
544 > EOF
547 > EOF
545 subrepository sub diverged (local revision: f74e50bd9e55, remote revision: d65e59e952a9)
548 subrepository sub diverged (local revision: f74e50bd9e55, remote revision: d65e59e952a9)
546 (M)erge, keep (l)ocal or keep (r)emote? m
549 (M)erge, keep (l)ocal or keep (r)emote? m
547 subrepository sources for sub differ (in checked out version)
550 subrepository sources for sub differ (in checked out version)
548 use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)? r
551 use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)? r
549 remote turned local largefile large2 into a normal file
552 remote turned local largefile large2 into a normal file
550 keep (l)argefile or use (n)ormal file? l
553 keep (l)argefile or use (n)ormal file? l
551 largefile large1 has a merge conflict
554 largefile large1 has a merge conflict
552 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
555 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
553 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
556 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
554 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
557 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
555 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
558 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
556 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
557
560
558 $ hg -R sub status -A sub/large1
561 $ hg -R sub status -A sub/large1
559 M sub/large1
562 M sub/large1
560 $ cat sub/large1
563 $ cat sub/large1
561 large1 for linear merge (conflict)
564 large1 for linear merge (conflict)
562 $ cat sub/.hglf/large1
565 $ cat sub/.hglf/large1
563 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
566 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
564 $ hg -R sub status -A sub/large2
567 $ hg -R sub status -A sub/large2
565 A sub/large2
568 A sub/large2
566 $ cat sub/large2
569 $ cat sub/large2
567 large2 for linear merge (conflict with normal file)
570 large2 for linear merge (conflict with normal file)
568 $ cat sub/.hglf/large2
571 $ cat sub/.hglf/large2
569 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
572 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
570
573
571 $ cd ..
574 $ cd ..
572 $ cd repo
575 $ cd repo
573
576
574 Test that rebase updates largefiles in the working directory even if
577 Test that rebase updates largefiles in the working directory even if
575 it is aborted by conflict.
578 it is aborted by conflict.
576
579
577 $ hg update -q -C 3
580 $ hg update -q -C 3
578 $ cat .hglf/large1
581 $ cat .hglf/large1
579 e5bb990443d6a92aaf7223813720f7566c9dd05b
582 e5bb990443d6a92aaf7223813720f7566c9dd05b
580 $ cat large1
583 $ cat large1
581 large1 in #3
584 large1 in #3
582 $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
585 $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
583 > o
586 > o
584 > EOF
587 > EOF
585 rebasing 1:72518492caa6 "#1"
588 rebasing 1:72518492caa6 "#1"
586 largefile large1 has a merge conflict
589 largefile large1 has a merge conflict
587 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
590 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
588 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
591 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
589 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
592 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
590 merging normal1
593 merging normal1
591 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
594 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
592 unresolved conflicts (see hg resolve, then hg rebase --continue)
595 unresolved conflicts (see hg resolve, then hg rebase --continue)
593 [1]
596 [1]
594 $ cat .hglf/large1
597 $ cat .hglf/large1
595 58e24f733a964da346e2407a2bee99d9001184f5
598 58e24f733a964da346e2407a2bee99d9001184f5
596 $ cat large1
599 $ cat large1
597 large1 in #1
600 large1 in #1
598
601
599 Test that rebase updates standins for manually modified largefiles at
602 Test that rebase updates standins for manually modified largefiles at
600 the 1st commit of resuming.
603 the 1st commit of resuming.
601
604
602 $ echo "manually modified before 'hg rebase --continue'" > large1
605 $ echo "manually modified before 'hg rebase --continue'" > large1
603 $ hg resolve -m normal1
606 $ hg resolve -m normal1
604 (no more unresolved files)
607 (no more unresolved files)
605 continue: hg rebase --continue
608 continue: hg rebase --continue
606 $ hg rebase --continue --config ui.interactive=True <<EOF
609 $ hg rebase --continue --config ui.interactive=True <<EOF
607 > c
610 > c
608 > EOF
611 > EOF
609 rebasing 1:72518492caa6 "#1"
612 rebasing 1:72518492caa6 "#1"
610 rebasing 4:07d6153b5c04 "#4"
613 rebasing 4:07d6153b5c04 "#4"
611 local changed .hglf/large1 which remote deleted
614 local changed .hglf/large1 which remote deleted
612 use (c)hanged version, (d)elete, or leave (u)nresolved? c
615 use (c)hanged version, (d)elete, or leave (u)nresolved? c
613
616
614 $ hg diff -c "tip~1" --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
617 $ hg diff -c "tip~1" --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
615 -e5bb990443d6a92aaf7223813720f7566c9dd05b
618 -e5bb990443d6a92aaf7223813720f7566c9dd05b
616 +8a4f783556e7dea21139ca0466eafce954c75c13
619 +8a4f783556e7dea21139ca0466eafce954c75c13
617 $ rm -f large1
620 $ rm -f large1
618 $ hg update -q -C tip
621 $ hg update -q -C tip
619 $ cat large1
622 $ cat large1
620 manually modified before 'hg rebase --continue'
623 manually modified before 'hg rebase --continue'
621
624
622 Test that transplant updates largefiles, of which standins are safely
625 Test that transplant updates largefiles, of which standins are safely
623 changed, even if it is aborted by conflict of other.
626 changed, even if it is aborted by conflict of other.
624
627
625 $ hg update -q -C 5
628 $ hg update -q -C 5
626 $ cat .hglf/large1
629 $ cat .hglf/large1
627 e5bb990443d6a92aaf7223813720f7566c9dd05b
630 e5bb990443d6a92aaf7223813720f7566c9dd05b
628 $ cat large1
631 $ cat large1
629 large1 in #3
632 large1 in #3
630 $ hg diff -c 4 .hglf/largeX | grep '^[+-][0-9a-z]'
633 $ hg diff -c 4 .hglf/largeX | grep '^[+-][0-9a-z]'
631 +fa44618ea25181aff4f48b70428294790cec9f61
634 +fa44618ea25181aff4f48b70428294790cec9f61
632 $ hg transplant 4
635 $ hg transplant 4
633 applying 07d6153b5c04
636 applying 07d6153b5c04
634 patching file .hglf/large1
637 patching file .hglf/large1
635 Hunk #1 FAILED at 0
638 Hunk #1 FAILED at 0
636 1 out of 1 hunks FAILED -- saving rejects to file .hglf/large1.rej
639 1 out of 1 hunks FAILED -- saving rejects to file .hglf/large1.rej
637 patch failed to apply
640 patch failed to apply
638 abort: fix up the working directory and run hg transplant --continue
641 abort: fix up the working directory and run hg transplant --continue
639 [255]
642 [255]
640 $ hg status -A large1
643 $ hg status -A large1
641 C large1
644 C large1
642 $ cat .hglf/large1
645 $ cat .hglf/large1
643 e5bb990443d6a92aaf7223813720f7566c9dd05b
646 e5bb990443d6a92aaf7223813720f7566c9dd05b
644 $ cat large1
647 $ cat large1
645 large1 in #3
648 large1 in #3
646 $ hg status -A largeX
649 $ hg status -A largeX
647 A largeX
650 A largeX
648 $ cat .hglf/largeX
651 $ cat .hglf/largeX
649 fa44618ea25181aff4f48b70428294790cec9f61
652 fa44618ea25181aff4f48b70428294790cec9f61
650 $ cat largeX
653 $ cat largeX
651 largeX
654 largeX
652
655
653 Test that transplant updates standins for manually modified largefiles
656 Test that transplant updates standins for manually modified largefiles
654 at the 1st commit of resuming.
657 at the 1st commit of resuming.
655
658
656 $ echo "manually modified before 'hg transplant --continue'" > large1
659 $ echo "manually modified before 'hg transplant --continue'" > large1
657 $ hg transplant --continue
660 $ hg transplant --continue
658 07d6153b5c04 transplanted as f1bf30eb88cc
661 07d6153b5c04 transplanted as f1bf30eb88cc
659 $ hg diff -c tip .hglf/large1 | grep '^[+-][0-9a-z]'
662 $ hg diff -c tip .hglf/large1 | grep '^[+-][0-9a-z]'
660 -e5bb990443d6a92aaf7223813720f7566c9dd05b
663 -e5bb990443d6a92aaf7223813720f7566c9dd05b
661 +6a4f36d4075fbe0f30ec1d26ca44e63c05903671
664 +6a4f36d4075fbe0f30ec1d26ca44e63c05903671
662 $ rm -f large1
665 $ rm -f large1
663 $ hg update -q -C tip
666 $ hg update -q -C tip
664 $ cat large1
667 $ cat large1
665 manually modified before 'hg transplant --continue'
668 manually modified before 'hg transplant --continue'
666
669
667 Test that "hg status" doesn't show removal of largefiles not managed
670 Test that "hg status" doesn't show removal of largefiles not managed
668 in the target context.
671 in the target context.
669
672
670 $ hg update -q -C 4
673 $ hg update -q -C 4
671 $ hg remove largeX
674 $ hg remove largeX
672 $ hg status -A largeX
675 $ hg status -A largeX
673 R largeX
676 R largeX
674 $ hg status -A --rev '.^1' largeX
677 $ hg status -A --rev '.^1' largeX
675
678
676 #if execbit
679 #if execbit
677
680
678 Test that "hg status" against revisions other than parent notices exec
681 Test that "hg status" against revisions other than parent notices exec
679 bit changes of largefiles.
682 bit changes of largefiles.
680
683
681 $ hg update -q -C 4
684 $ hg update -q -C 4
682
685
683 (the case that large2 doesn't have exec bit in the target context but
686 (the case that large2 doesn't have exec bit in the target context but
684 in the working context)
687 in the working context)
685
688
686 $ chmod +x large2
689 $ chmod +x large2
687 $ hg status -A --rev 0 large2
690 $ hg status -A --rev 0 large2
688 M large2
691 M large2
689 $ hg commit -m 'chmod +x large2'
692 $ hg commit -m 'chmod +x large2'
690
693
691 (the case that large2 has exec bit in the target context but not in
694 (the case that large2 has exec bit in the target context but not in
692 the working context)
695 the working context)
693
696
694 $ echo dummy > dummy
697 $ echo dummy > dummy
695 $ hg add dummy
698 $ hg add dummy
696 $ hg commit -m 'revision for separation'
699 $ hg commit -m 'revision for separation'
697 $ chmod -x large2
700 $ chmod -x large2
698 $ hg status -A --rev '.^1' large2
701 $ hg status -A --rev '.^1' large2
699 M large2
702 M large2
700
703
701 #else
704 #else
702
705
703 Test that "hg status" against revisions other than parent ignores exec
706 Test that "hg status" against revisions other than parent ignores exec
704 bit correctly on the platform being unaware of it.
707 bit correctly on the platform being unaware of it.
705
708
706 $ hg update -q -C 4
709 $ hg update -q -C 4
707
710
708 $ cat > exec-bit.patch <<EOF
711 $ cat > exec-bit.patch <<EOF
709 > # HG changeset patch
712 > # HG changeset patch
710 > # User test
713 > # User test
711 > # Date 0 0
714 > # Date 0 0
712 > # Thu Jan 01 00:00:00 1970 +0000
715 > # Thu Jan 01 00:00:00 1970 +0000
713 > # Node ID be1b433a65b12b27b5519d92213e14f7e1769b90
716 > # Node ID be1b433a65b12b27b5519d92213e14f7e1769b90
714 > # Parent 07d6153b5c04313efb75deec9ba577de7faeb727
717 > # Parent 07d6153b5c04313efb75deec9ba577de7faeb727
715 > chmod +x large2
718 > chmod +x large2
716 >
719 >
717 > diff --git a/.hglf/large2 b/.hglf/large2
720 > diff --git a/.hglf/large2 b/.hglf/large2
718 > old mode 100644
721 > old mode 100644
719 > new mode 100755
722 > new mode 100755
720 > EOF
723 > EOF
721 $ hg import --exact --bypass exec-bit.patch
724 $ hg import --exact --bypass exec-bit.patch
722 applying exec-bit.patch
725 applying exec-bit.patch
723 $ hg status -A --rev tip large2
726 $ hg status -A --rev tip large2
724 C large2
727 C large2
725
728
726 #endif
729 #endif
727
730
728 $ cd ..
731 $ cd ..
729
732
730 Test that "hg convert" avoids copying largefiles from the working
733 Test that "hg convert" avoids copying largefiles from the working
731 directory into store, because "hg convert" doesn't update largefiles
734 directory into store, because "hg convert" doesn't update largefiles
732 in the working directory (removing files under ".cache/largefiles"
735 in the working directory (removing files under ".cache/largefiles"
733 forces "hg convert" to copy corresponding largefiles)
736 forces "hg convert" to copy corresponding largefiles)
734
737
735 $ cat >> $HGRCPATH <<EOF
738 $ cat >> $HGRCPATH <<EOF
736 > [extensions]
739 > [extensions]
737 > convert =
740 > convert =
738 > EOF
741 > EOF
739
742
740 $ rm $TESTTMP/.cache/largefiles/6a4f36d4075fbe0f30ec1d26ca44e63c05903671
743 $ rm $TESTTMP/.cache/largefiles/6a4f36d4075fbe0f30ec1d26ca44e63c05903671
741 $ hg convert -q repo repo.converted
744 $ hg convert -q repo repo.converted
@@ -1,804 +1,810 b''
1 $ cat >> $HGRCPATH <<EOF
2 > [defaults]
3 > # for portability
4 > extdiff = --option -Nru
5 > EOF
6
1 Preparing the subrepository 'sub2'
7 Preparing the subrepository 'sub2'
2
8
3 $ hg init sub2
9 $ hg init sub2
4 $ echo sub2 > sub2/sub2
10 $ echo sub2 > sub2/sub2
5 $ hg add -R sub2
11 $ hg add -R sub2
6 adding sub2/sub2 (glob)
12 adding sub2/sub2 (glob)
7 $ hg commit -R sub2 -m "sub2 import"
13 $ hg commit -R sub2 -m "sub2 import"
8
14
9 Preparing the 'sub1' repo which depends on the subrepo 'sub2'
15 Preparing the 'sub1' repo which depends on the subrepo 'sub2'
10
16
11 $ hg init sub1
17 $ hg init sub1
12 $ echo sub1 > sub1/sub1
18 $ echo sub1 > sub1/sub1
13 $ echo "sub2 = ../sub2" > sub1/.hgsub
19 $ echo "sub2 = ../sub2" > sub1/.hgsub
14 $ hg clone sub2 sub1/sub2
20 $ hg clone sub2 sub1/sub2
15 updating to branch default
21 updating to branch default
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 $ hg add -R sub1
23 $ hg add -R sub1
18 adding sub1/.hgsub (glob)
24 adding sub1/.hgsub (glob)
19 adding sub1/sub1 (glob)
25 adding sub1/sub1 (glob)
20 $ hg commit -R sub1 -m "sub1 import"
26 $ hg commit -R sub1 -m "sub1 import"
21
27
22 Preparing the 'main' repo which depends on the subrepo 'sub1'
28 Preparing the 'main' repo which depends on the subrepo 'sub1'
23
29
24 $ hg init main
30 $ hg init main
25 $ echo main > main/main
31 $ echo main > main/main
26 $ echo "sub1 = ../sub1" > main/.hgsub
32 $ echo "sub1 = ../sub1" > main/.hgsub
27 $ hg clone sub1 main/sub1
33 $ hg clone sub1 main/sub1
28 updating to branch default
34 updating to branch default
29 cloning subrepo sub2 from $TESTTMP/sub2
35 cloning subrepo sub2 from $TESTTMP/sub2
30 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 $ hg add -R main
37 $ hg add -R main
32 adding main/.hgsub (glob)
38 adding main/.hgsub (glob)
33 adding main/main (glob)
39 adding main/main (glob)
34 $ hg commit -R main -m "main import"
40 $ hg commit -R main -m "main import"
35
41
36 Cleaning both repositories, just as a clone -U
42 Cleaning both repositories, just as a clone -U
37
43
38 $ hg up -C -R sub2 null
44 $ hg up -C -R sub2 null
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
45 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 $ hg up -C -R sub1 null
46 $ hg up -C -R sub1 null
41 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
42 $ hg up -C -R main null
48 $ hg up -C -R main null
43 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
49 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
44 $ rm -rf main/sub1
50 $ rm -rf main/sub1
45 $ rm -rf sub1/sub2
51 $ rm -rf sub1/sub2
46
52
47 Clone main
53 Clone main
48
54
49 $ hg --config extensions.largefiles= clone main cloned
55 $ hg --config extensions.largefiles= clone main cloned
50 updating to branch default
56 updating to branch default
51 cloning subrepo sub1 from $TESTTMP/sub1
57 cloning subrepo sub1 from $TESTTMP/sub1
52 cloning subrepo sub1/sub2 from $TESTTMP/sub2 (glob)
58 cloning subrepo sub1/sub2 from $TESTTMP/sub2 (glob)
53 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
54
60
55 Largefiles is NOT enabled in the clone if the source repo doesn't require it
61 Largefiles is NOT enabled in the clone if the source repo doesn't require it
56 $ cat cloned/.hg/hgrc
62 $ cat cloned/.hg/hgrc
57 # example repository config (see "hg help config" for more info)
63 # example repository config (see "hg help config" for more info)
58 [paths]
64 [paths]
59 default = $TESTTMP/main (glob)
65 default = $TESTTMP/main (glob)
60
66
61 # path aliases to other clones of this repo in URLs or filesystem paths
67 # path aliases to other clones of this repo in URLs or filesystem paths
62 # (see "hg help config.paths" for more info)
68 # (see "hg help config.paths" for more info)
63 #
69 #
64 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
70 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
65 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
71 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
66 # my-clone = /home/jdoe/jdoes-clone
72 # my-clone = /home/jdoe/jdoes-clone
67
73
68 [ui]
74 [ui]
69 # name and email (local to this repository, optional), e.g.
75 # name and email (local to this repository, optional), e.g.
70 # username = Jane Doe <jdoe@example.com>
76 # username = Jane Doe <jdoe@example.com>
71
77
72 Checking cloned repo ids
78 Checking cloned repo ids
73
79
74 $ printf "cloned " ; hg id -R cloned
80 $ printf "cloned " ; hg id -R cloned
75 cloned 7f491f53a367 tip
81 cloned 7f491f53a367 tip
76 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
82 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
77 cloned/sub1 fc3b4ce2696f tip
83 cloned/sub1 fc3b4ce2696f tip
78 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
84 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
79 cloned/sub1/sub2 c57a0840e3ba tip
85 cloned/sub1/sub2 c57a0840e3ba tip
80
86
81 debugsub output for main and sub1
87 debugsub output for main and sub1
82
88
83 $ hg debugsub -R cloned
89 $ hg debugsub -R cloned
84 path sub1
90 path sub1
85 source ../sub1
91 source ../sub1
86 revision fc3b4ce2696f7741438c79207583768f2ce6b0dd
92 revision fc3b4ce2696f7741438c79207583768f2ce6b0dd
87 $ hg debugsub -R cloned/sub1
93 $ hg debugsub -R cloned/sub1
88 path sub2
94 path sub2
89 source ../sub2
95 source ../sub2
90 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
96 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
91
97
92 Modifying deeply nested 'sub2'
98 Modifying deeply nested 'sub2'
93
99
94 $ echo modified > cloned/sub1/sub2/sub2
100 $ echo modified > cloned/sub1/sub2/sub2
95 $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned
101 $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned
96 committing subrepository sub1
102 committing subrepository sub1
97 committing subrepository sub1/sub2 (glob)
103 committing subrepository sub1/sub2 (glob)
98
104
99 Checking modified node ids
105 Checking modified node ids
100
106
101 $ printf "cloned " ; hg id -R cloned
107 $ printf "cloned " ; hg id -R cloned
102 cloned ffe6649062fe tip
108 cloned ffe6649062fe tip
103 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
109 $ printf "cloned/sub1 " ; hg id -R cloned/sub1
104 cloned/sub1 2ecb03bf44a9 tip
110 cloned/sub1 2ecb03bf44a9 tip
105 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
111 $ printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
106 cloned/sub1/sub2 53dd3430bcaf tip
112 cloned/sub1/sub2 53dd3430bcaf tip
107
113
108 debugsub output for main and sub1
114 debugsub output for main and sub1
109
115
110 $ hg debugsub -R cloned
116 $ hg debugsub -R cloned
111 path sub1
117 path sub1
112 source ../sub1
118 source ../sub1
113 revision 2ecb03bf44a94e749e8669481dd9069526ce7cb9
119 revision 2ecb03bf44a94e749e8669481dd9069526ce7cb9
114 $ hg debugsub -R cloned/sub1
120 $ hg debugsub -R cloned/sub1
115 path sub2
121 path sub2
116 source ../sub2
122 source ../sub2
117 revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487
123 revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487
118
124
119 Check that deep archiving works
125 Check that deep archiving works
120
126
121 $ cd cloned
127 $ cd cloned
122 $ echo 'test' > sub1/sub2/test.txt
128 $ echo 'test' > sub1/sub2/test.txt
123 $ hg --config extensions.largefiles=! add sub1/sub2/test.txt
129 $ hg --config extensions.largefiles=! add sub1/sub2/test.txt
124 $ mkdir sub1/sub2/folder
130 $ mkdir sub1/sub2/folder
125 $ echo 'subfolder' > sub1/sub2/folder/test.txt
131 $ echo 'subfolder' > sub1/sub2/folder/test.txt
126 $ hg ci -ASm "add test.txt"
132 $ hg ci -ASm "add test.txt"
127 adding sub1/sub2/folder/test.txt
133 adding sub1/sub2/folder/test.txt
128 committing subrepository sub1
134 committing subrepository sub1
129 committing subrepository sub1/sub2 (glob)
135 committing subrepository sub1/sub2 (glob)
130
136
131 .. but first take a detour through some deep removal testing
137 .. but first take a detour through some deep removal testing
132
138
133 $ hg remove -S -I 're:.*.txt' .
139 $ hg remove -S -I 're:.*.txt' .
134 removing sub1/sub2/folder/test.txt (glob)
140 removing sub1/sub2/folder/test.txt (glob)
135 removing sub1/sub2/test.txt (glob)
141 removing sub1/sub2/test.txt (glob)
136 $ hg status -S
142 $ hg status -S
137 R sub1/sub2/folder/test.txt
143 R sub1/sub2/folder/test.txt
138 R sub1/sub2/test.txt
144 R sub1/sub2/test.txt
139 $ hg update -Cq
145 $ hg update -Cq
140 $ hg remove -I 're:.*.txt' sub1
146 $ hg remove -I 're:.*.txt' sub1
141 $ hg status -S
147 $ hg status -S
142 $ hg remove sub1/sub2/folder/test.txt
148 $ hg remove sub1/sub2/folder/test.txt
143 $ hg remove sub1/.hgsubstate
149 $ hg remove sub1/.hgsubstate
144 $ mv sub1/.hgsub sub1/x.hgsub
150 $ mv sub1/.hgsub sub1/x.hgsub
145 $ hg status -S
151 $ hg status -S
146 warning: subrepo spec file 'sub1/.hgsub' not found
152 warning: subrepo spec file 'sub1/.hgsub' not found
147 R sub1/.hgsubstate
153 R sub1/.hgsubstate
148 R sub1/sub2/folder/test.txt
154 R sub1/sub2/folder/test.txt
149 ! sub1/.hgsub
155 ! sub1/.hgsub
150 ? sub1/x.hgsub
156 ? sub1/x.hgsub
151 $ mv sub1/x.hgsub sub1/.hgsub
157 $ mv sub1/x.hgsub sub1/.hgsub
152 $ hg update -Cq
158 $ hg update -Cq
153 $ touch sub1/foo
159 $ touch sub1/foo
154 $ hg forget sub1/sub2/folder/test.txt
160 $ hg forget sub1/sub2/folder/test.txt
155 $ rm sub1/sub2/test.txt
161 $ rm sub1/sub2/test.txt
156
162
157 Test relative path printing + subrepos
163 Test relative path printing + subrepos
158 $ mkdir -p foo/bar
164 $ mkdir -p foo/bar
159 $ cd foo
165 $ cd foo
160 $ touch bar/abc
166 $ touch bar/abc
161 $ hg addremove -S ..
167 $ hg addremove -S ..
162 adding ../sub1/sub2/folder/test.txt (glob)
168 adding ../sub1/sub2/folder/test.txt (glob)
163 removing ../sub1/sub2/test.txt (glob)
169 removing ../sub1/sub2/test.txt (glob)
164 adding ../sub1/foo (glob)
170 adding ../sub1/foo (glob)
165 adding bar/abc (glob)
171 adding bar/abc (glob)
166 $ cd ..
172 $ cd ..
167 $ hg status -S
173 $ hg status -S
168 A foo/bar/abc
174 A foo/bar/abc
169 A sub1/foo
175 A sub1/foo
170 R sub1/sub2/test.txt
176 R sub1/sub2/test.txt
171
177
172 Archive wdir() with subrepos
178 Archive wdir() with subrepos
173 $ hg rm main
179 $ hg rm main
174 $ hg archive -S -r 'wdir()' ../wdir
180 $ hg archive -S -r 'wdir()' ../wdir
175 $ diff -r . ../wdir | egrep -v '\.hg$|^Common subdirectories:'
181 $ diff -r . ../wdir | egrep -v '\.hg$|^Common subdirectories:'
176 Only in ../wdir: .hg_archival.txt
182 Only in ../wdir: .hg_archival.txt
177
183
178 $ find ../wdir -type f | sort
184 $ find ../wdir -type f | sort
179 ../wdir/.hg_archival.txt
185 ../wdir/.hg_archival.txt
180 ../wdir/.hgsub
186 ../wdir/.hgsub
181 ../wdir/.hgsubstate
187 ../wdir/.hgsubstate
182 ../wdir/foo/bar/abc
188 ../wdir/foo/bar/abc
183 ../wdir/sub1/.hgsub
189 ../wdir/sub1/.hgsub
184 ../wdir/sub1/.hgsubstate
190 ../wdir/sub1/.hgsubstate
185 ../wdir/sub1/foo
191 ../wdir/sub1/foo
186 ../wdir/sub1/sub1
192 ../wdir/sub1/sub1
187 ../wdir/sub1/sub2/folder/test.txt
193 ../wdir/sub1/sub2/folder/test.txt
188 ../wdir/sub1/sub2/sub2
194 ../wdir/sub1/sub2/sub2
189
195
190 $ cat ../wdir/.hg_archival.txt
196 $ cat ../wdir/.hg_archival.txt
191 repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
197 repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
192 node: 9bb10eebee29dc0f1201dcf5977b811a540255fd+
198 node: 9bb10eebee29dc0f1201dcf5977b811a540255fd+
193 branch: default
199 branch: default
194 latesttag: null
200 latesttag: null
195 latesttagdistance: 4
201 latesttagdistance: 4
196 changessincelatesttag: 4
202 changessincelatesttag: 4
197
203
198 Attempting to archive 'wdir()' with a missing file is handled gracefully
204 Attempting to archive 'wdir()' with a missing file is handled gracefully
199 $ rm sub1/sub1
205 $ rm sub1/sub1
200 $ rm -r ../wdir
206 $ rm -r ../wdir
201 $ hg archive -v -S -r 'wdir()' ../wdir
207 $ hg archive -v -S -r 'wdir()' ../wdir
202 $ find ../wdir -type f | sort
208 $ find ../wdir -type f | sort
203 ../wdir/.hg_archival.txt
209 ../wdir/.hg_archival.txt
204 ../wdir/.hgsub
210 ../wdir/.hgsub
205 ../wdir/.hgsubstate
211 ../wdir/.hgsubstate
206 ../wdir/foo/bar/abc
212 ../wdir/foo/bar/abc
207 ../wdir/sub1/.hgsub
213 ../wdir/sub1/.hgsub
208 ../wdir/sub1/.hgsubstate
214 ../wdir/sub1/.hgsubstate
209 ../wdir/sub1/foo
215 ../wdir/sub1/foo
210 ../wdir/sub1/sub2/folder/test.txt
216 ../wdir/sub1/sub2/folder/test.txt
211 ../wdir/sub1/sub2/sub2
217 ../wdir/sub1/sub2/sub2
212
218
213 Continue relative path printing + subrepos
219 Continue relative path printing + subrepos
214 $ hg update -Cq
220 $ hg update -Cq
215 $ rm -r ../wdir
221 $ rm -r ../wdir
216 $ hg archive -S -r 'wdir()' ../wdir
222 $ hg archive -S -r 'wdir()' ../wdir
217 $ cat ../wdir/.hg_archival.txt
223 $ cat ../wdir/.hg_archival.txt
218 repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
224 repo: 7f491f53a367861f47ee64a80eb997d1f341b77a
219 node: 9bb10eebee29dc0f1201dcf5977b811a540255fd
225 node: 9bb10eebee29dc0f1201dcf5977b811a540255fd
220 branch: default
226 branch: default
221 latesttag: null
227 latesttag: null
222 latesttagdistance: 4
228 latesttagdistance: 4
223 changessincelatesttag: 4
229 changessincelatesttag: 4
224
230
225 $ touch sub1/sub2/folder/bar
231 $ touch sub1/sub2/folder/bar
226 $ hg addremove sub1/sub2
232 $ hg addremove sub1/sub2
227 adding sub1/sub2/folder/bar (glob)
233 adding sub1/sub2/folder/bar (glob)
228 $ hg status -S
234 $ hg status -S
229 A sub1/sub2/folder/bar
235 A sub1/sub2/folder/bar
230 ? foo/bar/abc
236 ? foo/bar/abc
231 ? sub1/foo
237 ? sub1/foo
232 $ hg update -Cq
238 $ hg update -Cq
233 $ hg addremove sub1
239 $ hg addremove sub1
234 adding sub1/sub2/folder/bar (glob)
240 adding sub1/sub2/folder/bar (glob)
235 adding sub1/foo (glob)
241 adding sub1/foo (glob)
236 $ hg update -Cq
242 $ hg update -Cq
237 $ rm sub1/sub2/folder/test.txt
243 $ rm sub1/sub2/folder/test.txt
238 $ rm sub1/sub2/test.txt
244 $ rm sub1/sub2/test.txt
239 $ hg ci -ASm "remove test.txt"
245 $ hg ci -ASm "remove test.txt"
240 adding sub1/sub2/folder/bar
246 adding sub1/sub2/folder/bar
241 removing sub1/sub2/folder/test.txt
247 removing sub1/sub2/folder/test.txt
242 removing sub1/sub2/test.txt
248 removing sub1/sub2/test.txt
243 adding sub1/foo
249 adding sub1/foo
244 adding foo/bar/abc
250 adding foo/bar/abc
245 committing subrepository sub1
251 committing subrepository sub1
246 committing subrepository sub1/sub2 (glob)
252 committing subrepository sub1/sub2 (glob)
247
253
248 $ hg forget sub1/sub2/sub2
254 $ hg forget sub1/sub2/sub2
249 $ echo x > sub1/sub2/x.txt
255 $ echo x > sub1/sub2/x.txt
250 $ hg add sub1/sub2/x.txt
256 $ hg add sub1/sub2/x.txt
251
257
252 Files sees uncommitted adds and removes in subrepos
258 Files sees uncommitted adds and removes in subrepos
253 $ hg files -S
259 $ hg files -S
254 .hgsub
260 .hgsub
255 .hgsubstate
261 .hgsubstate
256 foo/bar/abc (glob)
262 foo/bar/abc (glob)
257 main
263 main
258 sub1/.hgsub (glob)
264 sub1/.hgsub (glob)
259 sub1/.hgsubstate (glob)
265 sub1/.hgsubstate (glob)
260 sub1/foo (glob)
266 sub1/foo (glob)
261 sub1/sub1 (glob)
267 sub1/sub1 (glob)
262 sub1/sub2/folder/bar (glob)
268 sub1/sub2/folder/bar (glob)
263 sub1/sub2/x.txt (glob)
269 sub1/sub2/x.txt (glob)
264
270
265 $ hg files -S "set:eol('dos') or eol('unix') or size('<= 0')"
271 $ hg files -S "set:eol('dos') or eol('unix') or size('<= 0')"
266 .hgsub
272 .hgsub
267 .hgsubstate
273 .hgsubstate
268 foo/bar/abc (glob)
274 foo/bar/abc (glob)
269 main
275 main
270 sub1/.hgsub (glob)
276 sub1/.hgsub (glob)
271 sub1/.hgsubstate (glob)
277 sub1/.hgsubstate (glob)
272 sub1/foo (glob)
278 sub1/foo (glob)
273 sub1/sub1 (glob)
279 sub1/sub1 (glob)
274 sub1/sub2/folder/bar (glob)
280 sub1/sub2/folder/bar (glob)
275 sub1/sub2/x.txt (glob)
281 sub1/sub2/x.txt (glob)
276
282
277 $ hg files -r '.^' -S "set:eol('dos') or eol('unix')"
283 $ hg files -r '.^' -S "set:eol('dos') or eol('unix')"
278 .hgsub
284 .hgsub
279 .hgsubstate
285 .hgsubstate
280 main
286 main
281 sub1/.hgsub (glob)
287 sub1/.hgsub (glob)
282 sub1/.hgsubstate (glob)
288 sub1/.hgsubstate (glob)
283 sub1/sub1 (glob)
289 sub1/sub1 (glob)
284 sub1/sub2/folder/test.txt (glob)
290 sub1/sub2/folder/test.txt (glob)
285 sub1/sub2/sub2 (glob)
291 sub1/sub2/sub2 (glob)
286 sub1/sub2/test.txt (glob)
292 sub1/sub2/test.txt (glob)
287
293
288 $ hg files sub1
294 $ hg files sub1
289 sub1/.hgsub (glob)
295 sub1/.hgsub (glob)
290 sub1/.hgsubstate (glob)
296 sub1/.hgsubstate (glob)
291 sub1/foo (glob)
297 sub1/foo (glob)
292 sub1/sub1 (glob)
298 sub1/sub1 (glob)
293 sub1/sub2/folder/bar (glob)
299 sub1/sub2/folder/bar (glob)
294 sub1/sub2/x.txt (glob)
300 sub1/sub2/x.txt (glob)
295
301
296 $ hg files sub1/sub2
302 $ hg files sub1/sub2
297 sub1/sub2/folder/bar (glob)
303 sub1/sub2/folder/bar (glob)
298 sub1/sub2/x.txt (glob)
304 sub1/sub2/x.txt (glob)
299
305
300 $ hg files -S -r '.^' sub1/sub2/folder
306 $ hg files -S -r '.^' sub1/sub2/folder
301 sub1/sub2/folder/test.txt (glob)
307 sub1/sub2/folder/test.txt (glob)
302
308
303 $ hg files -S -r '.^' sub1/sub2/missing
309 $ hg files -S -r '.^' sub1/sub2/missing
304 sub1/sub2/missing: no such file in rev 78026e779ea6 (glob)
310 sub1/sub2/missing: no such file in rev 78026e779ea6 (glob)
305 [1]
311 [1]
306
312
307 $ hg files -r '.^' sub1/
313 $ hg files -r '.^' sub1/
308 sub1/.hgsub (glob)
314 sub1/.hgsub (glob)
309 sub1/.hgsubstate (glob)
315 sub1/.hgsubstate (glob)
310 sub1/sub1 (glob)
316 sub1/sub1 (glob)
311 sub1/sub2/folder/test.txt (glob)
317 sub1/sub2/folder/test.txt (glob)
312 sub1/sub2/sub2 (glob)
318 sub1/sub2/sub2 (glob)
313 sub1/sub2/test.txt (glob)
319 sub1/sub2/test.txt (glob)
314
320
315 $ hg files -r '.^' sub1/sub2
321 $ hg files -r '.^' sub1/sub2
316 sub1/sub2/folder/test.txt (glob)
322 sub1/sub2/folder/test.txt (glob)
317 sub1/sub2/sub2 (glob)
323 sub1/sub2/sub2 (glob)
318 sub1/sub2/test.txt (glob)
324 sub1/sub2/test.txt (glob)
319
325
320 $ hg rollback -q
326 $ hg rollback -q
321 $ hg up -Cq
327 $ hg up -Cq
322
328
323 $ hg --config extensions.largefiles=! archive -S ../archive_all
329 $ hg --config extensions.largefiles=! archive -S ../archive_all
324 $ find ../archive_all | sort
330 $ find ../archive_all | sort
325 ../archive_all
331 ../archive_all
326 ../archive_all/.hg_archival.txt
332 ../archive_all/.hg_archival.txt
327 ../archive_all/.hgsub
333 ../archive_all/.hgsub
328 ../archive_all/.hgsubstate
334 ../archive_all/.hgsubstate
329 ../archive_all/main
335 ../archive_all/main
330 ../archive_all/sub1
336 ../archive_all/sub1
331 ../archive_all/sub1/.hgsub
337 ../archive_all/sub1/.hgsub
332 ../archive_all/sub1/.hgsubstate
338 ../archive_all/sub1/.hgsubstate
333 ../archive_all/sub1/sub1
339 ../archive_all/sub1/sub1
334 ../archive_all/sub1/sub2
340 ../archive_all/sub1/sub2
335 ../archive_all/sub1/sub2/folder
341 ../archive_all/sub1/sub2/folder
336 ../archive_all/sub1/sub2/folder/test.txt
342 ../archive_all/sub1/sub2/folder/test.txt
337 ../archive_all/sub1/sub2/sub2
343 ../archive_all/sub1/sub2/sub2
338 ../archive_all/sub1/sub2/test.txt
344 ../archive_all/sub1/sub2/test.txt
339
345
340 Check that archive -X works in deep subrepos
346 Check that archive -X works in deep subrepos
341
347
342 $ hg --config extensions.largefiles=! archive -S -X '**test*' ../archive_exclude
348 $ hg --config extensions.largefiles=! archive -S -X '**test*' ../archive_exclude
343 $ find ../archive_exclude | sort
349 $ find ../archive_exclude | sort
344 ../archive_exclude
350 ../archive_exclude
345 ../archive_exclude/.hg_archival.txt
351 ../archive_exclude/.hg_archival.txt
346 ../archive_exclude/.hgsub
352 ../archive_exclude/.hgsub
347 ../archive_exclude/.hgsubstate
353 ../archive_exclude/.hgsubstate
348 ../archive_exclude/main
354 ../archive_exclude/main
349 ../archive_exclude/sub1
355 ../archive_exclude/sub1
350 ../archive_exclude/sub1/.hgsub
356 ../archive_exclude/sub1/.hgsub
351 ../archive_exclude/sub1/.hgsubstate
357 ../archive_exclude/sub1/.hgsubstate
352 ../archive_exclude/sub1/sub1
358 ../archive_exclude/sub1/sub1
353 ../archive_exclude/sub1/sub2
359 ../archive_exclude/sub1/sub2
354 ../archive_exclude/sub1/sub2/sub2
360 ../archive_exclude/sub1/sub2/sub2
355
361
356 $ hg --config extensions.largefiles=! archive -S -I '**test*' ../archive_include
362 $ hg --config extensions.largefiles=! archive -S -I '**test*' ../archive_include
357 $ find ../archive_include | sort
363 $ find ../archive_include | sort
358 ../archive_include
364 ../archive_include
359 ../archive_include/sub1
365 ../archive_include/sub1
360 ../archive_include/sub1/sub2
366 ../archive_include/sub1/sub2
361 ../archive_include/sub1/sub2/folder
367 ../archive_include/sub1/sub2/folder
362 ../archive_include/sub1/sub2/folder/test.txt
368 ../archive_include/sub1/sub2/folder/test.txt
363 ../archive_include/sub1/sub2/test.txt
369 ../archive_include/sub1/sub2/test.txt
364
370
365 Check that deep archive works with largefiles (which overrides hgsubrepo impl)
371 Check that deep archive works with largefiles (which overrides hgsubrepo impl)
366 This also tests the repo.ui regression in 43fb170a23bd, and that lf subrepo
372 This also tests the repo.ui regression in 43fb170a23bd, and that lf subrepo
367 subrepos are archived properly.
373 subrepos are archived properly.
368 Note that add --large through a subrepo currently adds the file as a normal file
374 Note that add --large through a subrepo currently adds the file as a normal file
369
375
370 $ echo "large" > sub1/sub2/large.bin
376 $ echo "large" > sub1/sub2/large.bin
371 $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin
377 $ hg --config extensions.largefiles= add --large -R sub1/sub2 sub1/sub2/large.bin
372 $ echo "large" > large.bin
378 $ echo "large" > large.bin
373 $ hg --config extensions.largefiles= add --large large.bin
379 $ hg --config extensions.largefiles= add --large large.bin
374 $ hg --config extensions.largefiles= ci -S -m "add large files"
380 $ hg --config extensions.largefiles= ci -S -m "add large files"
375 committing subrepository sub1
381 committing subrepository sub1
376 committing subrepository sub1/sub2 (glob)
382 committing subrepository sub1/sub2 (glob)
377
383
378 $ hg --config extensions.largefiles= archive -S ../archive_lf
384 $ hg --config extensions.largefiles= archive -S ../archive_lf
379 $ find ../archive_lf | sort
385 $ find ../archive_lf | sort
380 ../archive_lf
386 ../archive_lf
381 ../archive_lf/.hg_archival.txt
387 ../archive_lf/.hg_archival.txt
382 ../archive_lf/.hgsub
388 ../archive_lf/.hgsub
383 ../archive_lf/.hgsubstate
389 ../archive_lf/.hgsubstate
384 ../archive_lf/large.bin
390 ../archive_lf/large.bin
385 ../archive_lf/main
391 ../archive_lf/main
386 ../archive_lf/sub1
392 ../archive_lf/sub1
387 ../archive_lf/sub1/.hgsub
393 ../archive_lf/sub1/.hgsub
388 ../archive_lf/sub1/.hgsubstate
394 ../archive_lf/sub1/.hgsubstate
389 ../archive_lf/sub1/sub1
395 ../archive_lf/sub1/sub1
390 ../archive_lf/sub1/sub2
396 ../archive_lf/sub1/sub2
391 ../archive_lf/sub1/sub2/folder
397 ../archive_lf/sub1/sub2/folder
392 ../archive_lf/sub1/sub2/folder/test.txt
398 ../archive_lf/sub1/sub2/folder/test.txt
393 ../archive_lf/sub1/sub2/large.bin
399 ../archive_lf/sub1/sub2/large.bin
394 ../archive_lf/sub1/sub2/sub2
400 ../archive_lf/sub1/sub2/sub2
395 ../archive_lf/sub1/sub2/test.txt
401 ../archive_lf/sub1/sub2/test.txt
396 $ rm -rf ../archive_lf
402 $ rm -rf ../archive_lf
397
403
398 Exclude large files from main and sub-sub repo
404 Exclude large files from main and sub-sub repo
399
405
400 $ hg --config extensions.largefiles= archive -S -X '**.bin' ../archive_lf
406 $ hg --config extensions.largefiles= archive -S -X '**.bin' ../archive_lf
401 $ find ../archive_lf | sort
407 $ find ../archive_lf | sort
402 ../archive_lf
408 ../archive_lf
403 ../archive_lf/.hg_archival.txt
409 ../archive_lf/.hg_archival.txt
404 ../archive_lf/.hgsub
410 ../archive_lf/.hgsub
405 ../archive_lf/.hgsubstate
411 ../archive_lf/.hgsubstate
406 ../archive_lf/main
412 ../archive_lf/main
407 ../archive_lf/sub1
413 ../archive_lf/sub1
408 ../archive_lf/sub1/.hgsub
414 ../archive_lf/sub1/.hgsub
409 ../archive_lf/sub1/.hgsubstate
415 ../archive_lf/sub1/.hgsubstate
410 ../archive_lf/sub1/sub1
416 ../archive_lf/sub1/sub1
411 ../archive_lf/sub1/sub2
417 ../archive_lf/sub1/sub2
412 ../archive_lf/sub1/sub2/folder
418 ../archive_lf/sub1/sub2/folder
413 ../archive_lf/sub1/sub2/folder/test.txt
419 ../archive_lf/sub1/sub2/folder/test.txt
414 ../archive_lf/sub1/sub2/sub2
420 ../archive_lf/sub1/sub2/sub2
415 ../archive_lf/sub1/sub2/test.txt
421 ../archive_lf/sub1/sub2/test.txt
416 $ rm -rf ../archive_lf
422 $ rm -rf ../archive_lf
417
423
418 Exclude normal files from main and sub-sub repo
424 Exclude normal files from main and sub-sub repo
419
425
420 $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz
426 $ hg --config extensions.largefiles= archive -S -X '**.txt' -p '.' ../archive_lf.tgz
421 $ tar -tzf ../archive_lf.tgz | sort
427 $ tar -tzf ../archive_lf.tgz | sort
422 .hgsub
428 .hgsub
423 .hgsubstate
429 .hgsubstate
424 large.bin
430 large.bin
425 main
431 main
426 sub1/.hgsub
432 sub1/.hgsub
427 sub1/.hgsubstate
433 sub1/.hgsubstate
428 sub1/sub1
434 sub1/sub1
429 sub1/sub2/large.bin
435 sub1/sub2/large.bin
430 sub1/sub2/sub2
436 sub1/sub2/sub2
431
437
432 Include normal files from within a largefiles subrepo
438 Include normal files from within a largefiles subrepo
433
439
434 $ hg --config extensions.largefiles= archive -S -I '**.txt' ../archive_lf
440 $ hg --config extensions.largefiles= archive -S -I '**.txt' ../archive_lf
435 $ find ../archive_lf | sort
441 $ find ../archive_lf | sort
436 ../archive_lf
442 ../archive_lf
437 ../archive_lf/.hg_archival.txt
443 ../archive_lf/.hg_archival.txt
438 ../archive_lf/sub1
444 ../archive_lf/sub1
439 ../archive_lf/sub1/sub2
445 ../archive_lf/sub1/sub2
440 ../archive_lf/sub1/sub2/folder
446 ../archive_lf/sub1/sub2/folder
441 ../archive_lf/sub1/sub2/folder/test.txt
447 ../archive_lf/sub1/sub2/folder/test.txt
442 ../archive_lf/sub1/sub2/test.txt
448 ../archive_lf/sub1/sub2/test.txt
443 $ rm -rf ../archive_lf
449 $ rm -rf ../archive_lf
444
450
445 Include large files from within a largefiles subrepo
451 Include large files from within a largefiles subrepo
446
452
447 $ hg --config extensions.largefiles= archive -S -I '**.bin' ../archive_lf
453 $ hg --config extensions.largefiles= archive -S -I '**.bin' ../archive_lf
448 $ find ../archive_lf | sort
454 $ find ../archive_lf | sort
449 ../archive_lf
455 ../archive_lf
450 ../archive_lf/large.bin
456 ../archive_lf/large.bin
451 ../archive_lf/sub1
457 ../archive_lf/sub1
452 ../archive_lf/sub1/sub2
458 ../archive_lf/sub1/sub2
453 ../archive_lf/sub1/sub2/large.bin
459 ../archive_lf/sub1/sub2/large.bin
454 $ rm -rf ../archive_lf
460 $ rm -rf ../archive_lf
455
461
456 Find an exact largefile match in a largefiles subrepo
462 Find an exact largefile match in a largefiles subrepo
457
463
458 $ hg --config extensions.largefiles= archive -S -I 'sub1/sub2/large.bin' ../archive_lf
464 $ hg --config extensions.largefiles= archive -S -I 'sub1/sub2/large.bin' ../archive_lf
459 $ find ../archive_lf | sort
465 $ find ../archive_lf | sort
460 ../archive_lf
466 ../archive_lf
461 ../archive_lf/sub1
467 ../archive_lf/sub1
462 ../archive_lf/sub1/sub2
468 ../archive_lf/sub1/sub2
463 ../archive_lf/sub1/sub2/large.bin
469 ../archive_lf/sub1/sub2/large.bin
464 $ rm -rf ../archive_lf
470 $ rm -rf ../archive_lf
465
471
466 The local repo enables largefiles if a largefiles repo is cloned
472 The local repo enables largefiles if a largefiles repo is cloned
467 $ hg showconfig extensions
473 $ hg showconfig extensions
468 abort: repository requires features unknown to this Mercurial: largefiles!
474 abort: repository requires features unknown to this Mercurial: largefiles!
469 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
475 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
470 [255]
476 [255]
471 $ hg --config extensions.largefiles= clone -qU . ../lfclone
477 $ hg --config extensions.largefiles= clone -qU . ../lfclone
472 $ cat ../lfclone/.hg/hgrc
478 $ cat ../lfclone/.hg/hgrc
473 # example repository config (see "hg help config" for more info)
479 # example repository config (see "hg help config" for more info)
474 [paths]
480 [paths]
475 default = $TESTTMP/cloned (glob)
481 default = $TESTTMP/cloned (glob)
476
482
477 # path aliases to other clones of this repo in URLs or filesystem paths
483 # path aliases to other clones of this repo in URLs or filesystem paths
478 # (see "hg help config.paths" for more info)
484 # (see "hg help config.paths" for more info)
479 #
485 #
480 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
486 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
481 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
487 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
482 # my-clone = /home/jdoe/jdoes-clone
488 # my-clone = /home/jdoe/jdoes-clone
483
489
484 [ui]
490 [ui]
485 # name and email (local to this repository, optional), e.g.
491 # name and email (local to this repository, optional), e.g.
486 # username = Jane Doe <jdoe@example.com>
492 # username = Jane Doe <jdoe@example.com>
487
493
488 [extensions]
494 [extensions]
489 largefiles=
495 largefiles=
490
496
491 Find an exact match to a standin (should archive nothing)
497 Find an exact match to a standin (should archive nothing)
492 $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf
498 $ hg --config extensions.largefiles= archive -S -I 'sub/sub2/.hglf/large.bin' ../archive_lf
493 $ find ../archive_lf 2> /dev/null | sort
499 $ find ../archive_lf 2> /dev/null | sort
494
500
495 $ cat >> $HGRCPATH <<EOF
501 $ cat >> $HGRCPATH <<EOF
496 > [extensions]
502 > [extensions]
497 > largefiles=
503 > largefiles=
498 > [largefiles]
504 > [largefiles]
499 > patterns=glob:**.dat
505 > patterns=glob:**.dat
500 > EOF
506 > EOF
501
507
502 Test forget through a deep subrepo with the largefiles extension, both a
508 Test forget through a deep subrepo with the largefiles extension, both a
503 largefile and a normal file. Then a largefile that hasn't been committed yet.
509 largefile and a normal file. Then a largefile that hasn't been committed yet.
504 $ touch sub1/sub2/untracked.txt
510 $ touch sub1/sub2/untracked.txt
505 $ touch sub1/sub2/large.dat
511 $ touch sub1/sub2/large.dat
506 $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt
512 $ hg forget sub1/sub2/large.bin sub1/sub2/test.txt sub1/sub2/untracked.txt
507 not removing sub1/sub2/untracked.txt: file is already untracked (glob)
513 not removing sub1/sub2/untracked.txt: file is already untracked (glob)
508 [1]
514 [1]
509 $ hg add --large --dry-run -v sub1/sub2/untracked.txt
515 $ hg add --large --dry-run -v sub1/sub2/untracked.txt
510 adding sub1/sub2/untracked.txt as a largefile (glob)
516 adding sub1/sub2/untracked.txt as a largefile (glob)
511 $ hg add --large -v sub1/sub2/untracked.txt
517 $ hg add --large -v sub1/sub2/untracked.txt
512 adding sub1/sub2/untracked.txt as a largefile (glob)
518 adding sub1/sub2/untracked.txt as a largefile (glob)
513 $ hg add --normal -v sub1/sub2/large.dat
519 $ hg add --normal -v sub1/sub2/large.dat
514 adding sub1/sub2/large.dat (glob)
520 adding sub1/sub2/large.dat (glob)
515 $ hg forget -v sub1/sub2/untracked.txt
521 $ hg forget -v sub1/sub2/untracked.txt
516 removing sub1/sub2/untracked.txt (glob)
522 removing sub1/sub2/untracked.txt (glob)
517 $ hg status -S
523 $ hg status -S
518 A sub1/sub2/large.dat
524 A sub1/sub2/large.dat
519 R sub1/sub2/large.bin
525 R sub1/sub2/large.bin
520 R sub1/sub2/test.txt
526 R sub1/sub2/test.txt
521 ? foo/bar/abc
527 ? foo/bar/abc
522 ? sub1/sub2/untracked.txt
528 ? sub1/sub2/untracked.txt
523 ? sub1/sub2/x.txt
529 ? sub1/sub2/x.txt
524 $ hg add sub1/sub2
530 $ hg add sub1/sub2
525
531
526 $ hg archive -S -r 'wdir()' ../wdir2
532 $ hg archive -S -r 'wdir()' ../wdir2
527 $ diff -r . ../wdir2 | egrep -v '\.hg$|^Common subdirectories:'
533 $ diff -r . ../wdir2 | egrep -v '\.hg$|^Common subdirectories:'
528 Only in ../wdir2: .hg_archival.txt
534 Only in ../wdir2: .hg_archival.txt
529 Only in .: .hglf
535 Only in .: .hglf
530 Only in .: foo
536 Only in .: foo
531 Only in ./sub1/sub2: large.bin
537 Only in ./sub1/sub2: large.bin
532 Only in ./sub1/sub2: test.txt
538 Only in ./sub1/sub2: test.txt
533 Only in ./sub1/sub2: untracked.txt
539 Only in ./sub1/sub2: untracked.txt
534 Only in ./sub1/sub2: x.txt
540 Only in ./sub1/sub2: x.txt
535 $ find ../wdir2 -type f | sort
541 $ find ../wdir2 -type f | sort
536 ../wdir2/.hg_archival.txt
542 ../wdir2/.hg_archival.txt
537 ../wdir2/.hgsub
543 ../wdir2/.hgsub
538 ../wdir2/.hgsubstate
544 ../wdir2/.hgsubstate
539 ../wdir2/large.bin
545 ../wdir2/large.bin
540 ../wdir2/main
546 ../wdir2/main
541 ../wdir2/sub1/.hgsub
547 ../wdir2/sub1/.hgsub
542 ../wdir2/sub1/.hgsubstate
548 ../wdir2/sub1/.hgsubstate
543 ../wdir2/sub1/sub1
549 ../wdir2/sub1/sub1
544 ../wdir2/sub1/sub2/folder/test.txt
550 ../wdir2/sub1/sub2/folder/test.txt
545 ../wdir2/sub1/sub2/large.dat
551 ../wdir2/sub1/sub2/large.dat
546 ../wdir2/sub1/sub2/sub2
552 ../wdir2/sub1/sub2/sub2
547 $ hg status -S -mac -n | sort
553 $ hg status -S -mac -n | sort
548 .hgsub
554 .hgsub
549 .hgsubstate
555 .hgsubstate
550 large.bin
556 large.bin
551 main
557 main
552 sub1/.hgsub
558 sub1/.hgsub
553 sub1/.hgsubstate
559 sub1/.hgsubstate
554 sub1/sub1
560 sub1/sub1
555 sub1/sub2/folder/test.txt
561 sub1/sub2/folder/test.txt
556 sub1/sub2/large.dat
562 sub1/sub2/large.dat
557 sub1/sub2/sub2
563 sub1/sub2/sub2
558
564
559 $ hg ci -Sqm 'forget testing'
565 $ hg ci -Sqm 'forget testing'
560
566
561 Test 'wdir()' modified file archiving with largefiles
567 Test 'wdir()' modified file archiving with largefiles
562 $ echo 'mod' > main
568 $ echo 'mod' > main
563 $ echo 'mod' > large.bin
569 $ echo 'mod' > large.bin
564 $ echo 'mod' > sub1/sub2/large.dat
570 $ echo 'mod' > sub1/sub2/large.dat
565 $ hg archive -S -r 'wdir()' ../wdir3
571 $ hg archive -S -r 'wdir()' ../wdir3
566 $ diff -r . ../wdir3 | egrep -v '\.hg$|^Common subdirectories'
572 $ diff -r . ../wdir3 | egrep -v '\.hg$|^Common subdirectories'
567 Only in ../wdir3: .hg_archival.txt
573 Only in ../wdir3: .hg_archival.txt
568 Only in .: .hglf
574 Only in .: .hglf
569 Only in .: foo
575 Only in .: foo
570 Only in ./sub1/sub2: large.bin
576 Only in ./sub1/sub2: large.bin
571 Only in ./sub1/sub2: test.txt
577 Only in ./sub1/sub2: test.txt
572 Only in ./sub1/sub2: untracked.txt
578 Only in ./sub1/sub2: untracked.txt
573 Only in ./sub1/sub2: x.txt
579 Only in ./sub1/sub2: x.txt
574 $ find ../wdir3 -type f | sort
580 $ find ../wdir3 -type f | sort
575 ../wdir3/.hg_archival.txt
581 ../wdir3/.hg_archival.txt
576 ../wdir3/.hgsub
582 ../wdir3/.hgsub
577 ../wdir3/.hgsubstate
583 ../wdir3/.hgsubstate
578 ../wdir3/large.bin
584 ../wdir3/large.bin
579 ../wdir3/main
585 ../wdir3/main
580 ../wdir3/sub1/.hgsub
586 ../wdir3/sub1/.hgsub
581 ../wdir3/sub1/.hgsubstate
587 ../wdir3/sub1/.hgsubstate
582 ../wdir3/sub1/sub1
588 ../wdir3/sub1/sub1
583 ../wdir3/sub1/sub2/folder/test.txt
589 ../wdir3/sub1/sub2/folder/test.txt
584 ../wdir3/sub1/sub2/large.dat
590 ../wdir3/sub1/sub2/large.dat
585 ../wdir3/sub1/sub2/sub2
591 ../wdir3/sub1/sub2/sub2
586 $ hg up -Cq
592 $ hg up -Cq
587
593
588 Test issue4330: commit a directory where only normal files have changed
594 Test issue4330: commit a directory where only normal files have changed
589 $ touch foo/bar/large.dat
595 $ touch foo/bar/large.dat
590 $ hg add --large foo/bar/large.dat
596 $ hg add --large foo/bar/large.dat
591 $ hg ci -m 'add foo/bar/large.dat'
597 $ hg ci -m 'add foo/bar/large.dat'
592 $ touch a.txt
598 $ touch a.txt
593 $ touch a.dat
599 $ touch a.dat
594 $ hg add -v foo/bar/abc a.txt a.dat
600 $ hg add -v foo/bar/abc a.txt a.dat
595 adding a.dat as a largefile
601 adding a.dat as a largefile
596 adding a.txt
602 adding a.txt
597 adding foo/bar/abc (glob)
603 adding foo/bar/abc (glob)
598 $ hg ci -m 'dir commit with only normal file deltas' foo/bar
604 $ hg ci -m 'dir commit with only normal file deltas' foo/bar
599 $ hg status
605 $ hg status
600 A a.dat
606 A a.dat
601 A a.txt
607 A a.txt
602
608
603 Test a directory commit with a changed largefile and a changed normal file
609 Test a directory commit with a changed largefile and a changed normal file
604 $ echo changed > foo/bar/large.dat
610 $ echo changed > foo/bar/large.dat
605 $ echo changed > foo/bar/abc
611 $ echo changed > foo/bar/abc
606 $ hg ci -m 'dir commit with normal and lf file deltas' foo
612 $ hg ci -m 'dir commit with normal and lf file deltas' foo
607 $ hg status
613 $ hg status
608 A a.dat
614 A a.dat
609 A a.txt
615 A a.txt
610
616
611 $ hg ci -m "add a.*"
617 $ hg ci -m "add a.*"
612 $ hg mv a.dat b.dat
618 $ hg mv a.dat b.dat
613 $ hg mv foo/bar/abc foo/bar/def
619 $ hg mv foo/bar/abc foo/bar/def
614 $ hg status -C
620 $ hg status -C
615 A b.dat
621 A b.dat
616 a.dat
622 a.dat
617 A foo/bar/def
623 A foo/bar/def
618 foo/bar/abc
624 foo/bar/abc
619 R a.dat
625 R a.dat
620 R foo/bar/abc
626 R foo/bar/abc
621
627
622 $ hg ci -m "move large and normal"
628 $ hg ci -m "move large and normal"
623 $ hg status -C --rev '.^' --rev .
629 $ hg status -C --rev '.^' --rev .
624 A b.dat
630 A b.dat
625 a.dat
631 a.dat
626 A foo/bar/def
632 A foo/bar/def
627 foo/bar/abc
633 foo/bar/abc
628 R a.dat
634 R a.dat
629 R foo/bar/abc
635 R foo/bar/abc
630
636
631
637
632 $ echo foo > main
638 $ echo foo > main
633 $ hg ci -m "mod parent only"
639 $ hg ci -m "mod parent only"
634 $ hg init sub3
640 $ hg init sub3
635 $ echo "sub3 = sub3" >> .hgsub
641 $ echo "sub3 = sub3" >> .hgsub
636 $ echo xyz > sub3/a.txt
642 $ echo xyz > sub3/a.txt
637 $ hg add sub3/a.txt
643 $ hg add sub3/a.txt
638 $ hg ci -Sm "add sub3"
644 $ hg ci -Sm "add sub3"
639 committing subrepository sub3
645 committing subrepository sub3
640 $ cat .hgsub | grep -v sub3 > .hgsub1
646 $ cat .hgsub | grep -v sub3 > .hgsub1
641 $ mv .hgsub1 .hgsub
647 $ mv .hgsub1 .hgsub
642 $ hg ci -m "remove sub3"
648 $ hg ci -m "remove sub3"
643
649
644 $ hg log -r "subrepo()" --style compact
650 $ hg log -r "subrepo()" --style compact
645 0 7f491f53a367 1970-01-01 00:00 +0000 test
651 0 7f491f53a367 1970-01-01 00:00 +0000 test
646 main import
652 main import
647
653
648 1 ffe6649062fe 1970-01-01 00:00 +0000 test
654 1 ffe6649062fe 1970-01-01 00:00 +0000 test
649 deep nested modif should trigger a commit
655 deep nested modif should trigger a commit
650
656
651 2 9bb10eebee29 1970-01-01 00:00 +0000 test
657 2 9bb10eebee29 1970-01-01 00:00 +0000 test
652 add test.txt
658 add test.txt
653
659
654 3 7c64f035294f 1970-01-01 00:00 +0000 test
660 3 7c64f035294f 1970-01-01 00:00 +0000 test
655 add large files
661 add large files
656
662
657 4 f734a59e2e35 1970-01-01 00:00 +0000 test
663 4 f734a59e2e35 1970-01-01 00:00 +0000 test
658 forget testing
664 forget testing
659
665
660 11 9685a22af5db 1970-01-01 00:00 +0000 test
666 11 9685a22af5db 1970-01-01 00:00 +0000 test
661 add sub3
667 add sub3
662
668
663 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test
669 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test
664 remove sub3
670 remove sub3
665
671
666 $ hg log -r "subrepo('sub3')" --style compact
672 $ hg log -r "subrepo('sub3')" --style compact
667 11 9685a22af5db 1970-01-01 00:00 +0000 test
673 11 9685a22af5db 1970-01-01 00:00 +0000 test
668 add sub3
674 add sub3
669
675
670 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test
676 12[tip] 2e0485b475b9 1970-01-01 00:00 +0000 test
671 remove sub3
677 remove sub3
672
678
673 $ hg log -r "subrepo('bogus')" --style compact
679 $ hg log -r "subrepo('bogus')" --style compact
674
680
675
681
676 Test .hgsubstate in the R state
682 Test .hgsubstate in the R state
677
683
678 $ hg rm .hgsub .hgsubstate
684 $ hg rm .hgsub .hgsubstate
679 $ hg ci -m 'trash subrepo tracking'
685 $ hg ci -m 'trash subrepo tracking'
680
686
681 $ hg log -r "subrepo('re:sub\d+')" --style compact
687 $ hg log -r "subrepo('re:sub\d+')" --style compact
682 0 7f491f53a367 1970-01-01 00:00 +0000 test
688 0 7f491f53a367 1970-01-01 00:00 +0000 test
683 main import
689 main import
684
690
685 1 ffe6649062fe 1970-01-01 00:00 +0000 test
691 1 ffe6649062fe 1970-01-01 00:00 +0000 test
686 deep nested modif should trigger a commit
692 deep nested modif should trigger a commit
687
693
688 2 9bb10eebee29 1970-01-01 00:00 +0000 test
694 2 9bb10eebee29 1970-01-01 00:00 +0000 test
689 add test.txt
695 add test.txt
690
696
691 3 7c64f035294f 1970-01-01 00:00 +0000 test
697 3 7c64f035294f 1970-01-01 00:00 +0000 test
692 add large files
698 add large files
693
699
694 4 f734a59e2e35 1970-01-01 00:00 +0000 test
700 4 f734a59e2e35 1970-01-01 00:00 +0000 test
695 forget testing
701 forget testing
696
702
697 11 9685a22af5db 1970-01-01 00:00 +0000 test
703 11 9685a22af5db 1970-01-01 00:00 +0000 test
698 add sub3
704 add sub3
699
705
700 12 2e0485b475b9 1970-01-01 00:00 +0000 test
706 12 2e0485b475b9 1970-01-01 00:00 +0000 test
701 remove sub3
707 remove sub3
702
708
703 13[tip] a68b2c361653 1970-01-01 00:00 +0000 test
709 13[tip] a68b2c361653 1970-01-01 00:00 +0000 test
704 trash subrepo tracking
710 trash subrepo tracking
705
711
706
712
707 Restore the trashed subrepo tracking
713 Restore the trashed subrepo tracking
708
714
709 $ hg rollback -q
715 $ hg rollback -q
710 $ hg update -Cq .
716 $ hg update -Cq .
711
717
712 Interaction with extdiff, largefiles and subrepos
718 Interaction with extdiff, largefiles and subrepos
713
719
714 $ hg --config extensions.extdiff= extdiff -S
720 $ hg --config extensions.extdiff= extdiff -S
715
721
716 $ hg --config extensions.extdiff= extdiff -r '.^' -S
722 $ hg --config extensions.extdiff= extdiff -r '.^' -S
717 diff -Npru cloned.*/.hgsub cloned/.hgsub (glob)
723 diff -Nru cloned.*/.hgsub cloned/.hgsub (glob)
718 --- cloned.*/.hgsub * +0000 (glob)
724 --- cloned.*/.hgsub * +0000 (glob)
719 +++ cloned/.hgsub * +0000 (glob)
725 +++ cloned/.hgsub * +0000 (glob)
720 @@ -1,2 +1 @@
726 @@ -1,2 +1 @@
721 sub1 = ../sub1
727 sub1 = ../sub1
722 -sub3 = sub3
728 -sub3 = sub3
723 diff -Npru cloned.*/.hgsubstate cloned/.hgsubstate (glob)
729 diff -Nru cloned.*/.hgsubstate cloned/.hgsubstate (glob)
724 --- cloned.*/.hgsubstate * +0000 (glob)
730 --- cloned.*/.hgsubstate * +0000 (glob)
725 +++ cloned/.hgsubstate * +0000 (glob)
731 +++ cloned/.hgsubstate * +0000 (glob)
726 @@ -1,2 +1 @@
732 @@ -1,2 +1 @@
727 7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
733 7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
728 -b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
734 -b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
729 [1]
735 [1]
730
736
731 $ hg --config extensions.extdiff= extdiff -r 0 -r '.^' -S
737 $ hg --config extensions.extdiff= extdiff -r 0 -r '.^' -S
732 diff -Npru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
738 diff -Nru cloned.*/.hglf/b.dat cloned.*/.hglf/b.dat (glob)
733 --- cloned.*/.hglf/b.dat * (glob)
739 --- cloned.*/.hglf/b.dat * (glob)
734 +++ cloned.*/.hglf/b.dat * (glob)
740 +++ cloned.*/.hglf/b.dat * (glob)
735 @@ -0,0 +1 @@
741 @@ -0,0 +1 @@
736 +da39a3ee5e6b4b0d3255bfef95601890afd80709
742 +da39a3ee5e6b4b0d3255bfef95601890afd80709
737 diff -Npru cloned.*/.hglf/foo/bar/large.dat cloned.*/.hglf/foo/bar/large.dat (glob)
743 diff -Nru cloned.*/.hglf/foo/bar/large.dat cloned.*/.hglf/foo/bar/large.dat (glob)
738 --- cloned.*/.hglf/foo/bar/large.dat * (glob)
744 --- cloned.*/.hglf/foo/bar/large.dat * (glob)
739 +++ cloned.*/.hglf/foo/bar/large.dat * (glob)
745 +++ cloned.*/.hglf/foo/bar/large.dat * (glob)
740 @@ -0,0 +1 @@
746 @@ -0,0 +1 @@
741 +2f6933b5ee0f5fdd823d9717d8729f3c2523811b
747 +2f6933b5ee0f5fdd823d9717d8729f3c2523811b
742 diff -Npru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
748 diff -Nru cloned.*/.hglf/large.bin cloned.*/.hglf/large.bin (glob)
743 --- cloned.*/.hglf/large.bin * (glob)
749 --- cloned.*/.hglf/large.bin * (glob)
744 +++ cloned.*/.hglf/large.bin * (glob)
750 +++ cloned.*/.hglf/large.bin * (glob)
745 @@ -0,0 +1 @@
751 @@ -0,0 +1 @@
746 +7f7097b041ccf68cc5561e9600da4655d21c6d18
752 +7f7097b041ccf68cc5561e9600da4655d21c6d18
747 diff -Npru cloned.*/.hgsub cloned.*/.hgsub (glob)
753 diff -Nru cloned.*/.hgsub cloned.*/.hgsub (glob)
748 --- cloned.*/.hgsub * (glob)
754 --- cloned.*/.hgsub * (glob)
749 +++ cloned.*/.hgsub * (glob)
755 +++ cloned.*/.hgsub * (glob)
750 @@ -1 +1,2 @@
756 @@ -1 +1,2 @@
751 sub1 = ../sub1
757 sub1 = ../sub1
752 +sub3 = sub3
758 +sub3 = sub3
753 diff -Npru cloned.*/.hgsubstate cloned.*/.hgsubstate (glob)
759 diff -Nru cloned.*/.hgsubstate cloned.*/.hgsubstate (glob)
754 --- cloned.*/.hgsubstate * (glob)
760 --- cloned.*/.hgsubstate * (glob)
755 +++ cloned.*/.hgsubstate * (glob)
761 +++ cloned.*/.hgsubstate * (glob)
756 @@ -1 +1,2 @@
762 @@ -1 +1,2 @@
757 -fc3b4ce2696f7741438c79207583768f2ce6b0dd sub1
763 -fc3b4ce2696f7741438c79207583768f2ce6b0dd sub1
758 +7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
764 +7a36fa02b66e61f27f3d4a822809f159479b8ab2 sub1
759 +b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
765 +b1a26de6f2a045a9f079323693614ee322f1ff7e sub3
760 diff -Npru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
766 diff -Nru cloned.*/foo/bar/def cloned.*/foo/bar/def (glob)
761 --- cloned.*/foo/bar/def * (glob)
767 --- cloned.*/foo/bar/def * (glob)
762 +++ cloned.*/foo/bar/def * (glob)
768 +++ cloned.*/foo/bar/def * (glob)
763 @@ -0,0 +1 @@
769 @@ -0,0 +1 @@
764 +changed
770 +changed
765 diff -Npru cloned.*/main cloned.*/main (glob)
771 diff -Nru cloned.*/main cloned.*/main (glob)
766 --- cloned.*/main * (glob)
772 --- cloned.*/main * (glob)
767 +++ cloned.*/main * (glob)
773 +++ cloned.*/main * (glob)
768 @@ -1 +1 @@
774 @@ -1 +1 @@
769 -main
775 -main
770 +foo
776 +foo
771 diff -Npru cloned.*/sub1/.hgsubstate cloned.*/sub1/.hgsubstate (glob)
777 diff -Nru cloned.*/sub1/.hgsubstate cloned.*/sub1/.hgsubstate (glob)
772 --- cloned.*/sub1/.hgsubstate * (glob)
778 --- cloned.*/sub1/.hgsubstate * (glob)
773 +++ cloned.*/sub1/.hgsubstate * (glob)
779 +++ cloned.*/sub1/.hgsubstate * (glob)
774 @@ -1 +1 @@
780 @@ -1 +1 @@
775 -c57a0840e3badd667ef3c3ef65471609acb2ba3c sub2
781 -c57a0840e3badd667ef3c3ef65471609acb2ba3c sub2
776 +c77908c81ccea3794a896c79e98b0e004aee2e9e sub2
782 +c77908c81ccea3794a896c79e98b0e004aee2e9e sub2
777 diff -Npru cloned.*/sub1/sub2/folder/test.txt cloned.*/sub1/sub2/folder/test.txt (glob)
783 diff -Nru cloned.*/sub1/sub2/folder/test.txt cloned.*/sub1/sub2/folder/test.txt (glob)
778 --- cloned.*/sub1/sub2/folder/test.txt * (glob)
784 --- cloned.*/sub1/sub2/folder/test.txt * (glob)
779 +++ cloned.*/sub1/sub2/folder/test.txt * (glob)
785 +++ cloned.*/sub1/sub2/folder/test.txt * (glob)
780 @@ -0,0 +1 @@
786 @@ -0,0 +1 @@
781 +subfolder
787 +subfolder
782 diff -Npru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
788 diff -Nru cloned.*/sub1/sub2/sub2 cloned.*/sub1/sub2/sub2 (glob)
783 --- cloned.*/sub1/sub2/sub2 * (glob)
789 --- cloned.*/sub1/sub2/sub2 * (glob)
784 +++ cloned.*/sub1/sub2/sub2 * (glob)
790 +++ cloned.*/sub1/sub2/sub2 * (glob)
785 @@ -1 +1 @@
791 @@ -1 +1 @@
786 -sub2
792 -sub2
787 +modified
793 +modified
788 diff -Npru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
794 diff -Nru cloned.*/sub3/a.txt cloned.*/sub3/a.txt (glob)
789 --- cloned.*/sub3/a.txt * (glob)
795 --- cloned.*/sub3/a.txt * (glob)
790 +++ cloned.*/sub3/a.txt * (glob)
796 +++ cloned.*/sub3/a.txt * (glob)
791 @@ -0,0 +1 @@
797 @@ -0,0 +1 @@
792 +xyz
798 +xyz
793 [1]
799 [1]
794
800
795 $ echo mod > sub1/sub2/sub2
801 $ echo mod > sub1/sub2/sub2
796 $ hg --config extensions.extdiff= extdiff -S
802 $ hg --config extensions.extdiff= extdiff -S
797 --- */cloned.*/sub1/sub2/sub2 * (glob)
803 --- */cloned.*/sub1/sub2/sub2 * (glob)
798 +++ */cloned/sub1/sub2/sub2 * (glob)
804 +++ */cloned/sub1/sub2/sub2 * (glob)
799 @@ -1 +1 @@
805 @@ -1 +1 @@
800 -modified
806 -modified
801 +mod
807 +mod
802 [1]
808 [1]
803
809
804 $ cd ..
810 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now