Show More
@@ -1,432 +1,433 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"[^\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'sed.*-i', "don't use 'sed -i', use a temporary file"), | |||
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'echo -n', "don't use 'echo -n', use printf"), | |
52 | (r'^diff.*-\w*N', "don't use 'diff -N'"), |
|
53 | (r'^diff.*-\w*N', "don't use 'diff -N'"), | |
53 | (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), |
|
54 | (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), | |
54 | (r'head -c', "don't use 'head -c', use 'dd'"), |
|
55 | (r'head -c', "don't use 'head -c', use 'dd'"), | |
55 | (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), |
|
56 | (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), | |
56 | (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), |
|
57 | (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), | |
57 | (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"), |
|
58 | (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"), | |
58 | (r'printf.*\\x', "don't use printf \\x, use Python"), |
|
59 | (r'printf.*\\x', "don't use printf \\x, use Python"), | |
59 | (r'\$\(.*\)', "don't use $(expr), use `expr`"), |
|
60 | (r'\$\(.*\)', "don't use $(expr), use `expr`"), | |
60 | (r'rm -rf \*', "don't use naked rm -rf, target a directory"), |
|
61 | (r'rm -rf \*', "don't use naked rm -rf, target a directory"), | |
61 | (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w', |
|
62 | (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w', | |
62 | "use egrep for extended grep syntax"), |
|
63 | "use egrep for extended grep syntax"), | |
63 | (r'/bin/', "don't use explicit paths for tools"), |
|
64 | (r'/bin/', "don't use explicit paths for tools"), | |
64 | (r'\$PWD', "don't use $PWD, use `pwd`"), |
|
65 | (r'\$PWD', "don't use $PWD, use `pwd`"), | |
65 | (r'[^\n]\Z', "no trailing newline"), |
|
66 | (r'[^\n]\Z', "no trailing newline"), | |
66 | (r'export.*=', "don't export and assign at once"), |
|
67 | (r'export.*=', "don't export and assign at once"), | |
67 | (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\\^', "^ must be quoted"), |
|
68 | (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\\^', "^ must be quoted"), | |
68 | (r'^source\b', "don't use 'source', use '.'"), |
|
69 | (r'^source\b', "don't use 'source', use '.'"), | |
69 | (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"), |
|
70 | (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"), | |
70 | (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"), |
|
71 | (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"), | |
71 | (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), |
|
72 | (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), | |
72 | (r'^stop\(\)', "don't use 'stop' as a shell function name"), |
|
73 | (r'^stop\(\)', "don't use 'stop' as a shell function name"), | |
73 | (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"), |
|
74 | (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"), | |
74 | (r'^alias\b.*=', "don't use alias, use a function"), |
|
75 | (r'^alias\b.*=', "don't use alias, use a function"), | |
75 | ], |
|
76 | ], | |
76 | # warnings |
|
77 | # warnings | |
77 | [] |
|
78 | [] | |
78 | ] |
|
79 | ] | |
79 |
|
80 | |||
80 | testfilters = [ |
|
81 | testfilters = [ | |
81 | (r"( *)(#([^\n]*\S)?)", repcomment), |
|
82 | (r"( *)(#([^\n]*\S)?)", repcomment), | |
82 | (r"<<(\S+)((.|\n)*?\n\1)", rephere), |
|
83 | (r"<<(\S+)((.|\n)*?\n\1)", rephere), | |
83 | ] |
|
84 | ] | |
84 |
|
85 | |||
85 | uprefix = r"^ \$ " |
|
86 | uprefix = r"^ \$ " | |
86 | uprefixc = r"^ > " |
|
87 | uprefixc = r"^ > " | |
87 | utestpats = [ |
|
88 | utestpats = [ | |
88 | [ |
|
89 | [ | |
89 | (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"), |
|
90 | (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"), | |
90 | (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), |
|
91 | (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), | |
91 | (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), |
|
92 | (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), | |
92 | (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"), |
|
93 | (uprefix + r'.*(?<!\[)\$\?', "explicit exit code checks unnecessary"), | |
93 | (uprefix + r'.*\|\| echo.*(fail|error)', |
|
94 | (uprefix + r'.*\|\| echo.*(fail|error)', | |
94 | "explicit exit code checks unnecessary"), |
|
95 | "explicit exit code checks unnecessary"), | |
95 | (uprefix + r'set -e', "don't use set -e"), |
|
96 | (uprefix + r'set -e', "don't use set -e"), | |
96 | (uprefixc + r'( *)\t', "don't use tabs to indent"), |
|
97 | (uprefixc + r'( *)\t', "don't use tabs to indent"), | |
97 | ], |
|
98 | ], | |
98 | # warnings |
|
99 | # warnings | |
99 | [] |
|
100 | [] | |
100 | ] |
|
101 | ] | |
101 |
|
102 | |||
102 | for i in [0, 1]: |
|
103 | for i in [0, 1]: | |
103 | for p, m in testpats[i]: |
|
104 | for p, m in testpats[i]: | |
104 | if p.startswith(r'^'): |
|
105 | if p.startswith(r'^'): | |
105 | p = uprefix + p[1:] |
|
106 | p = uprefix + p[1:] | |
106 | else: |
|
107 | else: | |
107 | p = uprefix + ".*" + p |
|
108 | p = uprefix + ".*" + p | |
108 | utestpats[i].append((p, m)) |
|
109 | utestpats[i].append((p, m)) | |
109 |
|
110 | |||
110 | utestfilters = [ |
|
111 | utestfilters = [ | |
111 | (r"( *)(#([^\n]*\S)?)", repcomment), |
|
112 | (r"( *)(#([^\n]*\S)?)", repcomment), | |
112 | ] |
|
113 | ] | |
113 |
|
114 | |||
114 | pypats = [ |
|
115 | pypats = [ | |
115 | [ |
|
116 | [ | |
116 | (r'^\s*def\s*\w+\s*\(.*,\s*\(', |
|
117 | (r'^\s*def\s*\w+\s*\(.*,\s*\(', | |
117 | "tuple parameter unpacking not available in Python 3+"), |
|
118 | "tuple parameter unpacking not available in Python 3+"), | |
118 | (r'lambda\s*\(.*,.*\)', |
|
119 | (r'lambda\s*\(.*,.*\)', | |
119 | "tuple parameter unpacking not available in Python 3+"), |
|
120 | "tuple parameter unpacking not available in Python 3+"), | |
120 | (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"), |
|
121 | (r'(?<!def)\s+(cmp)\(', "cmp is not available in Python 3+"), | |
121 | (r'\breduce\s*\(.*', "reduce is not available in Python 3+"), |
|
122 | (r'\breduce\s*\(.*', "reduce is not available in Python 3+"), | |
122 | (r'\.has_key\b', "dict.has_key is not available in Python 3+"), |
|
123 | (r'\.has_key\b', "dict.has_key is not available in Python 3+"), | |
123 | (r'^\s*\t', "don't use tabs"), |
|
124 | (r'^\s*\t', "don't use tabs"), | |
124 | (r'\S;\s*\n', "semicolon"), |
|
125 | (r'\S;\s*\n', "semicolon"), | |
125 | (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), |
|
126 | (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), | |
126 | (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), |
|
127 | (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), | |
127 | (r'\w,\w', "missing whitespace after ,"), |
|
128 | (r'\w,\w', "missing whitespace after ,"), | |
128 | (r'\w[+/*\-<>]\w', "missing whitespace in expression"), |
|
129 | (r'\w[+/*\-<>]\w', "missing whitespace in expression"), | |
129 | (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), |
|
130 | (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), | |
130 | (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' |
|
131 | (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' | |
131 | r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), |
|
132 | r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), | |
132 | (r'.{85}', "line too long"), |
|
133 | (r'.{85}', "line too long"), | |
133 | (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), |
|
134 | (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), | |
134 | (r'[^\n]\Z', "no trailing newline"), |
|
135 | (r'[^\n]\Z', "no trailing newline"), | |
135 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
136 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | |
136 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"), |
|
137 | # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"), | |
137 | (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', |
|
138 | (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', | |
138 | "don't use camelcase in identifiers"), |
|
139 | "don't use camelcase in identifiers"), | |
139 | (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', |
|
140 | (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', | |
140 | "linebreak after :"), |
|
141 | "linebreak after :"), | |
141 | (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), |
|
142 | (r'class\s[^( \n]+:', "old-style class, use class foo(object)"), | |
142 | (r'class\s[^( \n]+\(\):', |
|
143 | (r'class\s[^( \n]+\(\):', | |
143 | "class foo() not available in Python 2.4, use class foo(object)"), |
|
144 | "class foo() not available in Python 2.4, use class foo(object)"), | |
144 | (r'\b(%s)\(' % '|'.join(keyword.kwlist), |
|
145 | (r'\b(%s)\(' % '|'.join(keyword.kwlist), | |
145 | "Python keyword is not a function"), |
|
146 | "Python keyword is not a function"), | |
146 | (r',]', "unneeded trailing ',' in list"), |
|
147 | (r',]', "unneeded trailing ',' in list"), | |
147 | # (r'class\s[A-Z][^\(]*\((?!Exception)', |
|
148 | # (r'class\s[A-Z][^\(]*\((?!Exception)', | |
148 | # "don't capitalize non-exception classes"), |
|
149 | # "don't capitalize non-exception classes"), | |
149 | # (r'in range\(', "use xrange"), |
|
150 | # (r'in range\(', "use xrange"), | |
150 | # (r'^\s*print\s+', "avoid using print in core and extensions"), |
|
151 | # (r'^\s*print\s+', "avoid using print in core and extensions"), | |
151 | (r'[\x80-\xff]', "non-ASCII character literal"), |
|
152 | (r'[\x80-\xff]', "non-ASCII character literal"), | |
152 | (r'("\')\.format\(', "str.format() not available in Python 2.4"), |
|
153 | (r'("\')\.format\(', "str.format() not available in Python 2.4"), | |
153 | (r'^\s*with\s+', "with not available in Python 2.4"), |
|
154 | (r'^\s*with\s+', "with not available in Python 2.4"), | |
154 | (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"), |
|
155 | (r'\.isdisjoint\(', "set.isdisjoint not available in Python 2.4"), | |
155 | (r'^\s*except.* as .*:', "except as not available in Python 2.4"), |
|
156 | (r'^\s*except.* as .*:', "except as not available in Python 2.4"), | |
156 | (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"), |
|
157 | (r'^\s*os\.path\.relpath', "relpath not available in Python 2.4"), | |
157 | (r'(?<!def)\s+(any|all|format)\(', |
|
158 | (r'(?<!def)\s+(any|all|format)\(', | |
158 | "any/all/format not available in Python 2.4"), |
|
159 | "any/all/format not available in Python 2.4"), | |
159 | (r'(?<!def)\s+(callable)\(', |
|
160 | (r'(?<!def)\s+(callable)\(', | |
160 | "callable not available in Python 3, use getattr(f, '__call__', None)"), |
|
161 | "callable not available in Python 3, use getattr(f, '__call__', None)"), | |
161 | (r'if\s.*\selse', "if ... else form not available in Python 2.4"), |
|
162 | (r'if\s.*\selse', "if ... else form not available in Python 2.4"), | |
162 | (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), |
|
163 | (r'^\s*(%s)\s\s' % '|'.join(keyword.kwlist), | |
163 | "gratuitous whitespace after Python keyword"), |
|
164 | "gratuitous whitespace after Python keyword"), | |
164 | (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"), |
|
165 | (r'([\(\[][ \t]\S)|(\S[ \t][\)\]])', "gratuitous whitespace in () or []"), | |
165 | # (r'\s\s=', "gratuitous whitespace before ="), |
|
166 | # (r'\s\s=', "gratuitous whitespace before ="), | |
166 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', |
|
167 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', | |
167 | "missing whitespace around operator"), |
|
168 | "missing whitespace around operator"), | |
168 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s', |
|
169 | (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s', | |
169 | "missing whitespace around operator"), |
|
170 | "missing whitespace around operator"), | |
170 | (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', |
|
171 | (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', | |
171 | "missing whitespace around operator"), |
|
172 | "missing whitespace around operator"), | |
172 | (r'[^^+=*/!<>&| -](\s=|=\s)[^= ]', |
|
173 | (r'[^^+=*/!<>&| -](\s=|=\s)[^= ]', | |
173 | "wrong whitespace around ="), |
|
174 | "wrong whitespace around ="), | |
174 | (r'raise Exception', "don't raise generic exceptions"), |
|
175 | (r'raise Exception', "don't raise generic exceptions"), | |
175 | (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), |
|
176 | (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), | |
176 | (r' [=!]=\s+(True|False|None)', |
|
177 | (r' [=!]=\s+(True|False|None)', | |
177 | "comparison with singleton, use 'is' or 'is not' instead"), |
|
178 | "comparison with singleton, use 'is' or 'is not' instead"), | |
178 | (r'^\s*(while|if) [01]:', |
|
179 | (r'^\s*(while|if) [01]:', | |
179 | "use True/False for constant Boolean expression"), |
|
180 | "use True/False for constant Boolean expression"), | |
180 | (r'(?<!def)\s+hasattr', |
|
181 | (r'(?<!def)\s+hasattr', | |
181 | 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), |
|
182 | 'hasattr(foo, bar) is broken, use util.safehasattr(foo, bar) instead'), | |
182 | (r'opener\([^)]*\).read\(', |
|
183 | (r'opener\([^)]*\).read\(', | |
183 | "use opener.read() instead"), |
|
184 | "use opener.read() instead"), | |
184 | (r'BaseException', 'not in Py2.4, use Exception'), |
|
185 | (r'BaseException', 'not in Py2.4, use Exception'), | |
185 | (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'), |
|
186 | (r'os\.path\.relpath', 'os.path.relpath is not in Py2.5'), | |
186 | (r'opener\([^)]*\).write\(', |
|
187 | (r'opener\([^)]*\).write\(', | |
187 | "use opener.write() instead"), |
|
188 | "use opener.write() instead"), | |
188 | (r'[\s\(](open|file)\([^)]*\)\.read\(', |
|
189 | (r'[\s\(](open|file)\([^)]*\)\.read\(', | |
189 | "use util.readfile() instead"), |
|
190 | "use util.readfile() instead"), | |
190 | (r'[\s\(](open|file)\([^)]*\)\.write\(', |
|
191 | (r'[\s\(](open|file)\([^)]*\)\.write\(', | |
191 | "use util.readfile() instead"), |
|
192 | "use util.readfile() instead"), | |
192 | (r'^[\s\(]*(open(er)?|file)\([^)]*\)', |
|
193 | (r'^[\s\(]*(open(er)?|file)\([^)]*\)', | |
193 | "always assign an opened file to a variable, and close it afterwards"), |
|
194 | "always assign an opened file to a variable, and close it afterwards"), | |
194 | (r'[\s\(](open|file)\([^)]*\)\.', |
|
195 | (r'[\s\(](open|file)\([^)]*\)\.', | |
195 | "always assign an opened file to a variable, and close it afterwards"), |
|
196 | "always assign an opened file to a variable, and close it afterwards"), | |
196 | (r'(?i)descendent', "the proper spelling is descendAnt"), |
|
197 | (r'(?i)descendent', "the proper spelling is descendAnt"), | |
197 | (r'\.debug\(\_', "don't mark debug messages for translation"), |
|
198 | (r'\.debug\(\_', "don't mark debug messages for translation"), | |
198 | ], |
|
199 | ], | |
199 | # warnings |
|
200 | # warnings | |
200 | [ |
|
201 | [ | |
201 | (r'.{81}', "warning: line over 80 characters"), |
|
202 | (r'.{81}', "warning: line over 80 characters"), | |
202 | (r'^\s*except:$', "warning: naked except clause"), |
|
203 | (r'^\s*except:$', "warning: naked except clause"), | |
203 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', |
|
204 | (r'ui\.(status|progress|write|note|warn)\([\'\"]x', | |
204 | "warning: unwrapped ui message"), |
|
205 | "warning: unwrapped ui message"), | |
205 | ] |
|
206 | ] | |
206 | ] |
|
207 | ] | |
207 |
|
208 | |||
208 | pyfilters = [ |
|
209 | pyfilters = [ | |
209 | (r"""(?msx)(?P<comment>\#.*?$)| |
|
210 | (r"""(?msx)(?P<comment>\#.*?$)| | |
210 | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) |
|
211 | ((?P<quote>('''|\"\"\"|(?<!')'(?!')|(?<!")"(?!"))) | |
211 | (?P<text>(([^\\]|\\.)*?)) |
|
212 | (?P<text>(([^\\]|\\.)*?)) | |
212 | (?P=quote))""", reppython), |
|
213 | (?P=quote))""", reppython), | |
213 | ] |
|
214 | ] | |
214 |
|
215 | |||
215 | cpats = [ |
|
216 | cpats = [ | |
216 | [ |
|
217 | [ | |
217 | (r'//', "don't use //-style comments"), |
|
218 | (r'//', "don't use //-style comments"), | |
218 | (r'^ ', "don't use spaces to indent"), |
|
219 | (r'^ ', "don't use spaces to indent"), | |
219 | (r'\S\t', "don't use tabs except for indent"), |
|
220 | (r'\S\t', "don't use tabs except for indent"), | |
220 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), |
|
221 | (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), | |
221 | (r'.{85}', "line too long"), |
|
222 | (r'.{85}', "line too long"), | |
222 | (r'(while|if|do|for)\(', "use space after while/if/do/for"), |
|
223 | (r'(while|if|do|for)\(', "use space after while/if/do/for"), | |
223 | (r'return\(', "return is not a function"), |
|
224 | (r'return\(', "return is not a function"), | |
224 | (r' ;', "no space before ;"), |
|
225 | (r' ;', "no space before ;"), | |
225 | (r'\w+\* \w+', "use int *foo, not int* foo"), |
|
226 | (r'\w+\* \w+', "use int *foo, not int* foo"), | |
226 | (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"), |
|
227 | (r'\([^\)]+\) \w+', "use (int)foo, not (int) foo"), | |
227 | (r'\S+ (\+\+|--)', "use foo++, not foo ++"), |
|
228 | (r'\S+ (\+\+|--)', "use foo++, not foo ++"), | |
228 | (r'\w,\w', "missing whitespace after ,"), |
|
229 | (r'\w,\w', "missing whitespace after ,"), | |
229 | (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), |
|
230 | (r'^[^#]\w[+/*]\w', "missing whitespace in expression"), | |
230 | (r'^#\s+\w', "use #foo, not # foo"), |
|
231 | (r'^#\s+\w', "use #foo, not # foo"), | |
231 | (r'[^\n]\Z', "no trailing newline"), |
|
232 | (r'[^\n]\Z', "no trailing newline"), | |
232 | (r'^\s*#import\b', "use only #include in standard C code"), |
|
233 | (r'^\s*#import\b', "use only #include in standard C code"), | |
233 | ], |
|
234 | ], | |
234 | # warnings |
|
235 | # warnings | |
235 | [] |
|
236 | [] | |
236 | ] |
|
237 | ] | |
237 |
|
238 | |||
238 | cfilters = [ |
|
239 | cfilters = [ | |
239 | (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment), |
|
240 | (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment), | |
240 | (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote), |
|
241 | (r'''(?P<quote>(?<!")")(?P<text>([^"]|\\")+)"(?!")''', repquote), | |
241 | (r'''(#\s*include\s+<)([^>]+)>''', repinclude), |
|
242 | (r'''(#\s*include\s+<)([^>]+)>''', repinclude), | |
242 | (r'(\()([^)]+\))', repcallspaces), |
|
243 | (r'(\()([^)]+\))', repcallspaces), | |
243 | ] |
|
244 | ] | |
244 |
|
245 | |||
245 | inutilpats = [ |
|
246 | inutilpats = [ | |
246 | [ |
|
247 | [ | |
247 | (r'\bui\.', "don't use ui in util"), |
|
248 | (r'\bui\.', "don't use ui in util"), | |
248 | ], |
|
249 | ], | |
249 | # warnings |
|
250 | # warnings | |
250 | [] |
|
251 | [] | |
251 | ] |
|
252 | ] | |
252 |
|
253 | |||
253 | inrevlogpats = [ |
|
254 | inrevlogpats = [ | |
254 | [ |
|
255 | [ | |
255 | (r'\brepo\.', "don't use repo in revlog"), |
|
256 | (r'\brepo\.', "don't use repo in revlog"), | |
256 | ], |
|
257 | ], | |
257 | # warnings |
|
258 | # warnings | |
258 | [] |
|
259 | [] | |
259 | ] |
|
260 | ] | |
260 |
|
261 | |||
261 | checks = [ |
|
262 | checks = [ | |
262 | ('python', r'.*\.(py|cgi)$', pyfilters, pypats), |
|
263 | ('python', r'.*\.(py|cgi)$', pyfilters, pypats), | |
263 | ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats), |
|
264 | ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats), | |
264 | ('c', r'.*\.c$', cfilters, cpats), |
|
265 | ('c', r'.*\.c$', cfilters, cpats), | |
265 | ('unified test', r'.*\.t$', utestfilters, utestpats), |
|
266 | ('unified test', r'.*\.t$', utestfilters, utestpats), | |
266 | ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters, |
|
267 | ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters, | |
267 | inrevlogpats), |
|
268 | inrevlogpats), | |
268 | ('layering violation ui in util', r'mercurial/util\.py', pyfilters, |
|
269 | ('layering violation ui in util', r'mercurial/util\.py', pyfilters, | |
269 | inutilpats), |
|
270 | inutilpats), | |
270 | ] |
|
271 | ] | |
271 |
|
272 | |||
272 | class norepeatlogger(object): |
|
273 | class norepeatlogger(object): | |
273 | def __init__(self): |
|
274 | def __init__(self): | |
274 | self._lastseen = None |
|
275 | self._lastseen = None | |
275 |
|
276 | |||
276 | def log(self, fname, lineno, line, msg, blame): |
|
277 | def log(self, fname, lineno, line, msg, blame): | |
277 | """print error related a to given line of a given file. |
|
278 | """print error related a to given line of a given file. | |
278 |
|
279 | |||
279 | The faulty line will also be printed but only once in the case |
|
280 | The faulty line will also be printed but only once in the case | |
280 | of multiple errors. |
|
281 | of multiple errors. | |
281 |
|
282 | |||
282 | :fname: filename |
|
283 | :fname: filename | |
283 | :lineno: line number |
|
284 | :lineno: line number | |
284 | :line: actual content of the line |
|
285 | :line: actual content of the line | |
285 | :msg: error message |
|
286 | :msg: error message | |
286 | """ |
|
287 | """ | |
287 | msgid = fname, lineno, line |
|
288 | msgid = fname, lineno, line | |
288 | if msgid != self._lastseen: |
|
289 | if msgid != self._lastseen: | |
289 | if blame: |
|
290 | if blame: | |
290 | print "%s:%d (%s):" % (fname, lineno, blame) |
|
291 | print "%s:%d (%s):" % (fname, lineno, blame) | |
291 | else: |
|
292 | else: | |
292 | print "%s:%d:" % (fname, lineno) |
|
293 | print "%s:%d:" % (fname, lineno) | |
293 | print " > %s" % line |
|
294 | print " > %s" % line | |
294 | self._lastseen = msgid |
|
295 | self._lastseen = msgid | |
295 | print " " + msg |
|
296 | print " " + msg | |
296 |
|
297 | |||
297 | _defaultlogger = norepeatlogger() |
|
298 | _defaultlogger = norepeatlogger() | |
298 |
|
299 | |||
299 | def getblame(f): |
|
300 | def getblame(f): | |
300 | lines = [] |
|
301 | lines = [] | |
301 | for l in os.popen('hg annotate -un %s' % f): |
|
302 | for l in os.popen('hg annotate -un %s' % f): | |
302 | start, line = l.split(':', 1) |
|
303 | start, line = l.split(':', 1) | |
303 | user, rev = start.split() |
|
304 | user, rev = start.split() | |
304 | lines.append((line[1:-1], user, rev)) |
|
305 | lines.append((line[1:-1], user, rev)) | |
305 | return lines |
|
306 | return lines | |
306 |
|
307 | |||
307 | def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False, |
|
308 | def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False, | |
308 | blame=False, debug=False, lineno=True): |
|
309 | blame=False, debug=False, lineno=True): | |
309 | """checks style and portability of a given file |
|
310 | """checks style and portability of a given file | |
310 |
|
311 | |||
311 | :f: filepath |
|
312 | :f: filepath | |
312 | :logfunc: function used to report error |
|
313 | :logfunc: function used to report error | |
313 | logfunc(filename, linenumber, linecontent, errormessage) |
|
314 | logfunc(filename, linenumber, linecontent, errormessage) | |
314 | :maxerr: number of error to display before arborting. |
|
315 | :maxerr: number of error to display before arborting. | |
315 | Set to false (default) to report all errors |
|
316 | Set to false (default) to report all errors | |
316 |
|
317 | |||
317 | return True if no error is found, False otherwise. |
|
318 | return True if no error is found, False otherwise. | |
318 | """ |
|
319 | """ | |
319 | blamecache = None |
|
320 | blamecache = None | |
320 | result = True |
|
321 | result = True | |
321 | for name, match, filters, pats in checks: |
|
322 | for name, match, filters, pats in checks: | |
322 | if debug: |
|
323 | if debug: | |
323 | print name, f |
|
324 | print name, f | |
324 | fc = 0 |
|
325 | fc = 0 | |
325 | if not re.match(match, f): |
|
326 | if not re.match(match, f): | |
326 | if debug: |
|
327 | if debug: | |
327 | print "Skipping %s for %s it doesn't match %s" % ( |
|
328 | print "Skipping %s for %s it doesn't match %s" % ( | |
328 | name, match, f) |
|
329 | name, match, f) | |
329 | continue |
|
330 | continue | |
330 | fp = open(f) |
|
331 | fp = open(f) | |
331 | pre = post = fp.read() |
|
332 | pre = post = fp.read() | |
332 | fp.close() |
|
333 | fp.close() | |
333 | if "no-" + "check-code" in pre: |
|
334 | if "no-" + "check-code" in pre: | |
334 | if debug: |
|
335 | if debug: | |
335 | print "Skipping %s for %s it has no- and check-code" % ( |
|
336 | print "Skipping %s for %s it has no- and check-code" % ( | |
336 | name, f) |
|
337 | name, f) | |
337 | break |
|
338 | break | |
338 | for p, r in filters: |
|
339 | for p, r in filters: | |
339 | post = re.sub(p, r, post) |
|
340 | post = re.sub(p, r, post) | |
340 | if warnings: |
|
341 | if warnings: | |
341 | pats = pats[0] + pats[1] |
|
342 | pats = pats[0] + pats[1] | |
342 | else: |
|
343 | else: | |
343 | pats = pats[0] |
|
344 | pats = pats[0] | |
344 | # print post # uncomment to show filtered version |
|
345 | # print post # uncomment to show filtered version | |
345 |
|
346 | |||
346 | if debug: |
|
347 | if debug: | |
347 | print "Checking %s for %s" % (name, f) |
|
348 | print "Checking %s for %s" % (name, f) | |
348 |
|
349 | |||
349 | prelines = None |
|
350 | prelines = None | |
350 | errors = [] |
|
351 | errors = [] | |
351 | for p, msg in pats: |
|
352 | for p, msg in pats: | |
352 | # fix-up regexes for multiline searches |
|
353 | # fix-up regexes for multiline searches | |
353 | po = p |
|
354 | po = p | |
354 | # \s doesn't match \n |
|
355 | # \s doesn't match \n | |
355 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) |
|
356 | p = re.sub(r'(?<!\\)\\s', r'[ \\t]', p) | |
356 | # [^...] doesn't match newline |
|
357 | # [^...] doesn't match newline | |
357 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) |
|
358 | p = re.sub(r'(?<!\\)\[\^', r'[^\\n', p) | |
358 |
|
359 | |||
359 | #print po, '=>', p |
|
360 | #print po, '=>', p | |
360 |
|
361 | |||
361 | pos = 0 |
|
362 | pos = 0 | |
362 | n = 0 |
|
363 | n = 0 | |
363 | for m in re.finditer(p, post, re.MULTILINE): |
|
364 | for m in re.finditer(p, post, re.MULTILINE): | |
364 | if prelines is None: |
|
365 | if prelines is None: | |
365 | prelines = pre.splitlines() |
|
366 | prelines = pre.splitlines() | |
366 | postlines = post.splitlines(True) |
|
367 | postlines = post.splitlines(True) | |
367 |
|
368 | |||
368 | start = m.start() |
|
369 | start = m.start() | |
369 | while n < len(postlines): |
|
370 | while n < len(postlines): | |
370 | step = len(postlines[n]) |
|
371 | step = len(postlines[n]) | |
371 | if pos + step > start: |
|
372 | if pos + step > start: | |
372 | break |
|
373 | break | |
373 | pos += step |
|
374 | pos += step | |
374 | n += 1 |
|
375 | n += 1 | |
375 | l = prelines[n] |
|
376 | l = prelines[n] | |
376 |
|
377 | |||
377 | if "check-code" + "-ignore" in l: |
|
378 | if "check-code" + "-ignore" in l: | |
378 | if debug: |
|
379 | if debug: | |
379 | print "Skipping %s for %s:%s (check-code -ignore)" % ( |
|
380 | print "Skipping %s for %s:%s (check-code -ignore)" % ( | |
380 | name, f, n) |
|
381 | name, f, n) | |
381 | continue |
|
382 | continue | |
382 | bd = "" |
|
383 | bd = "" | |
383 | if blame: |
|
384 | if blame: | |
384 | bd = 'working directory' |
|
385 | bd = 'working directory' | |
385 | if not blamecache: |
|
386 | if not blamecache: | |
386 | blamecache = getblame(f) |
|
387 | blamecache = getblame(f) | |
387 | if n < len(blamecache): |
|
388 | if n < len(blamecache): | |
388 | bl, bu, br = blamecache[n] |
|
389 | bl, bu, br = blamecache[n] | |
389 | if bl == l: |
|
390 | if bl == l: | |
390 | bd = '%s@%s' % (bu, br) |
|
391 | bd = '%s@%s' % (bu, br) | |
391 | errors.append((f, lineno and n + 1, l, msg, bd)) |
|
392 | errors.append((f, lineno and n + 1, l, msg, bd)) | |
392 | result = False |
|
393 | result = False | |
393 |
|
394 | |||
394 | errors.sort() |
|
395 | errors.sort() | |
395 | for e in errors: |
|
396 | for e in errors: | |
396 | logfunc(*e) |
|
397 | logfunc(*e) | |
397 | fc += 1 |
|
398 | fc += 1 | |
398 | if maxerr and fc >= maxerr: |
|
399 | if maxerr and fc >= maxerr: | |
399 | print " (too many errors, giving up)" |
|
400 | print " (too many errors, giving up)" | |
400 | break |
|
401 | break | |
401 |
|
402 | |||
402 | return result |
|
403 | return result | |
403 |
|
404 | |||
404 | if __name__ == "__main__": |
|
405 | if __name__ == "__main__": | |
405 | parser = optparse.OptionParser("%prog [options] [files]") |
|
406 | parser = optparse.OptionParser("%prog [options] [files]") | |
406 | parser.add_option("-w", "--warnings", action="store_true", |
|
407 | parser.add_option("-w", "--warnings", action="store_true", | |
407 | help="include warning-level checks") |
|
408 | help="include warning-level checks") | |
408 | parser.add_option("-p", "--per-file", type="int", |
|
409 | parser.add_option("-p", "--per-file", type="int", | |
409 | help="max warnings per file") |
|
410 | help="max warnings per file") | |
410 | parser.add_option("-b", "--blame", action="store_true", |
|
411 | parser.add_option("-b", "--blame", action="store_true", | |
411 | help="use annotate to generate blame info") |
|
412 | help="use annotate to generate blame info") | |
412 | parser.add_option("", "--debug", action="store_true", |
|
413 | parser.add_option("", "--debug", action="store_true", | |
413 | help="show debug information") |
|
414 | help="show debug information") | |
414 | parser.add_option("", "--nolineno", action="store_false", |
|
415 | parser.add_option("", "--nolineno", action="store_false", | |
415 | dest='lineno', help="don't show line numbers") |
|
416 | dest='lineno', help="don't show line numbers") | |
416 |
|
417 | |||
417 | parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, |
|
418 | parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, | |
418 | lineno=True) |
|
419 | lineno=True) | |
419 | (options, args) = parser.parse_args() |
|
420 | (options, args) = parser.parse_args() | |
420 |
|
421 | |||
421 | if len(args) == 0: |
|
422 | if len(args) == 0: | |
422 | check = glob.glob("*") |
|
423 | check = glob.glob("*") | |
423 | else: |
|
424 | else: | |
424 | check = args |
|
425 | check = args | |
425 |
|
426 | |||
426 | ret = 0 |
|
427 | ret = 0 | |
427 | for f in check: |
|
428 | for f in check: | |
428 | if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, |
|
429 | if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, | |
429 | blame=options.blame, debug=options.debug, |
|
430 | blame=options.blame, debug=options.debug, | |
430 | lineno=options.lineno): |
|
431 | lineno=options.lineno): | |
431 | ret = 1 |
|
432 | ret = 1 | |
432 | sys.exit(ret) |
|
433 | sys.exit(ret) |
@@ -1,1108 +1,1112 b'' | |||||
1 | $ "$TESTDIR/hghave" execbit || exit 80 |
|
1 | $ "$TESTDIR/hghave" execbit || exit 80 | |
2 |
|
2 | |||
3 | Set up a repo |
|
3 | Set up a repo | |
4 |
|
4 | |||
5 | $ echo "[ui]" >> $HGRCPATH |
|
5 | $ echo "[ui]" >> $HGRCPATH | |
6 | $ echo "interactive=true" >> $HGRCPATH |
|
6 | $ echo "interactive=true" >> $HGRCPATH | |
7 | $ echo "[extensions]" >> $HGRCPATH |
|
7 | $ echo "[extensions]" >> $HGRCPATH | |
8 | $ echo "record=" >> $HGRCPATH |
|
8 | $ echo "record=" >> $HGRCPATH | |
9 |
|
9 | |||
10 | $ hg init a |
|
10 | $ hg init a | |
11 | $ cd a |
|
11 | $ cd a | |
12 |
|
12 | |||
13 | Select no files |
|
13 | Select no files | |
14 |
|
14 | |||
15 | $ touch empty-rw |
|
15 | $ touch empty-rw | |
16 | $ hg add empty-rw |
|
16 | $ hg add empty-rw | |
17 |
|
17 | |||
18 | $ hg record empty-rw<<EOF |
|
18 | $ hg record empty-rw<<EOF | |
19 | > n |
|
19 | > n | |
20 | > EOF |
|
20 | > EOF | |
21 | diff --git a/empty-rw b/empty-rw |
|
21 | diff --git a/empty-rw b/empty-rw | |
22 | new file mode 100644 |
|
22 | new file mode 100644 | |
23 | examine changes to 'empty-rw'? [Ynesfdaq?] |
|
23 | examine changes to 'empty-rw'? [Ynesfdaq?] | |
24 | no changes to record |
|
24 | no changes to record | |
25 |
|
25 | |||
26 | $ hg tip -p |
|
26 | $ hg tip -p | |
27 | changeset: -1:000000000000 |
|
27 | changeset: -1:000000000000 | |
28 | tag: tip |
|
28 | tag: tip | |
29 | user: |
|
29 | user: | |
30 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
30 | date: Thu Jan 01 00:00:00 1970 +0000 | |
31 |
|
31 | |||
32 |
|
32 | |||
33 |
|
33 | |||
34 | Select files but no hunks |
|
34 | Select files but no hunks | |
35 |
|
35 | |||
36 | $ hg record empty-rw<<EOF |
|
36 | $ hg record empty-rw<<EOF | |
37 | > y |
|
37 | > y | |
38 | > n |
|
38 | > n | |
39 | > EOF |
|
39 | > EOF | |
40 | diff --git a/empty-rw b/empty-rw |
|
40 | diff --git a/empty-rw b/empty-rw | |
41 | new file mode 100644 |
|
41 | new file mode 100644 | |
42 | examine changes to 'empty-rw'? [Ynesfdaq?] |
|
42 | examine changes to 'empty-rw'? [Ynesfdaq?] | |
43 | abort: empty commit message |
|
43 | abort: empty commit message | |
44 | [255] |
|
44 | [255] | |
45 |
|
45 | |||
46 | $ hg tip -p |
|
46 | $ hg tip -p | |
47 | changeset: -1:000000000000 |
|
47 | changeset: -1:000000000000 | |
48 | tag: tip |
|
48 | tag: tip | |
49 | user: |
|
49 | user: | |
50 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
50 | date: Thu Jan 01 00:00:00 1970 +0000 | |
51 |
|
51 | |||
52 |
|
52 | |||
53 |
|
53 | |||
54 | Record empty file |
|
54 | Record empty file | |
55 |
|
55 | |||
56 | $ hg record -d '0 0' -m empty empty-rw<<EOF |
|
56 | $ hg record -d '0 0' -m empty empty-rw<<EOF | |
57 | > y |
|
57 | > y | |
58 | > y |
|
58 | > y | |
59 | > EOF |
|
59 | > EOF | |
60 | diff --git a/empty-rw b/empty-rw |
|
60 | diff --git a/empty-rw b/empty-rw | |
61 | new file mode 100644 |
|
61 | new file mode 100644 | |
62 | examine changes to 'empty-rw'? [Ynesfdaq?] |
|
62 | examine changes to 'empty-rw'? [Ynesfdaq?] | |
63 |
|
63 | |||
64 | $ hg tip -p |
|
64 | $ hg tip -p | |
65 | changeset: 0:c0708cf4e46e |
|
65 | changeset: 0:c0708cf4e46e | |
66 | tag: tip |
|
66 | tag: tip | |
67 | user: test |
|
67 | user: test | |
68 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
68 | date: Thu Jan 01 00:00:00 1970 +0000 | |
69 | summary: empty |
|
69 | summary: empty | |
70 |
|
70 | |||
71 |
|
71 | |||
72 |
|
72 | |||
73 | Summary shows we updated to the new cset |
|
73 | Summary shows we updated to the new cset | |
74 |
|
74 | |||
75 | $ hg summary |
|
75 | $ hg summary | |
76 | parent: 0:c0708cf4e46e tip |
|
76 | parent: 0:c0708cf4e46e tip | |
77 | empty |
|
77 | empty | |
78 | branch: default |
|
78 | branch: default | |
79 | commit: (clean) |
|
79 | commit: (clean) | |
80 | update: (current) |
|
80 | update: (current) | |
81 |
|
81 | |||
82 | Rename empty file |
|
82 | Rename empty file | |
83 |
|
83 | |||
84 | $ hg mv empty-rw empty-rename |
|
84 | $ hg mv empty-rw empty-rename | |
85 | $ hg record -d '1 0' -m rename<<EOF |
|
85 | $ hg record -d '1 0' -m rename<<EOF | |
86 | > y |
|
86 | > y | |
87 | > EOF |
|
87 | > EOF | |
88 | diff --git a/empty-rw b/empty-rename |
|
88 | diff --git a/empty-rw b/empty-rename | |
89 | rename from empty-rw |
|
89 | rename from empty-rw | |
90 | rename to empty-rename |
|
90 | rename to empty-rename | |
91 | examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] |
|
91 | examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] | |
92 |
|
92 | |||
93 | $ hg tip -p |
|
93 | $ hg tip -p | |
94 | changeset: 1:d695e8dcb197 |
|
94 | changeset: 1:d695e8dcb197 | |
95 | tag: tip |
|
95 | tag: tip | |
96 | user: test |
|
96 | user: test | |
97 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
97 | date: Thu Jan 01 00:00:01 1970 +0000 | |
98 | summary: rename |
|
98 | summary: rename | |
99 |
|
99 | |||
100 |
|
100 | |||
101 |
|
101 | |||
102 | Copy empty file |
|
102 | Copy empty file | |
103 |
|
103 | |||
104 | $ hg cp empty-rename empty-copy |
|
104 | $ hg cp empty-rename empty-copy | |
105 | $ hg record -d '2 0' -m copy<<EOF |
|
105 | $ hg record -d '2 0' -m copy<<EOF | |
106 | > y |
|
106 | > y | |
107 | > EOF |
|
107 | > EOF | |
108 | diff --git a/empty-rename b/empty-copy |
|
108 | diff --git a/empty-rename b/empty-copy | |
109 | copy from empty-rename |
|
109 | copy from empty-rename | |
110 | copy to empty-copy |
|
110 | copy to empty-copy | |
111 | examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] |
|
111 | examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] | |
112 |
|
112 | |||
113 | $ hg tip -p |
|
113 | $ hg tip -p | |
114 | changeset: 2:1d4b90bea524 |
|
114 | changeset: 2:1d4b90bea524 | |
115 | tag: tip |
|
115 | tag: tip | |
116 | user: test |
|
116 | user: test | |
117 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
117 | date: Thu Jan 01 00:00:02 1970 +0000 | |
118 | summary: copy |
|
118 | summary: copy | |
119 |
|
119 | |||
120 |
|
120 | |||
121 |
|
121 | |||
122 | Delete empty file |
|
122 | Delete empty file | |
123 |
|
123 | |||
124 | $ hg rm empty-copy |
|
124 | $ hg rm empty-copy | |
125 | $ hg record -d '3 0' -m delete<<EOF |
|
125 | $ hg record -d '3 0' -m delete<<EOF | |
126 | > y |
|
126 | > y | |
127 | > EOF |
|
127 | > EOF | |
128 | diff --git a/empty-copy b/empty-copy |
|
128 | diff --git a/empty-copy b/empty-copy | |
129 | deleted file mode 100644 |
|
129 | deleted file mode 100644 | |
130 | examine changes to 'empty-copy'? [Ynesfdaq?] |
|
130 | examine changes to 'empty-copy'? [Ynesfdaq?] | |
131 |
|
131 | |||
132 | $ hg tip -p |
|
132 | $ hg tip -p | |
133 | changeset: 3:b39a238f01a1 |
|
133 | changeset: 3:b39a238f01a1 | |
134 | tag: tip |
|
134 | tag: tip | |
135 | user: test |
|
135 | user: test | |
136 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
136 | date: Thu Jan 01 00:00:03 1970 +0000 | |
137 | summary: delete |
|
137 | summary: delete | |
138 |
|
138 | |||
139 |
|
139 | |||
140 |
|
140 | |||
141 | Add binary file |
|
141 | Add binary file | |
142 |
|
142 | |||
143 | $ hg bundle --base -2 tip.bundle |
|
143 | $ hg bundle --base -2 tip.bundle | |
144 | 1 changesets found |
|
144 | 1 changesets found | |
145 | $ hg add tip.bundle |
|
145 | $ hg add tip.bundle | |
146 | $ hg record -d '4 0' -m binary<<EOF |
|
146 | $ hg record -d '4 0' -m binary<<EOF | |
147 | > y |
|
147 | > y | |
148 | > EOF |
|
148 | > EOF | |
149 | diff --git a/tip.bundle b/tip.bundle |
|
149 | diff --git a/tip.bundle b/tip.bundle | |
150 | new file mode 100644 |
|
150 | new file mode 100644 | |
151 | this is a binary file |
|
151 | this is a binary file | |
152 | examine changes to 'tip.bundle'? [Ynesfdaq?] |
|
152 | examine changes to 'tip.bundle'? [Ynesfdaq?] | |
153 |
|
153 | |||
154 | $ hg tip -p |
|
154 | $ hg tip -p | |
155 | changeset: 4:ad816da3711e |
|
155 | changeset: 4:ad816da3711e | |
156 | tag: tip |
|
156 | tag: tip | |
157 | user: test |
|
157 | user: test | |
158 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
158 | date: Thu Jan 01 00:00:04 1970 +0000 | |
159 | summary: binary |
|
159 | summary: binary | |
160 |
|
160 | |||
161 | diff -r b39a238f01a1 -r ad816da3711e tip.bundle |
|
161 | diff -r b39a238f01a1 -r ad816da3711e tip.bundle | |
162 | Binary file tip.bundle has changed |
|
162 | Binary file tip.bundle has changed | |
163 |
|
163 | |||
164 |
|
164 | |||
165 | Change binary file |
|
165 | Change binary file | |
166 |
|
166 | |||
167 | $ hg bundle --base -2 tip.bundle |
|
167 | $ hg bundle --base -2 tip.bundle | |
168 | 1 changesets found |
|
168 | 1 changesets found | |
169 | $ hg record -d '5 0' -m binary-change<<EOF |
|
169 | $ hg record -d '5 0' -m binary-change<<EOF | |
170 | > y |
|
170 | > y | |
171 | > EOF |
|
171 | > EOF | |
172 | diff --git a/tip.bundle b/tip.bundle |
|
172 | diff --git a/tip.bundle b/tip.bundle | |
173 | this modifies a binary file (all or nothing) |
|
173 | this modifies a binary file (all or nothing) | |
174 | examine changes to 'tip.bundle'? [Ynesfdaq?] |
|
174 | examine changes to 'tip.bundle'? [Ynesfdaq?] | |
175 |
|
175 | |||
176 | $ hg tip -p |
|
176 | $ hg tip -p | |
177 | changeset: 5:dccd6f3eb485 |
|
177 | changeset: 5:dccd6f3eb485 | |
178 | tag: tip |
|
178 | tag: tip | |
179 | user: test |
|
179 | user: test | |
180 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
180 | date: Thu Jan 01 00:00:05 1970 +0000 | |
181 | summary: binary-change |
|
181 | summary: binary-change | |
182 |
|
182 | |||
183 | diff -r ad816da3711e -r dccd6f3eb485 tip.bundle |
|
183 | diff -r ad816da3711e -r dccd6f3eb485 tip.bundle | |
184 | Binary file tip.bundle has changed |
|
184 | Binary file tip.bundle has changed | |
185 |
|
185 | |||
186 |
|
186 | |||
187 | Rename and change binary file |
|
187 | Rename and change binary file | |
188 |
|
188 | |||
189 | $ hg mv tip.bundle top.bundle |
|
189 | $ hg mv tip.bundle top.bundle | |
190 | $ hg bundle --base -2 top.bundle |
|
190 | $ hg bundle --base -2 top.bundle | |
191 | 1 changesets found |
|
191 | 1 changesets found | |
192 | $ hg record -d '6 0' -m binary-change-rename<<EOF |
|
192 | $ hg record -d '6 0' -m binary-change-rename<<EOF | |
193 | > y |
|
193 | > y | |
194 | > EOF |
|
194 | > EOF | |
195 | diff --git a/tip.bundle b/top.bundle |
|
195 | diff --git a/tip.bundle b/top.bundle | |
196 | rename from tip.bundle |
|
196 | rename from tip.bundle | |
197 | rename to top.bundle |
|
197 | rename to top.bundle | |
198 | this modifies a binary file (all or nothing) |
|
198 | this modifies a binary file (all or nothing) | |
199 | examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] |
|
199 | examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] | |
200 |
|
200 | |||
201 | $ hg tip -p |
|
201 | $ hg tip -p | |
202 | changeset: 6:7fa44105f5b3 |
|
202 | changeset: 6:7fa44105f5b3 | |
203 | tag: tip |
|
203 | tag: tip | |
204 | user: test |
|
204 | user: test | |
205 | date: Thu Jan 01 00:00:06 1970 +0000 |
|
205 | date: Thu Jan 01 00:00:06 1970 +0000 | |
206 | summary: binary-change-rename |
|
206 | summary: binary-change-rename | |
207 |
|
207 | |||
208 | diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle |
|
208 | diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle | |
209 | Binary file tip.bundle has changed |
|
209 | Binary file tip.bundle has changed | |
210 | diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle |
|
210 | diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle | |
211 | Binary file top.bundle has changed |
|
211 | Binary file top.bundle has changed | |
212 |
|
212 | |||
213 |
|
213 | |||
214 | Add plain file |
|
214 | Add plain file | |
215 |
|
215 | |||
216 | $ for i in 1 2 3 4 5 6 7 8 9 10; do |
|
216 | $ for i in 1 2 3 4 5 6 7 8 9 10; do | |
217 | > echo $i >> plain |
|
217 | > echo $i >> plain | |
218 | > done |
|
218 | > done | |
219 |
|
219 | |||
220 | $ hg add plain |
|
220 | $ hg add plain | |
221 | $ hg record -d '7 0' -m plain plain<<EOF |
|
221 | $ hg record -d '7 0' -m plain plain<<EOF | |
222 | > y |
|
222 | > y | |
223 | > y |
|
223 | > y | |
224 | > EOF |
|
224 | > EOF | |
225 | diff --git a/plain b/plain |
|
225 | diff --git a/plain b/plain | |
226 | new file mode 100644 |
|
226 | new file mode 100644 | |
227 | examine changes to 'plain'? [Ynesfdaq?] |
|
227 | examine changes to 'plain'? [Ynesfdaq?] | |
228 |
|
228 | |||
229 | $ hg tip -p |
|
229 | $ hg tip -p | |
230 | changeset: 7:11fb457c1be4 |
|
230 | changeset: 7:11fb457c1be4 | |
231 | tag: tip |
|
231 | tag: tip | |
232 | user: test |
|
232 | user: test | |
233 | date: Thu Jan 01 00:00:07 1970 +0000 |
|
233 | date: Thu Jan 01 00:00:07 1970 +0000 | |
234 | summary: plain |
|
234 | summary: plain | |
235 |
|
235 | |||
236 | diff -r 7fa44105f5b3 -r 11fb457c1be4 plain |
|
236 | diff -r 7fa44105f5b3 -r 11fb457c1be4 plain | |
237 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
237 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
238 | +++ b/plain Thu Jan 01 00:00:07 1970 +0000 |
|
238 | +++ b/plain Thu Jan 01 00:00:07 1970 +0000 | |
239 | @@ -0,0 +1,10 @@ |
|
239 | @@ -0,0 +1,10 @@ | |
240 | +1 |
|
240 | +1 | |
241 | +2 |
|
241 | +2 | |
242 | +3 |
|
242 | +3 | |
243 | +4 |
|
243 | +4 | |
244 | +5 |
|
244 | +5 | |
245 | +6 |
|
245 | +6 | |
246 | +7 |
|
246 | +7 | |
247 | +8 |
|
247 | +8 | |
248 | +9 |
|
248 | +9 | |
249 | +10 |
|
249 | +10 | |
250 |
|
250 | |||
251 |
|
251 | |||
252 | Modify end of plain file |
|
252 | Modify end of plain file | |
253 |
|
253 | |||
254 | $ echo 11 >> plain |
|
254 | $ echo 11 >> plain | |
255 | $ hg record -d '8 0' -m end plain <<EOF |
|
255 | $ hg record -d '8 0' -m end plain <<EOF | |
256 | > y |
|
256 | > y | |
257 | > y |
|
257 | > y | |
258 | > EOF |
|
258 | > EOF | |
259 | diff --git a/plain b/plain |
|
259 | diff --git a/plain b/plain | |
260 | 1 hunks, 1 lines changed |
|
260 | 1 hunks, 1 lines changed | |
261 | examine changes to 'plain'? [Ynesfdaq?] |
|
261 | examine changes to 'plain'? [Ynesfdaq?] | |
262 | @@ -8,3 +8,4 @@ |
|
262 | @@ -8,3 +8,4 @@ | |
263 | 8 |
|
263 | 8 | |
264 | 9 |
|
264 | 9 | |
265 | 10 |
|
265 | 10 | |
266 | +11 |
|
266 | +11 | |
267 | record this change to 'plain'? [Ynesfdaq?] |
|
267 | record this change to 'plain'? [Ynesfdaq?] | |
268 |
|
268 | |||
269 | Modify end of plain file, no EOL |
|
269 | Modify end of plain file, no EOL | |
270 |
|
270 | |||
271 | $ hg tip --template '{node}' >> plain |
|
271 | $ hg tip --template '{node}' >> plain | |
272 | $ hg record -d '9 0' -m noeol plain <<EOF |
|
272 | $ hg record -d '9 0' -m noeol plain <<EOF | |
273 | > y |
|
273 | > y | |
274 | > y |
|
274 | > y | |
275 | > EOF |
|
275 | > EOF | |
276 | diff --git a/plain b/plain |
|
276 | diff --git a/plain b/plain | |
277 | 1 hunks, 1 lines changed |
|
277 | 1 hunks, 1 lines changed | |
278 | examine changes to 'plain'? [Ynesfdaq?] |
|
278 | examine changes to 'plain'? [Ynesfdaq?] | |
279 | @@ -9,3 +9,4 @@ |
|
279 | @@ -9,3 +9,4 @@ | |
280 | 9 |
|
280 | 9 | |
281 | 10 |
|
281 | 10 | |
282 | 11 |
|
282 | 11 | |
283 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
283 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
284 | \ No newline at end of file |
|
284 | \ No newline at end of file | |
285 | record this change to 'plain'? [Ynesfdaq?] |
|
285 | record this change to 'plain'? [Ynesfdaq?] | |
286 |
|
286 | |||
287 | Modify end of plain file, add EOL |
|
287 | Modify end of plain file, add EOL | |
288 |
|
288 | |||
289 | $ echo >> plain |
|
289 | $ echo >> plain | |
290 | $ echo 1 > plain2 |
|
290 | $ echo 1 > plain2 | |
291 | $ hg add plain2 |
|
291 | $ hg add plain2 | |
292 | $ hg record -d '10 0' -m eol plain plain2 <<EOF |
|
292 | $ hg record -d '10 0' -m eol plain plain2 <<EOF | |
293 | > y |
|
293 | > y | |
294 | > y |
|
294 | > y | |
295 | > y |
|
295 | > y | |
296 | > EOF |
|
296 | > EOF | |
297 | diff --git a/plain b/plain |
|
297 | diff --git a/plain b/plain | |
298 | 1 hunks, 1 lines changed |
|
298 | 1 hunks, 1 lines changed | |
299 | examine changes to 'plain'? [Ynesfdaq?] |
|
299 | examine changes to 'plain'? [Ynesfdaq?] | |
300 | @@ -9,4 +9,4 @@ |
|
300 | @@ -9,4 +9,4 @@ | |
301 | 9 |
|
301 | 9 | |
302 | 10 |
|
302 | 10 | |
303 | 11 |
|
303 | 11 | |
304 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
304 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
305 | \ No newline at end of file |
|
305 | \ No newline at end of file | |
306 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
306 | +7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
307 | record change 1/2 to 'plain'? [Ynesfdaq?] |
|
307 | record change 1/2 to 'plain'? [Ynesfdaq?] | |
308 | diff --git a/plain2 b/plain2 |
|
308 | diff --git a/plain2 b/plain2 | |
309 | new file mode 100644 |
|
309 | new file mode 100644 | |
310 | examine changes to 'plain2'? [Ynesfdaq?] |
|
310 | examine changes to 'plain2'? [Ynesfdaq?] | |
311 |
|
311 | |||
312 | Modify beginning, trim end, record both, add another file to test |
|
312 | Modify beginning, trim end, record both, add another file to test | |
313 | changes numbering |
|
313 | changes numbering | |
314 |
|
314 | |||
315 | $ rm plain |
|
315 | $ rm plain | |
316 | $ for i in 2 2 3 4 5 6 7 8 9 10; do |
|
316 | $ for i in 2 2 3 4 5 6 7 8 9 10; do | |
317 | > echo $i >> plain |
|
317 | > echo $i >> plain | |
318 | > done |
|
318 | > done | |
319 | $ echo 2 >> plain2 |
|
319 | $ echo 2 >> plain2 | |
320 |
|
320 | |||
321 | $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF |
|
321 | $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF | |
322 | > y |
|
322 | > y | |
323 | > y |
|
323 | > y | |
324 | > y |
|
324 | > y | |
325 | > y |
|
325 | > y | |
326 | > y |
|
326 | > y | |
327 | > EOF |
|
327 | > EOF | |
328 | diff --git a/plain b/plain |
|
328 | diff --git a/plain b/plain | |
329 | 2 hunks, 3 lines changed |
|
329 | 2 hunks, 3 lines changed | |
330 | examine changes to 'plain'? [Ynesfdaq?] |
|
330 | examine changes to 'plain'? [Ynesfdaq?] | |
331 | @@ -1,4 +1,4 @@ |
|
331 | @@ -1,4 +1,4 @@ | |
332 | -1 |
|
332 | -1 | |
333 | +2 |
|
333 | +2 | |
334 | 2 |
|
334 | 2 | |
335 | 3 |
|
335 | 3 | |
336 | 4 |
|
336 | 4 | |
337 | record change 1/3 to 'plain'? [Ynesfdaq?] |
|
337 | record change 1/3 to 'plain'? [Ynesfdaq?] | |
338 | @@ -8,5 +8,3 @@ |
|
338 | @@ -8,5 +8,3 @@ | |
339 | 8 |
|
339 | 8 | |
340 | 9 |
|
340 | 9 | |
341 | 10 |
|
341 | 10 | |
342 | -11 |
|
342 | -11 | |
343 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
343 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
344 | record change 2/3 to 'plain'? [Ynesfdaq?] |
|
344 | record change 2/3 to 'plain'? [Ynesfdaq?] | |
345 | diff --git a/plain2 b/plain2 |
|
345 | diff --git a/plain2 b/plain2 | |
346 | 1 hunks, 1 lines changed |
|
346 | 1 hunks, 1 lines changed | |
347 | examine changes to 'plain2'? [Ynesfdaq?] |
|
347 | examine changes to 'plain2'? [Ynesfdaq?] | |
348 | @@ -1,1 +1,2 @@ |
|
348 | @@ -1,1 +1,2 @@ | |
349 | 1 |
|
349 | 1 | |
350 | +2 |
|
350 | +2 | |
351 | record change 3/3 to 'plain2'? [Ynesfdaq?] |
|
351 | record change 3/3 to 'plain2'? [Ynesfdaq?] | |
352 |
|
352 | |||
353 | $ hg tip -p |
|
353 | $ hg tip -p | |
354 | changeset: 11:21df83db12b8 |
|
354 | changeset: 11:21df83db12b8 | |
355 | tag: tip |
|
355 | tag: tip | |
356 | user: test |
|
356 | user: test | |
357 | date: Thu Jan 01 00:00:10 1970 +0000 |
|
357 | date: Thu Jan 01 00:00:10 1970 +0000 | |
358 | summary: begin-and-end |
|
358 | summary: begin-and-end | |
359 |
|
359 | |||
360 | diff -r ddb8b281c3ff -r 21df83db12b8 plain |
|
360 | diff -r ddb8b281c3ff -r 21df83db12b8 plain | |
361 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
361 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 | |
362 | +++ b/plain Thu Jan 01 00:00:10 1970 +0000 |
|
362 | +++ b/plain Thu Jan 01 00:00:10 1970 +0000 | |
363 | @@ -1,4 +1,4 @@ |
|
363 | @@ -1,4 +1,4 @@ | |
364 | -1 |
|
364 | -1 | |
365 | +2 |
|
365 | +2 | |
366 | 2 |
|
366 | 2 | |
367 | 3 |
|
367 | 3 | |
368 | 4 |
|
368 | 4 | |
369 | @@ -8,5 +8,3 @@ |
|
369 | @@ -8,5 +8,3 @@ | |
370 | 8 |
|
370 | 8 | |
371 | 9 |
|
371 | 9 | |
372 | 10 |
|
372 | 10 | |
373 | -11 |
|
373 | -11 | |
374 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 |
|
374 | -7264f99c5f5ff3261504828afa4fb4d406c3af54 | |
375 | diff -r ddb8b281c3ff -r 21df83db12b8 plain2 |
|
375 | diff -r ddb8b281c3ff -r 21df83db12b8 plain2 | |
376 | --- a/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
376 | --- a/plain2 Thu Jan 01 00:00:10 1970 +0000 | |
377 | +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000 |
|
377 | +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000 | |
378 | @@ -1,1 +1,2 @@ |
|
378 | @@ -1,1 +1,2 @@ | |
379 | 1 |
|
379 | 1 | |
380 | +2 |
|
380 | +2 | |
381 |
|
381 | |||
382 |
|
382 | |||
383 | Trim beginning, modify end |
|
383 | Trim beginning, modify end | |
384 |
|
384 | |||
385 | $ rm plain |
|
385 | $ rm plain | |
386 | > for i in 4 5 6 7 8 9 10.new; do |
|
386 | > for i in 4 5 6 7 8 9 10.new; do | |
387 | > echo $i >> plain |
|
387 | > echo $i >> plain | |
388 | > done |
|
388 | > done | |
389 |
|
389 | |||
390 | Record end |
|
390 | Record end | |
391 |
|
391 | |||
392 | $ hg record -d '11 0' -m end-only plain <<EOF |
|
392 | $ hg record -d '11 0' -m end-only plain <<EOF | |
393 | > y |
|
393 | > y | |
394 | > n |
|
394 | > n | |
395 | > y |
|
395 | > y | |
396 | > EOF |
|
396 | > EOF | |
397 | diff --git a/plain b/plain |
|
397 | diff --git a/plain b/plain | |
398 | 2 hunks, 4 lines changed |
|
398 | 2 hunks, 4 lines changed | |
399 | examine changes to 'plain'? [Ynesfdaq?] |
|
399 | examine changes to 'plain'? [Ynesfdaq?] | |
400 | @@ -1,9 +1,6 @@ |
|
400 | @@ -1,9 +1,6 @@ | |
401 | -2 |
|
401 | -2 | |
402 | -2 |
|
402 | -2 | |
403 | -3 |
|
403 | -3 | |
404 | 4 |
|
404 | 4 | |
405 | 5 |
|
405 | 5 | |
406 | 6 |
|
406 | 6 | |
407 | 7 |
|
407 | 7 | |
408 | 8 |
|
408 | 8 | |
409 | 9 |
|
409 | 9 | |
410 | record change 1/2 to 'plain'? [Ynesfdaq?] |
|
410 | record change 1/2 to 'plain'? [Ynesfdaq?] | |
411 | @@ -4,7 +1,7 @@ |
|
411 | @@ -4,7 +1,7 @@ | |
412 | 4 |
|
412 | 4 | |
413 | 5 |
|
413 | 5 | |
414 | 6 |
|
414 | 6 | |
415 | 7 |
|
415 | 7 | |
416 | 8 |
|
416 | 8 | |
417 | 9 |
|
417 | 9 | |
418 | -10 |
|
418 | -10 | |
419 | +10.new |
|
419 | +10.new | |
420 | record change 2/2 to 'plain'? [Ynesfdaq?] |
|
420 | record change 2/2 to 'plain'? [Ynesfdaq?] | |
421 |
|
421 | |||
422 | $ hg tip -p |
|
422 | $ hg tip -p | |
423 | changeset: 12:99337501826f |
|
423 | changeset: 12:99337501826f | |
424 | tag: tip |
|
424 | tag: tip | |
425 | user: test |
|
425 | user: test | |
426 | date: Thu Jan 01 00:00:11 1970 +0000 |
|
426 | date: Thu Jan 01 00:00:11 1970 +0000 | |
427 | summary: end-only |
|
427 | summary: end-only | |
428 |
|
428 | |||
429 | diff -r 21df83db12b8 -r 99337501826f plain |
|
429 | diff -r 21df83db12b8 -r 99337501826f plain | |
430 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 |
|
430 | --- a/plain Thu Jan 01 00:00:10 1970 +0000 | |
431 | +++ b/plain Thu Jan 01 00:00:11 1970 +0000 |
|
431 | +++ b/plain Thu Jan 01 00:00:11 1970 +0000 | |
432 | @@ -7,4 +7,4 @@ |
|
432 | @@ -7,4 +7,4 @@ | |
433 | 7 |
|
433 | 7 | |
434 | 8 |
|
434 | 8 | |
435 | 9 |
|
435 | 9 | |
436 | -10 |
|
436 | -10 | |
437 | +10.new |
|
437 | +10.new | |
438 |
|
438 | |||
439 |
|
439 | |||
440 | Record beginning |
|
440 | Record beginning | |
441 |
|
441 | |||
442 | $ hg record -d '12 0' -m begin-only plain <<EOF |
|
442 | $ hg record -d '12 0' -m begin-only plain <<EOF | |
443 | > y |
|
443 | > y | |
444 | > y |
|
444 | > y | |
445 | > EOF |
|
445 | > EOF | |
446 | diff --git a/plain b/plain |
|
446 | diff --git a/plain b/plain | |
447 | 1 hunks, 3 lines changed |
|
447 | 1 hunks, 3 lines changed | |
448 | examine changes to 'plain'? [Ynesfdaq?] |
|
448 | examine changes to 'plain'? [Ynesfdaq?] | |
449 | @@ -1,6 +1,3 @@ |
|
449 | @@ -1,6 +1,3 @@ | |
450 | -2 |
|
450 | -2 | |
451 | -2 |
|
451 | -2 | |
452 | -3 |
|
452 | -3 | |
453 | 4 |
|
453 | 4 | |
454 | 5 |
|
454 | 5 | |
455 | 6 |
|
455 | 6 | |
456 | record this change to 'plain'? [Ynesfdaq?] |
|
456 | record this change to 'plain'? [Ynesfdaq?] | |
457 |
|
457 | |||
458 | $ hg tip -p |
|
458 | $ hg tip -p | |
459 | changeset: 13:bbd45465d540 |
|
459 | changeset: 13:bbd45465d540 | |
460 | tag: tip |
|
460 | tag: tip | |
461 | user: test |
|
461 | user: test | |
462 | date: Thu Jan 01 00:00:12 1970 +0000 |
|
462 | date: Thu Jan 01 00:00:12 1970 +0000 | |
463 | summary: begin-only |
|
463 | summary: begin-only | |
464 |
|
464 | |||
465 | diff -r 99337501826f -r bbd45465d540 plain |
|
465 | diff -r 99337501826f -r bbd45465d540 plain | |
466 | --- a/plain Thu Jan 01 00:00:11 1970 +0000 |
|
466 | --- a/plain Thu Jan 01 00:00:11 1970 +0000 | |
467 | +++ b/plain Thu Jan 01 00:00:12 1970 +0000 |
|
467 | +++ b/plain Thu Jan 01 00:00:12 1970 +0000 | |
468 | @@ -1,6 +1,3 @@ |
|
468 | @@ -1,6 +1,3 @@ | |
469 | -2 |
|
469 | -2 | |
470 | -2 |
|
470 | -2 | |
471 | -3 |
|
471 | -3 | |
472 | 4 |
|
472 | 4 | |
473 | 5 |
|
473 | 5 | |
474 | 6 |
|
474 | 6 | |
475 |
|
475 | |||
476 |
|
476 | |||
477 | Add to beginning, trim from end |
|
477 | Add to beginning, trim from end | |
478 |
|
478 | |||
479 | $ rm plain |
|
479 | $ rm plain | |
480 | $ for i in 1 2 3 4 5 6 7 8 9; do |
|
480 | $ for i in 1 2 3 4 5 6 7 8 9; do | |
481 | > echo $i >> plain |
|
481 | > echo $i >> plain | |
482 | > done |
|
482 | > done | |
483 |
|
483 | |||
484 | Record end |
|
484 | Record end | |
485 |
|
485 | |||
486 | $ hg record --traceback -d '13 0' -m end-again plain<<EOF |
|
486 | $ hg record --traceback -d '13 0' -m end-again plain<<EOF | |
487 | > y |
|
487 | > y | |
488 | > n |
|
488 | > n | |
489 | > y |
|
489 | > y | |
490 | > EOF |
|
490 | > EOF | |
491 | diff --git a/plain b/plain |
|
491 | diff --git a/plain b/plain | |
492 | 2 hunks, 4 lines changed |
|
492 | 2 hunks, 4 lines changed | |
493 | examine changes to 'plain'? [Ynesfdaq?] |
|
493 | examine changes to 'plain'? [Ynesfdaq?] | |
494 | @@ -1,6 +1,9 @@ |
|
494 | @@ -1,6 +1,9 @@ | |
495 | +1 |
|
495 | +1 | |
496 | +2 |
|
496 | +2 | |
497 | +3 |
|
497 | +3 | |
498 | 4 |
|
498 | 4 | |
499 | 5 |
|
499 | 5 | |
500 | 6 |
|
500 | 6 | |
501 | 7 |
|
501 | 7 | |
502 | 8 |
|
502 | 8 | |
503 | 9 |
|
503 | 9 | |
504 | record change 1/2 to 'plain'? [Ynesfdaq?] |
|
504 | record change 1/2 to 'plain'? [Ynesfdaq?] | |
505 | @@ -1,7 +4,6 @@ |
|
505 | @@ -1,7 +4,6 @@ | |
506 | 4 |
|
506 | 4 | |
507 | 5 |
|
507 | 5 | |
508 | 6 |
|
508 | 6 | |
509 | 7 |
|
509 | 7 | |
510 | 8 |
|
510 | 8 | |
511 | 9 |
|
511 | 9 | |
512 | -10.new |
|
512 | -10.new | |
513 | record change 2/2 to 'plain'? [Ynesfdaq?] |
|
513 | record change 2/2 to 'plain'? [Ynesfdaq?] | |
514 |
|
514 | |||
515 | Add to beginning, middle, end |
|
515 | Add to beginning, middle, end | |
516 |
|
516 | |||
517 | $ rm plain |
|
517 | $ rm plain | |
518 | $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do |
|
518 | $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do | |
519 | > echo $i >> plain |
|
519 | > echo $i >> plain | |
520 | > done |
|
520 | > done | |
521 |
|
521 | |||
522 | Record beginning, middle |
|
522 | Record beginning, middle | |
523 |
|
523 | |||
524 | $ hg record -d '14 0' -m middle-only plain <<EOF |
|
524 | $ hg record -d '14 0' -m middle-only plain <<EOF | |
525 | > y |
|
525 | > y | |
526 | > y |
|
526 | > y | |
527 | > y |
|
527 | > y | |
528 | > n |
|
528 | > n | |
529 | > EOF |
|
529 | > EOF | |
530 | diff --git a/plain b/plain |
|
530 | diff --git a/plain b/plain | |
531 | 3 hunks, 7 lines changed |
|
531 | 3 hunks, 7 lines changed | |
532 | examine changes to 'plain'? [Ynesfdaq?] |
|
532 | examine changes to 'plain'? [Ynesfdaq?] | |
533 | @@ -1,2 +1,5 @@ |
|
533 | @@ -1,2 +1,5 @@ | |
534 | +1 |
|
534 | +1 | |
535 | +2 |
|
535 | +2 | |
536 | +3 |
|
536 | +3 | |
537 | 4 |
|
537 | 4 | |
538 | 5 |
|
538 | 5 | |
539 | record change 1/3 to 'plain'? [Ynesfdaq?] |
|
539 | record change 1/3 to 'plain'? [Ynesfdaq?] | |
540 | @@ -1,6 +4,8 @@ |
|
540 | @@ -1,6 +4,8 @@ | |
541 | 4 |
|
541 | 4 | |
542 | 5 |
|
542 | 5 | |
543 | +5.new |
|
543 | +5.new | |
544 | +5.reallynew |
|
544 | +5.reallynew | |
545 | 6 |
|
545 | 6 | |
546 | 7 |
|
546 | 7 | |
547 | 8 |
|
547 | 8 | |
548 | 9 |
|
548 | 9 | |
549 | record change 2/3 to 'plain'? [Ynesfdaq?] |
|
549 | record change 2/3 to 'plain'? [Ynesfdaq?] | |
550 | @@ -3,4 +8,6 @@ |
|
550 | @@ -3,4 +8,6 @@ | |
551 | 6 |
|
551 | 6 | |
552 | 7 |
|
552 | 7 | |
553 | 8 |
|
553 | 8 | |
554 | 9 |
|
554 | 9 | |
555 | +10 |
|
555 | +10 | |
556 | +11 |
|
556 | +11 | |
557 | record change 3/3 to 'plain'? [Ynesfdaq?] |
|
557 | record change 3/3 to 'plain'? [Ynesfdaq?] | |
558 |
|
558 | |||
559 | $ hg tip -p |
|
559 | $ hg tip -p | |
560 | changeset: 15:f34a7937ec33 |
|
560 | changeset: 15:f34a7937ec33 | |
561 | tag: tip |
|
561 | tag: tip | |
562 | user: test |
|
562 | user: test | |
563 | date: Thu Jan 01 00:00:14 1970 +0000 |
|
563 | date: Thu Jan 01 00:00:14 1970 +0000 | |
564 | summary: middle-only |
|
564 | summary: middle-only | |
565 |
|
565 | |||
566 | diff -r 82c065d0b850 -r f34a7937ec33 plain |
|
566 | diff -r 82c065d0b850 -r f34a7937ec33 plain | |
567 | --- a/plain Thu Jan 01 00:00:13 1970 +0000 |
|
567 | --- a/plain Thu Jan 01 00:00:13 1970 +0000 | |
568 | +++ b/plain Thu Jan 01 00:00:14 1970 +0000 |
|
568 | +++ b/plain Thu Jan 01 00:00:14 1970 +0000 | |
569 | @@ -1,5 +1,10 @@ |
|
569 | @@ -1,5 +1,10 @@ | |
570 | +1 |
|
570 | +1 | |
571 | +2 |
|
571 | +2 | |
572 | +3 |
|
572 | +3 | |
573 | 4 |
|
573 | 4 | |
574 | 5 |
|
574 | 5 | |
575 | +5.new |
|
575 | +5.new | |
576 | +5.reallynew |
|
576 | +5.reallynew | |
577 | 6 |
|
577 | 6 | |
578 | 7 |
|
578 | 7 | |
579 | 8 |
|
579 | 8 | |
580 |
|
580 | |||
581 |
|
581 | |||
582 | Record end |
|
582 | Record end | |
583 |
|
583 | |||
584 | $ hg record -d '15 0' -m end-only plain <<EOF |
|
584 | $ hg record -d '15 0' -m end-only plain <<EOF | |
585 | > y |
|
585 | > y | |
586 | > y |
|
586 | > y | |
587 | > EOF |
|
587 | > EOF | |
588 | diff --git a/plain b/plain |
|
588 | diff --git a/plain b/plain | |
589 | 1 hunks, 2 lines changed |
|
589 | 1 hunks, 2 lines changed | |
590 | examine changes to 'plain'? [Ynesfdaq?] |
|
590 | examine changes to 'plain'? [Ynesfdaq?] | |
591 | @@ -9,3 +9,5 @@ |
|
591 | @@ -9,3 +9,5 @@ | |
592 | 7 |
|
592 | 7 | |
593 | 8 |
|
593 | 8 | |
594 | 9 |
|
594 | 9 | |
595 | +10 |
|
595 | +10 | |
596 | +11 |
|
596 | +11 | |
597 | record this change to 'plain'? [Ynesfdaq?] |
|
597 | record this change to 'plain'? [Ynesfdaq?] | |
598 |
|
598 | |||
599 | $ hg tip -p |
|
599 | $ hg tip -p | |
600 | changeset: 16:f9900b71a04c |
|
600 | changeset: 16:f9900b71a04c | |
601 | tag: tip |
|
601 | tag: tip | |
602 | user: test |
|
602 | user: test | |
603 | date: Thu Jan 01 00:00:15 1970 +0000 |
|
603 | date: Thu Jan 01 00:00:15 1970 +0000 | |
604 | summary: end-only |
|
604 | summary: end-only | |
605 |
|
605 | |||
606 | diff -r f34a7937ec33 -r f9900b71a04c plain |
|
606 | diff -r f34a7937ec33 -r f9900b71a04c plain | |
607 | --- a/plain Thu Jan 01 00:00:14 1970 +0000 |
|
607 | --- a/plain Thu Jan 01 00:00:14 1970 +0000 | |
608 | +++ b/plain Thu Jan 01 00:00:15 1970 +0000 |
|
608 | +++ b/plain Thu Jan 01 00:00:15 1970 +0000 | |
609 | @@ -9,3 +9,5 @@ |
|
609 | @@ -9,3 +9,5 @@ | |
610 | 7 |
|
610 | 7 | |
611 | 8 |
|
611 | 8 | |
612 | 9 |
|
612 | 9 | |
613 | +10 |
|
613 | +10 | |
614 | +11 |
|
614 | +11 | |
615 |
|
615 | |||
616 |
|
616 | |||
617 | $ mkdir subdir |
|
617 | $ mkdir subdir | |
618 | $ cd subdir |
|
618 | $ cd subdir | |
619 | $ echo a > a |
|
619 | $ echo a > a | |
620 | $ hg ci -d '16 0' -Amsubdir |
|
620 | $ hg ci -d '16 0' -Amsubdir | |
621 | adding subdir/a |
|
621 | adding subdir/a | |
622 |
|
622 | |||
623 | $ echo a >> a |
|
623 | $ echo a >> a | |
624 | $ hg record -d '16 0' -m subdir-change a <<EOF |
|
624 | $ hg record -d '16 0' -m subdir-change a <<EOF | |
625 | > y |
|
625 | > y | |
626 | > y |
|
626 | > y | |
627 | > EOF |
|
627 | > EOF | |
628 | diff --git a/subdir/a b/subdir/a |
|
628 | diff --git a/subdir/a b/subdir/a | |
629 | 1 hunks, 1 lines changed |
|
629 | 1 hunks, 1 lines changed | |
630 | examine changes to 'subdir/a'? [Ynesfdaq?] |
|
630 | examine changes to 'subdir/a'? [Ynesfdaq?] | |
631 | @@ -1,1 +1,2 @@ |
|
631 | @@ -1,1 +1,2 @@ | |
632 | a |
|
632 | a | |
633 | +a |
|
633 | +a | |
634 | record this change to 'subdir/a'? [Ynesfdaq?] |
|
634 | record this change to 'subdir/a'? [Ynesfdaq?] | |
635 |
|
635 | |||
636 | $ hg tip -p |
|
636 | $ hg tip -p | |
637 | changeset: 18:61be427a9deb |
|
637 | changeset: 18:61be427a9deb | |
638 | tag: tip |
|
638 | tag: tip | |
639 | user: test |
|
639 | user: test | |
640 | date: Thu Jan 01 00:00:16 1970 +0000 |
|
640 | date: Thu Jan 01 00:00:16 1970 +0000 | |
641 | summary: subdir-change |
|
641 | summary: subdir-change | |
642 |
|
642 | |||
643 | diff -r a7ffae4d61cb -r 61be427a9deb subdir/a |
|
643 | diff -r a7ffae4d61cb -r 61be427a9deb subdir/a | |
644 | --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
644 | --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000 | |
645 | +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000 |
|
645 | +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000 | |
646 | @@ -1,1 +1,2 @@ |
|
646 | @@ -1,1 +1,2 @@ | |
647 | a |
|
647 | a | |
648 | +a |
|
648 | +a | |
649 |
|
649 | |||
650 |
|
650 | |||
651 | $ echo a > f1 |
|
651 | $ echo a > f1 | |
652 | $ echo b > f2 |
|
652 | $ echo b > f2 | |
653 | $ hg add f1 f2 |
|
653 | $ hg add f1 f2 | |
654 |
|
654 | |||
655 | $ hg ci -mz -d '17 0' |
|
655 | $ hg ci -mz -d '17 0' | |
656 |
|
656 | |||
657 | $ echo a >> f1 |
|
657 | $ echo a >> f1 | |
658 | $ echo b >> f2 |
|
658 | $ echo b >> f2 | |
659 |
|
659 | |||
660 | Help, quit |
|
660 | Help, quit | |
661 |
|
661 | |||
662 | $ hg record <<EOF |
|
662 | $ hg record <<EOF | |
663 | > ? |
|
663 | > ? | |
664 | > q |
|
664 | > q | |
665 | > EOF |
|
665 | > EOF | |
666 | diff --git a/subdir/f1 b/subdir/f1 |
|
666 | diff --git a/subdir/f1 b/subdir/f1 | |
667 | 1 hunks, 1 lines changed |
|
667 | 1 hunks, 1 lines changed | |
668 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
668 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
669 | y - record this change |
|
669 | y - record this change | |
670 | n - skip this change |
|
670 | n - skip this change | |
671 | e - edit this change manually |
|
671 | e - edit this change manually | |
672 | s - skip remaining changes to this file |
|
672 | s - skip remaining changes to this file | |
673 | f - record remaining changes to this file |
|
673 | f - record remaining changes to this file | |
674 | d - done, skip remaining changes and files |
|
674 | d - done, skip remaining changes and files | |
675 | a - record all changes to all remaining files |
|
675 | a - record all changes to all remaining files | |
676 | q - quit, recording no changes |
|
676 | q - quit, recording no changes | |
677 | ? - display help |
|
677 | ? - display help | |
678 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
678 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
679 | abort: user quit |
|
679 | abort: user quit | |
680 | [255] |
|
680 | [255] | |
681 |
|
681 | |||
682 | Skip |
|
682 | Skip | |
683 |
|
683 | |||
684 | $ hg record <<EOF |
|
684 | $ hg record <<EOF | |
685 | > s |
|
685 | > s | |
686 | > EOF |
|
686 | > EOF | |
687 | diff --git a/subdir/f1 b/subdir/f1 |
|
687 | diff --git a/subdir/f1 b/subdir/f1 | |
688 | 1 hunks, 1 lines changed |
|
688 | 1 hunks, 1 lines changed | |
689 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
689 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
690 | diff --git a/subdir/f2 b/subdir/f2 |
|
690 | diff --git a/subdir/f2 b/subdir/f2 | |
691 | 1 hunks, 1 lines changed |
|
691 | 1 hunks, 1 lines changed | |
692 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
692 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected | |
693 | [255] |
|
693 | [255] | |
694 |
|
694 | |||
695 | No |
|
695 | No | |
696 |
|
696 | |||
697 | $ hg record <<EOF |
|
697 | $ hg record <<EOF | |
698 | > n |
|
698 | > n | |
699 | > EOF |
|
699 | > EOF | |
700 | diff --git a/subdir/f1 b/subdir/f1 |
|
700 | diff --git a/subdir/f1 b/subdir/f1 | |
701 | 1 hunks, 1 lines changed |
|
701 | 1 hunks, 1 lines changed | |
702 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
702 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
703 | diff --git a/subdir/f2 b/subdir/f2 |
|
703 | diff --git a/subdir/f2 b/subdir/f2 | |
704 | 1 hunks, 1 lines changed |
|
704 | 1 hunks, 1 lines changed | |
705 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected |
|
705 | examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected | |
706 | [255] |
|
706 | [255] | |
707 |
|
707 | |||
708 | f, quit |
|
708 | f, quit | |
709 |
|
709 | |||
710 | $ hg record <<EOF |
|
710 | $ hg record <<EOF | |
711 | > f |
|
711 | > f | |
712 | > q |
|
712 | > q | |
713 | > EOF |
|
713 | > EOF | |
714 | diff --git a/subdir/f1 b/subdir/f1 |
|
714 | diff --git a/subdir/f1 b/subdir/f1 | |
715 | 1 hunks, 1 lines changed |
|
715 | 1 hunks, 1 lines changed | |
716 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
716 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
717 | diff --git a/subdir/f2 b/subdir/f2 |
|
717 | diff --git a/subdir/f2 b/subdir/f2 | |
718 | 1 hunks, 1 lines changed |
|
718 | 1 hunks, 1 lines changed | |
719 | examine changes to 'subdir/f2'? [Ynesfdaq?] |
|
719 | examine changes to 'subdir/f2'? [Ynesfdaq?] | |
720 | abort: user quit |
|
720 | abort: user quit | |
721 | [255] |
|
721 | [255] | |
722 |
|
722 | |||
723 | s, all |
|
723 | s, all | |
724 |
|
724 | |||
725 | $ hg record -d '18 0' -mx <<EOF |
|
725 | $ hg record -d '18 0' -mx <<EOF | |
726 | > s |
|
726 | > s | |
727 | > a |
|
727 | > a | |
728 | > EOF |
|
728 | > EOF | |
729 | diff --git a/subdir/f1 b/subdir/f1 |
|
729 | diff --git a/subdir/f1 b/subdir/f1 | |
730 | 1 hunks, 1 lines changed |
|
730 | 1 hunks, 1 lines changed | |
731 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
731 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
732 | diff --git a/subdir/f2 b/subdir/f2 |
|
732 | diff --git a/subdir/f2 b/subdir/f2 | |
733 | 1 hunks, 1 lines changed |
|
733 | 1 hunks, 1 lines changed | |
734 | examine changes to 'subdir/f2'? [Ynesfdaq?] |
|
734 | examine changes to 'subdir/f2'? [Ynesfdaq?] | |
735 |
|
735 | |||
736 | $ hg tip -p |
|
736 | $ hg tip -p | |
737 | changeset: 20:b3df3dda369a |
|
737 | changeset: 20:b3df3dda369a | |
738 | tag: tip |
|
738 | tag: tip | |
739 | user: test |
|
739 | user: test | |
740 | date: Thu Jan 01 00:00:18 1970 +0000 |
|
740 | date: Thu Jan 01 00:00:18 1970 +0000 | |
741 | summary: x |
|
741 | summary: x | |
742 |
|
742 | |||
743 | diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2 |
|
743 | diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2 | |
744 | --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000 |
|
744 | --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000 | |
745 | +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000 |
|
745 | +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000 | |
746 | @@ -1,1 +1,2 @@ |
|
746 | @@ -1,1 +1,2 @@ | |
747 | b |
|
747 | b | |
748 | +b |
|
748 | +b | |
749 |
|
749 | |||
750 |
|
750 | |||
751 | f |
|
751 | f | |
752 |
|
752 | |||
753 | $ hg record -d '19 0' -my <<EOF |
|
753 | $ hg record -d '19 0' -my <<EOF | |
754 | > f |
|
754 | > f | |
755 | > EOF |
|
755 | > EOF | |
756 | diff --git a/subdir/f1 b/subdir/f1 |
|
756 | diff --git a/subdir/f1 b/subdir/f1 | |
757 | 1 hunks, 1 lines changed |
|
757 | 1 hunks, 1 lines changed | |
758 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
758 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
759 |
|
759 | |||
760 | $ hg tip -p |
|
760 | $ hg tip -p | |
761 | changeset: 21:38ec577f126b |
|
761 | changeset: 21:38ec577f126b | |
762 | tag: tip |
|
762 | tag: tip | |
763 | user: test |
|
763 | user: test | |
764 | date: Thu Jan 01 00:00:19 1970 +0000 |
|
764 | date: Thu Jan 01 00:00:19 1970 +0000 | |
765 | summary: y |
|
765 | summary: y | |
766 |
|
766 | |||
767 | diff -r b3df3dda369a -r 38ec577f126b subdir/f1 |
|
767 | diff -r b3df3dda369a -r 38ec577f126b subdir/f1 | |
768 | --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000 |
|
768 | --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000 | |
769 | +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000 |
|
769 | +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000 | |
770 | @@ -1,1 +1,2 @@ |
|
770 | @@ -1,1 +1,2 @@ | |
771 | a |
|
771 | a | |
772 | +a |
|
772 | +a | |
773 |
|
773 | |||
774 |
|
774 | |||
775 | Preserve chmod +x |
|
775 | Preserve chmod +x | |
776 |
|
776 | |||
777 | $ chmod +x f1 |
|
777 | $ chmod +x f1 | |
778 | $ echo a >> f1 |
|
778 | $ echo a >> f1 | |
779 | $ hg record -d '20 0' -mz <<EOF |
|
779 | $ hg record -d '20 0' -mz <<EOF | |
780 | > y |
|
780 | > y | |
781 | > y |
|
781 | > y | |
782 | > y |
|
782 | > y | |
783 | > EOF |
|
783 | > EOF | |
784 | diff --git a/subdir/f1 b/subdir/f1 |
|
784 | diff --git a/subdir/f1 b/subdir/f1 | |
785 | old mode 100644 |
|
785 | old mode 100644 | |
786 | new mode 100755 |
|
786 | new mode 100755 | |
787 | 1 hunks, 1 lines changed |
|
787 | 1 hunks, 1 lines changed | |
788 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
788 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
789 | @@ -1,2 +1,3 @@ |
|
789 | @@ -1,2 +1,3 @@ | |
790 | a |
|
790 | a | |
791 | a |
|
791 | a | |
792 | +a |
|
792 | +a | |
793 | record this change to 'subdir/f1'? [Ynesfdaq?] |
|
793 | record this change to 'subdir/f1'? [Ynesfdaq?] | |
794 |
|
794 | |||
795 | $ hg tip --config diff.git=True -p |
|
795 | $ hg tip --config diff.git=True -p | |
796 | changeset: 22:3261adceb075 |
|
796 | changeset: 22:3261adceb075 | |
797 | tag: tip |
|
797 | tag: tip | |
798 | user: test |
|
798 | user: test | |
799 | date: Thu Jan 01 00:00:20 1970 +0000 |
|
799 | date: Thu Jan 01 00:00:20 1970 +0000 | |
800 | summary: z |
|
800 | summary: z | |
801 |
|
801 | |||
802 | diff --git a/subdir/f1 b/subdir/f1 |
|
802 | diff --git a/subdir/f1 b/subdir/f1 | |
803 | old mode 100644 |
|
803 | old mode 100644 | |
804 | new mode 100755 |
|
804 | new mode 100755 | |
805 | --- a/subdir/f1 |
|
805 | --- a/subdir/f1 | |
806 | +++ b/subdir/f1 |
|
806 | +++ b/subdir/f1 | |
807 | @@ -1,2 +1,3 @@ |
|
807 | @@ -1,2 +1,3 @@ | |
808 | a |
|
808 | a | |
809 | a |
|
809 | a | |
810 | +a |
|
810 | +a | |
811 |
|
811 | |||
812 |
|
812 | |||
813 | Preserve execute permission on original |
|
813 | Preserve execute permission on original | |
814 |
|
814 | |||
815 | $ echo b >> f1 |
|
815 | $ echo b >> f1 | |
816 | $ hg record -d '21 0' -maa <<EOF |
|
816 | $ hg record -d '21 0' -maa <<EOF | |
817 | > y |
|
817 | > y | |
818 | > y |
|
818 | > y | |
819 | > y |
|
819 | > y | |
820 | > EOF |
|
820 | > EOF | |
821 | diff --git a/subdir/f1 b/subdir/f1 |
|
821 | diff --git a/subdir/f1 b/subdir/f1 | |
822 | 1 hunks, 1 lines changed |
|
822 | 1 hunks, 1 lines changed | |
823 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
823 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
824 | @@ -1,3 +1,4 @@ |
|
824 | @@ -1,3 +1,4 @@ | |
825 | a |
|
825 | a | |
826 | a |
|
826 | a | |
827 | a |
|
827 | a | |
828 | +b |
|
828 | +b | |
829 | record this change to 'subdir/f1'? [Ynesfdaq?] |
|
829 | record this change to 'subdir/f1'? [Ynesfdaq?] | |
830 |
|
830 | |||
831 | $ hg tip --config diff.git=True -p |
|
831 | $ hg tip --config diff.git=True -p | |
832 | changeset: 23:b429867550db |
|
832 | changeset: 23:b429867550db | |
833 | tag: tip |
|
833 | tag: tip | |
834 | user: test |
|
834 | user: test | |
835 | date: Thu Jan 01 00:00:21 1970 +0000 |
|
835 | date: Thu Jan 01 00:00:21 1970 +0000 | |
836 | summary: aa |
|
836 | summary: aa | |
837 |
|
837 | |||
838 | diff --git a/subdir/f1 b/subdir/f1 |
|
838 | diff --git a/subdir/f1 b/subdir/f1 | |
839 | --- a/subdir/f1 |
|
839 | --- a/subdir/f1 | |
840 | +++ b/subdir/f1 |
|
840 | +++ b/subdir/f1 | |
841 | @@ -1,3 +1,4 @@ |
|
841 | @@ -1,3 +1,4 @@ | |
842 | a |
|
842 | a | |
843 | a |
|
843 | a | |
844 | a |
|
844 | a | |
845 | +b |
|
845 | +b | |
846 |
|
846 | |||
847 |
|
847 | |||
848 | Preserve chmod -x |
|
848 | Preserve chmod -x | |
849 |
|
849 | |||
850 | $ chmod -x f1 |
|
850 | $ chmod -x f1 | |
851 | $ echo c >> f1 |
|
851 | $ echo c >> f1 | |
852 | $ hg record -d '22 0' -mab <<EOF |
|
852 | $ hg record -d '22 0' -mab <<EOF | |
853 | > y |
|
853 | > y | |
854 | > y |
|
854 | > y | |
855 | > y |
|
855 | > y | |
856 | > EOF |
|
856 | > EOF | |
857 | diff --git a/subdir/f1 b/subdir/f1 |
|
857 | diff --git a/subdir/f1 b/subdir/f1 | |
858 | old mode 100755 |
|
858 | old mode 100755 | |
859 | new mode 100644 |
|
859 | new mode 100644 | |
860 | 1 hunks, 1 lines changed |
|
860 | 1 hunks, 1 lines changed | |
861 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
861 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
862 | @@ -2,3 +2,4 @@ |
|
862 | @@ -2,3 +2,4 @@ | |
863 | a |
|
863 | a | |
864 | a |
|
864 | a | |
865 | b |
|
865 | b | |
866 | +c |
|
866 | +c | |
867 | record this change to 'subdir/f1'? [Ynesfdaq?] |
|
867 | record this change to 'subdir/f1'? [Ynesfdaq?] | |
868 |
|
868 | |||
869 | $ hg tip --config diff.git=True -p |
|
869 | $ hg tip --config diff.git=True -p | |
870 | changeset: 24:0b082130c20a |
|
870 | changeset: 24:0b082130c20a | |
871 | tag: tip |
|
871 | tag: tip | |
872 | user: test |
|
872 | user: test | |
873 | date: Thu Jan 01 00:00:22 1970 +0000 |
|
873 | date: Thu Jan 01 00:00:22 1970 +0000 | |
874 | summary: ab |
|
874 | summary: ab | |
875 |
|
875 | |||
876 | diff --git a/subdir/f1 b/subdir/f1 |
|
876 | diff --git a/subdir/f1 b/subdir/f1 | |
877 | old mode 100755 |
|
877 | old mode 100755 | |
878 | new mode 100644 |
|
878 | new mode 100644 | |
879 | --- a/subdir/f1 |
|
879 | --- a/subdir/f1 | |
880 | +++ b/subdir/f1 |
|
880 | +++ b/subdir/f1 | |
881 | @@ -2,3 +2,4 @@ |
|
881 | @@ -2,3 +2,4 @@ | |
882 | a |
|
882 | a | |
883 | a |
|
883 | a | |
884 | b |
|
884 | b | |
885 | +c |
|
885 | +c | |
886 |
|
886 | |||
887 |
|
887 | |||
888 | $ cd .. |
|
888 | $ cd .. | |
889 |
|
889 | |||
890 | Abort early when a merge is in progress |
|
890 | Abort early when a merge is in progress | |
891 |
|
891 | |||
892 | $ hg up 4 |
|
892 | $ hg up 4 | |
893 | 1 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
893 | 1 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
894 |
|
894 | |||
895 | $ touch iwillmergethat |
|
895 | $ touch iwillmergethat | |
896 | $ hg add iwillmergethat |
|
896 | $ hg add iwillmergethat | |
897 |
|
897 | |||
898 | $ hg branch thatbranch |
|
898 | $ hg branch thatbranch | |
899 | marked working directory as branch thatbranch |
|
899 | marked working directory as branch thatbranch | |
900 | (branches are permanent and global, did you want a bookmark?) |
|
900 | (branches are permanent and global, did you want a bookmark?) | |
901 |
|
901 | |||
902 | $ hg ci -m'new head' |
|
902 | $ hg ci -m'new head' | |
903 |
|
903 | |||
904 | $ hg up default |
|
904 | $ hg up default | |
905 | 6 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
905 | 6 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
906 |
|
906 | |||
907 | $ hg merge thatbranch |
|
907 | $ hg merge thatbranch | |
908 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
908 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
909 | (branch merge, don't forget to commit) |
|
909 | (branch merge, don't forget to commit) | |
910 |
|
910 | |||
911 | $ hg record -m'will abort' |
|
911 | $ hg record -m'will abort' | |
912 | abort: cannot partially commit a merge (use "hg commit" instead) |
|
912 | abort: cannot partially commit a merge (use "hg commit" instead) | |
913 | [255] |
|
913 | [255] | |
914 |
|
914 | |||
915 | $ hg up -C |
|
915 | $ hg up -C | |
916 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
916 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
917 |
|
917 | |||
918 | Editing patch |
|
918 | Editing patch | |
919 |
|
919 | |||
920 | $ cat > editor << '__EOF__' |
|
920 | $ cat > editor << '__EOF__' | |
921 | > #!/bin/sh |
|
921 | > #!/bin/sh | |
922 |
> sed |
|
922 | > sed -e 7d -e '5s/^-/ /' "$1" > tmp | |
|
923 | > mv tmp "$1" | |||
923 | > __EOF__ |
|
924 | > __EOF__ | |
924 | $ chmod +x editor |
|
925 | $ chmod +x editor | |
925 | $ cat > editedfile << '__EOF__' |
|
926 | $ cat > editedfile << '__EOF__' | |
926 | > This is the first line |
|
927 | > This is the first line | |
927 | > This is the second line |
|
928 | > This is the second line | |
928 | > This is the third line |
|
929 | > This is the third line | |
929 | > __EOF__ |
|
930 | > __EOF__ | |
930 | $ hg add editedfile |
|
931 | $ hg add editedfile | |
931 | $ hg commit -medit-patch-1 |
|
932 | $ hg commit -medit-patch-1 | |
932 | $ cat > editedfile << '__EOF__' |
|
933 | $ cat > editedfile << '__EOF__' | |
933 | > This line has changed |
|
934 | > This line has changed | |
934 | > This change will be committed |
|
935 | > This change will be committed | |
935 | > This is the third line |
|
936 | > This is the third line | |
936 | > __EOF__ |
|
937 | > __EOF__ | |
937 | $ HGEDITOR="'`pwd`'"/editor hg record -d '23 0' -medit-patch-2 <<EOF |
|
938 | $ HGEDITOR="'`pwd`'"/editor hg record -d '23 0' -medit-patch-2 <<EOF | |
938 | > y |
|
939 | > y | |
939 | > e |
|
940 | > e | |
940 | > EOF |
|
941 | > EOF | |
941 | diff --git a/editedfile b/editedfile |
|
942 | diff --git a/editedfile b/editedfile | |
942 | 1 hunks, 2 lines changed |
|
943 | 1 hunks, 2 lines changed | |
943 | examine changes to 'editedfile'? [Ynesfdaq?] |
|
944 | examine changes to 'editedfile'? [Ynesfdaq?] | |
944 | @@ -1,3 +1,3 @@ |
|
945 | @@ -1,3 +1,3 @@ | |
945 | -This is the first line |
|
946 | -This is the first line | |
946 | -This is the second line |
|
947 | -This is the second line | |
947 | +This line has changed |
|
948 | +This line has changed | |
948 | +This change will be committed |
|
949 | +This change will be committed | |
949 | This is the third line |
|
950 | This is the third line | |
950 | record this change to 'editedfile'? [Ynesfdaq?] |
|
951 | record this change to 'editedfile'? [Ynesfdaq?] | |
951 | $ cat editedfile |
|
952 | $ cat editedfile | |
952 | This line has changed |
|
953 | This line has changed | |
953 | This change will be committed |
|
954 | This change will be committed | |
954 | This is the third line |
|
955 | This is the third line | |
955 | $ hg cat -r tip editedfile |
|
956 | $ hg cat -r tip editedfile | |
956 | This is the first line |
|
957 | This is the first line | |
957 | This change will be committed |
|
958 | This change will be committed | |
958 | This is the third line |
|
959 | This is the third line | |
959 | $ hg revert editedfile |
|
960 | $ hg revert editedfile | |
960 |
|
961 | |||
961 | Trying to edit patch for whole file |
|
962 | Trying to edit patch for whole file | |
962 |
|
963 | |||
963 | $ echo "This is the fourth line" >> editedfile |
|
964 | $ echo "This is the fourth line" >> editedfile | |
964 | $ hg record <<EOF |
|
965 | $ hg record <<EOF | |
965 | > e |
|
966 | > e | |
966 | > q |
|
967 | > q | |
967 | > EOF |
|
968 | > EOF | |
968 | diff --git a/editedfile b/editedfile |
|
969 | diff --git a/editedfile b/editedfile | |
969 | 1 hunks, 1 lines changed |
|
970 | 1 hunks, 1 lines changed | |
970 | examine changes to 'editedfile'? [Ynesfdaq?] |
|
971 | examine changes to 'editedfile'? [Ynesfdaq?] | |
971 | cannot edit patch for whole file |
|
972 | cannot edit patch for whole file | |
972 | examine changes to 'editedfile'? [Ynesfdaq?] |
|
973 | examine changes to 'editedfile'? [Ynesfdaq?] | |
973 | abort: user quit |
|
974 | abort: user quit | |
974 | [255] |
|
975 | [255] | |
975 | $ hg revert editedfile |
|
976 | $ hg revert editedfile | |
976 |
|
977 | |||
977 | Removing changes from patch |
|
978 | Removing changes from patch | |
978 |
|
979 | |||
979 | $ sed -i -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile |
|
980 | $ sed -i -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile | |
980 | $ echo "This line has been added" >> editedfile |
|
981 | $ echo "This line has been added" >> editedfile | |
981 | $ cat > editor << '__EOF__' |
|
982 | $ cat > editor << '__EOF__' | |
982 | > #!/bin/sh |
|
983 | > #!/bin/sh | |
983 |
> sed |
|
984 | > sed -e 's/^[-+]/ /' "$1" > tmp | |
|
985 | > mv tmp "$1" | |||
984 | > __EOF__ |
|
986 | > __EOF__ | |
985 | $ chmod +x editor |
|
987 | $ chmod +x editor | |
986 | $ HGEDITOR="'`pwd`'"/editor hg record <<EOF |
|
988 | $ HGEDITOR="'`pwd`'"/editor hg record <<EOF | |
987 | > y |
|
989 | > y | |
988 | > e |
|
990 | > e | |
989 | > EOF |
|
991 | > EOF | |
990 | diff --git a/editedfile b/editedfile |
|
992 | diff --git a/editedfile b/editedfile | |
991 | 1 hunks, 3 lines changed |
|
993 | 1 hunks, 3 lines changed | |
992 | examine changes to 'editedfile'? [Ynesfdaq?] |
|
994 | examine changes to 'editedfile'? [Ynesfdaq?] | |
993 | @@ -1,3 +1,3 @@ |
|
995 | @@ -1,3 +1,3 @@ | |
994 | -This is the first line |
|
996 | -This is the first line | |
995 | -This change will be committed |
|
997 | -This change will be committed | |
996 | -This is the third line |
|
998 | -This is the third line | |
997 | +This change will not be committed |
|
999 | +This change will not be committed | |
998 | +This is the second line |
|
1000 | +This is the second line | |
999 | +This line has been added |
|
1001 | +This line has been added | |
1000 | record this change to 'editedfile'? [Ynesfdaq?] |
|
1002 | record this change to 'editedfile'? [Ynesfdaq?] | |
1001 | no changes to record |
|
1003 | no changes to record | |
1002 | $ cat editedfile |
|
1004 | $ cat editedfile | |
1003 | This change will not be committed |
|
1005 | This change will not be committed | |
1004 | This is the second line |
|
1006 | This is the second line | |
1005 | This line has been added |
|
1007 | This line has been added | |
1006 | $ hg cat -r tip editedfile |
|
1008 | $ hg cat -r tip editedfile | |
1007 | This is the first line |
|
1009 | This is the first line | |
1008 | This change will be committed |
|
1010 | This change will be committed | |
1009 | This is the third line |
|
1011 | This is the third line | |
1010 | $ hg revert editedfile |
|
1012 | $ hg revert editedfile | |
1011 |
|
1013 | |||
1012 | Invalid patch |
|
1014 | Invalid patch | |
1013 |
|
1015 | |||
1014 |
$ sed |
|
1016 | $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp | |
|
1017 | $ mv tmp editedfile | |||
1015 | $ echo "This line has been added" >> editedfile |
|
1018 | $ echo "This line has been added" >> editedfile | |
1016 | $ cat > editor << '__EOF__' |
|
1019 | $ cat > editor << '__EOF__' | |
1017 | > #!/bin/sh |
|
1020 | > #!/bin/sh | |
1018 |
> sed |
|
1021 | > sed s/This/That/ "$1" > tmp | |
|
1022 | > mv tmp "$1" | |||
1019 | > __EOF__ |
|
1023 | > __EOF__ | |
1020 | $ chmod +x editor |
|
1024 | $ chmod +x editor | |
1021 | $ HGEDITOR="'`pwd`'"/editor hg record <<EOF |
|
1025 | $ HGEDITOR="'`pwd`'"/editor hg record <<EOF | |
1022 | > y |
|
1026 | > y | |
1023 | > e |
|
1027 | > e | |
1024 | > EOF |
|
1028 | > EOF | |
1025 | diff --git a/editedfile b/editedfile |
|
1029 | diff --git a/editedfile b/editedfile | |
1026 | 1 hunks, 3 lines changed |
|
1030 | 1 hunks, 3 lines changed | |
1027 | examine changes to 'editedfile'? [Ynesfdaq?] |
|
1031 | examine changes to 'editedfile'? [Ynesfdaq?] | |
1028 | @@ -1,3 +1,3 @@ |
|
1032 | @@ -1,3 +1,3 @@ | |
1029 | -This is the first line |
|
1033 | -This is the first line | |
1030 | -This change will be committed |
|
1034 | -This change will be committed | |
1031 | -This is the third line |
|
1035 | -This is the third line | |
1032 | +This change will not be committed |
|
1036 | +This change will not be committed | |
1033 | +This is the second line |
|
1037 | +This is the second line | |
1034 | +This line has been added |
|
1038 | +This line has been added | |
1035 | record this change to 'editedfile'? [Ynesfdaq?] |
|
1039 | record this change to 'editedfile'? [Ynesfdaq?] | |
1036 | patching file editedfile |
|
1040 | patching file editedfile | |
1037 | Hunk #1 FAILED at 0 |
|
1041 | Hunk #1 FAILED at 0 | |
1038 | 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej |
|
1042 | 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej | |
1039 | abort: patch failed to apply |
|
1043 | abort: patch failed to apply | |
1040 | [255] |
|
1044 | [255] | |
1041 | $ cat editedfile |
|
1045 | $ cat editedfile | |
1042 | This change will not be committed |
|
1046 | This change will not be committed | |
1043 | This is the second line |
|
1047 | This is the second line | |
1044 | This line has been added |
|
1048 | This line has been added | |
1045 | $ hg cat -r tip editedfile |
|
1049 | $ hg cat -r tip editedfile | |
1046 | This is the first line |
|
1050 | This is the first line | |
1047 | This change will be committed |
|
1051 | This change will be committed | |
1048 | This is the third line |
|
1052 | This is the third line | |
1049 | $ cat editedfile.rej |
|
1053 | $ cat editedfile.rej | |
1050 | --- editedfile |
|
1054 | --- editedfile | |
1051 | +++ editedfile |
|
1055 | +++ editedfile | |
1052 | @@ -1,3 +1,3 @@ |
|
1056 | @@ -1,3 +1,3 @@ | |
1053 | -That is the first line |
|
1057 | -That is the first line | |
1054 | -That change will be committed |
|
1058 | -That change will be committed | |
1055 | -That is the third line |
|
1059 | -That is the third line | |
1056 | +That change will not be committed |
|
1060 | +That change will not be committed | |
1057 | +That is the second line |
|
1061 | +That is the second line | |
1058 | +That line has been added |
|
1062 | +That line has been added | |
1059 | $ hg up -C |
|
1063 | $ hg up -C | |
1060 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1064 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1061 |
|
1065 | |||
1062 | With win32text |
|
1066 | With win32text | |
1063 |
|
1067 | |||
1064 | $ echo '[extensions]' >> .hg/hgrc |
|
1068 | $ echo '[extensions]' >> .hg/hgrc | |
1065 | $ echo 'win32text = ' >> .hg/hgrc |
|
1069 | $ echo 'win32text = ' >> .hg/hgrc | |
1066 | $ echo '[decode]' >> .hg/hgrc |
|
1070 | $ echo '[decode]' >> .hg/hgrc | |
1067 | $ echo '** = cleverdecode:' >> .hg/hgrc |
|
1071 | $ echo '** = cleverdecode:' >> .hg/hgrc | |
1068 | $ echo '[encode]' >> .hg/hgrc |
|
1072 | $ echo '[encode]' >> .hg/hgrc | |
1069 | $ echo '** = cleverencode:' >> .hg/hgrc |
|
1073 | $ echo '** = cleverencode:' >> .hg/hgrc | |
1070 | $ echo '[patch]' >> .hg/hgrc |
|
1074 | $ echo '[patch]' >> .hg/hgrc | |
1071 | $ echo 'eol = crlf' >> .hg/hgrc |
|
1075 | $ echo 'eol = crlf' >> .hg/hgrc | |
1072 |
|
1076 | |||
1073 | Ignore win32text deprecation warning for now: |
|
1077 | Ignore win32text deprecation warning for now: | |
1074 |
|
1078 | |||
1075 | $ echo '[win32text]' >> .hg/hgrc |
|
1079 | $ echo '[win32text]' >> .hg/hgrc | |
1076 | $ echo 'warn = no' >> .hg/hgrc |
|
1080 | $ echo 'warn = no' >> .hg/hgrc | |
1077 |
|
1081 | |||
1078 | $ echo d >> subdir/f1 |
|
1082 | $ echo d >> subdir/f1 | |
1079 | $ hg record -d '24 0' -mw1 <<EOF |
|
1083 | $ hg record -d '24 0' -mw1 <<EOF | |
1080 | > y |
|
1084 | > y | |
1081 | > y |
|
1085 | > y | |
1082 | > EOF |
|
1086 | > EOF | |
1083 | diff --git a/subdir/f1 b/subdir/f1 |
|
1087 | diff --git a/subdir/f1 b/subdir/f1 | |
1084 | 1 hunks, 1 lines changed |
|
1088 | 1 hunks, 1 lines changed | |
1085 | examine changes to 'subdir/f1'? [Ynesfdaq?] |
|
1089 | examine changes to 'subdir/f1'? [Ynesfdaq?] | |
1086 | @@ -3,3 +3,4 @@ |
|
1090 | @@ -3,3 +3,4 @@ | |
1087 | a |
|
1091 | a | |
1088 | b |
|
1092 | b | |
1089 | c |
|
1093 | c | |
1090 | +d |
|
1094 | +d | |
1091 | record this change to 'subdir/f1'? [Ynesfdaq?] |
|
1095 | record this change to 'subdir/f1'? [Ynesfdaq?] | |
1092 |
|
1096 | |||
1093 | $ hg tip -p |
|
1097 | $ hg tip -p | |
1094 | changeset: 28:287ad1f41a72 |
|
1098 | changeset: 28:287ad1f41a72 | |
1095 | tag: tip |
|
1099 | tag: tip | |
1096 | user: test |
|
1100 | user: test | |
1097 | date: Thu Jan 01 00:00:24 1970 +0000 |
|
1101 | date: Thu Jan 01 00:00:24 1970 +0000 | |
1098 | summary: w1 |
|
1102 | summary: w1 | |
1099 |
|
1103 | |||
1100 | diff -r 65ce23a81197 -r 287ad1f41a72 subdir/f1 |
|
1104 | diff -r 65ce23a81197 -r 287ad1f41a72 subdir/f1 | |
1101 | --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 |
|
1105 | --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000 | |
1102 | +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 |
|
1106 | +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000 | |
1103 | @@ -3,3 +3,4 @@ |
|
1107 | @@ -3,3 +3,4 @@ | |
1104 | a |
|
1108 | a | |
1105 | b |
|
1109 | b | |
1106 | c |
|
1110 | c | |
1107 | +d |
|
1111 | +d | |
1108 |
|
1112 |
General Comments 0
You need to be logged in to leave comments.
Login now