Show More
@@ -1,785 +1,790 | |||||
1 | commit date test |
|
1 | commit date test | |
2 |
|
2 | |||
3 | $ hg init test |
|
3 | $ hg init test | |
4 | $ cd test |
|
4 | $ cd test | |
5 | $ echo foo > foo |
|
5 | $ echo foo > foo | |
6 | $ hg add foo |
|
6 | $ hg add foo | |
7 | $ cat > $TESTTMP/checkeditform.sh <<EOF |
|
7 | $ cat > $TESTTMP/checkeditform.sh <<EOF | |
8 | > env | grep HGEDITFORM |
|
8 | > env | grep HGEDITFORM | |
9 | > true |
|
9 | > true | |
10 | > EOF |
|
10 | > EOF | |
11 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m "" |
|
11 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg commit -m "" | |
12 | HGEDITFORM=commit.normal.normal |
|
12 | HGEDITFORM=commit.normal.normal | |
13 | abort: empty commit message |
|
13 | abort: empty commit message | |
14 | [255] |
|
14 | [255] | |
15 | $ hg commit -d '0 0' -m commit-1 |
|
15 | $ hg commit -d '0 0' -m commit-1 | |
16 | $ echo foo >> foo |
|
16 | $ echo foo >> foo | |
17 | $ hg commit -d '1 4444444' -m commit-3 |
|
17 | $ hg commit -d '1 4444444' -m commit-3 | |
18 | abort: impossible time zone offset: 4444444 |
|
18 | abort: impossible time zone offset: 4444444 | |
19 | [255] |
|
19 | [255] | |
20 | $ hg commit -d '1 15.1' -m commit-4 |
|
20 | $ hg commit -d '1 15.1' -m commit-4 | |
21 | abort: invalid date: '1\t15.1' |
|
21 | abort: invalid date: '1\t15.1' | |
22 | [255] |
|
22 | [255] | |
23 | $ hg commit -d 'foo bar' -m commit-5 |
|
23 | $ hg commit -d 'foo bar' -m commit-5 | |
24 | abort: invalid date: 'foo bar' |
|
24 | abort: invalid date: 'foo bar' | |
25 | [255] |
|
25 | [255] | |
26 | $ hg commit -d ' 1 4444' -m commit-6 |
|
26 | $ hg commit -d ' 1 4444' -m commit-6 | |
27 | $ hg commit -d '111111111111 0' -m commit-7 |
|
27 | $ hg commit -d '111111111111 0' -m commit-7 | |
28 | abort: date exceeds 32 bits: 111111111111 |
|
28 | abort: date exceeds 32 bits: 111111111111 | |
29 | [255] |
|
29 | [255] | |
30 | $ hg commit -d '-111111111111 0' -m commit-7 |
|
30 | $ hg commit -d '-111111111111 0' -m commit-7 | |
31 | abort: date exceeds 32 bits: -111111111111 |
|
31 | abort: date exceeds 32 bits: -111111111111 | |
32 | [255] |
|
32 | [255] | |
33 | $ echo foo >> foo |
|
33 | $ echo foo >> foo | |
34 | $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2 |
|
34 | $ hg commit -d '1901-12-13 20:45:52 +0000' -m commit-7-2 | |
35 | $ echo foo >> foo |
|
35 | $ echo foo >> foo | |
36 | $ hg commit -d '-2147483648 0' -m commit-7-3 |
|
36 | $ hg commit -d '-2147483648 0' -m commit-7-3 | |
37 | $ hg log -T '{rev} {date|isodatesec}\n' -l2 |
|
37 | $ hg log -T '{rev} {date|isodatesec}\n' -l2 | |
38 | 3 1901-12-13 20:45:52 +0000 |
|
38 | 3 1901-12-13 20:45:52 +0000 | |
39 | 2 1901-12-13 20:45:52 +0000 |
|
39 | 2 1901-12-13 20:45:52 +0000 | |
40 | $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7 |
|
40 | $ hg commit -d '1901-12-13 20:45:51 +0000' -m commit-7 | |
41 | abort: date exceeds 32 bits: -2147483649 |
|
41 | abort: date exceeds 32 bits: -2147483649 | |
42 | [255] |
|
42 | [255] | |
43 | $ hg commit -d '-2147483649 0' -m commit-7 |
|
43 | $ hg commit -d '-2147483649 0' -m commit-7 | |
44 | abort: date exceeds 32 bits: -2147483649 |
|
44 | abort: date exceeds 32 bits: -2147483649 | |
45 | [255] |
|
45 | [255] | |
46 |
|
46 | |||
47 | commit added file that has been deleted |
|
47 | commit added file that has been deleted | |
48 |
|
48 | |||
49 | $ echo bar > bar |
|
49 | $ echo bar > bar | |
50 | $ hg add bar |
|
50 | $ hg add bar | |
51 | $ rm bar |
|
51 | $ rm bar | |
52 | $ hg commit -m commit-8 |
|
52 | $ hg commit -m commit-8 | |
53 | nothing changed (1 missing files, see 'hg status') |
|
53 | nothing changed (1 missing files, see 'hg status') | |
54 | [1] |
|
54 | [1] | |
55 | $ hg commit -m commit-8-2 bar |
|
55 | $ hg commit -m commit-8-2 bar | |
56 | abort: bar: file not found! |
|
56 | abort: bar: file not found! | |
57 | [255] |
|
57 | [255] | |
58 |
|
58 | |||
59 | $ hg -q revert -a --no-backup |
|
59 | $ hg -q revert -a --no-backup | |
60 |
|
60 | |||
61 | $ mkdir dir |
|
61 | $ mkdir dir | |
62 | $ echo boo > dir/file |
|
62 | $ echo boo > dir/file | |
63 | $ hg add |
|
63 | $ hg add | |
64 | adding dir/file (glob) |
|
64 | adding dir/file (glob) | |
65 | $ hg -v commit -m commit-9 dir |
|
65 | $ hg -v commit -m commit-9 dir | |
66 | committing files: |
|
66 | committing files: | |
67 | dir/file |
|
67 | dir/file | |
68 | committing manifest |
|
68 | committing manifest | |
69 | committing changelog |
|
69 | committing changelog | |
70 | committed changeset 4:1957363f1ced |
|
70 | committed changeset 4:1957363f1ced | |
71 |
|
71 | |||
72 | $ echo > dir.file |
|
72 | $ echo > dir.file | |
73 | $ hg add |
|
73 | $ hg add | |
74 | adding dir.file |
|
74 | adding dir.file | |
75 | $ hg commit -m commit-10 dir dir.file |
|
75 | $ hg commit -m commit-10 dir dir.file | |
76 | abort: dir: no match under directory! |
|
76 | abort: dir: no match under directory! | |
77 | [255] |
|
77 | [255] | |
78 |
|
78 | |||
79 | $ echo >> dir/file |
|
79 | $ echo >> dir/file | |
80 | $ mkdir bleh |
|
80 | $ mkdir bleh | |
81 | $ mkdir dir2 |
|
81 | $ mkdir dir2 | |
82 | $ cd bleh |
|
82 | $ cd bleh | |
83 | $ hg commit -m commit-11 . |
|
83 | $ hg commit -m commit-11 . | |
84 | abort: bleh: no match under directory! |
|
84 | abort: bleh: no match under directory! | |
85 | [255] |
|
85 | [255] | |
86 | $ hg commit -m commit-12 ../dir ../dir2 |
|
86 | $ hg commit -m commit-12 ../dir ../dir2 | |
87 | abort: dir2: no match under directory! |
|
87 | abort: dir2: no match under directory! | |
88 | [255] |
|
88 | [255] | |
89 | $ hg -v commit -m commit-13 ../dir |
|
89 | $ hg -v commit -m commit-13 ../dir | |
90 | committing files: |
|
90 | committing files: | |
91 | dir/file |
|
91 | dir/file | |
92 | committing manifest |
|
92 | committing manifest | |
93 | committing changelog |
|
93 | committing changelog | |
94 | committed changeset 5:a31d8f87544a |
|
94 | committed changeset 5:a31d8f87544a | |
95 | $ cd .. |
|
95 | $ cd .. | |
96 |
|
96 | |||
97 | $ hg commit -m commit-14 does-not-exist |
|
97 | $ hg commit -m commit-14 does-not-exist | |
98 | abort: does-not-exist: * (glob) |
|
98 | abort: does-not-exist: * (glob) | |
99 | [255] |
|
99 | [255] | |
100 |
|
100 | |||
101 | #if symlink |
|
101 | #if symlink | |
102 | $ ln -s foo baz |
|
102 | $ ln -s foo baz | |
103 | $ hg commit -m commit-15 baz |
|
103 | $ hg commit -m commit-15 baz | |
104 | abort: baz: file not tracked! |
|
104 | abort: baz: file not tracked! | |
105 | [255] |
|
105 | [255] | |
106 | #endif |
|
106 | #endif | |
107 |
|
107 | |||
108 | $ touch quux |
|
108 | $ touch quux | |
109 | $ hg commit -m commit-16 quux |
|
109 | $ hg commit -m commit-16 quux | |
110 | abort: quux: file not tracked! |
|
110 | abort: quux: file not tracked! | |
111 | [255] |
|
111 | [255] | |
112 | $ echo >> dir/file |
|
112 | $ echo >> dir/file | |
113 | $ hg -v commit -m commit-17 dir/file |
|
113 | $ hg -v commit -m commit-17 dir/file | |
114 | committing files: |
|
114 | committing files: | |
115 | dir/file |
|
115 | dir/file | |
116 | committing manifest |
|
116 | committing manifest | |
117 | committing changelog |
|
117 | committing changelog | |
118 | committed changeset 6:32d054c9d085 |
|
118 | committed changeset 6:32d054c9d085 | |
119 |
|
119 | |||
120 | An empty date was interpreted as epoch origin |
|
120 | An empty date was interpreted as epoch origin | |
121 |
|
121 | |||
122 | $ echo foo >> foo |
|
122 | $ echo foo >> foo | |
123 | $ hg commit -d '' -m commit-no-date |
|
123 | $ hg commit -d '' -m commit-no-date | |
124 | $ hg tip --template '{date|isodate}\n' | grep '1970' |
|
124 | $ hg tip --template '{date|isodate}\n' | grep '1970' | |
125 | [1] |
|
125 | [1] | |
126 |
|
126 | |||
127 | Make sure we do not obscure unknown requires file entries (issue2649) |
|
127 | Make sure we do not obscure unknown requires file entries (issue2649) | |
128 |
|
128 | |||
129 | $ echo foo >> foo |
|
129 | $ echo foo >> foo | |
130 | $ echo fake >> .hg/requires |
|
130 | $ echo fake >> .hg/requires | |
131 | $ hg commit -m bla |
|
131 | $ hg commit -m bla | |
132 | abort: repository requires features unknown to this Mercurial: fake! |
|
132 | abort: repository requires features unknown to this Mercurial: fake! | |
133 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
|
133 | (see https://mercurial-scm.org/wiki/MissingRequirement for more information) | |
134 | [255] |
|
134 | [255] | |
135 |
|
135 | |||
136 | $ cd .. |
|
136 | $ cd .. | |
137 |
|
137 | |||
138 |
|
138 | |||
139 | partial subdir commit test |
|
139 | partial subdir commit test | |
140 |
|
140 | |||
141 | $ hg init test2 |
|
141 | $ hg init test2 | |
142 | $ cd test2 |
|
142 | $ cd test2 | |
143 | $ mkdir foo |
|
143 | $ mkdir foo | |
144 | $ echo foo > foo/foo |
|
144 | $ echo foo > foo/foo | |
145 | $ mkdir bar |
|
145 | $ mkdir bar | |
146 | $ echo bar > bar/bar |
|
146 | $ echo bar > bar/bar | |
147 | $ hg add |
|
147 | $ hg add | |
148 | adding bar/bar (glob) |
|
148 | adding bar/bar (glob) | |
149 | adding foo/foo (glob) |
|
149 | adding foo/foo (glob) | |
150 | $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo |
|
150 | $ HGEDITOR=cat hg ci -e -m commit-subdir-1 foo | |
151 | commit-subdir-1 |
|
151 | commit-subdir-1 | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
154 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
155 | HG: Leave message empty to abort commit. |
|
155 | HG: Leave message empty to abort commit. | |
156 | HG: -- |
|
156 | HG: -- | |
157 | HG: user: test |
|
157 | HG: user: test | |
158 | HG: branch 'default' |
|
158 | HG: branch 'default' | |
159 | HG: added foo/foo |
|
159 | HG: added foo/foo | |
160 |
|
160 | |||
161 |
|
161 | |||
162 | $ hg ci -m commit-subdir-2 bar |
|
162 | $ hg ci -m commit-subdir-2 bar | |
163 |
|
163 | |||
164 | subdir log 1 |
|
164 | subdir log 1 | |
165 |
|
165 | |||
166 | $ hg log -v foo |
|
166 | $ hg log -v foo | |
167 | changeset: 0:f97e73a25882 |
|
167 | changeset: 0:f97e73a25882 | |
168 | user: test |
|
168 | user: test | |
169 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
169 | date: Thu Jan 01 00:00:00 1970 +0000 | |
170 | files: foo/foo |
|
170 | files: foo/foo | |
171 | description: |
|
171 | description: | |
172 | commit-subdir-1 |
|
172 | commit-subdir-1 | |
173 |
|
173 | |||
174 |
|
174 | |||
175 |
|
175 | |||
176 | subdir log 2 |
|
176 | subdir log 2 | |
177 |
|
177 | |||
178 | $ hg log -v bar |
|
178 | $ hg log -v bar | |
179 | changeset: 1:aa809156d50d |
|
179 | changeset: 1:aa809156d50d | |
180 | tag: tip |
|
180 | tag: tip | |
181 | user: test |
|
181 | user: test | |
182 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
182 | date: Thu Jan 01 00:00:00 1970 +0000 | |
183 | files: bar/bar |
|
183 | files: bar/bar | |
184 | description: |
|
184 | description: | |
185 | commit-subdir-2 |
|
185 | commit-subdir-2 | |
186 |
|
186 | |||
187 |
|
187 | |||
188 |
|
188 | |||
189 | full log |
|
189 | full log | |
190 |
|
190 | |||
191 | $ hg log -v |
|
191 | $ hg log -v | |
192 | changeset: 1:aa809156d50d |
|
192 | changeset: 1:aa809156d50d | |
193 | tag: tip |
|
193 | tag: tip | |
194 | user: test |
|
194 | user: test | |
195 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
195 | date: Thu Jan 01 00:00:00 1970 +0000 | |
196 | files: bar/bar |
|
196 | files: bar/bar | |
197 | description: |
|
197 | description: | |
198 | commit-subdir-2 |
|
198 | commit-subdir-2 | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | changeset: 0:f97e73a25882 |
|
201 | changeset: 0:f97e73a25882 | |
202 | user: test |
|
202 | user: test | |
203 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
203 | date: Thu Jan 01 00:00:00 1970 +0000 | |
204 | files: foo/foo |
|
204 | files: foo/foo | |
205 | description: |
|
205 | description: | |
206 | commit-subdir-1 |
|
206 | commit-subdir-1 | |
207 |
|
207 | |||
208 |
|
208 | |||
209 | $ cd .. |
|
209 | $ cd .. | |
210 |
|
210 | |||
211 |
|
211 | |||
212 | dot and subdir commit test |
|
212 | dot and subdir commit test | |
213 |
|
213 | |||
214 | $ hg init test3 |
|
214 | $ hg init test3 | |
215 | $ echo commit-foo-subdir > commit-log-test |
|
215 | $ echo commit-foo-subdir > commit-log-test | |
216 | $ cd test3 |
|
216 | $ cd test3 | |
217 | $ mkdir foo |
|
217 | $ mkdir foo | |
218 | $ echo foo content > foo/plain-file |
|
218 | $ echo foo content > foo/plain-file | |
219 | $ hg add foo/plain-file |
|
219 | $ hg add foo/plain-file | |
220 | $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo |
|
220 | $ HGEDITOR=cat hg ci --edit -l ../commit-log-test foo | |
221 | commit-foo-subdir |
|
221 | commit-foo-subdir | |
222 |
|
222 | |||
223 |
|
223 | |||
224 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
224 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
225 | HG: Leave message empty to abort commit. |
|
225 | HG: Leave message empty to abort commit. | |
226 | HG: -- |
|
226 | HG: -- | |
227 | HG: user: test |
|
227 | HG: user: test | |
228 | HG: branch 'default' |
|
228 | HG: branch 'default' | |
229 | HG: added foo/plain-file |
|
229 | HG: added foo/plain-file | |
230 |
|
230 | |||
231 |
|
231 | |||
232 | $ echo modified foo content > foo/plain-file |
|
232 | $ echo modified foo content > foo/plain-file | |
233 | $ hg ci -m commit-foo-dot . |
|
233 | $ hg ci -m commit-foo-dot . | |
234 |
|
234 | |||
235 | full log |
|
235 | full log | |
236 |
|
236 | |||
237 | $ hg log -v |
|
237 | $ hg log -v | |
238 | changeset: 1:95b38e3a5b2e |
|
238 | changeset: 1:95b38e3a5b2e | |
239 | tag: tip |
|
239 | tag: tip | |
240 | user: test |
|
240 | user: test | |
241 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
241 | date: Thu Jan 01 00:00:00 1970 +0000 | |
242 | files: foo/plain-file |
|
242 | files: foo/plain-file | |
243 | description: |
|
243 | description: | |
244 | commit-foo-dot |
|
244 | commit-foo-dot | |
245 |
|
245 | |||
246 |
|
246 | |||
247 | changeset: 0:65d4e9386227 |
|
247 | changeset: 0:65d4e9386227 | |
248 | user: test |
|
248 | user: test | |
249 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
249 | date: Thu Jan 01 00:00:00 1970 +0000 | |
250 | files: foo/plain-file |
|
250 | files: foo/plain-file | |
251 | description: |
|
251 | description: | |
252 | commit-foo-subdir |
|
252 | commit-foo-subdir | |
253 |
|
253 | |||
254 |
|
254 | |||
255 |
|
255 | |||
256 | subdir log |
|
256 | subdir log | |
257 |
|
257 | |||
258 | $ cd foo |
|
258 | $ cd foo | |
259 | $ hg log . |
|
259 | $ hg log . | |
260 | changeset: 1:95b38e3a5b2e |
|
260 | changeset: 1:95b38e3a5b2e | |
261 | tag: tip |
|
261 | tag: tip | |
262 | user: test |
|
262 | user: test | |
263 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
263 | date: Thu Jan 01 00:00:00 1970 +0000 | |
264 | summary: commit-foo-dot |
|
264 | summary: commit-foo-dot | |
265 |
|
265 | |||
266 | changeset: 0:65d4e9386227 |
|
266 | changeset: 0:65d4e9386227 | |
267 | user: test |
|
267 | user: test | |
268 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
268 | date: Thu Jan 01 00:00:00 1970 +0000 | |
269 | summary: commit-foo-subdir |
|
269 | summary: commit-foo-subdir | |
270 |
|
270 | |||
271 | $ cd .. |
|
271 | $ cd .. | |
272 | $ cd .. |
|
272 | $ cd .. | |
273 |
|
273 | |||
274 | Issue1049: Hg permits partial commit of merge without warning |
|
274 | Issue1049: Hg permits partial commit of merge without warning | |
275 |
|
275 | |||
276 | $ hg init issue1049 |
|
276 | $ hg init issue1049 | |
277 | $ cd issue1049 |
|
277 | $ cd issue1049 | |
278 | $ echo a > a |
|
278 | $ echo a > a | |
279 | $ hg ci -Ama |
|
279 | $ hg ci -Ama | |
280 | adding a |
|
280 | adding a | |
281 | $ echo a >> a |
|
281 | $ echo a >> a | |
282 | $ hg ci -mb |
|
282 | $ hg ci -mb | |
283 | $ hg up 0 |
|
283 | $ hg up 0 | |
284 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
284 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
285 | $ echo b >> a |
|
285 | $ echo b >> a | |
286 | $ hg ci -mc |
|
286 | $ hg ci -mc | |
287 | created new head |
|
287 | created new head | |
288 | $ HGMERGE=true hg merge |
|
288 | $ HGMERGE=true hg merge | |
289 | merging a |
|
289 | merging a | |
290 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
290 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
291 | (branch merge, don't forget to commit) |
|
291 | (branch merge, don't forget to commit) | |
292 |
|
292 | |||
293 | should fail because we are specifying a file name |
|
293 | should fail because we are specifying a file name | |
294 |
|
294 | |||
295 | $ hg ci -mmerge a |
|
295 | $ hg ci -mmerge a | |
296 | abort: cannot partially commit a merge (do not specify files or patterns) |
|
296 | abort: cannot partially commit a merge (do not specify files or patterns) | |
297 | [255] |
|
297 | [255] | |
298 |
|
298 | |||
299 | should fail because we are specifying a pattern |
|
299 | should fail because we are specifying a pattern | |
300 |
|
300 | |||
301 | $ hg ci -mmerge -I a |
|
301 | $ hg ci -mmerge -I a | |
302 | abort: cannot partially commit a merge (do not specify files or patterns) |
|
302 | abort: cannot partially commit a merge (do not specify files or patterns) | |
303 | [255] |
|
303 | [255] | |
304 |
|
304 | |||
305 | should succeed |
|
305 | should succeed | |
306 |
|
306 | |||
307 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit |
|
307 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg ci -mmerge --edit | |
308 | HGEDITFORM=commit.normal.merge |
|
308 | HGEDITFORM=commit.normal.merge | |
309 | $ cd .. |
|
309 | $ cd .. | |
310 |
|
310 | |||
311 |
|
311 | |||
312 | test commit message content |
|
312 | test commit message content | |
313 |
|
313 | |||
314 | $ hg init commitmsg |
|
314 | $ hg init commitmsg | |
315 | $ cd commitmsg |
|
315 | $ cd commitmsg | |
316 | $ echo changed > changed |
|
316 | $ echo changed > changed | |
317 | $ echo removed > removed |
|
317 | $ echo removed > removed | |
318 | $ hg book activebookmark |
|
318 | $ hg book activebookmark | |
319 | $ hg ci -qAm init |
|
319 | $ hg ci -qAm init | |
320 |
|
320 | |||
321 | $ hg rm removed |
|
321 | $ hg rm removed | |
322 | $ echo changed >> changed |
|
322 | $ echo changed >> changed | |
323 | $ echo added > added |
|
323 | $ echo added > added | |
324 | $ hg add added |
|
324 | $ hg add added | |
325 | $ HGEDITOR=cat hg ci -A |
|
325 | $ HGEDITOR=cat hg ci -A | |
326 |
|
326 | |||
327 |
|
327 | |||
328 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
328 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
329 | HG: Leave message empty to abort commit. |
|
329 | HG: Leave message empty to abort commit. | |
330 | HG: -- |
|
330 | HG: -- | |
331 | HG: user: test |
|
331 | HG: user: test | |
332 | HG: branch 'default' |
|
332 | HG: branch 'default' | |
333 | HG: bookmark 'activebookmark' |
|
333 | HG: bookmark 'activebookmark' | |
334 | HG: added added |
|
334 | HG: added added | |
335 | HG: changed changed |
|
335 | HG: changed changed | |
336 | HG: removed removed |
|
336 | HG: removed removed | |
337 | abort: empty commit message |
|
337 | abort: empty commit message | |
338 | [255] |
|
338 | [255] | |
339 |
|
339 | |||
340 | test saving last-message.txt |
|
340 | test saving last-message.txt | |
341 |
|
341 | |||
342 | $ hg init sub |
|
342 | $ hg init sub | |
343 | $ echo a > sub/a |
|
343 | $ echo a > sub/a | |
344 | $ hg -R sub add sub/a |
|
344 | $ hg -R sub add sub/a | |
345 | $ cat > sub/.hg/hgrc <<EOF |
|
345 | $ cat > sub/.hg/hgrc <<EOF | |
346 | > [hooks] |
|
346 | > [hooks] | |
347 | > precommit.test-saving-last-message = false |
|
347 | > precommit.test-saving-last-message = false | |
348 | > EOF |
|
348 | > EOF | |
349 |
|
349 | |||
350 | $ echo 'sub = sub' > .hgsub |
|
350 | $ echo 'sub = sub' > .hgsub | |
351 | $ hg add .hgsub |
|
351 | $ hg add .hgsub | |
352 |
|
352 | |||
353 | $ cat > $TESTTMP/editor.sh <<EOF |
|
353 | $ cat > $TESTTMP/editor.sh <<EOF | |
354 | > echo "==== before editing:" |
|
354 | > echo "==== before editing:" | |
355 | > cat \$1 |
|
355 | > cat \$1 | |
356 | > echo "====" |
|
356 | > echo "====" | |
357 | > echo "test saving last-message.txt" >> \$1 |
|
357 | > echo "test saving last-message.txt" >> \$1 | |
358 | > EOF |
|
358 | > EOF | |
359 |
|
359 | |||
360 | $ rm -f .hg/last-message.txt |
|
360 | $ rm -f .hg/last-message.txt | |
361 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q |
|
361 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q | |
362 | ==== before editing: |
|
362 | ==== before editing: | |
363 |
|
363 | |||
364 |
|
364 | |||
365 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
365 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
366 | HG: Leave message empty to abort commit. |
|
366 | HG: Leave message empty to abort commit. | |
367 | HG: -- |
|
367 | HG: -- | |
368 | HG: user: test |
|
368 | HG: user: test | |
369 | HG: branch 'default' |
|
369 | HG: branch 'default' | |
370 | HG: bookmark 'activebookmark' |
|
370 | HG: bookmark 'activebookmark' | |
371 | HG: subrepo sub |
|
371 | HG: subrepo sub | |
372 | HG: added .hgsub |
|
372 | HG: added .hgsub | |
373 | HG: added added |
|
373 | HG: added added | |
374 | HG: changed .hgsubstate |
|
374 | HG: changed .hgsubstate | |
375 | HG: changed changed |
|
375 | HG: changed changed | |
376 | HG: removed removed |
|
376 | HG: removed removed | |
377 | ==== |
|
377 | ==== | |
378 | abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub) |
|
378 | abort: precommit.test-saving-last-message hook exited with status 1 (in subrepo sub) | |
379 | [255] |
|
379 | [255] | |
380 | $ cat .hg/last-message.txt |
|
380 | $ cat .hg/last-message.txt | |
381 |
|
381 | |||
382 |
|
382 | |||
383 | test saving last-message.txt |
|
383 | test saving last-message.txt | |
384 |
|
384 | |||
385 | test that '[committemplate] changeset' definition and commit log |
|
385 | test that '[committemplate] changeset' definition and commit log | |
386 | specific template keywords work well |
|
386 | specific template keywords work well | |
387 |
|
387 | |||
388 | $ cat >> .hg/hgrc <<EOF |
|
388 | $ cat >> .hg/hgrc <<EOF | |
389 | > [committemplate] |
|
389 | > [committemplate] | |
390 | > changeset.commit.normal = HG: this is "commit.normal" template |
|
390 | > changeset.commit.normal = HG: this is "commit.normal" template | |
391 | > HG: {extramsg} |
|
391 | > HG: {extramsg} | |
392 | > {if(activebookmark, |
|
392 | > {if(activebookmark, | |
393 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
393 | > "HG: bookmark '{activebookmark}' is activated\n", | |
394 | > "HG: no bookmark is activated\n")}{subrepos % |
|
394 | > "HG: no bookmark is activated\n")}{subrepos % | |
395 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
395 | > "HG: subrepo '{subrepo}' is changed\n"} | |
396 | > |
|
396 | > | |
397 | > changeset.commit = HG: this is "commit" template |
|
397 | > changeset.commit = HG: this is "commit" template | |
398 | > HG: {extramsg} |
|
398 | > HG: {extramsg} | |
399 | > {if(activebookmark, |
|
399 | > {if(activebookmark, | |
400 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
400 | > "HG: bookmark '{activebookmark}' is activated\n", | |
401 | > "HG: no bookmark is activated\n")}{subrepos % |
|
401 | > "HG: no bookmark is activated\n")}{subrepos % | |
402 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
402 | > "HG: subrepo '{subrepo}' is changed\n"} | |
403 | > |
|
403 | > | |
404 | > changeset = HG: this is customized commit template |
|
404 | > changeset = HG: this is customized commit template | |
405 | > HG: {extramsg} |
|
405 | > HG: {extramsg} | |
406 | > {if(activebookmark, |
|
406 | > {if(activebookmark, | |
407 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
407 | > "HG: bookmark '{activebookmark}' is activated\n", | |
408 | > "HG: no bookmark is activated\n")}{subrepos % |
|
408 | > "HG: no bookmark is activated\n")}{subrepos % | |
409 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
409 | > "HG: subrepo '{subrepo}' is changed\n"} | |
410 | > EOF |
|
410 | > EOF | |
411 |
|
411 | |||
412 | $ hg init sub2 |
|
412 | $ hg init sub2 | |
413 | $ echo a > sub2/a |
|
413 | $ echo a > sub2/a | |
414 | $ hg -R sub2 add sub2/a |
|
414 | $ hg -R sub2 add sub2/a | |
415 | $ echo 'sub2 = sub2' >> .hgsub |
|
415 | $ echo 'sub2 = sub2' >> .hgsub | |
416 |
|
416 | |||
417 | $ HGEDITOR=cat hg commit -S -q |
|
417 | $ HGEDITOR=cat hg commit -S -q | |
418 | HG: this is "commit.normal" template |
|
418 | HG: this is "commit.normal" template | |
419 | HG: Leave message empty to abort commit. |
|
419 | HG: Leave message empty to abort commit. | |
420 | HG: bookmark 'activebookmark' is activated |
|
420 | HG: bookmark 'activebookmark' is activated | |
421 | HG: subrepo 'sub' is changed |
|
421 | HG: subrepo 'sub' is changed | |
422 | HG: subrepo 'sub2' is changed |
|
422 | HG: subrepo 'sub2' is changed | |
423 | abort: empty commit message |
|
423 | abort: empty commit message | |
424 | [255] |
|
424 | [255] | |
425 |
|
425 | |||
426 | $ cat >> .hg/hgrc <<EOF |
|
426 | $ cat >> .hg/hgrc <<EOF | |
427 | > [committemplate] |
|
427 | > [committemplate] | |
428 | > changeset.commit.normal = |
|
428 | > changeset.commit.normal = | |
429 | > # now, "changeset.commit" should be chosen for "hg commit" |
|
429 | > # now, "changeset.commit" should be chosen for "hg commit" | |
430 | > EOF |
|
430 | > EOF | |
431 |
|
431 | |||
432 | $ hg bookmark --inactive activebookmark |
|
432 | $ hg bookmark --inactive activebookmark | |
433 | $ hg forget .hgsub |
|
433 | $ hg forget .hgsub | |
434 | $ HGEDITOR=cat hg commit -q |
|
434 | $ HGEDITOR=cat hg commit -q | |
435 | HG: this is "commit" template |
|
435 | HG: this is "commit" template | |
436 | HG: Leave message empty to abort commit. |
|
436 | HG: Leave message empty to abort commit. | |
437 | HG: no bookmark is activated |
|
437 | HG: no bookmark is activated | |
438 | abort: empty commit message |
|
438 | abort: empty commit message | |
439 | [255] |
|
439 | [255] | |
440 |
|
440 | |||
441 | $ cat >> .hg/hgrc <<EOF |
|
441 | $ cat >> .hg/hgrc <<EOF | |
442 | > [committemplate] |
|
442 | > [committemplate] | |
443 | > changeset.commit = |
|
443 | > changeset.commit = | |
444 | > # now, "changeset" should be chosen for "hg commit" |
|
444 | > # now, "changeset" should be chosen for "hg commit" | |
445 | > EOF |
|
445 | > EOF | |
446 |
|
446 | |||
447 | $ HGEDITOR=cat hg commit -q |
|
447 | $ HGEDITOR=cat hg commit -q | |
448 | HG: this is customized commit template |
|
448 | HG: this is customized commit template | |
449 | HG: Leave message empty to abort commit. |
|
449 | HG: Leave message empty to abort commit. | |
450 | HG: no bookmark is activated |
|
450 | HG: no bookmark is activated | |
451 | abort: empty commit message |
|
451 | abort: empty commit message | |
452 | [255] |
|
452 | [255] | |
453 |
|
453 | |||
454 | $ cat >> .hg/hgrc <<EOF |
|
454 | $ cat >> .hg/hgrc <<EOF | |
455 | > [committemplate] |
|
455 | > [committemplate] | |
456 | > changeset = {desc} |
|
456 | > changeset = {desc} | |
457 | > HG: mods={file_mods} |
|
457 | > HG: mods={file_mods} | |
458 | > HG: adds={file_adds} |
|
458 | > HG: adds={file_adds} | |
459 | > HG: dels={file_dels} |
|
459 | > HG: dels={file_dels} | |
460 | > HG: files={files} |
|
460 | > HG: files={files} | |
461 | > HG: |
|
461 | > HG: | |
462 | > {splitlines(diff()) % 'HG: {line}\n' |
|
462 | > {splitlines(diff()) % 'HG: {line}\n' | |
463 | > }HG: |
|
463 | > }HG: | |
464 | > HG: mods={file_mods} |
|
464 | > HG: mods={file_mods} | |
465 | > HG: adds={file_adds} |
|
465 | > HG: adds={file_adds} | |
466 | > HG: dels={file_dels} |
|
466 | > HG: dels={file_dels} | |
467 | > HG: files={files}\n |
|
467 | > HG: files={files}\n | |
468 | > EOF |
|
468 | > EOF | |
469 | $ hg status -amr |
|
469 | $ hg status -amr | |
470 | M changed |
|
470 | M changed | |
471 | A added |
|
471 | A added | |
472 | R removed |
|
472 | R removed | |
473 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed |
|
473 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" changed | |
474 | foo bar |
|
474 | foo bar | |
475 | HG: mods=changed |
|
475 | HG: mods=changed | |
476 | HG: adds= |
|
476 | HG: adds= | |
477 | HG: dels= |
|
477 | HG: dels= | |
478 | HG: files=changed |
|
478 | HG: files=changed | |
479 | HG: |
|
479 | HG: | |
480 | HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 |
|
480 | HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 | |
481 | HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 |
|
481 | HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 | |
482 | HG: @@ -1,1 +1,2 @@ |
|
482 | HG: @@ -1,1 +1,2 @@ | |
483 | HG: changed |
|
483 | HG: changed | |
484 | HG: +changed |
|
484 | HG: +changed | |
485 | HG: |
|
485 | HG: | |
486 | HG: mods=changed |
|
486 | HG: mods=changed | |
487 | HG: adds= |
|
487 | HG: adds= | |
488 | HG: dels= |
|
488 | HG: dels= | |
489 | HG: files=changed |
|
489 | HG: files=changed | |
490 | $ hg status -amr |
|
490 | $ hg status -amr | |
491 | A added |
|
491 | A added | |
492 | R removed |
|
492 | R removed | |
493 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" |
|
493 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" | |
494 | M changed |
|
494 | M changed | |
495 | A |
|
495 | A | |
496 | R |
|
496 | R | |
497 | $ hg rollback -q |
|
497 | $ hg rollback -q | |
498 |
|
498 | |||
499 | $ cat >> .hg/hgrc <<EOF |
|
499 | $ cat >> .hg/hgrc <<EOF | |
500 | > [committemplate] |
|
500 | > [committemplate] | |
501 | > changeset = {desc} |
|
501 | > changeset = {desc} | |
502 | > HG: mods={file_mods} |
|
502 | > HG: mods={file_mods} | |
503 | > HG: adds={file_adds} |
|
503 | > HG: adds={file_adds} | |
504 | > HG: dels={file_dels} |
|
504 | > HG: dels={file_dels} | |
505 | > HG: files={files} |
|
505 | > HG: files={files} | |
506 | > HG: |
|
506 | > HG: | |
507 | > {splitlines(diff("changed")) % 'HG: {line}\n' |
|
507 | > {splitlines(diff("changed")) % 'HG: {line}\n' | |
508 | > }HG: |
|
508 | > }HG: | |
509 | > HG: mods={file_mods} |
|
509 | > HG: mods={file_mods} | |
510 | > HG: adds={file_adds} |
|
510 | > HG: adds={file_adds} | |
511 | > HG: dels={file_dels} |
|
511 | > HG: dels={file_dels} | |
512 | > HG: files={files} |
|
512 | > HG: files={files} | |
513 | > HG: |
|
513 | > HG: | |
514 | > {splitlines(diff("added")) % 'HG: {line}\n' |
|
514 | > {splitlines(diff("added")) % 'HG: {line}\n' | |
515 | > }HG: |
|
515 | > }HG: | |
516 | > HG: mods={file_mods} |
|
516 | > HG: mods={file_mods} | |
517 | > HG: adds={file_adds} |
|
517 | > HG: adds={file_adds} | |
518 | > HG: dels={file_dels} |
|
518 | > HG: dels={file_dels} | |
519 | > HG: files={files} |
|
519 | > HG: files={files} | |
520 | > HG: |
|
520 | > HG: | |
521 | > {splitlines(diff("removed")) % 'HG: {line}\n' |
|
521 | > {splitlines(diff("removed")) % 'HG: {line}\n' | |
522 | > }HG: |
|
522 | > }HG: | |
523 | > HG: mods={file_mods} |
|
523 | > HG: mods={file_mods} | |
524 | > HG: adds={file_adds} |
|
524 | > HG: adds={file_adds} | |
525 | > HG: dels={file_dels} |
|
525 | > HG: dels={file_dels} | |
526 | > HG: files={files}\n |
|
526 | > HG: files={files}\n | |
527 | > EOF |
|
527 | > EOF | |
528 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed |
|
528 | $ HGEDITOR=cat hg commit -q -e -m "foo bar" added removed | |
529 | foo bar |
|
529 | foo bar | |
530 | HG: mods= |
|
530 | HG: mods= | |
531 | HG: adds=added |
|
531 | HG: adds=added | |
532 | HG: dels=removed |
|
532 | HG: dels=removed | |
533 | HG: files=added removed |
|
533 | HG: files=added removed | |
534 | HG: |
|
534 | HG: | |
535 | HG: |
|
535 | HG: | |
536 | HG: mods= |
|
536 | HG: mods= | |
537 | HG: adds=added |
|
537 | HG: adds=added | |
538 | HG: dels=removed |
|
538 | HG: dels=removed | |
539 | HG: files=added removed |
|
539 | HG: files=added removed | |
540 | HG: |
|
540 | HG: | |
541 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
541 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
542 | HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 |
|
542 | HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 | |
543 | HG: @@ -0,0 +1,1 @@ |
|
543 | HG: @@ -0,0 +1,1 @@ | |
544 | HG: +added |
|
544 | HG: +added | |
545 | HG: |
|
545 | HG: | |
546 | HG: mods= |
|
546 | HG: mods= | |
547 | HG: adds=added |
|
547 | HG: adds=added | |
548 | HG: dels=removed |
|
548 | HG: dels=removed | |
549 | HG: files=added removed |
|
549 | HG: files=added removed | |
550 | HG: |
|
550 | HG: | |
551 | HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 |
|
551 | HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 | |
552 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
552 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
553 | HG: @@ -1,1 +0,0 @@ |
|
553 | HG: @@ -1,1 +0,0 @@ | |
554 | HG: -removed |
|
554 | HG: -removed | |
555 | HG: |
|
555 | HG: | |
556 | HG: mods= |
|
556 | HG: mods= | |
557 | HG: adds=added |
|
557 | HG: adds=added | |
558 | HG: dels=removed |
|
558 | HG: dels=removed | |
559 | HG: files=added removed |
|
559 | HG: files=added removed | |
560 | $ hg status -amr |
|
560 | $ hg status -amr | |
561 | M changed |
|
561 | M changed | |
562 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" |
|
562 | $ hg parents --template "M {file_mods}\nA {file_adds}\nR {file_dels}\n" | |
563 | M |
|
563 | M | |
564 | A added |
|
564 | A added | |
565 | R removed |
|
565 | R removed | |
566 | $ hg rollback -q |
|
566 | $ hg rollback -q | |
567 |
|
567 | |||
568 | $ cat >> .hg/hgrc <<EOF |
|
568 | $ cat >> .hg/hgrc <<EOF | |
569 | > # disable customizing for subsequent tests |
|
569 | > # disable customizing for subsequent tests | |
570 | > [committemplate] |
|
570 | > [committemplate] | |
571 | > changeset = |
|
571 | > changeset = | |
572 | > EOF |
|
572 | > EOF | |
573 |
|
573 | |||
574 | $ cd .. |
|
574 | $ cd .. | |
575 |
|
575 | |||
576 |
|
576 | |||
577 | commit copy |
|
577 | commit copy | |
578 |
|
578 | |||
579 | $ hg init dir2 |
|
579 | $ hg init dir2 | |
580 | $ cd dir2 |
|
580 | $ cd dir2 | |
581 | $ echo bleh > bar |
|
581 | $ echo bleh > bar | |
582 | $ hg add bar |
|
582 | $ hg add bar | |
583 | $ hg ci -m 'add bar' |
|
583 | $ hg ci -m 'add bar' | |
584 |
|
584 | |||
585 | $ hg cp bar foo |
|
585 | $ hg cp bar foo | |
586 | $ echo >> bar |
|
586 | $ echo >> bar | |
587 | $ hg ci -m 'cp bar foo; change bar' |
|
587 | $ hg ci -m 'cp bar foo; change bar' | |
588 |
|
588 | |||
589 | $ hg debugrename foo |
|
589 | $ hg debugrename foo | |
590 | foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 |
|
590 | foo renamed from bar:26d3ca0dfd18e44d796b564e38dd173c9668d3a9 | |
591 | $ hg debugindex bar |
|
591 | $ hg debugindex bar | |
592 | rev offset length ..... linkrev nodeid p1 p2 (re) |
|
592 | rev offset length ..... linkrev nodeid p1 p2 (re) | |
593 | 0 0 6 ..... 0 26d3ca0dfd18 000000000000 000000000000 (re) |
|
593 | 0 0 6 ..... 0 26d3ca0dfd18 000000000000 000000000000 (re) | |
594 | 1 6 7 ..... 1 d267bddd54f7 26d3ca0dfd18 000000000000 (re) |
|
594 | 1 6 7 ..... 1 d267bddd54f7 26d3ca0dfd18 000000000000 (re) | |
595 |
|
595 | |||
596 | Test making empty commits |
|
596 | Test making empty commits | |
597 | $ hg commit --config ui.allowemptycommit=True -m "empty commit" |
|
597 | $ hg commit --config ui.allowemptycommit=True -m "empty commit" | |
598 | $ hg log -r . -v --stat |
|
598 | $ hg log -r . -v --stat | |
599 | changeset: 2:d809f3644287 |
|
599 | changeset: 2:d809f3644287 | |
600 | tag: tip |
|
600 | tag: tip | |
601 | user: test |
|
601 | user: test | |
602 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
602 | date: Thu Jan 01 00:00:00 1970 +0000 | |
603 | description: |
|
603 | description: | |
604 | empty commit |
|
604 | empty commit | |
605 |
|
605 | |||
606 |
|
606 | |||
607 |
|
607 | |||
608 | verify pathauditor blocks evil filepaths |
|
608 | verify pathauditor blocks evil filepaths | |
609 | $ cat > evil-commit.py <<EOF |
|
609 | $ cat > evil-commit.py <<EOF | |
610 | > from mercurial import ui, hg, context, node |
|
610 | > from mercurial import ui, hg, context, node | |
611 | > notrc = u".h\u200cg".encode('utf-8') + '/hgrc' |
|
611 | > notrc = u".h\u200cg".encode('utf-8') + '/hgrc' | |
612 | > u = ui.ui.load() |
|
612 | > u = ui.ui.load() | |
613 | > r = hg.repository(u, '.') |
|
613 | > r = hg.repository(u, '.') | |
614 | > def filectxfn(repo, memctx, path): |
|
614 | > def filectxfn(repo, memctx, path): | |
615 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
|
615 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') | |
616 | > c = context.memctx(r, [r['tip'].node(), node.nullid], |
|
616 | > c = context.memctx(r, [r['tip'].node(), node.nullid], | |
617 | > 'evil', [notrc], filectxfn, 0) |
|
617 | > 'evil', [notrc], filectxfn, 0) | |
618 | > r.commitctx(c) |
|
618 | > r.commitctx(c) | |
619 | > EOF |
|
619 | > EOF | |
620 | $ $PYTHON evil-commit.py |
|
620 | $ $PYTHON evil-commit.py | |
621 | #if windows |
|
621 | #if windows | |
622 | $ hg co --clean tip |
|
622 | $ hg co --clean tip | |
623 | abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) |
|
623 | abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) | |
624 | [255] |
|
624 | [255] | |
625 | #else |
|
625 | #else | |
626 | $ hg co --clean tip |
|
626 | $ hg co --clean tip | |
627 | abort: path contains illegal component: .h\xe2\x80\x8cg/hgrc (esc) |
|
627 | abort: path contains illegal component: .h\xe2\x80\x8cg/hgrc (esc) | |
628 | [255] |
|
628 | [255] | |
629 | #endif |
|
629 | #endif | |
630 |
|
630 | |||
631 | $ hg rollback -f |
|
631 | $ hg rollback -f | |
632 | repository tip rolled back to revision 2 (undo commit) |
|
632 | repository tip rolled back to revision 2 (undo commit) | |
633 | $ cat > evil-commit.py <<EOF |
|
633 | $ cat > evil-commit.py <<EOF | |
634 | > from mercurial import ui, hg, context, node |
|
634 | > from mercurial import ui, hg, context, node | |
635 | > notrc = "HG~1/hgrc" |
|
635 | > notrc = "HG~1/hgrc" | |
636 | > u = ui.ui.load() |
|
636 | > u = ui.ui.load() | |
637 | > r = hg.repository(u, '.') |
|
637 | > r = hg.repository(u, '.') | |
638 | > def filectxfn(repo, memctx, path): |
|
638 | > def filectxfn(repo, memctx, path): | |
639 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
|
639 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') | |
640 | > c = context.memctx(r, [r['tip'].node(), node.nullid], |
|
640 | > c = context.memctx(r, [r['tip'].node(), node.nullid], | |
641 | > 'evil', [notrc], filectxfn, 0) |
|
641 | > 'evil', [notrc], filectxfn, 0) | |
642 | > r.commitctx(c) |
|
642 | > r.commitctx(c) | |
643 | > EOF |
|
643 | > EOF | |
644 | $ $PYTHON evil-commit.py |
|
644 | $ $PYTHON evil-commit.py | |
645 | $ hg co --clean tip |
|
645 | $ hg co --clean tip | |
646 | abort: path contains illegal component: HG~1/hgrc (glob) |
|
646 | abort: path contains illegal component: HG~1/hgrc (glob) | |
647 | [255] |
|
647 | [255] | |
648 |
|
648 | |||
649 | $ hg rollback -f |
|
649 | $ hg rollback -f | |
650 | repository tip rolled back to revision 2 (undo commit) |
|
650 | repository tip rolled back to revision 2 (undo commit) | |
651 | $ cat > evil-commit.py <<EOF |
|
651 | $ cat > evil-commit.py <<EOF | |
652 | > from mercurial import ui, hg, context, node |
|
652 | > from mercurial import ui, hg, context, node | |
653 | > notrc = "HG8B6C~2/hgrc" |
|
653 | > notrc = "HG8B6C~2/hgrc" | |
654 | > u = ui.ui.load() |
|
654 | > u = ui.ui.load() | |
655 | > r = hg.repository(u, '.') |
|
655 | > r = hg.repository(u, '.') | |
656 | > def filectxfn(repo, memctx, path): |
|
656 | > def filectxfn(repo, memctx, path): | |
657 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') |
|
657 | > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') | |
658 | > c = context.memctx(r, [r['tip'].node(), node.nullid], |
|
658 | > c = context.memctx(r, [r['tip'].node(), node.nullid], | |
659 | > 'evil', [notrc], filectxfn, 0) |
|
659 | > 'evil', [notrc], filectxfn, 0) | |
660 | > r.commitctx(c) |
|
660 | > r.commitctx(c) | |
661 | > EOF |
|
661 | > EOF | |
662 | $ $PYTHON evil-commit.py |
|
662 | $ $PYTHON evil-commit.py | |
663 | $ hg co --clean tip |
|
663 | $ hg co --clean tip | |
664 | abort: path contains illegal component: HG8B6C~2/hgrc (glob) |
|
664 | abort: path contains illegal component: HG8B6C~2/hgrc (glob) | |
665 | [255] |
|
665 | [255] | |
666 |
|
666 | |||
667 | # test that an unmodified commit template message aborts |
|
667 | # test that an unmodified commit template message aborts | |
668 |
|
668 | |||
669 | $ hg init unmodified_commit_template |
|
669 | $ hg init unmodified_commit_template | |
670 | $ cd unmodified_commit_template |
|
670 | $ cd unmodified_commit_template | |
671 | $ echo foo > foo |
|
671 | $ echo foo > foo | |
672 | $ hg add foo |
|
672 | $ hg add foo | |
673 | $ hg commit -m "foo" |
|
673 | $ hg commit -m "foo" | |
674 | $ cat >> .hg/hgrc <<EOF |
|
674 | $ cat >> .hg/hgrc <<EOF | |
675 | > [committemplate] |
|
675 | > [committemplate] | |
676 | > changeset.commit = HI THIS IS NOT STRIPPED |
|
676 | > changeset.commit = HI THIS IS NOT STRIPPED | |
677 | > HG: this is customized commit template |
|
677 | > HG: this is customized commit template | |
678 | > HG: {extramsg} |
|
678 | > HG: {extramsg} | |
679 | > {if(activebookmark, |
|
679 | > {if(activebookmark, | |
680 | > "HG: bookmark '{activebookmark}' is activated\n", |
|
680 | > "HG: bookmark '{activebookmark}' is activated\n", | |
681 | > "HG: no bookmark is activated\n")}{subrepos % |
|
681 | > "HG: no bookmark is activated\n")}{subrepos % | |
682 | > "HG: subrepo '{subrepo}' is changed\n"} |
|
682 | > "HG: subrepo '{subrepo}' is changed\n"} | |
683 | > EOF |
|
683 | > EOF | |
684 | $ cat > $TESTTMP/notouching.sh <<EOF |
|
684 | $ cat > $TESTTMP/notouching.sh <<EOF | |
685 | > true |
|
685 | > true | |
686 | > EOF |
|
686 | > EOF | |
687 | $ echo foo2 > foo2 |
|
687 | $ echo foo2 > foo2 | |
688 | $ hg add foo2 |
|
688 | $ hg add foo2 | |
689 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit |
|
689 | $ HGEDITOR="sh $TESTTMP/notouching.sh" hg commit | |
690 | abort: commit message unchanged |
|
690 | abort: commit message unchanged | |
691 | [255] |
|
691 | [255] | |
692 |
|
692 | |||
693 | test that text below the --- >8 --- special string is ignored |
|
693 | test that text below the --- >8 --- special string is ignored | |
694 |
|
694 | |||
|
695 | $ cat <<'EOF' > $TESTTMP/lowercaseline.sh | |||
|
696 | > cat $1 | sed s/LINE/line/ | tee $1.new | |||
|
697 | > mv $1.new $1 | |||
|
698 | > EOF | |||
|
699 | ||||
695 | $ hg init ignore_below_special_string |
|
700 | $ hg init ignore_below_special_string | |
696 | $ cd ignore_below_special_string |
|
701 | $ cd ignore_below_special_string | |
697 | $ echo foo > foo |
|
702 | $ echo foo > foo | |
698 | $ hg add foo |
|
703 | $ hg add foo | |
699 | $ hg commit -m "foo" |
|
704 | $ hg commit -m "foo" | |
700 | $ cat >> .hg/hgrc <<EOF |
|
705 | $ cat >> .hg/hgrc <<EOF | |
701 | > [committemplate] |
|
706 | > [committemplate] | |
702 |
> changeset.commit = first |
|
707 | > changeset.commit = first LINE | |
703 | > HG: this is customized commit template |
|
708 | > HG: this is customized commit template | |
704 | > HG: {extramsg} |
|
709 | > HG: {extramsg} | |
705 | > HG: ------------------------ >8 ------------------------ |
|
710 | > HG: ------------------------ >8 ------------------------ | |
706 | > {diff()} |
|
711 | > {diff()} | |
707 | > EOF |
|
712 | > EOF | |
708 | $ echo foo2 > foo2 |
|
713 | $ echo foo2 > foo2 | |
709 | $ hg add foo2 |
|
714 | $ hg add foo2 | |
710 | $ HGEDITOR=cat hg ci |
|
715 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
711 | first line |
|
716 | first line | |
712 | HG: this is customized commit template |
|
717 | HG: this is customized commit template | |
713 | HG: Leave message empty to abort commit. |
|
718 | HG: Leave message empty to abort commit. | |
714 | HG: ------------------------ >8 ------------------------ |
|
719 | HG: ------------------------ >8 ------------------------ | |
715 | diff -r e63c23eaa88a foo2 |
|
720 | diff -r e63c23eaa88a foo2 | |
716 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
721 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
717 | +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 |
|
722 | +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 | |
718 | @@ -0,0 +1,1 @@ |
|
723 | @@ -0,0 +1,1 @@ | |
719 | +foo2 |
|
724 | +foo2 | |
720 | $ hg log -T '{desc}\n' -r . |
|
725 | $ hg log -T '{desc}\n' -r . | |
721 | first line |
|
726 | first line | |
722 |
|
727 | |||
723 | test that the special string --- >8 --- isn't used when not at the beginning of |
|
728 | test that the special string --- >8 --- isn't used when not at the beginning of | |
724 | a line |
|
729 | a line | |
725 |
|
730 | |||
726 | $ cat >> .hg/hgrc <<EOF |
|
731 | $ cat >> .hg/hgrc <<EOF | |
727 | > [committemplate] |
|
732 | > [committemplate] | |
728 |
> changeset.commit = first |
|
733 | > changeset.commit = first LINE2 | |
729 | > another line HG: ------------------------ >8 ------------------------ |
|
734 | > another line HG: ------------------------ >8 ------------------------ | |
730 | > HG: this is customized commit template |
|
735 | > HG: this is customized commit template | |
731 | > HG: {extramsg} |
|
736 | > HG: {extramsg} | |
732 | > HG: ------------------------ >8 ------------------------ |
|
737 | > HG: ------------------------ >8 ------------------------ | |
733 | > {diff()} |
|
738 | > {diff()} | |
734 | > EOF |
|
739 | > EOF | |
735 | $ echo foo >> foo |
|
740 | $ echo foo >> foo | |
736 | $ HGEDITOR=cat hg ci |
|
741 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
737 | first line2 |
|
742 | first line2 | |
738 | another line HG: ------------------------ >8 ------------------------ |
|
743 | another line HG: ------------------------ >8 ------------------------ | |
739 | HG: this is customized commit template |
|
744 | HG: this is customized commit template | |
740 | HG: Leave message empty to abort commit. |
|
745 | HG: Leave message empty to abort commit. | |
741 | HG: ------------------------ >8 ------------------------ |
|
746 | HG: ------------------------ >8 ------------------------ | |
742 | diff -r 3661b22b0702 foo |
|
747 | diff -r 3661b22b0702 foo | |
743 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 |
|
748 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 | |
744 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
749 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
745 | @@ -1,1 +1,2 @@ |
|
750 | @@ -1,1 +1,2 @@ | |
746 | foo |
|
751 | foo | |
747 | +foo |
|
752 | +foo | |
748 | $ hg log -T '{desc}\n' -r . |
|
753 | $ hg log -T '{desc}\n' -r . | |
749 | first line2 |
|
754 | first line2 | |
750 | another line HG: ------------------------ >8 ------------------------ |
|
755 | another line HG: ------------------------ >8 ------------------------ | |
751 |
|
756 | |||
752 | also test that this special string isn't accepted when there is some extra text |
|
757 | also test that this special string isn't accepted when there is some extra text | |
753 | at the end |
|
758 | at the end | |
754 |
|
759 | |||
755 | $ cat >> .hg/hgrc <<EOF |
|
760 | $ cat >> .hg/hgrc <<EOF | |
756 | > [committemplate] |
|
761 | > [committemplate] | |
757 |
> changeset.commit = first |
|
762 | > changeset.commit = first LINE3 | |
758 | > HG: ------------------------ >8 ------------------------foobar |
|
763 | > HG: ------------------------ >8 ------------------------foobar | |
759 | > second line |
|
764 | > second line | |
760 | > HG: this is customized commit template |
|
765 | > HG: this is customized commit template | |
761 | > HG: {extramsg} |
|
766 | > HG: {extramsg} | |
762 | > HG: ------------------------ >8 ------------------------ |
|
767 | > HG: ------------------------ >8 ------------------------ | |
763 | > {diff()} |
|
768 | > {diff()} | |
764 | > EOF |
|
769 | > EOF | |
765 | $ echo foo >> foo |
|
770 | $ echo foo >> foo | |
766 | $ HGEDITOR=cat hg ci |
|
771 | $ HGEDITOR="sh $TESTTMP/lowercaseline.sh" hg ci | |
767 | first line3 |
|
772 | first line3 | |
768 | HG: ------------------------ >8 ------------------------foobar |
|
773 | HG: ------------------------ >8 ------------------------foobar | |
769 | second line |
|
774 | second line | |
770 | HG: this is customized commit template |
|
775 | HG: this is customized commit template | |
771 | HG: Leave message empty to abort commit. |
|
776 | HG: Leave message empty to abort commit. | |
772 | HG: ------------------------ >8 ------------------------ |
|
777 | HG: ------------------------ >8 ------------------------ | |
773 | diff -r ce648f5f066f foo |
|
778 | diff -r ce648f5f066f foo | |
774 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 |
|
779 | --- a/foo Thu Jan 01 00:00:00 1970 +0000 | |
775 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
780 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
776 | @@ -1,2 +1,3 @@ |
|
781 | @@ -1,2 +1,3 @@ | |
777 | foo |
|
782 | foo | |
778 | foo |
|
783 | foo | |
779 | +foo |
|
784 | +foo | |
780 | $ hg log -T '{desc}\n' -r . |
|
785 | $ hg log -T '{desc}\n' -r . | |
781 | first line3 |
|
786 | first line3 | |
782 | second line |
|
787 | second line | |
783 |
|
788 | |||
784 | $ cd .. |
|
789 | $ cd .. | |
785 |
|
790 |
General Comments 0
You need to be logged in to leave comments.
Login now