##// END OF EJS Templates
treediscovery: rename stop() in tests to fix failures on AIX....
Jim Hague -
r14831:0407b761 stable
parent child Browse files
Show More
@@ -1,383 +1,384 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 #
2 #
3 # check-code - a style and portability checker for Mercurial
3 # check-code - a style and portability checker for Mercurial
4 #
4 #
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
6 #
6 #
7 # This software may be used and distributed according to the terms of the
7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version.
8 # GNU General Public License version 2 or any later version.
9
9
10 import re, glob, os, sys
10 import re, glob, os, sys
11 import keyword
11 import keyword
12 import optparse
12 import optparse
13
13
14 def repquote(m):
14 def repquote(m):
15 t = re.sub(r"\w", "x", m.group('text'))
15 t = re.sub(r"\w", "x", m.group('text'))
16 t = re.sub(r"[^\sx]", "o", t)
16 t = re.sub(r"[^\sx]", "o", t)
17 return m.group('quote') + t + m.group('quote')
17 return m.group('quote') + t + m.group('quote')
18
18
19 def reppython(m):
19 def reppython(m):
20 comment = m.group('comment')
20 comment = m.group('comment')
21 if comment:
21 if comment:
22 return "#" * len(comment)
22 return "#" * len(comment)
23 return repquote(m)
23 return repquote(m)
24
24
25 def repcomment(m):
25 def repcomment(m):
26 return m.group(1) + "#" * len(m.group(2))
26 return m.group(1) + "#" * len(m.group(2))
27
27
28 def repccomment(m):
28 def repccomment(m):
29 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
29 t = re.sub(r"((?<=\n) )|\S", "x", m.group(2))
30 return m.group(1) + t + "*/"
30 return m.group(1) + t + "*/"
31
31
32 def repcallspaces(m):
32 def repcallspaces(m):
33 t = re.sub(r"\n\s+", "\n", m.group(2))
33 t = re.sub(r"\n\s+", "\n", m.group(2))
34 return m.group(1) + t
34 return m.group(1) + t
35
35
36 def repinclude(m):
36 def repinclude(m):
37 return m.group(1) + "<foo>"
37 return m.group(1) + "<foo>"
38
38
39 def rephere(m):
39 def rephere(m):
40 t = re.sub(r"\S", "x", m.group(2))
40 t = re.sub(r"\S", "x", m.group(2))
41 return m.group(1) + t
41 return m.group(1) + t
42
42
43
43
44 testpats = [
44 testpats = [
45 [
45 [
46 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
46 (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"),
47 (r'\W\$?\(\([^\)]*\)\)', "don't use (()) or $(()), use 'expr'"),
47 (r'\W\$?\(\([^\)]*\)\)', "don't use (()) or $(()), use 'expr'"),
48 (r'^function', "don't use 'function', use old style"),
48 (r'^function', "don't use 'function', use old style"),
49 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
49 (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"),
50 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
50 (r'echo.*\\n', "don't use 'echo \\n', use printf"),
51 (r'echo -n', "don't use 'echo -n', use printf"),
51 (r'echo -n', "don't use 'echo -n', use printf"),
52 (r'^diff.*-\w*N', "don't use 'diff -N'"),
52 (r'^diff.*-\w*N', "don't use 'diff -N'"),
53 (r'(^| )wc[^|]*$', "filter wc output"),
53 (r'(^| )wc[^|]*$', "filter wc output"),
54 (r'head -c', "don't use 'head -c', use 'dd'"),
54 (r'head -c', "don't use 'head -c', use 'dd'"),
55 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
55 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
56 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
56 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
57 (r'printf.*\\x', "don't use printf \\x, use Python"),
57 (r'printf.*\\x', "don't use printf \\x, use Python"),
58 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
58 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
59 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
59 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
60 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
60 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
61 "use egrep for extended grep syntax"),
61 "use egrep for extended grep syntax"),
62 (r'/bin/', "don't use explicit paths for tools"),
62 (r'/bin/', "don't use explicit paths for tools"),
63 (r'\$PWD', "don't use $PWD, use `pwd`"),
63 (r'\$PWD', "don't use $PWD, use `pwd`"),
64 (r'[^\n]\Z', "no trailing newline"),
64 (r'[^\n]\Z', "no trailing newline"),
65 (r'export.*=', "don't export and assign at once"),
65 (r'export.*=', "don't export and assign at once"),
66 ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"),
66 ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"),
67 (r'^source\b', "don't use 'source', use '.'"),
67 (r'^source\b', "don't use 'source', use '.'"),
68 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
68 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
69 (r'ls\s+[^|-]+\s+-', "options to 'ls' must come before filenames"),
69 (r'ls\s+[^|-]+\s+-', "options to 'ls' must come before filenames"),
70 (r'[^>]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
70 (r'[^>]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
71 (r'stop\(\)', "don't use 'stop' as a shell function name"),
71 ],
72 ],
72 # warnings
73 # warnings
73 []
74 []
74 ]
75 ]
75
76
76 testfilters = [
77 testfilters = [
77 (r"( *)(#([^\n]*\S)?)", repcomment),
78 (r"( *)(#([^\n]*\S)?)", repcomment),
78 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
79 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
79 ]
80 ]
80
81
81 uprefix = r"^ \$ "
82 uprefix = r"^ \$ "
82 uprefixc = r"^ > "
83 uprefixc = r"^ > "
83 utestpats = [
84 utestpats = [
84 [
85 [
85 (r'^(\S| $ ).*(\S\s+|^\s+)\n', "trailing whitespace on non-output"),
86 (r'^(\S| $ ).*(\S\s+|^\s+)\n', "trailing whitespace on non-output"),
86 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
87 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
87 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
88 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
88 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
89 (uprefix + r'.*\$\?', "explicit exit code checks unnecessary"),
89 (uprefix + r'.*\|\| echo.*(fail|error)',
90 (uprefix + r'.*\|\| echo.*(fail|error)',
90 "explicit exit code checks unnecessary"),
91 "explicit exit code checks unnecessary"),
91 (uprefix + r'set -e', "don't use set -e"),
92 (uprefix + r'set -e', "don't use set -e"),
92 (uprefixc + r'( *)\t', "don't use tabs to indent"),
93 (uprefixc + r'( *)\t', "don't use tabs to indent"),
93 ],
94 ],
94 # warnings
95 # warnings
95 []
96 []
96 ]
97 ]
97
98
98 for i in [0, 1]:
99 for i in [0, 1]:
99 for p, m in testpats[i]:
100 for p, m in testpats[i]:
100 if p.startswith('^'):
101 if p.startswith('^'):
101 p = uprefix + p[1:]
102 p = uprefix + p[1:]
102 else:
103 else:
103 p = uprefix + p
104 p = uprefix + p
104 utestpats[i].append((p, m))
105 utestpats[i].append((p, m))
105
106
106 utestfilters = [
107 utestfilters = [
107 (r"( *)(#([^\n]*\S)?)", repcomment),
108 (r"( *)(#([^\n]*\S)?)", repcomment),
108 ]
109 ]
109
110
110 pypats = [
111 pypats = [
111 [
112 [
112 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
113 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
113 "tuple parameter unpacking not available in Python 3+"),
114 "tuple parameter unpacking not available in Python 3+"),
114 (r'lambda\s*\(.*,.*\)',
115 (r'lambda\s*\(.*,.*\)',
115 "tuple parameter unpacking not available in Python 3+"),
116 "tuple parameter unpacking not available in Python 3+"),
116 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
117 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
117 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
118 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
118 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
119 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
119 (r'^\s*\t', "don't use tabs"),
120 (r'^\s*\t', "don't use tabs"),
120 (r'\S;\s*\n', "semicolon"),
121 (r'\S;\s*\n', "semicolon"),
121 (r'\w,\w', "missing whitespace after ,"),
122 (r'\w,\w', "missing whitespace after ,"),
122 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
123 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
123 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
124 (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"),
124 (r'.{85}', "line too long"),
125 (r'.{85}', "line too long"),
125 (r'[^\n]\Z', "no trailing newline"),
126 (r'[^\n]\Z', "no trailing newline"),
126 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
127 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
127 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
128 # (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"),
128 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
129 # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"),
129 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
130 (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+',
130 "linebreak after :"),
131 "linebreak after :"),
131 (r'class\s[^( ]+:', "old-style class, use class foo(object)"),
132 (r'class\s[^( ]+:', "old-style class, use class foo(object)"),
132 (r'class\s[^( ]+\(\):',
133 (r'class\s[^( ]+\(\):',
133 "class foo() not available in Python 2.4, use class foo(object)"),
134 "class foo() not available in Python 2.4, use class foo(object)"),
134 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
135 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
135 "Python keyword is not a function"),
136 "Python keyword is not a function"),
136 (r',]', "unneeded trailing ',' in list"),
137 (r',]', "unneeded trailing ',' in list"),
137 # (r'class\s[A-Z][^\(]*\((?!Exception)',
138 # (r'class\s[A-Z][^\(]*\((?!Exception)',
138 # "don't capitalize non-exception classes"),
139 # "don't capitalize non-exception classes"),
139 # (r'in range\(', "use xrange"),
140 # (r'in range\(', "use xrange"),
140 # (r'^\s*print\s+', "avoid using print in core and extensions"),
141 # (r'^\s*print\s+', "avoid using print in core and extensions"),
141 (r'[\x80-\xff]', "non-ASCII character literal"),
142 (r'[\x80-\xff]', "non-ASCII character literal"),
142 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
143 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
143 (r'^\s*with\s+', "with not available in Python 2.4"),
144 (r'^\s*with\s+', "with not available in Python 2.4"),
144 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
145 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
145 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
146 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
146 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
147 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
147 (r'(?<!def)\s+(any|all|format)\(',
148 (r'(?<!def)\s+(any|all|format)\(',
148 "any/all/format not available in Python 2.4"),
149 "any/all/format not available in Python 2.4"),
149 (r'(?<!def)\s+(callable)\(',
150 (r'(?<!def)\s+(callable)\(',
150 "callable not available in Python 3, use hasattr(f, '__call__')"),
151 "callable not available in Python 3, use hasattr(f, '__call__')"),
151 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
152 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
152 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
153 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
153 "gratuitous whitespace after Python keyword"),
154 "gratuitous whitespace after Python keyword"),
154 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
155 (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"),
155 # (r'\s\s=', "gratuitous whitespace before ="),
156 # (r'\s\s=', "gratuitous whitespace before ="),
156 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
157 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
157 "missing whitespace around operator"),
158 "missing whitespace around operator"),
158 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
159 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
159 "missing whitespace around operator"),
160 "missing whitespace around operator"),
160 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
161 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
161 "missing whitespace around operator"),
162 "missing whitespace around operator"),
162 (r'[^+=*/!<>&| -](\s=|=\s)[^= ]',
163 (r'[^+=*/!<>&| -](\s=|=\s)[^= ]',
163 "wrong whitespace around ="),
164 "wrong whitespace around ="),
164 (r'raise Exception', "don't raise generic exceptions"),
165 (r'raise Exception', "don't raise generic exceptions"),
165 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
166 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
166 (r' [=!]=\s+(True|False|None)',
167 (r' [=!]=\s+(True|False|None)',
167 "comparison with singleton, use 'is' or 'is not' instead"),
168 "comparison with singleton, use 'is' or 'is not' instead"),
168 (r'^\s*(while|if) [01]:',
169 (r'^\s*(while|if) [01]:',
169 "use True/False for constant Boolean expression"),
170 "use True/False for constant Boolean expression"),
170 (r'opener\([^)]*\).read\(',
171 (r'opener\([^)]*\).read\(',
171 "use opener.read() instead"),
172 "use opener.read() instead"),
172 (r'opener\([^)]*\).write\(',
173 (r'opener\([^)]*\).write\(',
173 "use opener.write() instead"),
174 "use opener.write() instead"),
174 (r'[\s\(](open|file)\([^)]*\)\.read\(',
175 (r'[\s\(](open|file)\([^)]*\)\.read\(',
175 "use util.readfile() instead"),
176 "use util.readfile() instead"),
176 (r'[\s\(](open|file)\([^)]*\)\.write\(',
177 (r'[\s\(](open|file)\([^)]*\)\.write\(',
177 "use util.readfile() instead"),
178 "use util.readfile() instead"),
178 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
179 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
179 "always assign an opened file to a variable, and close it afterwards"),
180 "always assign an opened file to a variable, and close it afterwards"),
180 (r'[\s\(](open|file)\([^)]*\)\.',
181 (r'[\s\(](open|file)\([^)]*\)\.',
181 "always assign an opened file to a variable, and close it afterwards"),
182 "always assign an opened file to a variable, and close it afterwards"),
182 (r'(?i)descendent', "the proper spelling is descendAnt"),
183 (r'(?i)descendent', "the proper spelling is descendAnt"),
183 (r'\.debug\(\_', "don't mark debug messages for translation"),
184 (r'\.debug\(\_', "don't mark debug messages for translation"),
184 ],
185 ],
185 # warnings
186 # warnings
186 [
187 [
187 (r'.{81}', "warning: line over 80 characters"),
188 (r'.{81}', "warning: line over 80 characters"),
188 (r'^\s*except:$', "warning: naked except clause"),
189 (r'^\s*except:$', "warning: naked except clause"),
189 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
190 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
190 "warning: unwrapped ui message"),
191 "warning: unwrapped ui message"),
191 ]
192 ]
192 ]
193 ]
193
194
194 pyfilters = [
195 pyfilters = [
195 (r"""(?msx)(?P<comment>\#.*?$)|
196 (r"""(?msx)(?P<comment>\#.*?$)|
196 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
197 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
197 (?P<text>(([^\\]|\\.)*?))
198 (?P<text>(([^\\]|\\.)*?))
198 (?P=quote))""", reppython),
199 (?P=quote))""", reppython),
199 ]
200 ]
200
201
201 cpats = [
202 cpats = [
202 [
203 [
203 (r'//', "don't use //-style comments"),
204 (r'//', "don't use //-style comments"),
204 (r'^ ', "don't use spaces to indent"),
205 (r'^ ', "don't use spaces to indent"),
205 (r'\S\t', "don't use tabs except for indent"),
206 (r'\S\t', "don't use tabs except for indent"),
206 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
207 (r'(\S\s+|^\s+)\n', "trailing whitespace"),
207 (r'.{85}', "line too long"),
208 (r'.{85}', "line too long"),
208 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
209 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
209 (r'return\(', "return is not a function"),
210 (r'return\(', "return is not a function"),
210 (r' ;', "no space before ;"),
211 (r' ;', "no space before ;"),
211 (r'\w+\* \w+', "use int *foo, not int* foo"),
212 (r'\w+\* \w+', "use int *foo, not int* foo"),
212 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
213 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
213 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
214 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
214 (r'\w,\w', "missing whitespace after ,"),
215 (r'\w,\w', "missing whitespace after ,"),
215 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
216 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
216 (r'^#\s+\w', "use #foo, not # foo"),
217 (r'^#\s+\w', "use #foo, not # foo"),
217 (r'[^\n]\Z', "no trailing newline"),
218 (r'[^\n]\Z', "no trailing newline"),
218 (r'^\s*#import\b', "use only #include in standard C code"),
219 (r'^\s*#import\b', "use only #include in standard C code"),
219 ],
220 ],
220 # warnings
221 # warnings
221 []
222 []
222 ]
223 ]
223
224
224 cfilters = [
225 cfilters = [
225 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
226 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
226 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
227 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
227 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
228 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
228 (r'(\()([^)]+\))', repcallspaces),
229 (r'(\()([^)]+\))', repcallspaces),
229 ]
230 ]
230
231
231 inutilpats = [
232 inutilpats = [
232 [
233 [
233 (r'\bui\.', "don't use ui in util"),
234 (r'\bui\.', "don't use ui in util"),
234 ],
235 ],
235 # warnings
236 # warnings
236 []
237 []
237 ]
238 ]
238
239
239 inrevlogpats = [
240 inrevlogpats = [
240 [
241 [
241 (r'\brepo\.', "don't use repo in revlog"),
242 (r'\brepo\.', "don't use repo in revlog"),
242 ],
243 ],
243 # warnings
244 # warnings
244 []
245 []
245 ]
246 ]
246
247
247 checks = [
248 checks = [
248 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
249 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
249 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
250 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
250 ('c', r'.*\.c$', cfilters, cpats),
251 ('c', r'.*\.c$', cfilters, cpats),
251 ('unified test', r'.*\.t$', utestfilters, utestpats),
252 ('unified test', r'.*\.t$', utestfilters, utestpats),
252 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
253 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
253 inrevlogpats),
254 inrevlogpats),
254 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
255 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
255 inutilpats),
256 inutilpats),
256 ]
257 ]
257
258
258 class norepeatlogger(object):
259 class norepeatlogger(object):
259 def __init__(self):
260 def __init__(self):
260 self._lastseen = None
261 self._lastseen = None
261
262
262 def log(self, fname, lineno, line, msg, blame):
263 def log(self, fname, lineno, line, msg, blame):
263 """print error related a to given line of a given file.
264 """print error related a to given line of a given file.
264
265
265 The faulty line will also be printed but only once in the case
266 The faulty line will also be printed but only once in the case
266 of multiple errors.
267 of multiple errors.
267
268
268 :fname: filename
269 :fname: filename
269 :lineno: line number
270 :lineno: line number
270 :line: actual content of the line
271 :line: actual content of the line
271 :msg: error message
272 :msg: error message
272 """
273 """
273 msgid = fname, lineno, line
274 msgid = fname, lineno, line
274 if msgid != self._lastseen:
275 if msgid != self._lastseen:
275 if blame:
276 if blame:
276 print "%s:%d (%s):" % (fname, lineno, blame)
277 print "%s:%d (%s):" % (fname, lineno, blame)
277 else:
278 else:
278 print "%s:%d:" % (fname, lineno)
279 print "%s:%d:" % (fname, lineno)
279 print " > %s" % line
280 print " > %s" % line
280 self._lastseen = msgid
281 self._lastseen = msgid
281 print " " + msg
282 print " " + msg
282
283
283 _defaultlogger = norepeatlogger()
284 _defaultlogger = norepeatlogger()
284
285
285 def getblame(f):
286 def getblame(f):
286 lines = []
287 lines = []
287 for l in os.popen('hg annotate -un %s' % f):
288 for l in os.popen('hg annotate -un %s' % f):
288 start, line = l.split(':', 1)
289 start, line = l.split(':', 1)
289 user, rev = start.split()
290 user, rev = start.split()
290 lines.append((line[1:-1], user, rev))
291 lines.append((line[1:-1], user, rev))
291 return lines
292 return lines
292
293
293 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
294 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
294 blame=False, debug=False):
295 blame=False, debug=False):
295 """checks style and portability of a given file
296 """checks style and portability of a given file
296
297
297 :f: filepath
298 :f: filepath
298 :logfunc: function used to report error
299 :logfunc: function used to report error
299 logfunc(filename, linenumber, linecontent, errormessage)
300 logfunc(filename, linenumber, linecontent, errormessage)
300 :maxerr: number of error to display before arborting.
301 :maxerr: number of error to display before arborting.
301 Set to None (default) to report all errors
302 Set to None (default) to report all errors
302
303
303 return True if no error is found, False otherwise.
304 return True if no error is found, False otherwise.
304 """
305 """
305 blamecache = None
306 blamecache = None
306 result = True
307 result = True
307 for name, match, filters, pats in checks:
308 for name, match, filters, pats in checks:
308 if debug:
309 if debug:
309 print name, f
310 print name, f
310 fc = 0
311 fc = 0
311 if not re.match(match, f):
312 if not re.match(match, f):
312 if debug:
313 if debug:
313 print "Skipping %s for %s it doesn't match %s" % (
314 print "Skipping %s for %s it doesn't match %s" % (
314 name, match, f)
315 name, match, f)
315 continue
316 continue
316 fp = open(f)
317 fp = open(f)
317 pre = post = fp.read()
318 pre = post = fp.read()
318 fp.close()
319 fp.close()
319 if "no-" + "check-code" in pre:
320 if "no-" + "check-code" in pre:
320 if debug:
321 if debug:
321 print "Skipping %s for %s it has no- and check-code" % (
322 print "Skipping %s for %s it has no- and check-code" % (
322 name, f)
323 name, f)
323 break
324 break
324 for p, r in filters:
325 for p, r in filters:
325 post = re.sub(p, r, post)
326 post = re.sub(p, r, post)
326 if warnings:
327 if warnings:
327 pats = pats[0] + pats[1]
328 pats = pats[0] + pats[1]
328 else:
329 else:
329 pats = pats[0]
330 pats = pats[0]
330 # print post # uncomment to show filtered version
331 # print post # uncomment to show filtered version
331 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
332 z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
332 if debug:
333 if debug:
333 print "Checking %s for %s" % (name, f)
334 print "Checking %s for %s" % (name, f)
334 for n, l in z:
335 for n, l in z:
335 if "check-code" + "-ignore" in l[0]:
336 if "check-code" + "-ignore" in l[0]:
336 if debug:
337 if debug:
337 print "Skipping %s for %s:%s (check-code -ignore)" % (
338 print "Skipping %s for %s:%s (check-code -ignore)" % (
338 name, f, n)
339 name, f, n)
339 continue
340 continue
340 for p, msg in pats:
341 for p, msg in pats:
341 if re.search(p, l[1]):
342 if re.search(p, l[1]):
342 bd = ""
343 bd = ""
343 if blame:
344 if blame:
344 bd = 'working directory'
345 bd = 'working directory'
345 if not blamecache:
346 if not blamecache:
346 blamecache = getblame(f)
347 blamecache = getblame(f)
347 if n < len(blamecache):
348 if n < len(blamecache):
348 bl, bu, br = blamecache[n]
349 bl, bu, br = blamecache[n]
349 if bl == l[0]:
350 if bl == l[0]:
350 bd = '%s@%s' % (bu, br)
351 bd = '%s@%s' % (bu, br)
351 logfunc(f, n + 1, l[0], msg, bd)
352 logfunc(f, n + 1, l[0], msg, bd)
352 fc += 1
353 fc += 1
353 result = False
354 result = False
354 if maxerr is not None and fc >= maxerr:
355 if maxerr is not None and fc >= maxerr:
355 print " (too many errors, giving up)"
356 print " (too many errors, giving up)"
356 break
357 break
357 return result
358 return result
358
359
359 if __name__ == "__main__":
360 if __name__ == "__main__":
360 parser = optparse.OptionParser("%prog [options] [files]")
361 parser = optparse.OptionParser("%prog [options] [files]")
361 parser.add_option("-w", "--warnings", action="store_true",
362 parser.add_option("-w", "--warnings", action="store_true",
362 help="include warning-level checks")
363 help="include warning-level checks")
363 parser.add_option("-p", "--per-file", type="int",
364 parser.add_option("-p", "--per-file", type="int",
364 help="max warnings per file")
365 help="max warnings per file")
365 parser.add_option("-b", "--blame", action="store_true",
366 parser.add_option("-b", "--blame", action="store_true",
366 help="use annotate to generate blame info")
367 help="use annotate to generate blame info")
367 parser.add_option("", "--debug", action="store_true",
368 parser.add_option("", "--debug", action="store_true",
368 help="show debug information")
369 help="show debug information")
369
370
370 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False)
371 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False)
371 (options, args) = parser.parse_args()
372 (options, args) = parser.parse_args()
372
373
373 if len(args) == 0:
374 if len(args) == 0:
374 check = glob.glob("*")
375 check = glob.glob("*")
375 else:
376 else:
376 check = args
377 check = args
377
378
378 for f in check:
379 for f in check:
379 ret = 0
380 ret = 0
380 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
381 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
381 blame=options.blame, debug=options.debug):
382 blame=options.blame, debug=options.debug):
382 ret = 1
383 ret = 1
383 sys.exit(ret)
384 sys.exit(ret)
@@ -1,310 +1,310 b''
1 Tests discovery against servers without getbundle support:
1 Tests discovery against servers without getbundle support:
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [ui]
4 > [ui]
5 > logtemplate="{rev} {node|short}: {desc} {branches}\n"
5 > logtemplate="{rev} {node|short}: {desc} {branches}\n"
6 > [extensions]
6 > [extensions]
7 > graphlog=
7 > graphlog=
8 > EOF
8 > EOF
9 $ cp $HGRCPATH $HGRCPATH-withcap
9 $ cp $HGRCPATH $HGRCPATH-withcap
10
10
11 $ CAP="getbundle known changegroupsubset"
11 $ CAP="getbundle known changegroupsubset"
12 $ . "$TESTDIR/notcapable"
12 $ . "$TESTDIR/notcapable"
13 $ cp $HGRCPATH $HGRCPATH-nocap
13 $ cp $HGRCPATH $HGRCPATH-nocap
14 $ cp $HGRCPATH-withcap $HGRCPATH
14 $ cp $HGRCPATH-withcap $HGRCPATH
15
15
16 Setup HTTP server control:
16 Setup HTTP server control:
17
17
18 $ remote=http://localhost:$HGPORT/
18 $ remote=http://localhost:$HGPORT/
19 $ export remote
19 $ export remote
20 $ start() {
20 $ tstart() {
21 > echo '[web]' > $1/.hg/hgrc
21 > echo '[web]' > $1/.hg/hgrc
22 > echo 'push_ssl = false' >> $1/.hg/hgrc
22 > echo 'push_ssl = false' >> $1/.hg/hgrc
23 > echo 'allow_push = *' >> $1/.hg/hgrc
23 > echo 'allow_push = *' >> $1/.hg/hgrc
24 > cp $HGRCPATH-nocap $HGRCPATH
24 > cp $HGRCPATH-nocap $HGRCPATH
25 > hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
25 > hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
26 > cat hg.pid >> $DAEMON_PIDS
26 > cat hg.pid >> $DAEMON_PIDS
27 > }
27 > }
28 $ stop() {
28 $ tstop() {
29 > "$TESTDIR/killdaemons.py"
29 > "$TESTDIR/killdaemons.py"
30 > cp $HGRCPATH-withcap $HGRCPATH
30 > cp $HGRCPATH-withcap $HGRCPATH
31 > }
31 > }
32
32
33 Both are empty:
33 Both are empty:
34
34
35 $ hg init empty1
35 $ hg init empty1
36 $ hg init empty2
36 $ hg init empty2
37 $ start empty2
37 $ tstart empty2
38 $ hg incoming -R empty1 $remote
38 $ hg incoming -R empty1 $remote
39 comparing with http://localhost:$HGPORT/
39 comparing with http://localhost:$HGPORT/
40 no changes found
40 no changes found
41 [1]
41 [1]
42 $ hg outgoing -R empty1 $remote
42 $ hg outgoing -R empty1 $remote
43 comparing with http://localhost:$HGPORT/
43 comparing with http://localhost:$HGPORT/
44 no changes found
44 no changes found
45 [1]
45 [1]
46 $ hg pull -R empty1 $remote
46 $ hg pull -R empty1 $remote
47 pulling from http://localhost:$HGPORT/
47 pulling from http://localhost:$HGPORT/
48 no changes found
48 no changes found
49 $ hg push -R empty1 $remote
49 $ hg push -R empty1 $remote
50 pushing to http://localhost:$HGPORT/
50 pushing to http://localhost:$HGPORT/
51 no changes found
51 no changes found
52 $ stop
52 $ tstop
53
53
54 Base repo:
54 Base repo:
55
55
56 $ hg init main
56 $ hg init main
57 $ cd main
57 $ cd main
58 $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
58 $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
59 $ hg glog
59 $ hg glog
60 o 11 a19bfa7e7328: r11 both
60 o 11 a19bfa7e7328: r11 both
61 |
61 |
62 o 10 8b6bad1512e1: r10 both
62 o 10 8b6bad1512e1: r10 both
63 |
63 |
64 o 9 025829e08038: r9 both
64 o 9 025829e08038: r9 both
65 |\
65 |\
66 | o 8 d8f638ac69e9: r8 name2
66 | o 8 d8f638ac69e9: r8 name2
67 | |
67 | |
68 | o 7 b6b4d315a2ac: r7 name2
68 | o 7 b6b4d315a2ac: r7 name2
69 | |
69 | |
70 | o 6 6c6f5d5f3c11: r6 name2
70 | o 6 6c6f5d5f3c11: r6 name2
71 | |
71 | |
72 | o 5 70314b29987d: r5 name2
72 | o 5 70314b29987d: r5 name2
73 | |
73 | |
74 o | 4 e71dbbc70e03: r4 name1
74 o | 4 e71dbbc70e03: r4 name1
75 | |
75 | |
76 o | 3 2c8d5d5ec612: r3 name1
76 o | 3 2c8d5d5ec612: r3 name1
77 | |
77 | |
78 o | 2 a7892891da29: r2 name1
78 o | 2 a7892891da29: r2 name1
79 |/
79 |/
80 o 1 0019a3b924fd: r1
80 o 1 0019a3b924fd: r1
81 |
81 |
82 o 0 d57206cc072a: r0
82 o 0 d57206cc072a: r0
83
83
84 $ cd ..
84 $ cd ..
85 $ start main
85 $ tstart main
86
86
87 Full clone:
87 Full clone:
88
88
89 $ hg clone main full
89 $ hg clone main full
90 updating to branch default
90 updating to branch default
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 $ cd full
92 $ cd full
93 $ hg incoming $remote
93 $ hg incoming $remote
94 comparing with http://localhost:$HGPORT/
94 comparing with http://localhost:$HGPORT/
95 searching for changes
95 searching for changes
96 no changes found
96 no changes found
97 [1]
97 [1]
98 $ hg outgoing $remote
98 $ hg outgoing $remote
99 comparing with http://localhost:$HGPORT/
99 comparing with http://localhost:$HGPORT/
100 searching for changes
100 searching for changes
101 no changes found
101 no changes found
102 [1]
102 [1]
103 $ hg pull $remote
103 $ hg pull $remote
104 pulling from http://localhost:$HGPORT/
104 pulling from http://localhost:$HGPORT/
105 searching for changes
105 searching for changes
106 no changes found
106 no changes found
107 $ hg push $remote
107 $ hg push $remote
108 pushing to http://localhost:$HGPORT/
108 pushing to http://localhost:$HGPORT/
109 searching for changes
109 searching for changes
110 no changes found
110 no changes found
111 $ cd ..
111 $ cd ..
112
112
113 Local is empty:
113 Local is empty:
114
114
115 $ cd empty1
115 $ cd empty1
116 $ hg incoming $remote --rev name1
116 $ hg incoming $remote --rev name1
117 comparing with http://localhost:$HGPORT/
117 comparing with http://localhost:$HGPORT/
118 abort: cannot look up remote changes; remote repository does not support the 'changegroupsubset' capability!
118 abort: cannot look up remote changes; remote repository does not support the 'changegroupsubset' capability!
119 [255]
119 [255]
120 $ hg incoming $remote
120 $ hg incoming $remote
121 comparing with http://localhost:$HGPORT/
121 comparing with http://localhost:$HGPORT/
122 0 d57206cc072a: r0
122 0 d57206cc072a: r0
123 1 0019a3b924fd: r1
123 1 0019a3b924fd: r1
124 2 a7892891da29: r2 name1
124 2 a7892891da29: r2 name1
125 3 2c8d5d5ec612: r3 name1
125 3 2c8d5d5ec612: r3 name1
126 4 e71dbbc70e03: r4 name1
126 4 e71dbbc70e03: r4 name1
127 5 70314b29987d: r5 name2
127 5 70314b29987d: r5 name2
128 6 6c6f5d5f3c11: r6 name2
128 6 6c6f5d5f3c11: r6 name2
129 7 b6b4d315a2ac: r7 name2
129 7 b6b4d315a2ac: r7 name2
130 8 d8f638ac69e9: r8 name2
130 8 d8f638ac69e9: r8 name2
131 9 025829e08038: r9 both
131 9 025829e08038: r9 both
132 10 8b6bad1512e1: r10 both
132 10 8b6bad1512e1: r10 both
133 11 a19bfa7e7328: r11 both
133 11 a19bfa7e7328: r11 both
134 $ hg outgoing $remote
134 $ hg outgoing $remote
135 comparing with http://localhost:$HGPORT/
135 comparing with http://localhost:$HGPORT/
136 no changes found
136 no changes found
137 [1]
137 [1]
138 $ hg push $remote
138 $ hg push $remote
139 pushing to http://localhost:$HGPORT/
139 pushing to http://localhost:$HGPORT/
140 no changes found
140 no changes found
141 $ hg pull $remote
141 $ hg pull $remote
142 pulling from http://localhost:$HGPORT/
142 pulling from http://localhost:$HGPORT/
143 requesting all changes
143 requesting all changes
144 adding changesets
144 adding changesets
145 adding manifests
145 adding manifests
146 adding file changes
146 adding file changes
147 added 12 changesets with 24 changes to 2 files
147 added 12 changesets with 24 changes to 2 files
148 (run 'hg update' to get a working copy)
148 (run 'hg update' to get a working copy)
149 $ hg incoming $remote
149 $ hg incoming $remote
150 comparing with http://localhost:$HGPORT/
150 comparing with http://localhost:$HGPORT/
151 searching for changes
151 searching for changes
152 no changes found
152 no changes found
153 [1]
153 [1]
154 $ cd ..
154 $ cd ..
155
155
156 Local is subset:
156 Local is subset:
157
157
158 $ cp $HGRCPATH-withcap $HGRCPATH
158 $ cp $HGRCPATH-withcap $HGRCPATH
159 $ hg clone main subset --rev name2 ; cd subset
159 $ hg clone main subset --rev name2 ; cd subset
160 adding changesets
160 adding changesets
161 adding manifests
161 adding manifests
162 adding file changes
162 adding file changes
163 added 6 changesets with 12 changes to 2 files
163 added 6 changesets with 12 changes to 2 files
164 updating to branch name2
164 updating to branch name2
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ cp $HGRCPATH-nocap $HGRCPATH
166 $ cp $HGRCPATH-nocap $HGRCPATH
167 $ hg incoming $remote
167 $ hg incoming $remote
168 comparing with http://localhost:$HGPORT/
168 comparing with http://localhost:$HGPORT/
169 searching for changes
169 searching for changes
170 6 a7892891da29: r2 name1
170 6 a7892891da29: r2 name1
171 7 2c8d5d5ec612: r3 name1
171 7 2c8d5d5ec612: r3 name1
172 8 e71dbbc70e03: r4 name1
172 8 e71dbbc70e03: r4 name1
173 9 025829e08038: r9 both
173 9 025829e08038: r9 both
174 10 8b6bad1512e1: r10 both
174 10 8b6bad1512e1: r10 both
175 11 a19bfa7e7328: r11 both
175 11 a19bfa7e7328: r11 both
176 $ hg outgoing $remote
176 $ hg outgoing $remote
177 comparing with http://localhost:$HGPORT/
177 comparing with http://localhost:$HGPORT/
178 searching for changes
178 searching for changes
179 no changes found
179 no changes found
180 [1]
180 [1]
181 $ hg push $remote
181 $ hg push $remote
182 pushing to http://localhost:$HGPORT/
182 pushing to http://localhost:$HGPORT/
183 searching for changes
183 searching for changes
184 no changes found
184 no changes found
185 $ hg pull $remote
185 $ hg pull $remote
186 pulling from http://localhost:$HGPORT/
186 pulling from http://localhost:$HGPORT/
187 searching for changes
187 searching for changes
188 adding changesets
188 adding changesets
189 adding manifests
189 adding manifests
190 adding file changes
190 adding file changes
191 added 6 changesets with 12 changes to 2 files
191 added 6 changesets with 12 changes to 2 files
192 (run 'hg update' to get a working copy)
192 (run 'hg update' to get a working copy)
193 $ hg incoming $remote
193 $ hg incoming $remote
194 comparing with http://localhost:$HGPORT/
194 comparing with http://localhost:$HGPORT/
195 searching for changes
195 searching for changes
196 no changes found
196 no changes found
197 [1]
197 [1]
198 $ cd ..
198 $ cd ..
199
199
200 Remote is empty:
200 Remote is empty:
201
201
202 $ stop ; start empty2
202 $ tstop ; tstart empty2
203 $ cd main
203 $ cd main
204 $ hg incoming $remote
204 $ hg incoming $remote
205 comparing with http://localhost:$HGPORT/
205 comparing with http://localhost:$HGPORT/
206 searching for changes
206 searching for changes
207 no changes found
207 no changes found
208 [1]
208 [1]
209 $ hg outgoing $remote
209 $ hg outgoing $remote
210 comparing with http://localhost:$HGPORT/
210 comparing with http://localhost:$HGPORT/
211 searching for changes
211 searching for changes
212 0 d57206cc072a: r0
212 0 d57206cc072a: r0
213 1 0019a3b924fd: r1
213 1 0019a3b924fd: r1
214 2 a7892891da29: r2 name1
214 2 a7892891da29: r2 name1
215 3 2c8d5d5ec612: r3 name1
215 3 2c8d5d5ec612: r3 name1
216 4 e71dbbc70e03: r4 name1
216 4 e71dbbc70e03: r4 name1
217 5 70314b29987d: r5 name2
217 5 70314b29987d: r5 name2
218 6 6c6f5d5f3c11: r6 name2
218 6 6c6f5d5f3c11: r6 name2
219 7 b6b4d315a2ac: r7 name2
219 7 b6b4d315a2ac: r7 name2
220 8 d8f638ac69e9: r8 name2
220 8 d8f638ac69e9: r8 name2
221 9 025829e08038: r9 both
221 9 025829e08038: r9 both
222 10 8b6bad1512e1: r10 both
222 10 8b6bad1512e1: r10 both
223 11 a19bfa7e7328: r11 both
223 11 a19bfa7e7328: r11 both
224 $ hg pull $remote
224 $ hg pull $remote
225 pulling from http://localhost:$HGPORT/
225 pulling from http://localhost:$HGPORT/
226 searching for changes
226 searching for changes
227 no changes found
227 no changes found
228 $ hg push $remote
228 $ hg push $remote
229 pushing to http://localhost:$HGPORT/
229 pushing to http://localhost:$HGPORT/
230 searching for changes
230 searching for changes
231 remote: adding changesets
231 remote: adding changesets
232 remote: adding manifests
232 remote: adding manifests
233 remote: adding file changes
233 remote: adding file changes
234 remote: added 12 changesets with 24 changes to 2 files
234 remote: added 12 changesets with 24 changes to 2 files
235 $ hg outgoing $remote
235 $ hg outgoing $remote
236 comparing with http://localhost:$HGPORT/
236 comparing with http://localhost:$HGPORT/
237 searching for changes
237 searching for changes
238 no changes found
238 no changes found
239 [1]
239 [1]
240 $ cd ..
240 $ cd ..
241
241
242 Local is superset:
242 Local is superset:
243
243
244 $ stop
244 $ tstop
245 $ hg clone main subset2 --rev name2
245 $ hg clone main subset2 --rev name2
246 adding changesets
246 adding changesets
247 adding manifests
247 adding manifests
248 adding file changes
248 adding file changes
249 added 6 changesets with 12 changes to 2 files
249 added 6 changesets with 12 changes to 2 files
250 updating to branch name2
250 updating to branch name2
251 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 $ start subset2
252 $ tstart subset2
253 $ cd main
253 $ cd main
254 $ hg incoming $remote
254 $ hg incoming $remote
255 comparing with http://localhost:$HGPORT/
255 comparing with http://localhost:$HGPORT/
256 searching for changes
256 searching for changes
257 no changes found
257 no changes found
258 [1]
258 [1]
259 $ hg outgoing $remote
259 $ hg outgoing $remote
260 comparing with http://localhost:$HGPORT/
260 comparing with http://localhost:$HGPORT/
261 searching for changes
261 searching for changes
262 2 a7892891da29: r2 name1
262 2 a7892891da29: r2 name1
263 3 2c8d5d5ec612: r3 name1
263 3 2c8d5d5ec612: r3 name1
264 4 e71dbbc70e03: r4 name1
264 4 e71dbbc70e03: r4 name1
265 9 025829e08038: r9 both
265 9 025829e08038: r9 both
266 10 8b6bad1512e1: r10 both
266 10 8b6bad1512e1: r10 both
267 11 a19bfa7e7328: r11 both
267 11 a19bfa7e7328: r11 both
268 $ hg pull $remote
268 $ hg pull $remote
269 pulling from http://localhost:$HGPORT/
269 pulling from http://localhost:$HGPORT/
270 searching for changes
270 searching for changes
271 no changes found
271 no changes found
272 $ hg push $remote
272 $ hg push $remote
273 pushing to http://localhost:$HGPORT/
273 pushing to http://localhost:$HGPORT/
274 searching for changes
274 searching for changes
275 abort: push creates new remote branches: both, name1!
275 abort: push creates new remote branches: both, name1!
276 (use 'hg push --new-branch' to create new remote branches)
276 (use 'hg push --new-branch' to create new remote branches)
277 [255]
277 [255]
278 $ hg push $remote --new-branch
278 $ hg push $remote --new-branch
279 pushing to http://localhost:$HGPORT/
279 pushing to http://localhost:$HGPORT/
280 searching for changes
280 searching for changes
281 remote: adding changesets
281 remote: adding changesets
282 remote: adding manifests
282 remote: adding manifests
283 remote: adding file changes
283 remote: adding file changes
284 remote: added 6 changesets with 12 changes to 2 files
284 remote: added 6 changesets with 12 changes to 2 files
285 $ hg outgoing $remote
285 $ hg outgoing $remote
286 comparing with http://localhost:$HGPORT/
286 comparing with http://localhost:$HGPORT/
287 searching for changes
287 searching for changes
288 no changes found
288 no changes found
289 [1]
289 [1]
290 $ cd ..
290 $ cd ..
291
291
292 Partial pull:
292 Partial pull:
293
293
294 $ stop ; start main
294 $ tstop ; tstart main
295 $ hg clone $remote partial --rev name2
295 $ hg clone $remote partial --rev name2
296 abort: partial pull cannot be done because other repository doesn't support changegroupsubset.
296 abort: partial pull cannot be done because other repository doesn't support changegroupsubset.
297 [255]
297 [255]
298 $ hg init partial; cd partial
298 $ hg init partial; cd partial
299 $ hg incoming $remote --rev name2
299 $ hg incoming $remote --rev name2
300 comparing with http://localhost:$HGPORT/
300 comparing with http://localhost:$HGPORT/
301 abort: cannot look up remote changes; remote repository does not support the 'changegroupsubset' capability!
301 abort: cannot look up remote changes; remote repository does not support the 'changegroupsubset' capability!
302 [255]
302 [255]
303 $ hg pull $remote --rev name2
303 $ hg pull $remote --rev name2
304 pulling from http://localhost:$HGPORT/
304 pulling from http://localhost:$HGPORT/
305 abort: partial pull cannot be done because other repository doesn't support changegroupsubset.
305 abort: partial pull cannot be done because other repository doesn't support changegroupsubset.
306 [255]
306 [255]
307 $ cd ..
307 $ cd ..
308
308
309 $ stop
309 $ tstop
310
310
@@ -1,498 +1,498 b''
1 Tests discovery against servers without getbundle support:
1 Tests discovery against servers without getbundle support:
2
2
3 $ CAP=getbundle
3 $ CAP=getbundle
4 $ . "$TESTDIR/notcapable"
4 $ . "$TESTDIR/notcapable"
5 $ cat >> $HGRCPATH <<EOF
5 $ cat >> $HGRCPATH <<EOF
6 > [ui]
6 > [ui]
7 > logtemplate="{rev} {node|short}: {desc} {branches}\n"
7 > logtemplate="{rev} {node|short}: {desc} {branches}\n"
8 > [extensions]
8 > [extensions]
9 > graphlog=
9 > graphlog=
10 > EOF
10 > EOF
11
11
12 Setup HTTP server control:
12 Setup HTTP server control:
13
13
14 $ remote=http://localhost:$HGPORT/
14 $ remote=http://localhost:$HGPORT/
15 $ export remote
15 $ export remote
16 $ start() {
16 $ tstart() {
17 > echo '[web]' > $1/.hg/hgrc
17 > echo '[web]' > $1/.hg/hgrc
18 > echo 'push_ssl = false' >> $1/.hg/hgrc
18 > echo 'push_ssl = false' >> $1/.hg/hgrc
19 > echo 'allow_push = *' >> $1/.hg/hgrc
19 > echo 'allow_push = *' >> $1/.hg/hgrc
20 > hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
20 > hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
21 > cat hg.pid >> $DAEMON_PIDS
21 > cat hg.pid >> $DAEMON_PIDS
22 > }
22 > }
23 $ stop() {
23 $ tstop() {
24 > "$TESTDIR/killdaemons.py"
24 > "$TESTDIR/killdaemons.py"
25 > }
25 > }
26
26
27 Both are empty:
27 Both are empty:
28
28
29 $ hg init empty1
29 $ hg init empty1
30 $ hg init empty2
30 $ hg init empty2
31 $ start empty2
31 $ tstart empty2
32 $ hg incoming -R empty1 $remote
32 $ hg incoming -R empty1 $remote
33 comparing with http://localhost:$HGPORT/
33 comparing with http://localhost:$HGPORT/
34 no changes found
34 no changes found
35 [1]
35 [1]
36 $ hg outgoing -R empty1 $remote
36 $ hg outgoing -R empty1 $remote
37 comparing with http://localhost:$HGPORT/
37 comparing with http://localhost:$HGPORT/
38 no changes found
38 no changes found
39 [1]
39 [1]
40 $ hg pull -R empty1 $remote
40 $ hg pull -R empty1 $remote
41 pulling from http://localhost:$HGPORT/
41 pulling from http://localhost:$HGPORT/
42 no changes found
42 no changes found
43 $ hg push -R empty1 $remote
43 $ hg push -R empty1 $remote
44 pushing to http://localhost:$HGPORT/
44 pushing to http://localhost:$HGPORT/
45 no changes found
45 no changes found
46 $ stop
46 $ tstop
47
47
48 Base repo:
48 Base repo:
49
49
50 $ hg init main
50 $ hg init main
51 $ cd main
51 $ cd main
52 $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
52 $ hg debugbuilddag -mo '+2:tbase @name1 +3:thead1 <tbase @name2 +4:thead2 @both /thead1 +2:tmaintip'
53 $ hg glog
53 $ hg glog
54 o 11 a19bfa7e7328: r11 both
54 o 11 a19bfa7e7328: r11 both
55 |
55 |
56 o 10 8b6bad1512e1: r10 both
56 o 10 8b6bad1512e1: r10 both
57 |
57 |
58 o 9 025829e08038: r9 both
58 o 9 025829e08038: r9 both
59 |\
59 |\
60 | o 8 d8f638ac69e9: r8 name2
60 | o 8 d8f638ac69e9: r8 name2
61 | |
61 | |
62 | o 7 b6b4d315a2ac: r7 name2
62 | o 7 b6b4d315a2ac: r7 name2
63 | |
63 | |
64 | o 6 6c6f5d5f3c11: r6 name2
64 | o 6 6c6f5d5f3c11: r6 name2
65 | |
65 | |
66 | o 5 70314b29987d: r5 name2
66 | o 5 70314b29987d: r5 name2
67 | |
67 | |
68 o | 4 e71dbbc70e03: r4 name1
68 o | 4 e71dbbc70e03: r4 name1
69 | |
69 | |
70 o | 3 2c8d5d5ec612: r3 name1
70 o | 3 2c8d5d5ec612: r3 name1
71 | |
71 | |
72 o | 2 a7892891da29: r2 name1
72 o | 2 a7892891da29: r2 name1
73 |/
73 |/
74 o 1 0019a3b924fd: r1
74 o 1 0019a3b924fd: r1
75 |
75 |
76 o 0 d57206cc072a: r0
76 o 0 d57206cc072a: r0
77
77
78 $ cd ..
78 $ cd ..
79 $ start main
79 $ tstart main
80
80
81 Full clone:
81 Full clone:
82
82
83 $ hg clone main full
83 $ hg clone main full
84 updating to branch default
84 updating to branch default
85 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 $ cd full
86 $ cd full
87 $ hg incoming $remote
87 $ hg incoming $remote
88 comparing with http://localhost:$HGPORT/
88 comparing with http://localhost:$HGPORT/
89 searching for changes
89 searching for changes
90 no changes found
90 no changes found
91 [1]
91 [1]
92 $ hg outgoing $remote
92 $ hg outgoing $remote
93 comparing with http://localhost:$HGPORT/
93 comparing with http://localhost:$HGPORT/
94 searching for changes
94 searching for changes
95 no changes found
95 no changes found
96 [1]
96 [1]
97 $ hg pull $remote
97 $ hg pull $remote
98 pulling from http://localhost:$HGPORT/
98 pulling from http://localhost:$HGPORT/
99 searching for changes
99 searching for changes
100 no changes found
100 no changes found
101 $ hg push $remote
101 $ hg push $remote
102 pushing to http://localhost:$HGPORT/
102 pushing to http://localhost:$HGPORT/
103 searching for changes
103 searching for changes
104 no changes found
104 no changes found
105 $ cd ..
105 $ cd ..
106
106
107 Local is empty:
107 Local is empty:
108
108
109 $ cd empty1
109 $ cd empty1
110 $ hg incoming $remote
110 $ hg incoming $remote
111 comparing with http://localhost:$HGPORT/
111 comparing with http://localhost:$HGPORT/
112 0 d57206cc072a: r0
112 0 d57206cc072a: r0
113 1 0019a3b924fd: r1
113 1 0019a3b924fd: r1
114 2 a7892891da29: r2 name1
114 2 a7892891da29: r2 name1
115 3 2c8d5d5ec612: r3 name1
115 3 2c8d5d5ec612: r3 name1
116 4 e71dbbc70e03: r4 name1
116 4 e71dbbc70e03: r4 name1
117 5 70314b29987d: r5 name2
117 5 70314b29987d: r5 name2
118 6 6c6f5d5f3c11: r6 name2
118 6 6c6f5d5f3c11: r6 name2
119 7 b6b4d315a2ac: r7 name2
119 7 b6b4d315a2ac: r7 name2
120 8 d8f638ac69e9: r8 name2
120 8 d8f638ac69e9: r8 name2
121 9 025829e08038: r9 both
121 9 025829e08038: r9 both
122 10 8b6bad1512e1: r10 both
122 10 8b6bad1512e1: r10 both
123 11 a19bfa7e7328: r11 both
123 11 a19bfa7e7328: r11 both
124 $ hg outgoing $remote
124 $ hg outgoing $remote
125 comparing with http://localhost:$HGPORT/
125 comparing with http://localhost:$HGPORT/
126 no changes found
126 no changes found
127 [1]
127 [1]
128 $ hg push $remote
128 $ hg push $remote
129 pushing to http://localhost:$HGPORT/
129 pushing to http://localhost:$HGPORT/
130 no changes found
130 no changes found
131 $ hg pull $remote
131 $ hg pull $remote
132 pulling from http://localhost:$HGPORT/
132 pulling from http://localhost:$HGPORT/
133 requesting all changes
133 requesting all changes
134 adding changesets
134 adding changesets
135 adding manifests
135 adding manifests
136 adding file changes
136 adding file changes
137 added 12 changesets with 24 changes to 2 files
137 added 12 changesets with 24 changes to 2 files
138 (run 'hg update' to get a working copy)
138 (run 'hg update' to get a working copy)
139 $ hg incoming $remote
139 $ hg incoming $remote
140 comparing with http://localhost:$HGPORT/
140 comparing with http://localhost:$HGPORT/
141 searching for changes
141 searching for changes
142 no changes found
142 no changes found
143 [1]
143 [1]
144 $ cd ..
144 $ cd ..
145
145
146 Local is subset:
146 Local is subset:
147
147
148 $ hg clone main subset --rev name2 ; cd subset
148 $ hg clone main subset --rev name2 ; cd subset
149 adding changesets
149 adding changesets
150 adding manifests
150 adding manifests
151 adding file changes
151 adding file changes
152 added 6 changesets with 12 changes to 2 files
152 added 6 changesets with 12 changes to 2 files
153 updating to branch name2
153 updating to branch name2
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 $ hg incoming $remote
155 $ hg incoming $remote
156 comparing with http://localhost:$HGPORT/
156 comparing with http://localhost:$HGPORT/
157 searching for changes
157 searching for changes
158 6 a7892891da29: r2 name1
158 6 a7892891da29: r2 name1
159 7 2c8d5d5ec612: r3 name1
159 7 2c8d5d5ec612: r3 name1
160 8 e71dbbc70e03: r4 name1
160 8 e71dbbc70e03: r4 name1
161 9 025829e08038: r9 both
161 9 025829e08038: r9 both
162 10 8b6bad1512e1: r10 both
162 10 8b6bad1512e1: r10 both
163 11 a19bfa7e7328: r11 both
163 11 a19bfa7e7328: r11 both
164 $ hg outgoing $remote
164 $ hg outgoing $remote
165 comparing with http://localhost:$HGPORT/
165 comparing with http://localhost:$HGPORT/
166 searching for changes
166 searching for changes
167 no changes found
167 no changes found
168 [1]
168 [1]
169 $ hg push $remote
169 $ hg push $remote
170 pushing to http://localhost:$HGPORT/
170 pushing to http://localhost:$HGPORT/
171 searching for changes
171 searching for changes
172 no changes found
172 no changes found
173 $ hg pull $remote
173 $ hg pull $remote
174 pulling from http://localhost:$HGPORT/
174 pulling from http://localhost:$HGPORT/
175 searching for changes
175 searching for changes
176 adding changesets
176 adding changesets
177 adding manifests
177 adding manifests
178 adding file changes
178 adding file changes
179 added 6 changesets with 12 changes to 2 files
179 added 6 changesets with 12 changes to 2 files
180 (run 'hg update' to get a working copy)
180 (run 'hg update' to get a working copy)
181 $ hg incoming $remote
181 $ hg incoming $remote
182 comparing with http://localhost:$HGPORT/
182 comparing with http://localhost:$HGPORT/
183 searching for changes
183 searching for changes
184 no changes found
184 no changes found
185 [1]
185 [1]
186 $ cd ..
186 $ cd ..
187
187
188 Remote is empty:
188 Remote is empty:
189
189
190 $ stop ; start empty2
190 $ tstop ; tstart empty2
191 $ cd main
191 $ cd main
192 $ hg incoming $remote
192 $ hg incoming $remote
193 comparing with http://localhost:$HGPORT/
193 comparing with http://localhost:$HGPORT/
194 searching for changes
194 searching for changes
195 no changes found
195 no changes found
196 [1]
196 [1]
197 $ hg outgoing $remote
197 $ hg outgoing $remote
198 comparing with http://localhost:$HGPORT/
198 comparing with http://localhost:$HGPORT/
199 searching for changes
199 searching for changes
200 0 d57206cc072a: r0
200 0 d57206cc072a: r0
201 1 0019a3b924fd: r1
201 1 0019a3b924fd: r1
202 2 a7892891da29: r2 name1
202 2 a7892891da29: r2 name1
203 3 2c8d5d5ec612: r3 name1
203 3 2c8d5d5ec612: r3 name1
204 4 e71dbbc70e03: r4 name1
204 4 e71dbbc70e03: r4 name1
205 5 70314b29987d: r5 name2
205 5 70314b29987d: r5 name2
206 6 6c6f5d5f3c11: r6 name2
206 6 6c6f5d5f3c11: r6 name2
207 7 b6b4d315a2ac: r7 name2
207 7 b6b4d315a2ac: r7 name2
208 8 d8f638ac69e9: r8 name2
208 8 d8f638ac69e9: r8 name2
209 9 025829e08038: r9 both
209 9 025829e08038: r9 both
210 10 8b6bad1512e1: r10 both
210 10 8b6bad1512e1: r10 both
211 11 a19bfa7e7328: r11 both
211 11 a19bfa7e7328: r11 both
212 $ hg pull $remote
212 $ hg pull $remote
213 pulling from http://localhost:$HGPORT/
213 pulling from http://localhost:$HGPORT/
214 searching for changes
214 searching for changes
215 no changes found
215 no changes found
216 $ hg push $remote
216 $ hg push $remote
217 pushing to http://localhost:$HGPORT/
217 pushing to http://localhost:$HGPORT/
218 searching for changes
218 searching for changes
219 remote: adding changesets
219 remote: adding changesets
220 remote: adding manifests
220 remote: adding manifests
221 remote: adding file changes
221 remote: adding file changes
222 remote: added 12 changesets with 24 changes to 2 files
222 remote: added 12 changesets with 24 changes to 2 files
223 $ hg outgoing $remote
223 $ hg outgoing $remote
224 comparing with http://localhost:$HGPORT/
224 comparing with http://localhost:$HGPORT/
225 searching for changes
225 searching for changes
226 no changes found
226 no changes found
227 [1]
227 [1]
228 $ cd ..
228 $ cd ..
229
229
230 Local is superset:
230 Local is superset:
231
231
232 $ stop
232 $ tstop
233 $ hg clone main subset2 --rev name2
233 $ hg clone main subset2 --rev name2
234 adding changesets
234 adding changesets
235 adding manifests
235 adding manifests
236 adding file changes
236 adding file changes
237 added 6 changesets with 12 changes to 2 files
237 added 6 changesets with 12 changes to 2 files
238 updating to branch name2
238 updating to branch name2
239 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
240 $ start subset2
240 $ tstart subset2
241 $ cd main
241 $ cd main
242 $ hg incoming $remote
242 $ hg incoming $remote
243 comparing with http://localhost:$HGPORT/
243 comparing with http://localhost:$HGPORT/
244 searching for changes
244 searching for changes
245 no changes found
245 no changes found
246 [1]
246 [1]
247 $ hg outgoing $remote
247 $ hg outgoing $remote
248 comparing with http://localhost:$HGPORT/
248 comparing with http://localhost:$HGPORT/
249 searching for changes
249 searching for changes
250 2 a7892891da29: r2 name1
250 2 a7892891da29: r2 name1
251 3 2c8d5d5ec612: r3 name1
251 3 2c8d5d5ec612: r3 name1
252 4 e71dbbc70e03: r4 name1
252 4 e71dbbc70e03: r4 name1
253 9 025829e08038: r9 both
253 9 025829e08038: r9 both
254 10 8b6bad1512e1: r10 both
254 10 8b6bad1512e1: r10 both
255 11 a19bfa7e7328: r11 both
255 11 a19bfa7e7328: r11 both
256 $ hg pull $remote
256 $ hg pull $remote
257 pulling from http://localhost:$HGPORT/
257 pulling from http://localhost:$HGPORT/
258 searching for changes
258 searching for changes
259 no changes found
259 no changes found
260 $ hg push $remote
260 $ hg push $remote
261 pushing to http://localhost:$HGPORT/
261 pushing to http://localhost:$HGPORT/
262 searching for changes
262 searching for changes
263 abort: push creates new remote branches: both, name1!
263 abort: push creates new remote branches: both, name1!
264 (use 'hg push --new-branch' to create new remote branches)
264 (use 'hg push --new-branch' to create new remote branches)
265 [255]
265 [255]
266 $ hg push $remote --new-branch
266 $ hg push $remote --new-branch
267 pushing to http://localhost:$HGPORT/
267 pushing to http://localhost:$HGPORT/
268 searching for changes
268 searching for changes
269 remote: adding changesets
269 remote: adding changesets
270 remote: adding manifests
270 remote: adding manifests
271 remote: adding file changes
271 remote: adding file changes
272 remote: added 6 changesets with 12 changes to 2 files
272 remote: added 6 changesets with 12 changes to 2 files
273 $ hg outgoing $remote
273 $ hg outgoing $remote
274 comparing with http://localhost:$HGPORT/
274 comparing with http://localhost:$HGPORT/
275 searching for changes
275 searching for changes
276 no changes found
276 no changes found
277 [1]
277 [1]
278 $ cd ..
278 $ cd ..
279
279
280 Partial pull:
280 Partial pull:
281
281
282 $ stop ; start main
282 $ tstop ; tstart main
283 $ hg clone $remote partial --rev name2
283 $ hg clone $remote partial --rev name2
284 adding changesets
284 adding changesets
285 adding manifests
285 adding manifests
286 adding file changes
286 adding file changes
287 added 6 changesets with 12 changes to 2 files
287 added 6 changesets with 12 changes to 2 files
288 updating to branch name2
288 updating to branch name2
289 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 $ cd partial
290 $ cd partial
291 $ hg incoming $remote
291 $ hg incoming $remote
292 comparing with http://localhost:$HGPORT/
292 comparing with http://localhost:$HGPORT/
293 searching for changes
293 searching for changes
294 6 a7892891da29: r2 name1
294 6 a7892891da29: r2 name1
295 7 2c8d5d5ec612: r3 name1
295 7 2c8d5d5ec612: r3 name1
296 8 e71dbbc70e03: r4 name1
296 8 e71dbbc70e03: r4 name1
297 9 025829e08038: r9 both
297 9 025829e08038: r9 both
298 10 8b6bad1512e1: r10 both
298 10 8b6bad1512e1: r10 both
299 11 a19bfa7e7328: r11 both
299 11 a19bfa7e7328: r11 both
300 $ hg incoming $remote --rev name1
300 $ hg incoming $remote --rev name1
301 comparing with http://localhost:$HGPORT/
301 comparing with http://localhost:$HGPORT/
302 searching for changes
302 searching for changes
303 6 a7892891da29: r2 name1
303 6 a7892891da29: r2 name1
304 7 2c8d5d5ec612: r3 name1
304 7 2c8d5d5ec612: r3 name1
305 8 e71dbbc70e03: r4 name1
305 8 e71dbbc70e03: r4 name1
306 $ hg pull $remote --rev name1
306 $ hg pull $remote --rev name1
307 pulling from http://localhost:$HGPORT/
307 pulling from http://localhost:$HGPORT/
308 searching for changes
308 searching for changes
309 adding changesets
309 adding changesets
310 adding manifests
310 adding manifests
311 adding file changes
311 adding file changes
312 added 3 changesets with 6 changes to 2 files (+1 heads)
312 added 3 changesets with 6 changes to 2 files (+1 heads)
313 (run 'hg heads' to see heads)
313 (run 'hg heads' to see heads)
314 $ hg incoming $remote
314 $ hg incoming $remote
315 comparing with http://localhost:$HGPORT/
315 comparing with http://localhost:$HGPORT/
316 searching for changes
316 searching for changes
317 9 025829e08038: r9 both
317 9 025829e08038: r9 both
318 10 8b6bad1512e1: r10 both
318 10 8b6bad1512e1: r10 both
319 11 a19bfa7e7328: r11 both
319 11 a19bfa7e7328: r11 both
320 $ cd ..
320 $ cd ..
321
321
322 Both have new stuff in new named branches:
322 Both have new stuff in new named branches:
323
323
324 $ stop
324 $ tstop
325 $ hg clone main repo1a --rev name1 -q
325 $ hg clone main repo1a --rev name1 -q
326 $ hg clone repo1a repo1b -q
326 $ hg clone repo1a repo1b -q
327 $ hg clone main repo2a --rev name2 -q
327 $ hg clone main repo2a --rev name2 -q
328 $ hg clone repo2a repo2b -q
328 $ hg clone repo2a repo2b -q
329 $ start repo1a
329 $ tstart repo1a
330
330
331 $ cd repo2a
331 $ cd repo2a
332 $ hg incoming $remote
332 $ hg incoming $remote
333 comparing with http://localhost:$HGPORT/
333 comparing with http://localhost:$HGPORT/
334 searching for changes
334 searching for changes
335 6 a7892891da29: r2 name1
335 6 a7892891da29: r2 name1
336 7 2c8d5d5ec612: r3 name1
336 7 2c8d5d5ec612: r3 name1
337 8 e71dbbc70e03: r4 name1
337 8 e71dbbc70e03: r4 name1
338 $ hg outgoing $remote
338 $ hg outgoing $remote
339 comparing with http://localhost:$HGPORT/
339 comparing with http://localhost:$HGPORT/
340 searching for changes
340 searching for changes
341 2 70314b29987d: r5 name2
341 2 70314b29987d: r5 name2
342 3 6c6f5d5f3c11: r6 name2
342 3 6c6f5d5f3c11: r6 name2
343 4 b6b4d315a2ac: r7 name2
343 4 b6b4d315a2ac: r7 name2
344 5 d8f638ac69e9: r8 name2
344 5 d8f638ac69e9: r8 name2
345 $ hg push $remote --new-branch
345 $ hg push $remote --new-branch
346 pushing to http://localhost:$HGPORT/
346 pushing to http://localhost:$HGPORT/
347 searching for changes
347 searching for changes
348 remote: adding changesets
348 remote: adding changesets
349 remote: adding manifests
349 remote: adding manifests
350 remote: adding file changes
350 remote: adding file changes
351 remote: added 4 changesets with 8 changes to 2 files (+1 heads)
351 remote: added 4 changesets with 8 changes to 2 files (+1 heads)
352 $ hg pull $remote
352 $ hg pull $remote
353 pulling from http://localhost:$HGPORT/
353 pulling from http://localhost:$HGPORT/
354 searching for changes
354 searching for changes
355 adding changesets
355 adding changesets
356 adding manifests
356 adding manifests
357 adding file changes
357 adding file changes
358 added 3 changesets with 6 changes to 2 files (+1 heads)
358 added 3 changesets with 6 changes to 2 files (+1 heads)
359 (run 'hg heads' to see heads)
359 (run 'hg heads' to see heads)
360 $ hg incoming $remote
360 $ hg incoming $remote
361 comparing with http://localhost:$HGPORT/
361 comparing with http://localhost:$HGPORT/
362 searching for changes
362 searching for changes
363 no changes found
363 no changes found
364 [1]
364 [1]
365 $ hg outgoing $remote
365 $ hg outgoing $remote
366 comparing with http://localhost:$HGPORT/
366 comparing with http://localhost:$HGPORT/
367 searching for changes
367 searching for changes
368 no changes found
368 no changes found
369 [1]
369 [1]
370 $ cd ..
370 $ cd ..
371
371
372 $ stop ; start repo1b
372 $ tstop ; tstart repo1b
373 $ cd repo2b
373 $ cd repo2b
374 $ hg incoming $remote
374 $ hg incoming $remote
375 comparing with http://localhost:$HGPORT/
375 comparing with http://localhost:$HGPORT/
376 searching for changes
376 searching for changes
377 6 a7892891da29: r2 name1
377 6 a7892891da29: r2 name1
378 7 2c8d5d5ec612: r3 name1
378 7 2c8d5d5ec612: r3 name1
379 8 e71dbbc70e03: r4 name1
379 8 e71dbbc70e03: r4 name1
380 $ hg outgoing $remote
380 $ hg outgoing $remote
381 comparing with http://localhost:$HGPORT/
381 comparing with http://localhost:$HGPORT/
382 searching for changes
382 searching for changes
383 2 70314b29987d: r5 name2
383 2 70314b29987d: r5 name2
384 3 6c6f5d5f3c11: r6 name2
384 3 6c6f5d5f3c11: r6 name2
385 4 b6b4d315a2ac: r7 name2
385 4 b6b4d315a2ac: r7 name2
386 5 d8f638ac69e9: r8 name2
386 5 d8f638ac69e9: r8 name2
387 $ hg pull $remote
387 $ hg pull $remote
388 pulling from http://localhost:$HGPORT/
388 pulling from http://localhost:$HGPORT/
389 searching for changes
389 searching for changes
390 adding changesets
390 adding changesets
391 adding manifests
391 adding manifests
392 adding file changes
392 adding file changes
393 added 3 changesets with 6 changes to 2 files (+1 heads)
393 added 3 changesets with 6 changes to 2 files (+1 heads)
394 (run 'hg heads' to see heads)
394 (run 'hg heads' to see heads)
395 $ hg push $remote --new-branch
395 $ hg push $remote --new-branch
396 pushing to http://localhost:$HGPORT/
396 pushing to http://localhost:$HGPORT/
397 searching for changes
397 searching for changes
398 remote: adding changesets
398 remote: adding changesets
399 remote: adding manifests
399 remote: adding manifests
400 remote: adding file changes
400 remote: adding file changes
401 remote: added 4 changesets with 8 changes to 2 files (+1 heads)
401 remote: added 4 changesets with 8 changes to 2 files (+1 heads)
402 $ hg incoming $remote
402 $ hg incoming $remote
403 comparing with http://localhost:$HGPORT/
403 comparing with http://localhost:$HGPORT/
404 searching for changes
404 searching for changes
405 no changes found
405 no changes found
406 [1]
406 [1]
407 $ hg outgoing $remote
407 $ hg outgoing $remote
408 comparing with http://localhost:$HGPORT/
408 comparing with http://localhost:$HGPORT/
409 searching for changes
409 searching for changes
410 no changes found
410 no changes found
411 [1]
411 [1]
412 $ cd ..
412 $ cd ..
413
413
414 Both have new stuff in existing named branches:
414 Both have new stuff in existing named branches:
415
415
416 $ stop
416 $ tstop
417 $ rm -r repo1a repo1b repo2a repo2b
417 $ rm -r repo1a repo1b repo2a repo2b
418 $ hg clone main repo1a --rev 3 --rev 8 -q
418 $ hg clone main repo1a --rev 3 --rev 8 -q
419 $ hg clone repo1a repo1b -q
419 $ hg clone repo1a repo1b -q
420 $ hg clone main repo2a --rev 4 --rev 7 -q
420 $ hg clone main repo2a --rev 4 --rev 7 -q
421 $ hg clone repo2a repo2b -q
421 $ hg clone repo2a repo2b -q
422 $ start repo1a
422 $ tstart repo1a
423
423
424 $ cd repo2a
424 $ cd repo2a
425 $ hg incoming $remote
425 $ hg incoming $remote
426 comparing with http://localhost:$HGPORT/
426 comparing with http://localhost:$HGPORT/
427 searching for changes
427 searching for changes
428 8 d8f638ac69e9: r8 name2
428 8 d8f638ac69e9: r8 name2
429 $ hg outgoing $remote
429 $ hg outgoing $remote
430 comparing with http://localhost:$HGPORT/
430 comparing with http://localhost:$HGPORT/
431 searching for changes
431 searching for changes
432 4 e71dbbc70e03: r4 name1
432 4 e71dbbc70e03: r4 name1
433 $ hg push $remote --new-branch
433 $ hg push $remote --new-branch
434 pushing to http://localhost:$HGPORT/
434 pushing to http://localhost:$HGPORT/
435 searching for changes
435 searching for changes
436 remote: adding changesets
436 remote: adding changesets
437 remote: adding manifests
437 remote: adding manifests
438 remote: adding file changes
438 remote: adding file changes
439 remote: added 1 changesets with 2 changes to 2 files
439 remote: added 1 changesets with 2 changes to 2 files
440 $ hg pull $remote
440 $ hg pull $remote
441 pulling from http://localhost:$HGPORT/
441 pulling from http://localhost:$HGPORT/
442 searching for changes
442 searching for changes
443 adding changesets
443 adding changesets
444 adding manifests
444 adding manifests
445 adding file changes
445 adding file changes
446 added 1 changesets with 2 changes to 2 files
446 added 1 changesets with 2 changes to 2 files
447 (run 'hg update' to get a working copy)
447 (run 'hg update' to get a working copy)
448 $ hg incoming $remote
448 $ hg incoming $remote
449 comparing with http://localhost:$HGPORT/
449 comparing with http://localhost:$HGPORT/
450 searching for changes
450 searching for changes
451 no changes found
451 no changes found
452 [1]
452 [1]
453 $ hg outgoing $remote
453 $ hg outgoing $remote
454 comparing with http://localhost:$HGPORT/
454 comparing with http://localhost:$HGPORT/
455 searching for changes
455 searching for changes
456 no changes found
456 no changes found
457 [1]
457 [1]
458 $ cd ..
458 $ cd ..
459
459
460 $ stop ; start repo1b
460 $ tstop ; tstart repo1b
461 $ cd repo2b
461 $ cd repo2b
462 $ hg incoming $remote
462 $ hg incoming $remote
463 comparing with http://localhost:$HGPORT/
463 comparing with http://localhost:$HGPORT/
464 searching for changes
464 searching for changes
465 8 d8f638ac69e9: r8 name2
465 8 d8f638ac69e9: r8 name2
466 $ hg outgoing $remote
466 $ hg outgoing $remote
467 comparing with http://localhost:$HGPORT/
467 comparing with http://localhost:$HGPORT/
468 searching for changes
468 searching for changes
469 4 e71dbbc70e03: r4 name1
469 4 e71dbbc70e03: r4 name1
470 $ hg pull $remote
470 $ hg pull $remote
471 pulling from http://localhost:$HGPORT/
471 pulling from http://localhost:$HGPORT/
472 searching for changes
472 searching for changes
473 adding changesets
473 adding changesets
474 adding manifests
474 adding manifests
475 adding file changes
475 adding file changes
476 added 1 changesets with 2 changes to 2 files
476 added 1 changesets with 2 changes to 2 files
477 (run 'hg update' to get a working copy)
477 (run 'hg update' to get a working copy)
478 $ hg push $remote --new-branch
478 $ hg push $remote --new-branch
479 pushing to http://localhost:$HGPORT/
479 pushing to http://localhost:$HGPORT/
480 searching for changes
480 searching for changes
481 remote: adding changesets
481 remote: adding changesets
482 remote: adding manifests
482 remote: adding manifests
483 remote: adding file changes
483 remote: adding file changes
484 remote: added 1 changesets with 2 changes to 2 files
484 remote: added 1 changesets with 2 changes to 2 files
485 $ hg incoming $remote
485 $ hg incoming $remote
486 comparing with http://localhost:$HGPORT/
486 comparing with http://localhost:$HGPORT/
487 searching for changes
487 searching for changes
488 no changes found
488 no changes found
489 [1]
489 [1]
490 $ hg outgoing $remote
490 $ hg outgoing $remote
491 comparing with http://localhost:$HGPORT/
491 comparing with http://localhost:$HGPORT/
492 searching for changes
492 searching for changes
493 no changes found
493 no changes found
494 [1]
494 [1]
495 $ cd ..
495 $ cd ..
496
496
497 $ stop
497 $ tstop
498
498
General Comments 0
You need to be logged in to leave comments. Login now