##// END OF EJS Templates
tests: don't use alias...
Mads Kiilerich -
r16013:2a1d9763 stable
parent child Browse files
Show More
@@ -1,429 +1,430
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"[^\s\nx]", "o", t)
16 t = re.sub(r"[^\s\nx]", "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\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"),
47 (r'\W\$?\(\([^\)\n]*\)\)', "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[^|]*$\n(?!.*\(re\))', "filter wc output"),
53 (r'(^| )wc[^|]*$\n(?!.*\(re\))', "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'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
55 (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
56 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
56 (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
57 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
57 (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"),
58 (r'printf.*\\x', "don't use printf \\x, use Python"),
58 (r'printf.*\\x', "don't use printf \\x, use Python"),
59 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
59 (r'\$\(.*\)', "don't use $(expr), use `expr`"),
60 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
60 (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
61 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
61 (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w',
62 "use egrep for extended grep syntax"),
62 "use egrep for extended grep syntax"),
63 (r'/bin/', "don't use explicit paths for tools"),
63 (r'/bin/', "don't use explicit paths for tools"),
64 (r'\$PWD', "don't use $PWD, use `pwd`"),
64 (r'\$PWD', "don't use $PWD, use `pwd`"),
65 (r'[^\n]\Z', "no trailing newline"),
65 (r'[^\n]\Z', "no trailing newline"),
66 (r'export.*=', "don't export and assign at once"),
66 (r'export.*=', "don't export and assign at once"),
67 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\\^', "^ must be quoted"),
67 (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\\^', "^ must be quoted"),
68 (r'^source\b', "don't use 'source', use '.'"),
68 (r'^source\b', "don't use 'source', use '.'"),
69 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
69 (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
70 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
70 (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
71 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
71 (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"),
72 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
72 (r'^stop\(\)', "don't use 'stop' as a shell function name"),
73 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
73 (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
74 (r'^alias\b.*=', "don't use alias, use a function"),
74 ],
75 ],
75 # warnings
76 # warnings
76 []
77 []
77 ]
78 ]
78
79
79 testfilters = [
80 testfilters = [
80 (r"( *)(#([^\n]*\S)?)", repcomment),
81 (r"( *)(#([^\n]*\S)?)", repcomment),
81 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
82 (r"<<(\S+)((.|\n)*?\n\1)", rephere),
82 ]
83 ]
83
84
84 uprefix = r"^ \$ "
85 uprefix = r"^ \$ "
85 uprefixc = r"^ > "
86 uprefixc = r"^ > "
86 utestpats = [
87 utestpats = [
87 [
88 [
88 (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"),
89 (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"),
89 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
90 (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"),
90 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
91 (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"),
91 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
92 (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"),
92 (uprefix + r'.*\|\| echo.*(fail|error)',
93 (uprefix + r'.*\|\| echo.*(fail|error)',
93 "explicit exit code checks unnecessary"),
94 "explicit exit code checks unnecessary"),
94 (uprefix + r'set -e', "don't use set -e"),
95 (uprefix + r'set -e', "don't use set -e"),
95 (uprefixc + r'( *)\t', "don't use tabs to indent"),
96 (uprefixc + r'( *)\t', "don't use tabs to indent"),
96 ],
97 ],
97 # warnings
98 # warnings
98 []
99 []
99 ]
100 ]
100
101
101 for i in [0, 1]:
102 for i in [0, 1]:
102 for p, m in testpats[i]:
103 for p, m in testpats[i]:
103 if p.startswith(r'^'):
104 if p.startswith(r'^'):
104 p = uprefix + p[1:]
105 p = uprefix + p[1:]
105 else:
106 else:
106 p = uprefix + ".*" + p
107 p = uprefix + ".*" + p
107 utestpats[i].append((p, m))
108 utestpats[i].append((p, m))
108
109
109 utestfilters = [
110 utestfilters = [
110 (r"( *)(#([^\n]*\S)?)", repcomment),
111 (r"( *)(#([^\n]*\S)?)", repcomment),
111 ]
112 ]
112
113
113 pypats = [
114 pypats = [
114 [
115 [
115 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
116 (r'^\s*def\s*\w+\s*\(.*,\s*\(',
116 "tuple parameter unpacking not available in Python 3+"),
117 "tuple parameter unpacking not available in Python 3+"),
117 (r'lambda\s*\(.*,.*\)',
118 (r'lambda\s*\(.*,.*\)',
118 "tuple parameter unpacking not available in Python 3+"),
119 "tuple parameter unpacking not available in Python 3+"),
119 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
120 (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"),
120 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
121 (r'\breduce\s*\(.*', "reduce is not available in Python 3+"),
121 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
122 (r'\.has_key\b', "dict.has_key is not available in Python 3+"),
122 (r'^\s*\t', "don't use tabs"),
123 (r'^\s*\t', "don't use tabs"),
123 (r'\S;\s*\n', "semicolon"),
124 (r'\S;\s*\n', "semicolon"),
124 (r'\w,\w', "missing whitespace after ,"),
125 (r'\w,\w', "missing whitespace after ,"),
125 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
126 (r'\w[+/*\-<>]\w', "missing whitespace in expression"),
126 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
127 (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"),
127 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
128 (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n'
128 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
129 r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'),
129 (r'.{85}', "line too long"),
130 (r'.{85}', "line too long"),
130 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
131 (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'),
131 (r'[^\n]\Z', "no trailing newline"),
132 (r'[^\n]\Z', "no trailing newline"),
132 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
133 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
133 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
134 # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
134 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
135 (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ',
135 "don't use camelcase in identifiers"),
136 "don't use camelcase in identifiers"),
136 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
137 (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+',
137 "linebreak after :"),
138 "linebreak after :"),
138 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
139 (r'class\s[^( \n]+:', "old-style class, use class foo(object)"),
139 (r'class\s[^( \n]+\(\):',
140 (r'class\s[^( \n]+\(\):',
140 "class foo() not available in Python 2.4, use class foo(object)"),
141 "class foo() not available in Python 2.4, use class foo(object)"),
141 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
142 (r'\b(%s)\(' % '|'.join(keyword.kwlist),
142 "Python keyword is not a function"),
143 "Python keyword is not a function"),
143 (r',]', "unneeded trailing ',' in list"),
144 (r',]', "unneeded trailing ',' in list"),
144 # (r'class\s[A-Z][^\(]*\((?!Exception)',
145 # (r'class\s[A-Z][^\(]*\((?!Exception)',
145 # "don't capitalize non-exception classes"),
146 # "don't capitalize non-exception classes"),
146 # (r'in range\(', "use xrange"),
147 # (r'in range\(', "use xrange"),
147 # (r'^\s*print\s+', "avoid using print in core and extensions"),
148 # (r'^\s*print\s+', "avoid using print in core and extensions"),
148 (r'[\x80-\xff]', "non-ASCII character literal"),
149 (r'[\x80-\xff]', "non-ASCII character literal"),
149 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
150 (r'("\')\.format\(', "str.format() not available in Python 2.4"),
150 (r'^\s*with\s+', "with not available in Python 2.4"),
151 (r'^\s*with\s+', "with not available in Python 2.4"),
151 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
152 (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"),
152 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
153 (r'^\s*except.* as .*:', "except as not available in Python 2.4"),
153 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
154 (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"),
154 (r'(?<!def)\s+(any|all|format)\(',
155 (r'(?<!def)\s+(any|all|format)\(',
155 "any/all/format not available in Python 2.4"),
156 "any/all/format not available in Python 2.4"),
156 (r'(?<!def)\s+(callable)\(',
157 (r'(?<!def)\s+(callable)\(',
157 "callable not available in Python 3, use getattr(f, '__call__', None)"),
158 "callable not available in Python 3, use getattr(f, '__call__', None)"),
158 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
159 (r'if\s.*\selse', "if ... else form not available in Python 2.4"),
159 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
160 (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist),
160 "gratuitous whitespace after Python keyword"),
161 "gratuitous whitespace after Python keyword"),
161 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
162 (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"),
162 # (r'\s\s=', "gratuitous whitespace before ="),
163 # (r'\s\s=', "gratuitous whitespace before ="),
163 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
164 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
164 "missing whitespace around operator"),
165 "missing whitespace around operator"),
165 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
166 (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s',
166 "missing whitespace around operator"),
167 "missing whitespace around operator"),
167 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
168 (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S',
168 "missing whitespace around operator"),
169 "missing whitespace around operator"),
169 (r'[^+=*/!<>&| -](\s=|=\s)[^= ]',
170 (r'[^+=*/!<>&| -](\s=|=\s)[^= ]',
170 "wrong whitespace around ="),
171 "wrong whitespace around ="),
171 (r'raise Exception', "don't raise generic exceptions"),
172 (r'raise Exception', "don't raise generic exceptions"),
172 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
173 (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
173 (r' [=!]=\s+(True|False|None)',
174 (r' [=!]=\s+(True|False|None)',
174 "comparison with singleton, use 'is' or 'is not' instead"),
175 "comparison with singleton, use 'is' or 'is not' instead"),
175 (r'^\s*(while|if) [01]:',
176 (r'^\s*(while|if) [01]:',
176 "use True/False for constant Boolean expression"),
177 "use True/False for constant Boolean expression"),
177 (r'(?<!def)\s+hasattr',
178 (r'(?<!def)\s+hasattr',
178 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
179 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'),
179 (r'opener\([^)]*\).read\(',
180 (r'opener\([^)]*\).read\(',
180 "use opener.read() instead"),
181 "use opener.read() instead"),
181 (r'BaseException', 'not in Py2.4, use Exception'),
182 (r'BaseException', 'not in Py2.4, use Exception'),
182 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),
183 (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'),
183 (r'opener\([^)]*\).write\(',
184 (r'opener\([^)]*\).write\(',
184 "use opener.write() instead"),
185 "use opener.write() instead"),
185 (r'[\s\(](open|file)\([^)]*\)\.read\(',
186 (r'[\s\(](open|file)\([^)]*\)\.read\(',
186 "use util.readfile() instead"),
187 "use util.readfile() instead"),
187 (r'[\s\(](open|file)\([^)]*\)\.write\(',
188 (r'[\s\(](open|file)\([^)]*\)\.write\(',
188 "use util.readfile() instead"),
189 "use util.readfile() instead"),
189 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
190 (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
190 "always assign an opened file to a variable, and close it afterwards"),
191 "always assign an opened file to a variable, and close it afterwards"),
191 (r'[\s\(](open|file)\([^)]*\)\.',
192 (r'[\s\(](open|file)\([^)]*\)\.',
192 "always assign an opened file to a variable, and close it afterwards"),
193 "always assign an opened file to a variable, and close it afterwards"),
193 (r'(?i)descendent', "the proper spelling is descendAnt"),
194 (r'(?i)descendent', "the proper spelling is descendAnt"),
194 (r'\.debug\(\_', "don't mark debug messages for translation"),
195 (r'\.debug\(\_', "don't mark debug messages for translation"),
195 ],
196 ],
196 # warnings
197 # warnings
197 [
198 [
198 (r'.{81}', "warning: line over 80 characters"),
199 (r'.{81}', "warning: line over 80 characters"),
199 (r'^\s*except:$', "warning: naked except clause"),
200 (r'^\s*except:$', "warning: naked except clause"),
200 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
201 (r'ui\.(status|progress|write|note|warn)\([\'\"]x',
201 "warning: unwrapped ui message"),
202 "warning: unwrapped ui message"),
202 ]
203 ]
203 ]
204 ]
204
205
205 pyfilters = [
206 pyfilters = [
206 (r"""(?msx)(?P<comment>\#.*?$)|
207 (r"""(?msx)(?P<comment>\#.*?$)|
207 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
208 ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!")))
208 (?P<text>(([^\\]|\\.)*?))
209 (?P<text>(([^\\]|\\.)*?))
209 (?P=quote))""", reppython),
210 (?P=quote))""", reppython),
210 ]
211 ]
211
212
212 cpats = [
213 cpats = [
213 [
214 [
214 (r'//', "don't use //-style comments"),
215 (r'//', "don't use //-style comments"),
215 (r'^ ', "don't use spaces to indent"),
216 (r'^ ', "don't use spaces to indent"),
216 (r'\S\t', "don't use tabs except for indent"),
217 (r'\S\t', "don't use tabs except for indent"),
217 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
218 (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
218 (r'.{85}', "line too long"),
219 (r'.{85}', "line too long"),
219 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
220 (r'(while|if|do|for)\(', "use space after while/if/do/for"),
220 (r'return\(', "return is not a function"),
221 (r'return\(', "return is not a function"),
221 (r' ;', "no space before ;"),
222 (r' ;', "no space before ;"),
222 (r'\w+\* \w+', "use int *foo, not int* foo"),
223 (r'\w+\* \w+', "use int *foo, not int* foo"),
223 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
224 (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"),
224 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
225 (r'\S+ (\+\+|--)', "use foo++, not foo ++"),
225 (r'\w,\w', "missing whitespace after ,"),
226 (r'\w,\w', "missing whitespace after ,"),
226 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
227 (r'^[^#]\w[+/*]\w', "missing whitespace in expression"),
227 (r'^#\s+\w', "use #foo, not # foo"),
228 (r'^#\s+\w', "use #foo, not # foo"),
228 (r'[^\n]\Z', "no trailing newline"),
229 (r'[^\n]\Z', "no trailing newline"),
229 (r'^\s*#import\b', "use only #include in standard C code"),
230 (r'^\s*#import\b', "use only #include in standard C code"),
230 ],
231 ],
231 # warnings
232 # warnings
232 []
233 []
233 ]
234 ]
234
235
235 cfilters = [
236 cfilters = [
236 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
237 (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment),
237 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
238 (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote),
238 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
239 (r'''(#\s*include\s+<)([^>]+)>''', repinclude),
239 (r'(\()([^)]+\))', repcallspaces),
240 (r'(\()([^)]+\))', repcallspaces),
240 ]
241 ]
241
242
242 inutilpats = [
243 inutilpats = [
243 [
244 [
244 (r'\bui\.', "don't use ui in util"),
245 (r'\bui\.', "don't use ui in util"),
245 ],
246 ],
246 # warnings
247 # warnings
247 []
248 []
248 ]
249 ]
249
250
250 inrevlogpats = [
251 inrevlogpats = [
251 [
252 [
252 (r'\brepo\.', "don't use repo in revlog"),
253 (r'\brepo\.', "don't use repo in revlog"),
253 ],
254 ],
254 # warnings
255 # warnings
255 []
256 []
256 ]
257 ]
257
258
258 checks = [
259 checks = [
259 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
260 ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
260 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
261 ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
261 ('c', r'.*\.c$', cfilters, cpats),
262 ('c', r'.*\.c$', cfilters, cpats),
262 ('unified test', r'.*\.t$', utestfilters, utestpats),
263 ('unified test', r'.*\.t$', utestfilters, utestpats),
263 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
264 ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
264 inrevlogpats),
265 inrevlogpats),
265 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
266 ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
266 inutilpats),
267 inutilpats),
267 ]
268 ]
268
269
269 class norepeatlogger(object):
270 class norepeatlogger(object):
270 def __init__(self):
271 def __init__(self):
271 self._lastseen = None
272 self._lastseen = None
272
273
273 def log(self, fname, lineno, line, msg, blame):
274 def log(self, fname, lineno, line, msg, blame):
274 """print error related a to given line of a given file.
275 """print error related a to given line of a given file.
275
276
276 The faulty line will also be printed but only once in the case
277 The faulty line will also be printed but only once in the case
277 of multiple errors.
278 of multiple errors.
278
279
279 :fname: filename
280 :fname: filename
280 :lineno: line number
281 :lineno: line number
281 :line: actual content of the line
282 :line: actual content of the line
282 :msg: error message
283 :msg: error message
283 """
284 """
284 msgid = fname, lineno, line
285 msgid = fname, lineno, line
285 if msgid != self._lastseen:
286 if msgid != self._lastseen:
286 if blame:
287 if blame:
287 print "%s:%d (%s):" % (fname, lineno, blame)
288 print "%s:%d (%s):" % (fname, lineno, blame)
288 else:
289 else:
289 print "%s:%d:" % (fname, lineno)
290 print "%s:%d:" % (fname, lineno)
290 print " > %s" % line
291 print " > %s" % line
291 self._lastseen = msgid
292 self._lastseen = msgid
292 print " " + msg
293 print " " + msg
293
294
294 _defaultlogger = norepeatlogger()
295 _defaultlogger = norepeatlogger()
295
296
296 def getblame(f):
297 def getblame(f):
297 lines = []
298 lines = []
298 for l in os.popen('hg annotate -un %s' % f):
299 for l in os.popen('hg annotate -un %s' % f):
299 start, line = l.split(':', 1)
300 start, line = l.split(':', 1)
300 user, rev = start.split()
301 user, rev = start.split()
301 lines.append((line[1:-1], user, rev))
302 lines.append((line[1:-1], user, rev))
302 return lines
303 return lines
303
304
304 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
305 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
305 blame=False, debug=False, lineno=True):
306 blame=False, debug=False, lineno=True):
306 """checks style and portability of a given file
307 """checks style and portability of a given file
307
308
308 :f: filepath
309 :f: filepath
309 :logfunc: function used to report error
310 :logfunc: function used to report error
310 logfunc(filename, linenumber, linecontent, errormessage)
311 logfunc(filename, linenumber, linecontent, errormessage)
311 :maxerr: number of error to display before arborting.
312 :maxerr: number of error to display before arborting.
312 Set to false (default) to report all errors
313 Set to false (default) to report all errors
313
314
314 return True if no error is found, False otherwise.
315 return True if no error is found, False otherwise.
315 """
316 """
316 blamecache = None
317 blamecache = None
317 result = True
318 result = True
318 for name, match, filters, pats in checks:
319 for name, match, filters, pats in checks:
319 if debug:
320 if debug:
320 print name, f
321 print name, f
321 fc = 0
322 fc = 0
322 if not re.match(match, f):
323 if not re.match(match, f):
323 if debug:
324 if debug:
324 print "Skipping %s for %s it doesn't match %s" % (
325 print "Skipping %s for %s it doesn't match %s" % (
325 name, match, f)
326 name, match, f)
326 continue
327 continue
327 fp = open(f)
328 fp = open(f)
328 pre = post = fp.read()
329 pre = post = fp.read()
329 fp.close()
330 fp.close()
330 if "no-" + "check-code" in pre:
331 if "no-" + "check-code" in pre:
331 if debug:
332 if debug:
332 print "Skipping %s for %s it has no- and check-code" % (
333 print "Skipping %s for %s it has no- and check-code" % (
333 name, f)
334 name, f)
334 break
335 break
335 for p, r in filters:
336 for p, r in filters:
336 post = re.sub(p, r, post)
337 post = re.sub(p, r, post)
337 if warnings:
338 if warnings:
338 pats = pats[0] + pats[1]
339 pats = pats[0] + pats[1]
339 else:
340 else:
340 pats = pats[0]
341 pats = pats[0]
341 # print post # uncomment to show filtered version
342 # print post # uncomment to show filtered version
342
343
343 if debug:
344 if debug:
344 print "Checking %s for %s" % (name, f)
345 print "Checking %s for %s" % (name, f)
345
346
346 prelines = None
347 prelines = None
347 errors = []
348 errors = []
348 for p, msg in pats:
349 for p, msg in pats:
349 # fix-up regexes for multiline searches
350 # fix-up regexes for multiline searches
350 po = p
351 po = p
351 # \s doesn't match \n
352 # \s doesn't match \n
352 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
353 p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p)
353 # [^...] doesn't match newline
354 # [^...] doesn't match newline
354 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
355 p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p)
355
356
356 #print po, '=>', p
357 #print po, '=>', p
357
358
358 pos = 0
359 pos = 0
359 n = 0
360 n = 0
360 for m in re.finditer(p, post, re.MULTILINE):
361 for m in re.finditer(p, post, re.MULTILINE):
361 if prelines is None:
362 if prelines is None:
362 prelines = pre.splitlines()
363 prelines = pre.splitlines()
363 postlines = post.splitlines(True)
364 postlines = post.splitlines(True)
364
365
365 start = m.start()
366 start = m.start()
366 while n < len(postlines):
367 while n < len(postlines):
367 step = len(postlines[n])
368 step = len(postlines[n])
368 if pos + step > start:
369 if pos + step > start:
369 break
370 break
370 pos += step
371 pos += step
371 n += 1
372 n += 1
372 l = prelines[n]
373 l = prelines[n]
373
374
374 if "check-code" + "-ignore" in l:
375 if "check-code" + "-ignore" in l:
375 if debug:
376 if debug:
376 print "Skipping %s for %s:%s (check-code -ignore)" % (
377 print "Skipping %s for %s:%s (check-code -ignore)" % (
377 name, f, n)
378 name, f, n)
378 continue
379 continue
379 bd = ""
380 bd = ""
380 if blame:
381 if blame:
381 bd = 'working directory'
382 bd = 'working directory'
382 if not blamecache:
383 if not blamecache:
383 blamecache = getblame(f)
384 blamecache = getblame(f)
384 if n < len(blamecache):
385 if n < len(blamecache):
385 bl, bu, br = blamecache[n]
386 bl, bu, br = blamecache[n]
386 if bl == l:
387 if bl == l:
387 bd = '%s@%s' % (bu, br)
388 bd = '%s@%s' % (bu, br)
388 errors.append((f, lineno and n + 1, l, msg, bd))
389 errors.append((f, lineno and n + 1, l, msg, bd))
389 result = False
390 result = False
390
391
391 errors.sort()
392 errors.sort()
392 for e in errors:
393 for e in errors:
393 logfunc(*e)
394 logfunc(*e)
394 fc += 1
395 fc += 1
395 if maxerr and fc >= maxerr:
396 if maxerr and fc >= maxerr:
396 print " (too many errors, giving up)"
397 print " (too many errors, giving up)"
397 break
398 break
398
399
399 return result
400 return result
400
401
401 if __name__ == "__main__":
402 if __name__ == "__main__":
402 parser = optparse.OptionParser("%prog [options] [files]")
403 parser = optparse.OptionParser("%prog [options] [files]")
403 parser.add_option("-w", "--warnings", action="store_true",
404 parser.add_option("-w", "--warnings", action="store_true",
404 help="include warning-level checks")
405 help="include warning-level checks")
405 parser.add_option("-p", "--per-file", type="int",
406 parser.add_option("-p", "--per-file", type="int",
406 help="max warnings per file")
407 help="max warnings per file")
407 parser.add_option("-b", "--blame", action="store_true",
408 parser.add_option("-b", "--blame", action="store_true",
408 help="use annotate to generate blame info")
409 help="use annotate to generate blame info")
409 parser.add_option("", "--debug", action="store_true",
410 parser.add_option("", "--debug", action="store_true",
410 help="show debug information")
411 help="show debug information")
411 parser.add_option("", "--nolineno", action="store_false",
412 parser.add_option("", "--nolineno", action="store_false",
412 dest='lineno', help="don't show line numbers")
413 dest='lineno', help="don't show line numbers")
413
414
414 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
415 parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False,
415 lineno=True)
416 lineno=True)
416 (options, args) = parser.parse_args()
417 (options, args) = parser.parse_args()
417
418
418 if len(args) == 0:
419 if len(args) == 0:
419 check = glob.glob("*")
420 check = glob.glob("*")
420 else:
421 else:
421 check = args
422 check = args
422
423
423 ret = 0
424 ret = 0
424 for f in check:
425 for f in check:
425 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
426 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
426 blame=options.blame, debug=options.debug,
427 blame=options.blame, debug=options.debug,
427 lineno=options.lineno):
428 lineno=options.lineno):
428 ret = 1
429 ret = 1
429 sys.exit(ret)
430 sys.exit(ret)
@@ -1,1018 +1,1018
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
2 > [extensions]
3 > graphlog=
3 > graphlog=
4 > EOF
4 > EOF
5 $ alias hgph='hg log -G --template "{rev} {phase} {desc} - {node|short}\n"'
5 $ hgph() { hg log -G --template "{rev} {phase} {desc} - {node|short}\n" $*; }
6
6
7 $ mkcommit() {
7 $ mkcommit() {
8 > echo "$1" > "$1"
8 > echo "$1" > "$1"
9 > hg add "$1"
9 > hg add "$1"
10 > message="$1"
10 > message="$1"
11 > shift
11 > shift
12 > hg ci -m "$message" $*
12 > hg ci -m "$message" $*
13 > }
13 > }
14
14
15 $ hg init alpha
15 $ hg init alpha
16 $ cd alpha
16 $ cd alpha
17 $ mkcommit a-A
17 $ mkcommit a-A
18 $ mkcommit a-B
18 $ mkcommit a-B
19 $ mkcommit a-C
19 $ mkcommit a-C
20 $ mkcommit a-D
20 $ mkcommit a-D
21 $ hgph
21 $ hgph
22 @ 3 draft a-D - b555f63b6063
22 @ 3 draft a-D - b555f63b6063
23 |
23 |
24 o 2 draft a-C - 54acac6f23ab
24 o 2 draft a-C - 54acac6f23ab
25 |
25 |
26 o 1 draft a-B - 548a3d25dbf0
26 o 1 draft a-B - 548a3d25dbf0
27 |
27 |
28 o 0 draft a-A - 054250a37db4
28 o 0 draft a-A - 054250a37db4
29
29
30
30
31 $ hg init ../beta
31 $ hg init ../beta
32 $ hg push -r 1 ../beta
32 $ hg push -r 1 ../beta
33 pushing to ../beta
33 pushing to ../beta
34 searching for changes
34 searching for changes
35 adding changesets
35 adding changesets
36 adding manifests
36 adding manifests
37 adding file changes
37 adding file changes
38 added 2 changesets with 2 changes to 2 files
38 added 2 changesets with 2 changes to 2 files
39 $ hgph
39 $ hgph
40 @ 3 draft a-D - b555f63b6063
40 @ 3 draft a-D - b555f63b6063
41 |
41 |
42 o 2 draft a-C - 54acac6f23ab
42 o 2 draft a-C - 54acac6f23ab
43 |
43 |
44 o 1 public a-B - 548a3d25dbf0
44 o 1 public a-B - 548a3d25dbf0
45 |
45 |
46 o 0 public a-A - 054250a37db4
46 o 0 public a-A - 054250a37db4
47
47
48
48
49 $ cd ../beta
49 $ cd ../beta
50 $ hgph
50 $ hgph
51 o 1 public a-B - 548a3d25dbf0
51 o 1 public a-B - 548a3d25dbf0
52 |
52 |
53 o 0 public a-A - 054250a37db4
53 o 0 public a-A - 054250a37db4
54
54
55 $ hg up -q
55 $ hg up -q
56 $ mkcommit b-A
56 $ mkcommit b-A
57 $ hgph
57 $ hgph
58 @ 2 draft b-A - f54f1bb90ff3
58 @ 2 draft b-A - f54f1bb90ff3
59 |
59 |
60 o 1 public a-B - 548a3d25dbf0
60 o 1 public a-B - 548a3d25dbf0
61 |
61 |
62 o 0 public a-A - 054250a37db4
62 o 0 public a-A - 054250a37db4
63
63
64 $ hg pull ../alpha
64 $ hg pull ../alpha
65 pulling from ../alpha
65 pulling from ../alpha
66 searching for changes
66 searching for changes
67 adding changesets
67 adding changesets
68 adding manifests
68 adding manifests
69 adding file changes
69 adding file changes
70 added 2 changesets with 2 changes to 2 files (+1 heads)
70 added 2 changesets with 2 changes to 2 files (+1 heads)
71 (run 'hg heads' to see heads, 'hg merge' to merge)
71 (run 'hg heads' to see heads, 'hg merge' to merge)
72 $ hgph
72 $ hgph
73 o 4 public a-D - b555f63b6063
73 o 4 public a-D - b555f63b6063
74 |
74 |
75 o 3 public a-C - 54acac6f23ab
75 o 3 public a-C - 54acac6f23ab
76 |
76 |
77 | @ 2 draft b-A - f54f1bb90ff3
77 | @ 2 draft b-A - f54f1bb90ff3
78 |/
78 |/
79 o 1 public a-B - 548a3d25dbf0
79 o 1 public a-B - 548a3d25dbf0
80 |
80 |
81 o 0 public a-A - 054250a37db4
81 o 0 public a-A - 054250a37db4
82
82
83
83
84 pull did not updated ../alpha state.
84 pull did not updated ../alpha state.
85 push from alpha to beta should update phase even if nothing is transfered
85 push from alpha to beta should update phase even if nothing is transfered
86
86
87 $ cd ../alpha
87 $ cd ../alpha
88 $ hgph # not updated by remote pull
88 $ hgph # not updated by remote pull
89 @ 3 draft a-D - b555f63b6063
89 @ 3 draft a-D - b555f63b6063
90 |
90 |
91 o 2 draft a-C - 54acac6f23ab
91 o 2 draft a-C - 54acac6f23ab
92 |
92 |
93 o 1 public a-B - 548a3d25dbf0
93 o 1 public a-B - 548a3d25dbf0
94 |
94 |
95 o 0 public a-A - 054250a37db4
95 o 0 public a-A - 054250a37db4
96
96
97 $ hg push ../beta
97 $ hg push ../beta
98 pushing to ../beta
98 pushing to ../beta
99 searching for changes
99 searching for changes
100 no changes found
100 no changes found
101 $ hgph
101 $ hgph
102 @ 3 public a-D - b555f63b6063
102 @ 3 public a-D - b555f63b6063
103 |
103 |
104 o 2 public a-C - 54acac6f23ab
104 o 2 public a-C - 54acac6f23ab
105 |
105 |
106 o 1 public a-B - 548a3d25dbf0
106 o 1 public a-B - 548a3d25dbf0
107 |
107 |
108 o 0 public a-A - 054250a37db4
108 o 0 public a-A - 054250a37db4
109
109
110
110
111 update must update phase of common changeset too
111 update must update phase of common changeset too
112
112
113 $ hg pull ../beta # getting b-A
113 $ hg pull ../beta # getting b-A
114 pulling from ../beta
114 pulling from ../beta
115 searching for changes
115 searching for changes
116 adding changesets
116 adding changesets
117 adding manifests
117 adding manifests
118 adding file changes
118 adding file changes
119 added 1 changesets with 1 changes to 1 files (+1 heads)
119 added 1 changesets with 1 changes to 1 files (+1 heads)
120 (run 'hg heads' to see heads, 'hg merge' to merge)
120 (run 'hg heads' to see heads, 'hg merge' to merge)
121
121
122 $ cd ../beta
122 $ cd ../beta
123 $ hgph # not updated by remote pull
123 $ hgph # not updated by remote pull
124 o 4 public a-D - b555f63b6063
124 o 4 public a-D - b555f63b6063
125 |
125 |
126 o 3 public a-C - 54acac6f23ab
126 o 3 public a-C - 54acac6f23ab
127 |
127 |
128 | @ 2 draft b-A - f54f1bb90ff3
128 | @ 2 draft b-A - f54f1bb90ff3
129 |/
129 |/
130 o 1 public a-B - 548a3d25dbf0
130 o 1 public a-B - 548a3d25dbf0
131 |
131 |
132 o 0 public a-A - 054250a37db4
132 o 0 public a-A - 054250a37db4
133
133
134 $ hg pull ../alpha
134 $ hg pull ../alpha
135 pulling from ../alpha
135 pulling from ../alpha
136 searching for changes
136 searching for changes
137 no changes found
137 no changes found
138 $ hgph
138 $ hgph
139 o 4 public a-D - b555f63b6063
139 o 4 public a-D - b555f63b6063
140 |
140 |
141 o 3 public a-C - 54acac6f23ab
141 o 3 public a-C - 54acac6f23ab
142 |
142 |
143 | @ 2 public b-A - f54f1bb90ff3
143 | @ 2 public b-A - f54f1bb90ff3
144 |/
144 |/
145 o 1 public a-B - 548a3d25dbf0
145 o 1 public a-B - 548a3d25dbf0
146 |
146 |
147 o 0 public a-A - 054250a37db4
147 o 0 public a-A - 054250a37db4
148
148
149
149
150 Publish configuration option
150 Publish configuration option
151 ----------------------------
151 ----------------------------
152
152
153 Pull
153 Pull
154 ````
154 ````
155
155
156 changegroup are added without phase movement
156 changegroup are added without phase movement
157
157
158 $ hg bundle -a ../base.bundle
158 $ hg bundle -a ../base.bundle
159 5 changesets found
159 5 changesets found
160 $ cd ..
160 $ cd ..
161 $ hg init mu
161 $ hg init mu
162 $ cd mu
162 $ cd mu
163 $ cat > .hg/hgrc << EOF
163 $ cat > .hg/hgrc << EOF
164 > [phases]
164 > [phases]
165 > publish=0
165 > publish=0
166 > EOF
166 > EOF
167 $ hg unbundle ../base.bundle
167 $ hg unbundle ../base.bundle
168 adding changesets
168 adding changesets
169 adding manifests
169 adding manifests
170 adding file changes
170 adding file changes
171 added 5 changesets with 5 changes to 5 files (+1 heads)
171 added 5 changesets with 5 changes to 5 files (+1 heads)
172 (run 'hg heads' to see heads, 'hg merge' to merge)
172 (run 'hg heads' to see heads, 'hg merge' to merge)
173 $ hgph
173 $ hgph
174 o 4 draft a-D - b555f63b6063
174 o 4 draft a-D - b555f63b6063
175 |
175 |
176 o 3 draft a-C - 54acac6f23ab
176 o 3 draft a-C - 54acac6f23ab
177 |
177 |
178 | o 2 draft b-A - f54f1bb90ff3
178 | o 2 draft b-A - f54f1bb90ff3
179 |/
179 |/
180 o 1 draft a-B - 548a3d25dbf0
180 o 1 draft a-B - 548a3d25dbf0
181 |
181 |
182 o 0 draft a-A - 054250a37db4
182 o 0 draft a-A - 054250a37db4
183
183
184 $ cd ..
184 $ cd ..
185
185
186 Pulling from publish=False to publish=False does not move boundary.
186 Pulling from publish=False to publish=False does not move boundary.
187
187
188 $ hg init nu
188 $ hg init nu
189 $ cd nu
189 $ cd nu
190 $ cat > .hg/hgrc << EOF
190 $ cat > .hg/hgrc << EOF
191 > [phases]
191 > [phases]
192 > publish=0
192 > publish=0
193 > EOF
193 > EOF
194 $ hg pull ../mu -r 54acac6f23ab
194 $ hg pull ../mu -r 54acac6f23ab
195 pulling from ../mu
195 pulling from ../mu
196 adding changesets
196 adding changesets
197 adding manifests
197 adding manifests
198 adding file changes
198 adding file changes
199 added 3 changesets with 3 changes to 3 files
199 added 3 changesets with 3 changes to 3 files
200 (run 'hg update' to get a working copy)
200 (run 'hg update' to get a working copy)
201 $ hgph
201 $ hgph
202 o 2 draft a-C - 54acac6f23ab
202 o 2 draft a-C - 54acac6f23ab
203 |
203 |
204 o 1 draft a-B - 548a3d25dbf0
204 o 1 draft a-B - 548a3d25dbf0
205 |
205 |
206 o 0 draft a-A - 054250a37db4
206 o 0 draft a-A - 054250a37db4
207
207
208
208
209 Even for common
209 Even for common
210
210
211 $ hg pull ../mu -r f54f1bb90ff3
211 $ hg pull ../mu -r f54f1bb90ff3
212 pulling from ../mu
212 pulling from ../mu
213 searching for changes
213 searching for changes
214 adding changesets
214 adding changesets
215 adding manifests
215 adding manifests
216 adding file changes
216 adding file changes
217 added 1 changesets with 1 changes to 1 files (+1 heads)
217 added 1 changesets with 1 changes to 1 files (+1 heads)
218 (run 'hg heads' to see heads, 'hg merge' to merge)
218 (run 'hg heads' to see heads, 'hg merge' to merge)
219 $ hgph
219 $ hgph
220 o 3 draft b-A - f54f1bb90ff3
220 o 3 draft b-A - f54f1bb90ff3
221 |
221 |
222 | o 2 draft a-C - 54acac6f23ab
222 | o 2 draft a-C - 54acac6f23ab
223 |/
223 |/
224 o 1 draft a-B - 548a3d25dbf0
224 o 1 draft a-B - 548a3d25dbf0
225 |
225 |
226 o 0 draft a-A - 054250a37db4
226 o 0 draft a-A - 054250a37db4
227
227
228
228
229
229
230 Pulling from Publish=True to Publish=False move boundary in common set.
230 Pulling from Publish=True to Publish=False move boundary in common set.
231 we are in nu
231 we are in nu
232
232
233 $ hg pull ../alpha -r b555f63b6063
233 $ hg pull ../alpha -r b555f63b6063
234 pulling from ../alpha
234 pulling from ../alpha
235 searching for changes
235 searching for changes
236 adding changesets
236 adding changesets
237 adding manifests
237 adding manifests
238 adding file changes
238 adding file changes
239 added 1 changesets with 1 changes to 1 files
239 added 1 changesets with 1 changes to 1 files
240 (run 'hg update' to get a working copy)
240 (run 'hg update' to get a working copy)
241 $ hgph # f54f1bb90ff3 stay draft, not ancestor of -r
241 $ hgph # f54f1bb90ff3 stay draft, not ancestor of -r
242 o 4 public a-D - b555f63b6063
242 o 4 public a-D - b555f63b6063
243 |
243 |
244 | o 3 draft b-A - f54f1bb90ff3
244 | o 3 draft b-A - f54f1bb90ff3
245 | |
245 | |
246 o | 2 public a-C - 54acac6f23ab
246 o | 2 public a-C - 54acac6f23ab
247 |/
247 |/
248 o 1 public a-B - 548a3d25dbf0
248 o 1 public a-B - 548a3d25dbf0
249 |
249 |
250 o 0 public a-A - 054250a37db4
250 o 0 public a-A - 054250a37db4
251
251
252
252
253 pulling from Publish=False to publish=False with some public
253 pulling from Publish=False to publish=False with some public
254
254
255 $ hg up -q f54f1bb90ff3
255 $ hg up -q f54f1bb90ff3
256 $ mkcommit n-A
256 $ mkcommit n-A
257 $ mkcommit n-B
257 $ mkcommit n-B
258 $ hgph
258 $ hgph
259 @ 6 draft n-B - 145e75495359
259 @ 6 draft n-B - 145e75495359
260 |
260 |
261 o 5 draft n-A - d6bcb4f74035
261 o 5 draft n-A - d6bcb4f74035
262 |
262 |
263 | o 4 public a-D - b555f63b6063
263 | o 4 public a-D - b555f63b6063
264 | |
264 | |
265 o | 3 draft b-A - f54f1bb90ff3
265 o | 3 draft b-A - f54f1bb90ff3
266 | |
266 | |
267 | o 2 public a-C - 54acac6f23ab
267 | o 2 public a-C - 54acac6f23ab
268 |/
268 |/
269 o 1 public a-B - 548a3d25dbf0
269 o 1 public a-B - 548a3d25dbf0
270 |
270 |
271 o 0 public a-A - 054250a37db4
271 o 0 public a-A - 054250a37db4
272
272
273 $ cd ../mu
273 $ cd ../mu
274 $ hg pull ../nu
274 $ hg pull ../nu
275 pulling from ../nu
275 pulling from ../nu
276 searching for changes
276 searching for changes
277 adding changesets
277 adding changesets
278 adding manifests
278 adding manifests
279 adding file changes
279 adding file changes
280 added 2 changesets with 2 changes to 2 files
280 added 2 changesets with 2 changes to 2 files
281 (run 'hg update' to get a working copy)
281 (run 'hg update' to get a working copy)
282 $ hgph
282 $ hgph
283 o 6 draft n-B - 145e75495359
283 o 6 draft n-B - 145e75495359
284 |
284 |
285 o 5 draft n-A - d6bcb4f74035
285 o 5 draft n-A - d6bcb4f74035
286 |
286 |
287 | o 4 public a-D - b555f63b6063
287 | o 4 public a-D - b555f63b6063
288 | |
288 | |
289 | o 3 public a-C - 54acac6f23ab
289 | o 3 public a-C - 54acac6f23ab
290 | |
290 | |
291 o | 2 draft b-A - f54f1bb90ff3
291 o | 2 draft b-A - f54f1bb90ff3
292 |/
292 |/
293 o 1 public a-B - 548a3d25dbf0
293 o 1 public a-B - 548a3d25dbf0
294 |
294 |
295 o 0 public a-A - 054250a37db4
295 o 0 public a-A - 054250a37db4
296
296
297 $ cd ..
297 $ cd ..
298
298
299 pulling into publish=True
299 pulling into publish=True
300
300
301 $ cd alpha
301 $ cd alpha
302 $ hgph
302 $ hgph
303 o 4 public b-A - f54f1bb90ff3
303 o 4 public b-A - f54f1bb90ff3
304 |
304 |
305 | @ 3 public a-D - b555f63b6063
305 | @ 3 public a-D - b555f63b6063
306 | |
306 | |
307 | o 2 public a-C - 54acac6f23ab
307 | o 2 public a-C - 54acac6f23ab
308 |/
308 |/
309 o 1 public a-B - 548a3d25dbf0
309 o 1 public a-B - 548a3d25dbf0
310 |
310 |
311 o 0 public a-A - 054250a37db4
311 o 0 public a-A - 054250a37db4
312
312
313 $ hg pull ../mu
313 $ hg pull ../mu
314 pulling from ../mu
314 pulling from ../mu
315 searching for changes
315 searching for changes
316 adding changesets
316 adding changesets
317 adding manifests
317 adding manifests
318 adding file changes
318 adding file changes
319 added 2 changesets with 2 changes to 2 files
319 added 2 changesets with 2 changes to 2 files
320 (run 'hg update' to get a working copy)
320 (run 'hg update' to get a working copy)
321 $ hgph
321 $ hgph
322 o 6 draft n-B - 145e75495359
322 o 6 draft n-B - 145e75495359
323 |
323 |
324 o 5 draft n-A - d6bcb4f74035
324 o 5 draft n-A - d6bcb4f74035
325 |
325 |
326 o 4 public b-A - f54f1bb90ff3
326 o 4 public b-A - f54f1bb90ff3
327 |
327 |
328 | @ 3 public a-D - b555f63b6063
328 | @ 3 public a-D - b555f63b6063
329 | |
329 | |
330 | o 2 public a-C - 54acac6f23ab
330 | o 2 public a-C - 54acac6f23ab
331 |/
331 |/
332 o 1 public a-B - 548a3d25dbf0
332 o 1 public a-B - 548a3d25dbf0
333 |
333 |
334 o 0 public a-A - 054250a37db4
334 o 0 public a-A - 054250a37db4
335
335
336 $ cd ..
336 $ cd ..
337
337
338 pulling back into original repo
338 pulling back into original repo
339
339
340 $ cd nu
340 $ cd nu
341 $ hg pull ../alpha
341 $ hg pull ../alpha
342 pulling from ../alpha
342 pulling from ../alpha
343 searching for changes
343 searching for changes
344 no changes found
344 no changes found
345 $ hgph
345 $ hgph
346 @ 6 public n-B - 145e75495359
346 @ 6 public n-B - 145e75495359
347 |
347 |
348 o 5 public n-A - d6bcb4f74035
348 o 5 public n-A - d6bcb4f74035
349 |
349 |
350 | o 4 public a-D - b555f63b6063
350 | o 4 public a-D - b555f63b6063
351 | |
351 | |
352 o | 3 public b-A - f54f1bb90ff3
352 o | 3 public b-A - f54f1bb90ff3
353 | |
353 | |
354 | o 2 public a-C - 54acac6f23ab
354 | o 2 public a-C - 54acac6f23ab
355 |/
355 |/
356 o 1 public a-B - 548a3d25dbf0
356 o 1 public a-B - 548a3d25dbf0
357 |
357 |
358 o 0 public a-A - 054250a37db4
358 o 0 public a-A - 054250a37db4
359
359
360
360
361 Push
361 Push
362 ````
362 ````
363
363
364 (inserted)
364 (inserted)
365
365
366 Test that phase are pushed even when they are nothing to pus
366 Test that phase are pushed even when they are nothing to pus
367 (this might be tested later bu are very convenient to not alter too much test)
367 (this might be tested later bu are very convenient to not alter too much test)
368
368
369 Push back to alpha
369 Push back to alpha
370
370
371 $ hg push ../alpha # from nu
371 $ hg push ../alpha # from nu
372 pushing to ../alpha
372 pushing to ../alpha
373 searching for changes
373 searching for changes
374 no changes found
374 no changes found
375 $ cd ..
375 $ cd ..
376 $ cd alpha
376 $ cd alpha
377 $ hgph
377 $ hgph
378 o 6 public n-B - 145e75495359
378 o 6 public n-B - 145e75495359
379 |
379 |
380 o 5 public n-A - d6bcb4f74035
380 o 5 public n-A - d6bcb4f74035
381 |
381 |
382 o 4 public b-A - f54f1bb90ff3
382 o 4 public b-A - f54f1bb90ff3
383 |
383 |
384 | @ 3 public a-D - b555f63b6063
384 | @ 3 public a-D - b555f63b6063
385 | |
385 | |
386 | o 2 public a-C - 54acac6f23ab
386 | o 2 public a-C - 54acac6f23ab
387 |/
387 |/
388 o 1 public a-B - 548a3d25dbf0
388 o 1 public a-B - 548a3d25dbf0
389 |
389 |
390 o 0 public a-A - 054250a37db4
390 o 0 public a-A - 054250a37db4
391
391
392
392
393 (end insertion)
393 (end insertion)
394
394
395
395
396 initial setup
396 initial setup
397
397
398 $ hg glog # of alpha
398 $ hg glog # of alpha
399 o changeset: 6:145e75495359
399 o changeset: 6:145e75495359
400 | tag: tip
400 | tag: tip
401 | user: test
401 | user: test
402 | date: Thu Jan 01 00:00:00 1970 +0000
402 | date: Thu Jan 01 00:00:00 1970 +0000
403 | summary: n-B
403 | summary: n-B
404 |
404 |
405 o changeset: 5:d6bcb4f74035
405 o changeset: 5:d6bcb4f74035
406 | user: test
406 | user: test
407 | date: Thu Jan 01 00:00:00 1970 +0000
407 | date: Thu Jan 01 00:00:00 1970 +0000
408 | summary: n-A
408 | summary: n-A
409 |
409 |
410 o changeset: 4:f54f1bb90ff3
410 o changeset: 4:f54f1bb90ff3
411 | parent: 1:548a3d25dbf0
411 | parent: 1:548a3d25dbf0
412 | user: test
412 | user: test
413 | date: Thu Jan 01 00:00:00 1970 +0000
413 | date: Thu Jan 01 00:00:00 1970 +0000
414 | summary: b-A
414 | summary: b-A
415 |
415 |
416 | @ changeset: 3:b555f63b6063
416 | @ changeset: 3:b555f63b6063
417 | | user: test
417 | | user: test
418 | | date: Thu Jan 01 00:00:00 1970 +0000
418 | | date: Thu Jan 01 00:00:00 1970 +0000
419 | | summary: a-D
419 | | summary: a-D
420 | |
420 | |
421 | o changeset: 2:54acac6f23ab
421 | o changeset: 2:54acac6f23ab
422 |/ user: test
422 |/ user: test
423 | date: Thu Jan 01 00:00:00 1970 +0000
423 | date: Thu Jan 01 00:00:00 1970 +0000
424 | summary: a-C
424 | summary: a-C
425 |
425 |
426 o changeset: 1:548a3d25dbf0
426 o changeset: 1:548a3d25dbf0
427 | user: test
427 | user: test
428 | date: Thu Jan 01 00:00:00 1970 +0000
428 | date: Thu Jan 01 00:00:00 1970 +0000
429 | summary: a-B
429 | summary: a-B
430 |
430 |
431 o changeset: 0:054250a37db4
431 o changeset: 0:054250a37db4
432 user: test
432 user: test
433 date: Thu Jan 01 00:00:00 1970 +0000
433 date: Thu Jan 01 00:00:00 1970 +0000
434 summary: a-A
434 summary: a-A
435
435
436 $ mkcommit a-E
436 $ mkcommit a-E
437 $ mkcommit a-F
437 $ mkcommit a-F
438 $ mkcommit a-G
438 $ mkcommit a-G
439 $ hg up d6bcb4f74035 -q
439 $ hg up d6bcb4f74035 -q
440 $ mkcommit a-H
440 $ mkcommit a-H
441 created new head
441 created new head
442 $ hgph
442 $ hgph
443 @ 10 draft a-H - 967b449fbc94
443 @ 10 draft a-H - 967b449fbc94
444 |
444 |
445 | o 9 draft a-G - 3e27b6f1eee1
445 | o 9 draft a-G - 3e27b6f1eee1
446 | |
446 | |
447 | o 8 draft a-F - b740e3e5c05d
447 | o 8 draft a-F - b740e3e5c05d
448 | |
448 | |
449 | o 7 draft a-E - e9f537e46dea
449 | o 7 draft a-E - e9f537e46dea
450 | |
450 | |
451 +---o 6 public n-B - 145e75495359
451 +---o 6 public n-B - 145e75495359
452 | |
452 | |
453 o | 5 public n-A - d6bcb4f74035
453 o | 5 public n-A - d6bcb4f74035
454 | |
454 | |
455 o | 4 public b-A - f54f1bb90ff3
455 o | 4 public b-A - f54f1bb90ff3
456 | |
456 | |
457 | o 3 public a-D - b555f63b6063
457 | o 3 public a-D - b555f63b6063
458 | |
458 | |
459 | o 2 public a-C - 54acac6f23ab
459 | o 2 public a-C - 54acac6f23ab
460 |/
460 |/
461 o 1 public a-B - 548a3d25dbf0
461 o 1 public a-B - 548a3d25dbf0
462 |
462 |
463 o 0 public a-A - 054250a37db4
463 o 0 public a-A - 054250a37db4
464
464
465
465
466 Pushing to Publish=False (unknown changeset)
466 Pushing to Publish=False (unknown changeset)
467
467
468 $ hg push ../mu -r b740e3e5c05d # a-F
468 $ hg push ../mu -r b740e3e5c05d # a-F
469 pushing to ../mu
469 pushing to ../mu
470 searching for changes
470 searching for changes
471 adding changesets
471 adding changesets
472 adding manifests
472 adding manifests
473 adding file changes
473 adding file changes
474 added 2 changesets with 2 changes to 2 files
474 added 2 changesets with 2 changes to 2 files
475 $ hgph
475 $ hgph
476 @ 10 draft a-H - 967b449fbc94
476 @ 10 draft a-H - 967b449fbc94
477 |
477 |
478 | o 9 draft a-G - 3e27b6f1eee1
478 | o 9 draft a-G - 3e27b6f1eee1
479 | |
479 | |
480 | o 8 draft a-F - b740e3e5c05d
480 | o 8 draft a-F - b740e3e5c05d
481 | |
481 | |
482 | o 7 draft a-E - e9f537e46dea
482 | o 7 draft a-E - e9f537e46dea
483 | |
483 | |
484 +---o 6 public n-B - 145e75495359
484 +---o 6 public n-B - 145e75495359
485 | |
485 | |
486 o | 5 public n-A - d6bcb4f74035
486 o | 5 public n-A - d6bcb4f74035
487 | |
487 | |
488 o | 4 public b-A - f54f1bb90ff3
488 o | 4 public b-A - f54f1bb90ff3
489 | |
489 | |
490 | o 3 public a-D - b555f63b6063
490 | o 3 public a-D - b555f63b6063
491 | |
491 | |
492 | o 2 public a-C - 54acac6f23ab
492 | o 2 public a-C - 54acac6f23ab
493 |/
493 |/
494 o 1 public a-B - 548a3d25dbf0
494 o 1 public a-B - 548a3d25dbf0
495 |
495 |
496 o 0 public a-A - 054250a37db4
496 o 0 public a-A - 054250a37db4
497
497
498
498
499 $ cd ../mu
499 $ cd ../mu
500 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
500 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
501 > # not ancestor of -r
501 > # not ancestor of -r
502 o 8 draft a-F - b740e3e5c05d
502 o 8 draft a-F - b740e3e5c05d
503 |
503 |
504 o 7 draft a-E - e9f537e46dea
504 o 7 draft a-E - e9f537e46dea
505 |
505 |
506 | o 6 draft n-B - 145e75495359
506 | o 6 draft n-B - 145e75495359
507 | |
507 | |
508 | o 5 draft n-A - d6bcb4f74035
508 | o 5 draft n-A - d6bcb4f74035
509 | |
509 | |
510 o | 4 public a-D - b555f63b6063
510 o | 4 public a-D - b555f63b6063
511 | |
511 | |
512 o | 3 public a-C - 54acac6f23ab
512 o | 3 public a-C - 54acac6f23ab
513 | |
513 | |
514 | o 2 draft b-A - f54f1bb90ff3
514 | o 2 draft b-A - f54f1bb90ff3
515 |/
515 |/
516 o 1 public a-B - 548a3d25dbf0
516 o 1 public a-B - 548a3d25dbf0
517 |
517 |
518 o 0 public a-A - 054250a37db4
518 o 0 public a-A - 054250a37db4
519
519
520
520
521 Pushing to Publish=True (unknown changeset)
521 Pushing to Publish=True (unknown changeset)
522
522
523 $ hg push ../beta -r b740e3e5c05d
523 $ hg push ../beta -r b740e3e5c05d
524 pushing to ../beta
524 pushing to ../beta
525 searching for changes
525 searching for changes
526 adding changesets
526 adding changesets
527 adding manifests
527 adding manifests
528 adding file changes
528 adding file changes
529 added 2 changesets with 2 changes to 2 files
529 added 2 changesets with 2 changes to 2 files
530 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
530 $ hgph # again f54f1bb90ff3, d6bcb4f74035 and 145e75495359 stay draft,
531 > # not ancestor of -r
531 > # not ancestor of -r
532 o 8 public a-F - b740e3e5c05d
532 o 8 public a-F - b740e3e5c05d
533 |
533 |
534 o 7 public a-E - e9f537e46dea
534 o 7 public a-E - e9f537e46dea
535 |
535 |
536 | o 6 draft n-B - 145e75495359
536 | o 6 draft n-B - 145e75495359
537 | |
537 | |
538 | o 5 draft n-A - d6bcb4f74035
538 | o 5 draft n-A - d6bcb4f74035
539 | |
539 | |
540 o | 4 public a-D - b555f63b6063
540 o | 4 public a-D - b555f63b6063
541 | |
541 | |
542 o | 3 public a-C - 54acac6f23ab
542 o | 3 public a-C - 54acac6f23ab
543 | |
543 | |
544 | o 2 draft b-A - f54f1bb90ff3
544 | o 2 draft b-A - f54f1bb90ff3
545 |/
545 |/
546 o 1 public a-B - 548a3d25dbf0
546 o 1 public a-B - 548a3d25dbf0
547 |
547 |
548 o 0 public a-A - 054250a37db4
548 o 0 public a-A - 054250a37db4
549
549
550
550
551 Pushing to Publish=True (common changeset)
551 Pushing to Publish=True (common changeset)
552
552
553 $ cd ../beta
553 $ cd ../beta
554 $ hg push ../alpha
554 $ hg push ../alpha
555 pushing to ../alpha
555 pushing to ../alpha
556 searching for changes
556 searching for changes
557 no changes found
557 no changes found
558 $ hgph
558 $ hgph
559 o 6 public a-F - b740e3e5c05d
559 o 6 public a-F - b740e3e5c05d
560 |
560 |
561 o 5 public a-E - e9f537e46dea
561 o 5 public a-E - e9f537e46dea
562 |
562 |
563 o 4 public a-D - b555f63b6063
563 o 4 public a-D - b555f63b6063
564 |
564 |
565 o 3 public a-C - 54acac6f23ab
565 o 3 public a-C - 54acac6f23ab
566 |
566 |
567 | @ 2 public b-A - f54f1bb90ff3
567 | @ 2 public b-A - f54f1bb90ff3
568 |/
568 |/
569 o 1 public a-B - 548a3d25dbf0
569 o 1 public a-B - 548a3d25dbf0
570 |
570 |
571 o 0 public a-A - 054250a37db4
571 o 0 public a-A - 054250a37db4
572
572
573 $ cd ../alpha
573 $ cd ../alpha
574 $ hgph
574 $ hgph
575 @ 10 draft a-H - 967b449fbc94
575 @ 10 draft a-H - 967b449fbc94
576 |
576 |
577 | o 9 draft a-G - 3e27b6f1eee1
577 | o 9 draft a-G - 3e27b6f1eee1
578 | |
578 | |
579 | o 8 public a-F - b740e3e5c05d
579 | o 8 public a-F - b740e3e5c05d
580 | |
580 | |
581 | o 7 public a-E - e9f537e46dea
581 | o 7 public a-E - e9f537e46dea
582 | |
582 | |
583 +---o 6 public n-B - 145e75495359
583 +---o 6 public n-B - 145e75495359
584 | |
584 | |
585 o | 5 public n-A - d6bcb4f74035
585 o | 5 public n-A - d6bcb4f74035
586 | |
586 | |
587 o | 4 public b-A - f54f1bb90ff3
587 o | 4 public b-A - f54f1bb90ff3
588 | |
588 | |
589 | o 3 public a-D - b555f63b6063
589 | o 3 public a-D - b555f63b6063
590 | |
590 | |
591 | o 2 public a-C - 54acac6f23ab
591 | o 2 public a-C - 54acac6f23ab
592 |/
592 |/
593 o 1 public a-B - 548a3d25dbf0
593 o 1 public a-B - 548a3d25dbf0
594 |
594 |
595 o 0 public a-A - 054250a37db4
595 o 0 public a-A - 054250a37db4
596
596
597
597
598 Pushing to Publish=False (common changeset that change phase + unknown one)
598 Pushing to Publish=False (common changeset that change phase + unknown one)
599
599
600 $ hg push ../mu -r 967b449fbc94 -f
600 $ hg push ../mu -r 967b449fbc94 -f
601 pushing to ../mu
601 pushing to ../mu
602 searching for changes
602 searching for changes
603 adding changesets
603 adding changesets
604 adding manifests
604 adding manifests
605 adding file changes
605 adding file changes
606 added 1 changesets with 1 changes to 1 files (+1 heads)
606 added 1 changesets with 1 changes to 1 files (+1 heads)
607 $ hgph
607 $ hgph
608 @ 10 draft a-H - 967b449fbc94
608 @ 10 draft a-H - 967b449fbc94
609 |
609 |
610 | o 9 draft a-G - 3e27b6f1eee1
610 | o 9 draft a-G - 3e27b6f1eee1
611 | |
611 | |
612 | o 8 public a-F - b740e3e5c05d
612 | o 8 public a-F - b740e3e5c05d
613 | |
613 | |
614 | o 7 public a-E - e9f537e46dea
614 | o 7 public a-E - e9f537e46dea
615 | |
615 | |
616 +---o 6 public n-B - 145e75495359
616 +---o 6 public n-B - 145e75495359
617 | |
617 | |
618 o | 5 public n-A - d6bcb4f74035
618 o | 5 public n-A - d6bcb4f74035
619 | |
619 | |
620 o | 4 public b-A - f54f1bb90ff3
620 o | 4 public b-A - f54f1bb90ff3
621 | |
621 | |
622 | o 3 public a-D - b555f63b6063
622 | o 3 public a-D - b555f63b6063
623 | |
623 | |
624 | o 2 public a-C - 54acac6f23ab
624 | o 2 public a-C - 54acac6f23ab
625 |/
625 |/
626 o 1 public a-B - 548a3d25dbf0
626 o 1 public a-B - 548a3d25dbf0
627 |
627 |
628 o 0 public a-A - 054250a37db4
628 o 0 public a-A - 054250a37db4
629
629
630 $ cd ../mu
630 $ cd ../mu
631 $ hgph # d6bcb4f74035 should have changed phase
631 $ hgph # d6bcb4f74035 should have changed phase
632 > # 145e75495359 is still draft. not ancestor of -r
632 > # 145e75495359 is still draft. not ancestor of -r
633 o 9 draft a-H - 967b449fbc94
633 o 9 draft a-H - 967b449fbc94
634 |
634 |
635 | o 8 public a-F - b740e3e5c05d
635 | o 8 public a-F - b740e3e5c05d
636 | |
636 | |
637 | o 7 public a-E - e9f537e46dea
637 | o 7 public a-E - e9f537e46dea
638 | |
638 | |
639 +---o 6 draft n-B - 145e75495359
639 +---o 6 draft n-B - 145e75495359
640 | |
640 | |
641 o | 5 public n-A - d6bcb4f74035
641 o | 5 public n-A - d6bcb4f74035
642 | |
642 | |
643 | o 4 public a-D - b555f63b6063
643 | o 4 public a-D - b555f63b6063
644 | |
644 | |
645 | o 3 public a-C - 54acac6f23ab
645 | o 3 public a-C - 54acac6f23ab
646 | |
646 | |
647 o | 2 public b-A - f54f1bb90ff3
647 o | 2 public b-A - f54f1bb90ff3
648 |/
648 |/
649 o 1 public a-B - 548a3d25dbf0
649 o 1 public a-B - 548a3d25dbf0
650 |
650 |
651 o 0 public a-A - 054250a37db4
651 o 0 public a-A - 054250a37db4
652
652
653
653
654
654
655 Pushing to Publish=True (common changeset from publish=False)
655 Pushing to Publish=True (common changeset from publish=False)
656
656
657 (in mu)
657 (in mu)
658 $ hg push ../alpha
658 $ hg push ../alpha
659 pushing to ../alpha
659 pushing to ../alpha
660 searching for changes
660 searching for changes
661 no changes found
661 no changes found
662 $ hgph
662 $ hgph
663 o 9 public a-H - 967b449fbc94
663 o 9 public a-H - 967b449fbc94
664 |
664 |
665 | o 8 public a-F - b740e3e5c05d
665 | o 8 public a-F - b740e3e5c05d
666 | |
666 | |
667 | o 7 public a-E - e9f537e46dea
667 | o 7 public a-E - e9f537e46dea
668 | |
668 | |
669 +---o 6 public n-B - 145e75495359
669 +---o 6 public n-B - 145e75495359
670 | |
670 | |
671 o | 5 public n-A - d6bcb4f74035
671 o | 5 public n-A - d6bcb4f74035
672 | |
672 | |
673 | o 4 public a-D - b555f63b6063
673 | o 4 public a-D - b555f63b6063
674 | |
674 | |
675 | o 3 public a-C - 54acac6f23ab
675 | o 3 public a-C - 54acac6f23ab
676 | |
676 | |
677 o | 2 public b-A - f54f1bb90ff3
677 o | 2 public b-A - f54f1bb90ff3
678 |/
678 |/
679 o 1 public a-B - 548a3d25dbf0
679 o 1 public a-B - 548a3d25dbf0
680 |
680 |
681 o 0 public a-A - 054250a37db4
681 o 0 public a-A - 054250a37db4
682
682
683 $ hgph -R ../alpha # a-H should have been synced to 0
683 $ hgph -R ../alpha # a-H should have been synced to 0
684 @ 10 public a-H - 967b449fbc94
684 @ 10 public a-H - 967b449fbc94
685 |
685 |
686 | o 9 draft a-G - 3e27b6f1eee1
686 | o 9 draft a-G - 3e27b6f1eee1
687 | |
687 | |
688 | o 8 public a-F - b740e3e5c05d
688 | o 8 public a-F - b740e3e5c05d
689 | |
689 | |
690 | o 7 public a-E - e9f537e46dea
690 | o 7 public a-E - e9f537e46dea
691 | |
691 | |
692 +---o 6 public n-B - 145e75495359
692 +---o 6 public n-B - 145e75495359
693 | |
693 | |
694 o | 5 public n-A - d6bcb4f74035
694 o | 5 public n-A - d6bcb4f74035
695 | |
695 | |
696 o | 4 public b-A - f54f1bb90ff3
696 o | 4 public b-A - f54f1bb90ff3
697 | |
697 | |
698 | o 3 public a-D - b555f63b6063
698 | o 3 public a-D - b555f63b6063
699 | |
699 | |
700 | o 2 public a-C - 54acac6f23ab
700 | o 2 public a-C - 54acac6f23ab
701 |/
701 |/
702 o 1 public a-B - 548a3d25dbf0
702 o 1 public a-B - 548a3d25dbf0
703 |
703 |
704 o 0 public a-A - 054250a37db4
704 o 0 public a-A - 054250a37db4
705
705
706
706
707
707
708 Discovery locally secret changeset on a remote repository:
708 Discovery locally secret changeset on a remote repository:
709
709
710 - should make it non-secret
710 - should make it non-secret
711
711
712 $ cd ../alpha
712 $ cd ../alpha
713 $ mkcommit A-secret --config phases.new-commit=2
713 $ mkcommit A-secret --config phases.new-commit=2
714 $ hgph
714 $ hgph
715 @ 11 secret A-secret - 435b5d83910c
715 @ 11 secret A-secret - 435b5d83910c
716 |
716 |
717 o 10 public a-H - 967b449fbc94
717 o 10 public a-H - 967b449fbc94
718 |
718 |
719 | o 9 draft a-G - 3e27b6f1eee1
719 | o 9 draft a-G - 3e27b6f1eee1
720 | |
720 | |
721 | o 8 public a-F - b740e3e5c05d
721 | o 8 public a-F - b740e3e5c05d
722 | |
722 | |
723 | o 7 public a-E - e9f537e46dea
723 | o 7 public a-E - e9f537e46dea
724 | |
724 | |
725 +---o 6 public n-B - 145e75495359
725 +---o 6 public n-B - 145e75495359
726 | |
726 | |
727 o | 5 public n-A - d6bcb4f74035
727 o | 5 public n-A - d6bcb4f74035
728 | |
728 | |
729 o | 4 public b-A - f54f1bb90ff3
729 o | 4 public b-A - f54f1bb90ff3
730 | |
730 | |
731 | o 3 public a-D - b555f63b6063
731 | o 3 public a-D - b555f63b6063
732 | |
732 | |
733 | o 2 public a-C - 54acac6f23ab
733 | o 2 public a-C - 54acac6f23ab
734 |/
734 |/
735 o 1 public a-B - 548a3d25dbf0
735 o 1 public a-B - 548a3d25dbf0
736 |
736 |
737 o 0 public a-A - 054250a37db4
737 o 0 public a-A - 054250a37db4
738
738
739 $ hg bundle --base 'parents(.)' -r . ../secret-bundle.hg
739 $ hg bundle --base 'parents(.)' -r . ../secret-bundle.hg
740 1 changesets found
740 1 changesets found
741 $ hg -R ../mu unbundle ../secret-bundle.hg
741 $ hg -R ../mu unbundle ../secret-bundle.hg
742 adding changesets
742 adding changesets
743 adding manifests
743 adding manifests
744 adding file changes
744 adding file changes
745 added 1 changesets with 1 changes to 1 files
745 added 1 changesets with 1 changes to 1 files
746 (run 'hg update' to get a working copy)
746 (run 'hg update' to get a working copy)
747 $ hgph -R ../mu
747 $ hgph -R ../mu
748 o 10 draft A-secret - 435b5d83910c
748 o 10 draft A-secret - 435b5d83910c
749 |
749 |
750 o 9 public a-H - 967b449fbc94
750 o 9 public a-H - 967b449fbc94
751 |
751 |
752 | o 8 public a-F - b740e3e5c05d
752 | o 8 public a-F - b740e3e5c05d
753 | |
753 | |
754 | o 7 public a-E - e9f537e46dea
754 | o 7 public a-E - e9f537e46dea
755 | |
755 | |
756 +---o 6 public n-B - 145e75495359
756 +---o 6 public n-B - 145e75495359
757 | |
757 | |
758 o | 5 public n-A - d6bcb4f74035
758 o | 5 public n-A - d6bcb4f74035
759 | |
759 | |
760 | o 4 public a-D - b555f63b6063
760 | o 4 public a-D - b555f63b6063
761 | |
761 | |
762 | o 3 public a-C - 54acac6f23ab
762 | o 3 public a-C - 54acac6f23ab
763 | |
763 | |
764 o | 2 public b-A - f54f1bb90ff3
764 o | 2 public b-A - f54f1bb90ff3
765 |/
765 |/
766 o 1 public a-B - 548a3d25dbf0
766 o 1 public a-B - 548a3d25dbf0
767 |
767 |
768 o 0 public a-A - 054250a37db4
768 o 0 public a-A - 054250a37db4
769
769
770 $ hg pull ../mu
770 $ hg pull ../mu
771 pulling from ../mu
771 pulling from ../mu
772 searching for changes
772 searching for changes
773 no changes found
773 no changes found
774 $ hgph
774 $ hgph
775 @ 11 draft A-secret - 435b5d83910c
775 @ 11 draft A-secret - 435b5d83910c
776 |
776 |
777 o 10 public a-H - 967b449fbc94
777 o 10 public a-H - 967b449fbc94
778 |
778 |
779 | o 9 draft a-G - 3e27b6f1eee1
779 | o 9 draft a-G - 3e27b6f1eee1
780 | |
780 | |
781 | o 8 public a-F - b740e3e5c05d
781 | o 8 public a-F - b740e3e5c05d
782 | |
782 | |
783 | o 7 public a-E - e9f537e46dea
783 | o 7 public a-E - e9f537e46dea
784 | |
784 | |
785 +---o 6 public n-B - 145e75495359
785 +---o 6 public n-B - 145e75495359
786 | |
786 | |
787 o | 5 public n-A - d6bcb4f74035
787 o | 5 public n-A - d6bcb4f74035
788 | |
788 | |
789 o | 4 public b-A - f54f1bb90ff3
789 o | 4 public b-A - f54f1bb90ff3
790 | |
790 | |
791 | o 3 public a-D - b555f63b6063
791 | o 3 public a-D - b555f63b6063
792 | |
792 | |
793 | o 2 public a-C - 54acac6f23ab
793 | o 2 public a-C - 54acac6f23ab
794 |/
794 |/
795 o 1 public a-B - 548a3d25dbf0
795 o 1 public a-B - 548a3d25dbf0
796 |
796 |
797 o 0 public a-A - 054250a37db4
797 o 0 public a-A - 054250a37db4
798
798
799
799
800 pushing a locally public and draft changesets remotly secret should make them appear on the remote side
800 pushing a locally public and draft changesets remotly secret should make them appear on the remote side
801
801
802 $ hg -R ../mu phase --secret --force 967b449fbc94
802 $ hg -R ../mu phase --secret --force 967b449fbc94
803 $ hg push -r 435b5d83910c ../mu
803 $ hg push -r 435b5d83910c ../mu
804 pushing to ../mu
804 pushing to ../mu
805 searching for changes
805 searching for changes
806 adding changesets
806 adding changesets
807 adding manifests
807 adding manifests
808 adding file changes
808 adding file changes
809 added 0 changesets with 0 changes to 2 files
809 added 0 changesets with 0 changes to 2 files
810 $ hgph -R ../mu
810 $ hgph -R ../mu
811 o 10 draft A-secret - 435b5d83910c
811 o 10 draft A-secret - 435b5d83910c
812 |
812 |
813 o 9 public a-H - 967b449fbc94
813 o 9 public a-H - 967b449fbc94
814 |
814 |
815 | o 8 public a-F - b740e3e5c05d
815 | o 8 public a-F - b740e3e5c05d
816 | |
816 | |
817 | o 7 public a-E - e9f537e46dea
817 | o 7 public a-E - e9f537e46dea
818 | |
818 | |
819 +---o 6 public n-B - 145e75495359
819 +---o 6 public n-B - 145e75495359
820 | |
820 | |
821 o | 5 public n-A - d6bcb4f74035
821 o | 5 public n-A - d6bcb4f74035
822 | |
822 | |
823 | o 4 public a-D - b555f63b6063
823 | o 4 public a-D - b555f63b6063
824 | |
824 | |
825 | o 3 public a-C - 54acac6f23ab
825 | o 3 public a-C - 54acac6f23ab
826 | |
826 | |
827 o | 2 public b-A - f54f1bb90ff3
827 o | 2 public b-A - f54f1bb90ff3
828 |/
828 |/
829 o 1 public a-B - 548a3d25dbf0
829 o 1 public a-B - 548a3d25dbf0
830 |
830 |
831 o 0 public a-A - 054250a37db4
831 o 0 public a-A - 054250a37db4
832
832
833
833
834 pull new changeset with common draft locally
834 pull new changeset with common draft locally
835
835
836 $ hg up -q 967b449fbc94 # create a new root for draft
836 $ hg up -q 967b449fbc94 # create a new root for draft
837 $ mkcommit 'alpha-more'
837 $ mkcommit 'alpha-more'
838 created new head
838 created new head
839 $ hg push -fr . ../mu
839 $ hg push -fr . ../mu
840 pushing to ../mu
840 pushing to ../mu
841 searching for changes
841 searching for changes
842 adding changesets
842 adding changesets
843 adding manifests
843 adding manifests
844 adding file changes
844 adding file changes
845 added 1 changesets with 1 changes to 1 files (+1 heads)
845 added 1 changesets with 1 changes to 1 files (+1 heads)
846 $ cd ../mu
846 $ cd ../mu
847 $ hg phase --secret --force 1c5cfd894796
847 $ hg phase --secret --force 1c5cfd894796
848 $ hg up -q 435b5d83910c
848 $ hg up -q 435b5d83910c
849 $ mkcommit 'mu-more'
849 $ mkcommit 'mu-more'
850 $ cd ../alpha
850 $ cd ../alpha
851 $ hg pull ../mu
851 $ hg pull ../mu
852 pulling from ../mu
852 pulling from ../mu
853 searching for changes
853 searching for changes
854 adding changesets
854 adding changesets
855 adding manifests
855 adding manifests
856 adding file changes
856 adding file changes
857 added 1 changesets with 1 changes to 1 files
857 added 1 changesets with 1 changes to 1 files
858 (run 'hg update' to get a working copy)
858 (run 'hg update' to get a working copy)
859 $ hgph
859 $ hgph
860 o 13 draft mu-more - 5237fb433fc8
860 o 13 draft mu-more - 5237fb433fc8
861 |
861 |
862 | @ 12 draft alpha-more - 1c5cfd894796
862 | @ 12 draft alpha-more - 1c5cfd894796
863 | |
863 | |
864 o | 11 draft A-secret - 435b5d83910c
864 o | 11 draft A-secret - 435b5d83910c
865 |/
865 |/
866 o 10 public a-H - 967b449fbc94
866 o 10 public a-H - 967b449fbc94
867 |
867 |
868 | o 9 draft a-G - 3e27b6f1eee1
868 | o 9 draft a-G - 3e27b6f1eee1
869 | |
869 | |
870 | o 8 public a-F - b740e3e5c05d
870 | o 8 public a-F - b740e3e5c05d
871 | |
871 | |
872 | o 7 public a-E - e9f537e46dea
872 | o 7 public a-E - e9f537e46dea
873 | |
873 | |
874 +---o 6 public n-B - 145e75495359
874 +---o 6 public n-B - 145e75495359
875 | |
875 | |
876 o | 5 public n-A - d6bcb4f74035
876 o | 5 public n-A - d6bcb4f74035
877 | |
877 | |
878 o | 4 public b-A - f54f1bb90ff3
878 o | 4 public b-A - f54f1bb90ff3
879 | |
879 | |
880 | o 3 public a-D - b555f63b6063
880 | o 3 public a-D - b555f63b6063
881 | |
881 | |
882 | o 2 public a-C - 54acac6f23ab
882 | o 2 public a-C - 54acac6f23ab
883 |/
883 |/
884 o 1 public a-B - 548a3d25dbf0
884 o 1 public a-B - 548a3d25dbf0
885 |
885 |
886 o 0 public a-A - 054250a37db4
886 o 0 public a-A - 054250a37db4
887
887
888
888
889 Test that test are properly ignored on remote event when existing locally
889 Test that test are properly ignored on remote event when existing locally
890
890
891 $ cd ..
891 $ cd ..
892 $ hg clone -qU -r b555f63b6063 -r f54f1bb90ff3 beta gamma
892 $ hg clone -qU -r b555f63b6063 -r f54f1bb90ff3 beta gamma
893
893
894 # pathological case are
894 # pathological case are
895 #
895 #
896 # * secret remotely
896 # * secret remotely
897 # * known locally
897 # * known locally
898 # * repo have uncommon changeset
898 # * repo have uncommon changeset
899
899
900 $ hg -R beta phase --secret --force f54f1bb90ff3
900 $ hg -R beta phase --secret --force f54f1bb90ff3
901 $ hg -R gamma phase --draft --force f54f1bb90ff3
901 $ hg -R gamma phase --draft --force f54f1bb90ff3
902
902
903 $ cd gamma
903 $ cd gamma
904 $ hg pull ../beta
904 $ hg pull ../beta
905 pulling from ../beta
905 pulling from ../beta
906 searching for changes
906 searching for changes
907 adding changesets
907 adding changesets
908 adding manifests
908 adding manifests
909 adding file changes
909 adding file changes
910 added 2 changesets with 2 changes to 2 files
910 added 2 changesets with 2 changes to 2 files
911 (run 'hg update' to get a working copy)
911 (run 'hg update' to get a working copy)
912 $ hg phase f54f1bb90ff3
912 $ hg phase f54f1bb90ff3
913 2: draft
913 2: draft
914
914
915 same over the wire
915 same over the wire
916
916
917 $ cd ../beta
917 $ cd ../beta
918 $ hg serve -p $HGPORT -d --pid-file=../beta.pid -E ../beta-error.log
918 $ hg serve -p $HGPORT -d --pid-file=../beta.pid -E ../beta-error.log
919 $ cat ../beta.pid >> $DAEMON_PIDS
919 $ cat ../beta.pid >> $DAEMON_PIDS
920 $ cd ../gamma
920 $ cd ../gamma
921
921
922 $ hg pull http://localhost:$HGPORT/
922 $ hg pull http://localhost:$HGPORT/
923 pulling from http://localhost:$HGPORT/
923 pulling from http://localhost:$HGPORT/
924 searching for changes
924 searching for changes
925 no changes found
925 no changes found
926 $ hg phase f54f1bb90ff3
926 $ hg phase f54f1bb90ff3
927 2: draft
927 2: draft
928
928
929 check that secret local on both side are not synced to public
929 check that secret local on both side are not synced to public
930
930
931 $ hg push -r b555f63b6063 http://localhost:$HGPORT/
931 $ hg push -r b555f63b6063 http://localhost:$HGPORT/
932 pushing to http://localhost:$HGPORT/
932 pushing to http://localhost:$HGPORT/
933 searching for changes
933 searching for changes
934 no changes found
934 no changes found
935 $ hg phase f54f1bb90ff3
935 $ hg phase f54f1bb90ff3
936 2: draft
936 2: draft
937
937
938 put the changeset in the draft state again
938 put the changeset in the draft state again
939 (first test after this one expect to be able to copy)
939 (first test after this one expect to be able to copy)
940
940
941 $ cd ..
941 $ cd ..
942
942
943
943
944 Test Clone behavior
944 Test Clone behavior
945
945
946 A. Clone without secret changeset
946 A. Clone without secret changeset
947
947
948 1. cloning non-publishing repository
948 1. cloning non-publishing repository
949 (Phase should be preserved)
949 (Phase should be preserved)
950
950
951 # make sure there is no secret so we can use a copy clone
951 # make sure there is no secret so we can use a copy clone
952
952
953 $ hg -R mu phase --draft 'secret()'
953 $ hg -R mu phase --draft 'secret()'
954
954
955 $ hg clone -U mu Tau
955 $ hg clone -U mu Tau
956 $ hgph -R Tau
956 $ hgph -R Tau
957 o 12 draft mu-more - 5237fb433fc8
957 o 12 draft mu-more - 5237fb433fc8
958 |
958 |
959 | o 11 draft alpha-more - 1c5cfd894796
959 | o 11 draft alpha-more - 1c5cfd894796
960 | |
960 | |
961 o | 10 draft A-secret - 435b5d83910c
961 o | 10 draft A-secret - 435b5d83910c
962 |/
962 |/
963 o 9 public a-H - 967b449fbc94
963 o 9 public a-H - 967b449fbc94
964 |
964 |
965 | o 8 public a-F - b740e3e5c05d
965 | o 8 public a-F - b740e3e5c05d
966 | |
966 | |
967 | o 7 public a-E - e9f537e46dea
967 | o 7 public a-E - e9f537e46dea
968 | |
968 | |
969 +---o 6 public n-B - 145e75495359
969 +---o 6 public n-B - 145e75495359
970 | |
970 | |
971 o | 5 public n-A - d6bcb4f74035
971 o | 5 public n-A - d6bcb4f74035
972 | |
972 | |
973 | o 4 public a-D - b555f63b6063
973 | o 4 public a-D - b555f63b6063
974 | |
974 | |
975 | o 3 public a-C - 54acac6f23ab
975 | o 3 public a-C - 54acac6f23ab
976 | |
976 | |
977 o | 2 public b-A - f54f1bb90ff3
977 o | 2 public b-A - f54f1bb90ff3
978 |/
978 |/
979 o 1 public a-B - 548a3d25dbf0
979 o 1 public a-B - 548a3d25dbf0
980 |
980 |
981 o 0 public a-A - 054250a37db4
981 o 0 public a-A - 054250a37db4
982
982
983
983
984 2. cloning publishing repository
984 2. cloning publishing repository
985
985
986 (everything should be public)
986 (everything should be public)
987
987
988 $ hg clone -U alpha Upsilon
988 $ hg clone -U alpha Upsilon
989 $ hgph -R Upsilon
989 $ hgph -R Upsilon
990 o 13 public mu-more - 5237fb433fc8
990 o 13 public mu-more - 5237fb433fc8
991 |
991 |
992 | o 12 public alpha-more - 1c5cfd894796
992 | o 12 public alpha-more - 1c5cfd894796
993 | |
993 | |
994 o | 11 public A-secret - 435b5d83910c
994 o | 11 public A-secret - 435b5d83910c
995 |/
995 |/
996 o 10 public a-H - 967b449fbc94
996 o 10 public a-H - 967b449fbc94
997 |
997 |
998 | o 9 public a-G - 3e27b6f1eee1
998 | o 9 public a-G - 3e27b6f1eee1
999 | |
999 | |
1000 | o 8 public a-F - b740e3e5c05d
1000 | o 8 public a-F - b740e3e5c05d
1001 | |
1001 | |
1002 | o 7 public a-E - e9f537e46dea
1002 | o 7 public a-E - e9f537e46dea
1003 | |
1003 | |
1004 +---o 6 public n-B - 145e75495359
1004 +---o 6 public n-B - 145e75495359
1005 | |
1005 | |
1006 o | 5 public n-A - d6bcb4f74035
1006 o | 5 public n-A - d6bcb4f74035
1007 | |
1007 | |
1008 o | 4 public b-A - f54f1bb90ff3
1008 o | 4 public b-A - f54f1bb90ff3
1009 | |
1009 | |
1010 | o 3 public a-D - b555f63b6063
1010 | o 3 public a-D - b555f63b6063
1011 | |
1011 | |
1012 | o 2 public a-C - 54acac6f23ab
1012 | o 2 public a-C - 54acac6f23ab
1013 |/
1013 |/
1014 o 1 public a-B - 548a3d25dbf0
1014 o 1 public a-B - 548a3d25dbf0
1015 |
1015 |
1016 o 0 public a-A - 054250a37db4
1016 o 0 public a-A - 054250a37db4
1017
1017
1018
1018
@@ -1,404 +1,404
1 $ alias hglog='hg log --template "{rev} {phaseidx} {desc}\n"'
1 $ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
2 $ mkcommit() {
2 $ mkcommit() {
3 > echo "$1" > "$1"
3 > echo "$1" > "$1"
4 > hg add "$1"
4 > hg add "$1"
5 > message="$1"
5 > message="$1"
6 > shift
6 > shift
7 > hg ci -m "$message" $*
7 > hg ci -m "$message" $*
8 > }
8 > }
9
9
10 $ hg init initialrepo
10 $ hg init initialrepo
11 $ cd initialrepo
11 $ cd initialrepo
12 $ mkcommit A
12 $ mkcommit A
13
13
14 New commit are draft by default
14 New commit are draft by default
15
15
16 $ hglog
16 $ hglog
17 0 1 A
17 0 1 A
18
18
19 Following commit are draft too
19 Following commit are draft too
20
20
21 $ mkcommit B
21 $ mkcommit B
22
22
23 $ hglog
23 $ hglog
24 1 1 B
24 1 1 B
25 0 1 A
25 0 1 A
26
26
27 Draft commit are properly created over public one:
27 Draft commit are properly created over public one:
28
28
29 $ hg phase --public .
29 $ hg phase --public .
30 $ hglog
30 $ hglog
31 1 0 B
31 1 0 B
32 0 0 A
32 0 0 A
33
33
34 $ mkcommit C
34 $ mkcommit C
35 $ mkcommit D
35 $ mkcommit D
36
36
37 $ hglog
37 $ hglog
38 3 1 D
38 3 1 D
39 2 1 C
39 2 1 C
40 1 0 B
40 1 0 B
41 0 0 A
41 0 0 A
42
42
43 Test creating changeset as secret
43 Test creating changeset as secret
44
44
45 $ mkcommit E --config phases.new-commit=2
45 $ mkcommit E --config phases.new-commit=2
46 $ hglog
46 $ hglog
47 4 2 E
47 4 2 E
48 3 1 D
48 3 1 D
49 2 1 C
49 2 1 C
50 1 0 B
50 1 0 B
51 0 0 A
51 0 0 A
52
52
53 Test the secret property is inherited
53 Test the secret property is inherited
54
54
55 $ mkcommit H
55 $ mkcommit H
56 $ hglog
56 $ hglog
57 5 2 H
57 5 2 H
58 4 2 E
58 4 2 E
59 3 1 D
59 3 1 D
60 2 1 C
60 2 1 C
61 1 0 B
61 1 0 B
62 0 0 A
62 0 0 A
63
63
64 Even on merge
64 Even on merge
65
65
66 $ hg up -q 1
66 $ hg up -q 1
67 $ mkcommit "B'"
67 $ mkcommit "B'"
68 created new head
68 created new head
69 $ hglog
69 $ hglog
70 6 1 B'
70 6 1 B'
71 5 2 H
71 5 2 H
72 4 2 E
72 4 2 E
73 3 1 D
73 3 1 D
74 2 1 C
74 2 1 C
75 1 0 B
75 1 0 B
76 0 0 A
76 0 0 A
77 $ hg merge 4 # E
77 $ hg merge 4 # E
78 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
79 (branch merge, don't forget to commit)
79 (branch merge, don't forget to commit)
80 $ hg ci -m "merge B' and E"
80 $ hg ci -m "merge B' and E"
81 $ hglog
81 $ hglog
82 7 2 merge B' and E
82 7 2 merge B' and E
83 6 1 B'
83 6 1 B'
84 5 2 H
84 5 2 H
85 4 2 E
85 4 2 E
86 3 1 D
86 3 1 D
87 2 1 C
87 2 1 C
88 1 0 B
88 1 0 B
89 0 0 A
89 0 0 A
90
90
91 Test secret changeset are not pushed
91 Test secret changeset are not pushed
92
92
93 $ hg init ../push-dest
93 $ hg init ../push-dest
94 $ cat > ../push-dest/.hg/hgrc << EOF
94 $ cat > ../push-dest/.hg/hgrc << EOF
95 > [phases]
95 > [phases]
96 > publish=False
96 > publish=False
97 > EOF
97 > EOF
98 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
98 $ hg outgoing ../push-dest --template='{rev} {phase} {desc|firstline}\n'
99 comparing with ../push-dest
99 comparing with ../push-dest
100 searching for changes
100 searching for changes
101 0 public A
101 0 public A
102 1 public B
102 1 public B
103 2 draft C
103 2 draft C
104 3 draft D
104 3 draft D
105 6 draft B'
105 6 draft B'
106 $ hg outgoing -r default ../push-dest --template='{rev} {phase} {desc|firstline}\n'
106 $ hg outgoing -r default ../push-dest --template='{rev} {phase} {desc|firstline}\n'
107 comparing with ../push-dest
107 comparing with ../push-dest
108 searching for changes
108 searching for changes
109 0 public A
109 0 public A
110 1 public B
110 1 public B
111 2 draft C
111 2 draft C
112 3 draft D
112 3 draft D
113 6 draft B'
113 6 draft B'
114
114
115 $ hg push ../push-dest -f # force because we push multiple heads
115 $ hg push ../push-dest -f # force because we push multiple heads
116 pushing to ../push-dest
116 pushing to ../push-dest
117 searching for changes
117 searching for changes
118 adding changesets
118 adding changesets
119 adding manifests
119 adding manifests
120 adding file changes
120 adding file changes
121 added 5 changesets with 5 changes to 5 files (+1 heads)
121 added 5 changesets with 5 changes to 5 files (+1 heads)
122 $ hglog
122 $ hglog
123 7 2 merge B' and E
123 7 2 merge B' and E
124 6 1 B'
124 6 1 B'
125 5 2 H
125 5 2 H
126 4 2 E
126 4 2 E
127 3 1 D
127 3 1 D
128 2 1 C
128 2 1 C
129 1 0 B
129 1 0 B
130 0 0 A
130 0 0 A
131 $ cd ../push-dest
131 $ cd ../push-dest
132 $ hglog
132 $ hglog
133 4 1 B'
133 4 1 B'
134 3 1 D
134 3 1 D
135 2 1 C
135 2 1 C
136 1 0 B
136 1 0 B
137 0 0 A
137 0 0 A
138 $ cd ..
138 $ cd ..
139
139
140 Test secret changeset are not pull
140 Test secret changeset are not pull
141
141
142 $ hg init pull-dest
142 $ hg init pull-dest
143 $ cd pull-dest
143 $ cd pull-dest
144 $ hg pull ../initialrepo
144 $ hg pull ../initialrepo
145 pulling from ../initialrepo
145 pulling from ../initialrepo
146 requesting all changes
146 requesting all changes
147 adding changesets
147 adding changesets
148 adding manifests
148 adding manifests
149 adding file changes
149 adding file changes
150 added 5 changesets with 5 changes to 5 files (+1 heads)
150 added 5 changesets with 5 changes to 5 files (+1 heads)
151 (run 'hg heads' to see heads, 'hg merge' to merge)
151 (run 'hg heads' to see heads, 'hg merge' to merge)
152 $ hglog
152 $ hglog
153 4 0 B'
153 4 0 B'
154 3 0 D
154 3 0 D
155 2 0 C
155 2 0 C
156 1 0 B
156 1 0 B
157 0 0 A
157 0 0 A
158 $ cd ..
158 $ cd ..
159
159
160 But secret can still be bundled explicitly
160 But secret can still be bundled explicitly
161
161
162 $ cd initialrepo
162 $ cd initialrepo
163 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
163 $ hg bundle --base '4^' -r 'children(4)' ../secret-bundle.hg
164 4 changesets found
164 4 changesets found
165 $ cd ..
165 $ cd ..
166
166
167 Test secret changeset are not cloned
167 Test secret changeset are not cloned
168 (during local clone)
168 (during local clone)
169
169
170 $ hg clone -qU initialrepo clone-dest
170 $ hg clone -qU initialrepo clone-dest
171 $ hglog -R clone-dest
171 $ hglog -R clone-dest
172 4 0 B'
172 4 0 B'
173 3 0 D
173 3 0 D
174 2 0 C
174 2 0 C
175 1 0 B
175 1 0 B
176 0 0 A
176 0 0 A
177
177
178 Test revset
178 Test revset
179
179
180 $ cd initialrepo
180 $ cd initialrepo
181 $ hglog -r 'public()'
181 $ hglog -r 'public()'
182 0 0 A
182 0 0 A
183 1 0 B
183 1 0 B
184 $ hglog -r 'draft()'
184 $ hglog -r 'draft()'
185 2 1 C
185 2 1 C
186 3 1 D
186 3 1 D
187 6 1 B'
187 6 1 B'
188 $ hglog -r 'secret()'
188 $ hglog -r 'secret()'
189 4 2 E
189 4 2 E
190 5 2 H
190 5 2 H
191 7 2 merge B' and E
191 7 2 merge B' and E
192
192
193 test that phase are displayed in log at debug level
193 test that phase are displayed in log at debug level
194
194
195 $ hg log --debug
195 $ hg log --debug
196 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
196 changeset: 7:17a481b3bccb796c0521ae97903d81c52bfee4af
197 tag: tip
197 tag: tip
198 phase: secret
198 phase: secret
199 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
199 parent: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
200 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
200 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
201 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
201 manifest: 7:5e724ffacba267b2ab726c91fc8b650710deaaa8
202 user: test
202 user: test
203 date: Thu Jan 01 00:00:00 1970 +0000
203 date: Thu Jan 01 00:00:00 1970 +0000
204 files+: C D E
204 files+: C D E
205 extra: branch=default
205 extra: branch=default
206 description:
206 description:
207 merge B' and E
207 merge B' and E
208
208
209
209
210 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
210 changeset: 6:cf9fe039dfd67e829edf6522a45de057b5c86519
211 phase: draft
211 phase: draft
212 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
212 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
213 parent: -1:0000000000000000000000000000000000000000
213 parent: -1:0000000000000000000000000000000000000000
214 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
214 manifest: 6:ab8bfef2392903058bf4ebb9e7746e8d7026b27a
215 user: test
215 user: test
216 date: Thu Jan 01 00:00:00 1970 +0000
216 date: Thu Jan 01 00:00:00 1970 +0000
217 files+: B'
217 files+: B'
218 extra: branch=default
218 extra: branch=default
219 description:
219 description:
220 B'
220 B'
221
221
222
222
223 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
223 changeset: 5:a030c6be5127abc010fcbff1851536552e6951a8
224 phase: secret
224 phase: secret
225 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
225 parent: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
226 parent: -1:0000000000000000000000000000000000000000
226 parent: -1:0000000000000000000000000000000000000000
227 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
227 manifest: 5:5c710aa854874fe3d5fa7192e77bdb314cc08b5a
228 user: test
228 user: test
229 date: Thu Jan 01 00:00:00 1970 +0000
229 date: Thu Jan 01 00:00:00 1970 +0000
230 files+: H
230 files+: H
231 extra: branch=default
231 extra: branch=default
232 description:
232 description:
233 H
233 H
234
234
235
235
236 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
236 changeset: 4:a603bfb5a83e312131cebcd05353c217d4d21dde
237 phase: secret
237 phase: secret
238 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
238 parent: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
239 parent: -1:0000000000000000000000000000000000000000
239 parent: -1:0000000000000000000000000000000000000000
240 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
240 manifest: 4:7173fd1c27119750b959e3a0f47ed78abe75d6dc
241 user: test
241 user: test
242 date: Thu Jan 01 00:00:00 1970 +0000
242 date: Thu Jan 01 00:00:00 1970 +0000
243 files+: E
243 files+: E
244 extra: branch=default
244 extra: branch=default
245 description:
245 description:
246 E
246 E
247
247
248
248
249 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
249 changeset: 3:b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e
250 phase: draft
250 phase: draft
251 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
251 parent: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
252 parent: -1:0000000000000000000000000000000000000000
252 parent: -1:0000000000000000000000000000000000000000
253 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
253 manifest: 3:6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c
254 user: test
254 user: test
255 date: Thu Jan 01 00:00:00 1970 +0000
255 date: Thu Jan 01 00:00:00 1970 +0000
256 files+: D
256 files+: D
257 extra: branch=default
257 extra: branch=default
258 description:
258 description:
259 D
259 D
260
260
261
261
262 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
262 changeset: 2:f838bfaca5c7226600ebcfd84f3c3c13a28d3757
263 phase: draft
263 phase: draft
264 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
264 parent: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
265 parent: -1:0000000000000000000000000000000000000000
265 parent: -1:0000000000000000000000000000000000000000
266 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
266 manifest: 2:66a5a01817fdf5239c273802b5b7618d051c89e4
267 user: test
267 user: test
268 date: Thu Jan 01 00:00:00 1970 +0000
268 date: Thu Jan 01 00:00:00 1970 +0000
269 files+: C
269 files+: C
270 extra: branch=default
270 extra: branch=default
271 description:
271 description:
272 C
272 C
273
273
274
274
275 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
275 changeset: 1:27547f69f25460a52fff66ad004e58da7ad3fb56
276 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
276 parent: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
277 parent: -1:0000000000000000000000000000000000000000
277 parent: -1:0000000000000000000000000000000000000000
278 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
278 manifest: 1:cb5cbbc1bfbf24cc34b9e8c16914e9caa2d2a7fd
279 user: test
279 user: test
280 date: Thu Jan 01 00:00:00 1970 +0000
280 date: Thu Jan 01 00:00:00 1970 +0000
281 files+: B
281 files+: B
282 extra: branch=default
282 extra: branch=default
283 description:
283 description:
284 B
284 B
285
285
286
286
287 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
287 changeset: 0:4a2df7238c3b48766b5e22fafbb8a2f506ec8256
288 parent: -1:0000000000000000000000000000000000000000
288 parent: -1:0000000000000000000000000000000000000000
289 parent: -1:0000000000000000000000000000000000000000
289 parent: -1:0000000000000000000000000000000000000000
290 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
290 manifest: 0:007d8c9d88841325f5c6b06371b35b4e8a2b1a83
291 user: test
291 user: test
292 date: Thu Jan 01 00:00:00 1970 +0000
292 date: Thu Jan 01 00:00:00 1970 +0000
293 files+: A
293 files+: A
294 extra: branch=default
294 extra: branch=default
295 description:
295 description:
296 A
296 A
297
297
298
298
299
299
300 Test phase command
300 Test phase command
301 ===================
301 ===================
302
302
303 initial picture
303 initial picture
304
304
305 $ cat >> $HGRCPATH << EOF
305 $ cat >> $HGRCPATH << EOF
306 > [extensions]
306 > [extensions]
307 > hgext.graphlog=
307 > hgext.graphlog=
308 > EOF
308 > EOF
309 $ hg log -G --template "{rev} {phase} {desc}\n"
309 $ hg log -G --template "{rev} {phase} {desc}\n"
310 @ 7 secret merge B' and E
310 @ 7 secret merge B' and E
311 |\
311 |\
312 | o 6 draft B'
312 | o 6 draft B'
313 | |
313 | |
314 +---o 5 secret H
314 +---o 5 secret H
315 | |
315 | |
316 o | 4 secret E
316 o | 4 secret E
317 | |
317 | |
318 o | 3 draft D
318 o | 3 draft D
319 | |
319 | |
320 o | 2 draft C
320 o | 2 draft C
321 |/
321 |/
322 o 1 public B
322 o 1 public B
323 |
323 |
324 o 0 public A
324 o 0 public A
325
325
326
326
327 display changesets phase
327 display changesets phase
328
328
329 (mixing -r and plain rev specification)
329 (mixing -r and plain rev specification)
330
330
331 $ hg phase 1::4 -r 7
331 $ hg phase 1::4 -r 7
332 1: public
332 1: public
333 2: draft
333 2: draft
334 3: draft
334 3: draft
335 4: secret
335 4: secret
336 7: secret
336 7: secret
337
337
338
338
339 move changeset forward
339 move changeset forward
340
340
341 (with -r option)
341 (with -r option)
342
342
343 $ hg phase --public -r 2
343 $ hg phase --public -r 2
344 $ hg log -G --template "{rev} {phase} {desc}\n"
344 $ hg log -G --template "{rev} {phase} {desc}\n"
345 @ 7 secret merge B' and E
345 @ 7 secret merge B' and E
346 |\
346 |\
347 | o 6 draft B'
347 | o 6 draft B'
348 | |
348 | |
349 +---o 5 secret H
349 +---o 5 secret H
350 | |
350 | |
351 o | 4 secret E
351 o | 4 secret E
352 | |
352 | |
353 o | 3 draft D
353 o | 3 draft D
354 | |
354 | |
355 o | 2 public C
355 o | 2 public C
356 |/
356 |/
357 o 1 public B
357 o 1 public B
358 |
358 |
359 o 0 public A
359 o 0 public A
360
360
361
361
362 move changeset backward
362 move changeset backward
363
363
364 (without -r option)
364 (without -r option)
365
365
366 $ hg phase --draft --force 2
366 $ hg phase --draft --force 2
367 $ hg log -G --template "{rev} {phase} {desc}\n"
367 $ hg log -G --template "{rev} {phase} {desc}\n"
368 @ 7 secret merge B' and E
368 @ 7 secret merge B' and E
369 |\
369 |\
370 | o 6 draft B'
370 | o 6 draft B'
371 | |
371 | |
372 +---o 5 secret H
372 +---o 5 secret H
373 | |
373 | |
374 o | 4 secret E
374 o | 4 secret E
375 | |
375 | |
376 o | 3 draft D
376 o | 3 draft D
377 | |
377 | |
378 o | 2 draft C
378 o | 2 draft C
379 |/
379 |/
380 o 1 public B
380 o 1 public B
381 |
381 |
382 o 0 public A
382 o 0 public A
383
383
384
384
385 move changeset forward and backward
385 move changeset forward and backward
386
386
387 $ hg phase --draft --force 1::4
387 $ hg phase --draft --force 1::4
388 $ hg log -G --template "{rev} {phase} {desc}\n"
388 $ hg log -G --template "{rev} {phase} {desc}\n"
389 @ 7 secret merge B' and E
389 @ 7 secret merge B' and E
390 |\
390 |\
391 | o 6 draft B'
391 | o 6 draft B'
392 | |
392 | |
393 +---o 5 secret H
393 +---o 5 secret H
394 | |
394 | |
395 o | 4 draft E
395 o | 4 draft E
396 | |
396 | |
397 o | 3 draft D
397 o | 3 draft D
398 | |
398 | |
399 o | 2 draft C
399 o | 2 draft C
400 |/
400 |/
401 o 1 draft B
401 o 1 draft B
402 |
402 |
403 o 0 public A
403 o 0 public A
404
404
General Comments 0
You need to be logged in to leave comments. Login now