##// END OF EJS Templates
tests: run many tests in $TESTTMP/repo instead of $TESTTMP...
Arseniy Alekseyev -
r50516:55c6ebd1 stable
parent child Browse files
Show More
@@ -1,240 +1,241 b''
1 The simple store doesn't escape paths robustly and can't store paths
1 The simple store doesn't escape paths robustly and can't store paths
2 with periods, etc. So much of this test fails with it.
2 with periods, etc. So much of this test fails with it.
3 #require no-reposimplestore
3 #require no-reposimplestore
4
4
5 $ hg init
5 $ hg init repo
6 $ cd repo
6
7
7 audit of .hg
8 audit of .hg
8
9
9 $ hg add .hg/00changelog.i
10 $ hg add .hg/00changelog.i
10 abort: path contains illegal component: .hg/00changelog.i
11 abort: path contains illegal component: .hg/00changelog.i
11 [10]
12 [10]
12
13
13 #if symlink
14 #if symlink
14
15
15 Symlinks
16 Symlinks
16
17
17 $ mkdir a
18 $ mkdir a
18 $ echo a > a/a
19 $ echo a > a/a
19 $ hg ci -Ama
20 $ hg ci -Ama
20 adding a/a
21 adding a/a
21 $ ln -s a b
22 $ ln -s a b
22 $ echo b > a/b
23 $ echo b > a/b
23 $ hg add b/b
24 $ hg add b/b
24 abort: path 'b/b' traverses symbolic link 'b'
25 abort: path 'b/b' traverses symbolic link 'b'
25 [255]
26 [255]
26 $ hg add b
27 $ hg add b
27
28
28 should still fail - maybe
29 should still fail - maybe
29
30
30 $ hg add b/b
31 $ hg add b/b
31 abort: path 'b/b' traverses symbolic link 'b'
32 abort: path 'b/b' traverses symbolic link 'b'
32 [255]
33 [255]
33
34
34 $ hg commit -m 'add symlink b'
35 $ hg commit -m 'add symlink b'
35
36
36
37
37 Test symlink traversing when accessing history:
38 Test symlink traversing when accessing history:
38 -----------------------------------------------
39 -----------------------------------------------
39
40
40 (build a changeset where the path exists as a directory)
41 (build a changeset where the path exists as a directory)
41
42
42 $ hg up 0
43 $ hg up 0
43 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
44 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
44 $ mkdir b
45 $ mkdir b
45 $ echo c > b/a
46 $ echo c > b/a
46 $ hg add b/a
47 $ hg add b/a
47 $ hg ci -m 'add directory b'
48 $ hg ci -m 'add directory b'
48 created new head
49 created new head
49
50
50 Test that hg cat does not do anything wrong the working copy has 'b' as directory
51 Test that hg cat does not do anything wrong the working copy has 'b' as directory
51
52
52 $ hg cat b/a
53 $ hg cat b/a
53 c
54 c
54 $ hg cat -r "desc(directory)" b/a
55 $ hg cat -r "desc(directory)" b/a
55 c
56 c
56 $ hg cat -r "desc(symlink)" b/a
57 $ hg cat -r "desc(symlink)" b/a
57 b/a: no such file in rev bc151a1f53bd
58 b/a: no such file in rev bc151a1f53bd
58 [1]
59 [1]
59
60
60 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
61 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
61
62
62 $ hg up 'desc(symlink)'
63 $ hg up 'desc(symlink)'
63 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
64 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
64 $ hg cat b/a
65 $ hg cat b/a
65 b/a: no such file in rev bc151a1f53bd
66 b/a: no such file in rev bc151a1f53bd
66 [1]
67 [1]
67 $ hg cat -r "desc(directory)" b/a
68 $ hg cat -r "desc(directory)" b/a
68 c
69 c
69 $ hg cat -r "desc(symlink)" b/a
70 $ hg cat -r "desc(symlink)" b/a
70 b/a: no such file in rev bc151a1f53bd
71 b/a: no such file in rev bc151a1f53bd
71 [1]
72 [1]
72
73
73 #endif
74 #endif
74
75
75
76
76 unbundle tampered bundle
77 unbundle tampered bundle
77
78
78 $ hg init target
79 $ hg init target
79 $ cd target
80 $ cd target
80 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
81 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
81 adding changesets
82 adding changesets
82 adding manifests
83 adding manifests
83 adding file changes
84 adding file changes
84 added 5 changesets with 6 changes to 6 files (+4 heads)
85 added 5 changesets with 6 changes to 6 files (+4 heads)
85 new changesets b7da9bf6b037:fc1393d727bc (5 drafts)
86 new changesets b7da9bf6b037:fc1393d727bc (5 drafts)
86 (run 'hg heads' to see heads, 'hg merge' to merge)
87 (run 'hg heads' to see heads, 'hg merge' to merge)
87
88
88 attack .hg/test
89 attack .hg/test
89
90
90 $ hg manifest -r0
91 $ hg manifest -r0
91 .hg/test
92 .hg/test
92 $ hg update -Cr0
93 $ hg update -Cr0
93 abort: path contains illegal component: .hg/test
94 abort: path contains illegal component: .hg/test
94 [10]
95 [10]
95
96
96 attack foo/.hg/test
97 attack foo/.hg/test
97
98
98 $ hg manifest -r1
99 $ hg manifest -r1
99 foo/.hg/test
100 foo/.hg/test
100 $ hg update -Cr1
101 $ hg update -Cr1
101 abort: path 'foo/.hg/test' is inside nested repo 'foo'
102 abort: path 'foo/.hg/test' is inside nested repo 'foo'
102 [10]
103 [10]
103
104
104 attack back/test where back symlinks to ..
105 attack back/test where back symlinks to ..
105
106
106 $ hg manifest -r2
107 $ hg manifest -r2
107 back
108 back
108 back/test
109 back/test
109 #if symlink
110 #if symlink
110 $ hg update -Cr2
111 $ hg update -Cr2
111 abort: path 'back/test' traverses symbolic link 'back'
112 abort: path 'back/test' traverses symbolic link 'back'
112 [255]
113 [255]
113 #else
114 #else
114 ('back' will be a file and cause some other system specific error)
115 ('back' will be a file and cause some other system specific error)
115 $ hg update -Cr2
116 $ hg update -Cr2
116 abort: $TESTTMP/target/back/test: $ENOTDIR$
117 abort: $TESTTMP/target/back/test: $ENOTDIR$
117 [255]
118 [255]
118 #endif
119 #endif
119
120
120 attack ../test
121 attack ../test
121
122
122 $ hg manifest -r3
123 $ hg manifest -r3
123 ../test
124 ../test
124 $ mkdir ../test
125 $ mkdir ../test
125 $ echo data > ../test/file
126 $ echo data > ../test/file
126 $ hg update -Cr3
127 $ hg update -Cr3
127 abort: path contains illegal component: ../test
128 abort: path contains illegal component: ../test
128 [10]
129 [10]
129 $ cat ../test/file
130 $ cat ../test/file
130 data
131 data
131
132
132 attack /tmp/test
133 attack /tmp/test
133
134
134 $ hg manifest -r4
135 $ hg manifest -r4
135 /tmp/test
136 /tmp/test
136 $ hg update -Cr4
137 $ hg update -Cr4
137 abort: path contains illegal component: /tmp/test
138 abort: path contains illegal component: /tmp/test
138 [10]
139 [10]
139
140
140 $ cd ..
141 $ cd ..
141
142
142 Test symlink traversal on merge:
143 Test symlink traversal on merge:
143 --------------------------------
144 --------------------------------
144
145
145 #if symlink
146 #if symlink
146
147
147 set up symlink hell
148 set up symlink hell
148
149
149 $ mkdir merge-symlink-out
150 $ mkdir merge-symlink-out
150 $ hg init merge-symlink
151 $ hg init merge-symlink
151 $ cd merge-symlink
152 $ cd merge-symlink
152 $ touch base
153 $ touch base
153 $ hg commit -qAm base
154 $ hg commit -qAm base
154 $ ln -s ../merge-symlink-out a
155 $ ln -s ../merge-symlink-out a
155 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
156 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
156 $ hg up -q 0
157 $ hg up -q 0
157 $ mkdir a
158 $ mkdir a
158 $ touch a/poisoned
159 $ touch a/poisoned
159 $ hg commit -qAm 'file a/poisoned'
160 $ hg commit -qAm 'file a/poisoned'
160 $ hg log -G -T '{rev}: {desc}\n'
161 $ hg log -G -T '{rev}: {desc}\n'
161 @ 2: file a/poisoned
162 @ 2: file a/poisoned
162 |
163 |
163 | o 1: symlink a -> ../merge-symlink-out
164 | o 1: symlink a -> ../merge-symlink-out
164 |/
165 |/
165 o 0: base
166 o 0: base
166
167
167
168
168 try trivial merge
169 try trivial merge
169
170
170 $ hg up -qC 1
171 $ hg up -qC 1
171 $ hg merge 2
172 $ hg merge 2
172 abort: path 'a/poisoned' traverses symbolic link 'a'
173 abort: path 'a/poisoned' traverses symbolic link 'a'
173 [255]
174 [255]
174
175
175 try rebase onto other revision: cache of audited paths should be discarded,
176 try rebase onto other revision: cache of audited paths should be discarded,
176 and the rebase should fail (issue5628)
177 and the rebase should fail (issue5628)
177
178
178 $ hg up -qC 2
179 $ hg up -qC 2
179 $ hg rebase -s 2 -d 1 --config extensions.rebase=
180 $ hg rebase -s 2 -d 1 --config extensions.rebase=
180 rebasing 2:e73c21d6b244 tip "file a/poisoned"
181 rebasing 2:e73c21d6b244 tip "file a/poisoned"
181 abort: path 'a/poisoned' traverses symbolic link 'a'
182 abort: path 'a/poisoned' traverses symbolic link 'a'
182 [255]
183 [255]
183 $ ls ../merge-symlink-out
184 $ ls ../merge-symlink-out
184
185
185 $ cd ..
186 $ cd ..
186
187
187 Test symlink traversal on update:
188 Test symlink traversal on update:
188 ---------------------------------
189 ---------------------------------
189
190
190 $ mkdir update-symlink-out
191 $ mkdir update-symlink-out
191 $ hg init update-symlink
192 $ hg init update-symlink
192 $ cd update-symlink
193 $ cd update-symlink
193 $ ln -s ../update-symlink-out a
194 $ ln -s ../update-symlink-out a
194 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
195 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
195 $ hg rm a
196 $ hg rm a
196 $ mkdir a && touch a/b
197 $ mkdir a && touch a/b
197 $ hg ci -qAm 'file a/b' a/b
198 $ hg ci -qAm 'file a/b' a/b
198 $ hg up -qC 0
199 $ hg up -qC 0
199 $ hg rm a
200 $ hg rm a
200 $ mkdir a && touch a/c
201 $ mkdir a && touch a/c
201 $ hg ci -qAm 'rm a, file a/c'
202 $ hg ci -qAm 'rm a, file a/c'
202 $ hg log -G -T '{rev}: {desc}\n'
203 $ hg log -G -T '{rev}: {desc}\n'
203 @ 2: rm a, file a/c
204 @ 2: rm a, file a/c
204 |
205 |
205 | o 1: file a/b
206 | o 1: file a/b
206 |/
207 |/
207 o 0: symlink a -> ../update-symlink-out
208 o 0: symlink a -> ../update-symlink-out
208
209
209
210
210 try linear update where symlink already exists:
211 try linear update where symlink already exists:
211
212
212 $ hg up -qC 0
213 $ hg up -qC 0
213 $ hg up 1
214 $ hg up 1
214 abort: path 'a/b' traverses symbolic link 'a'
215 abort: path 'a/b' traverses symbolic link 'a'
215 [255]
216 [255]
216
217
217 try linear update including symlinked directory and its content: paths are
218 try linear update including symlinked directory and its content: paths are
218 audited first by calculateupdates(), where no symlink is created so both
219 audited first by calculateupdates(), where no symlink is created so both
219 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
220 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
220
221
221 $ hg up -qC null
222 $ hg up -qC null
222 $ hg up 1
223 $ hg up 1
223 abort: path 'a/b' traverses symbolic link 'a'
224 abort: path 'a/b' traverses symbolic link 'a'
224 [255]
225 [255]
225 $ ls ../update-symlink-out
226 $ ls ../update-symlink-out
226
227
227 try branch update replacing directory with symlink, and its content: the
228 try branch update replacing directory with symlink, and its content: the
228 path 'a' is audited as a directory first, which should be audited again as
229 path 'a' is audited as a directory first, which should be audited again as
229 a symlink.
230 a symlink.
230
231
231 $ rm -f a
232 $ rm -f a
232 $ hg up -qC 2
233 $ hg up -qC 2
233 $ hg up 1
234 $ hg up 1
234 abort: path 'a/b' traverses symbolic link 'a'
235 abort: path 'a/b' traverses symbolic link 'a'
235 [255]
236 [255]
236 $ ls ../update-symlink-out
237 $ ls ../update-symlink-out
237
238
238 $ cd ..
239 $ cd ..
239
240
240 #endif
241 #endif
@@ -1,18 +1,19 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo This is file a1 > a
3 $ echo This is file a1 > a
3 $ hg add a
4 $ hg add a
4 $ hg commit -m "commit #0"
5 $ hg commit -m "commit #0"
5 $ ls -A
6 $ ls -A
6 .hg
7 .hg
7 a
8 a
8 $ echo This is file b1 > b
9 $ echo This is file b1 > b
9 $ hg add b
10 $ hg add b
10 $ hg commit -m "commit #1"
11 $ hg commit -m "commit #1"
11 $ hg co 0
12 $ hg co 0
12 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
13
14
14 B should disappear
15 B should disappear
15
16
16 $ ls -A
17 $ ls -A
17 .hg
18 .hg
18 a
19 a
@@ -1,795 +1,795 b''
1 $ hg init
1 $ hg init repo
2
2 $ cd repo
3
3
4 committing changes
4 committing changes
5
5
6 $ count=0
6 $ count=0
7 $ echo > a
7 $ echo > a
8 $ while test $count -lt 32 ; do
8 $ while test $count -lt 32 ; do
9 > echo 'a' >> a
9 > echo 'a' >> a
10 > test $count -eq 0 && hg add
10 > test $count -eq 0 && hg add
11 > hg ci -m "msg $count" -d "$count 0"
11 > hg ci -m "msg $count" -d "$count 0"
12 > count=`expr $count + 1`
12 > count=`expr $count + 1`
13 > done
13 > done
14 adding a
14 adding a
15
15
16
16
17 $ hg log -G
17 $ hg log -G
18 @ changeset: 31:58c80a7c8a40
18 @ changeset: 31:58c80a7c8a40
19 | tag: tip
19 | tag: tip
20 | user: test
20 | user: test
21 | date: Thu Jan 01 00:00:31 1970 +0000
21 | date: Thu Jan 01 00:00:31 1970 +0000
22 | summary: msg 31
22 | summary: msg 31
23 |
23 |
24 o changeset: 30:ed2d2f24b11c
24 o changeset: 30:ed2d2f24b11c
25 | user: test
25 | user: test
26 | date: Thu Jan 01 00:00:30 1970 +0000
26 | date: Thu Jan 01 00:00:30 1970 +0000
27 | summary: msg 30
27 | summary: msg 30
28 |
28 |
29 o changeset: 29:b5bd63375ab9
29 o changeset: 29:b5bd63375ab9
30 | user: test
30 | user: test
31 | date: Thu Jan 01 00:00:29 1970 +0000
31 | date: Thu Jan 01 00:00:29 1970 +0000
32 | summary: msg 29
32 | summary: msg 29
33 |
33 |
34 o changeset: 28:8e0c2264c8af
34 o changeset: 28:8e0c2264c8af
35 | user: test
35 | user: test
36 | date: Thu Jan 01 00:00:28 1970 +0000
36 | date: Thu Jan 01 00:00:28 1970 +0000
37 | summary: msg 28
37 | summary: msg 28
38 |
38 |
39 o changeset: 27:288867a866e9
39 o changeset: 27:288867a866e9
40 | user: test
40 | user: test
41 | date: Thu Jan 01 00:00:27 1970 +0000
41 | date: Thu Jan 01 00:00:27 1970 +0000
42 | summary: msg 27
42 | summary: msg 27
43 |
43 |
44 o changeset: 26:3efc6fd51aeb
44 o changeset: 26:3efc6fd51aeb
45 | user: test
45 | user: test
46 | date: Thu Jan 01 00:00:26 1970 +0000
46 | date: Thu Jan 01 00:00:26 1970 +0000
47 | summary: msg 26
47 | summary: msg 26
48 |
48 |
49 o changeset: 25:02a84173a97a
49 o changeset: 25:02a84173a97a
50 | user: test
50 | user: test
51 | date: Thu Jan 01 00:00:25 1970 +0000
51 | date: Thu Jan 01 00:00:25 1970 +0000
52 | summary: msg 25
52 | summary: msg 25
53 |
53 |
54 o changeset: 24:10e0acd3809e
54 o changeset: 24:10e0acd3809e
55 | user: test
55 | user: test
56 | date: Thu Jan 01 00:00:24 1970 +0000
56 | date: Thu Jan 01 00:00:24 1970 +0000
57 | summary: msg 24
57 | summary: msg 24
58 |
58 |
59 o changeset: 23:5ec79163bff4
59 o changeset: 23:5ec79163bff4
60 | user: test
60 | user: test
61 | date: Thu Jan 01 00:00:23 1970 +0000
61 | date: Thu Jan 01 00:00:23 1970 +0000
62 | summary: msg 23
62 | summary: msg 23
63 |
63 |
64 o changeset: 22:06c7993750ce
64 o changeset: 22:06c7993750ce
65 | user: test
65 | user: test
66 | date: Thu Jan 01 00:00:22 1970 +0000
66 | date: Thu Jan 01 00:00:22 1970 +0000
67 | summary: msg 22
67 | summary: msg 22
68 |
68 |
69 o changeset: 21:e5db6aa3fe2a
69 o changeset: 21:e5db6aa3fe2a
70 | user: test
70 | user: test
71 | date: Thu Jan 01 00:00:21 1970 +0000
71 | date: Thu Jan 01 00:00:21 1970 +0000
72 | summary: msg 21
72 | summary: msg 21
73 |
73 |
74 o changeset: 20:7128fb4fdbc9
74 o changeset: 20:7128fb4fdbc9
75 | user: test
75 | user: test
76 | date: Thu Jan 01 00:00:20 1970 +0000
76 | date: Thu Jan 01 00:00:20 1970 +0000
77 | summary: msg 20
77 | summary: msg 20
78 |
78 |
79 o changeset: 19:52798545b482
79 o changeset: 19:52798545b482
80 | user: test
80 | user: test
81 | date: Thu Jan 01 00:00:19 1970 +0000
81 | date: Thu Jan 01 00:00:19 1970 +0000
82 | summary: msg 19
82 | summary: msg 19
83 |
83 |
84 o changeset: 18:86977a90077e
84 o changeset: 18:86977a90077e
85 | user: test
85 | user: test
86 | date: Thu Jan 01 00:00:18 1970 +0000
86 | date: Thu Jan 01 00:00:18 1970 +0000
87 | summary: msg 18
87 | summary: msg 18
88 |
88 |
89 o changeset: 17:03515f4a9080
89 o changeset: 17:03515f4a9080
90 | user: test
90 | user: test
91 | date: Thu Jan 01 00:00:17 1970 +0000
91 | date: Thu Jan 01 00:00:17 1970 +0000
92 | summary: msg 17
92 | summary: msg 17
93 |
93 |
94 o changeset: 16:a2e6ea4973e9
94 o changeset: 16:a2e6ea4973e9
95 | user: test
95 | user: test
96 | date: Thu Jan 01 00:00:16 1970 +0000
96 | date: Thu Jan 01 00:00:16 1970 +0000
97 | summary: msg 16
97 | summary: msg 16
98 |
98 |
99 o changeset: 15:e7fa0811edb0
99 o changeset: 15:e7fa0811edb0
100 | user: test
100 | user: test
101 | date: Thu Jan 01 00:00:15 1970 +0000
101 | date: Thu Jan 01 00:00:15 1970 +0000
102 | summary: msg 15
102 | summary: msg 15
103 |
103 |
104 o changeset: 14:ce8f0998e922
104 o changeset: 14:ce8f0998e922
105 | user: test
105 | user: test
106 | date: Thu Jan 01 00:00:14 1970 +0000
106 | date: Thu Jan 01 00:00:14 1970 +0000
107 | summary: msg 14
107 | summary: msg 14
108 |
108 |
109 o changeset: 13:9d7d07bc967c
109 o changeset: 13:9d7d07bc967c
110 | user: test
110 | user: test
111 | date: Thu Jan 01 00:00:13 1970 +0000
111 | date: Thu Jan 01 00:00:13 1970 +0000
112 | summary: msg 13
112 | summary: msg 13
113 |
113 |
114 o changeset: 12:1941b52820a5
114 o changeset: 12:1941b52820a5
115 | user: test
115 | user: test
116 | date: Thu Jan 01 00:00:12 1970 +0000
116 | date: Thu Jan 01 00:00:12 1970 +0000
117 | summary: msg 12
117 | summary: msg 12
118 |
118 |
119 o changeset: 11:7b4cd9578619
119 o changeset: 11:7b4cd9578619
120 | user: test
120 | user: test
121 | date: Thu Jan 01 00:00:11 1970 +0000
121 | date: Thu Jan 01 00:00:11 1970 +0000
122 | summary: msg 11
122 | summary: msg 11
123 |
123 |
124 o changeset: 10:7c5eff49a6b6
124 o changeset: 10:7c5eff49a6b6
125 | user: test
125 | user: test
126 | date: Thu Jan 01 00:00:10 1970 +0000
126 | date: Thu Jan 01 00:00:10 1970 +0000
127 | summary: msg 10
127 | summary: msg 10
128 |
128 |
129 o changeset: 9:eb44510ef29a
129 o changeset: 9:eb44510ef29a
130 | user: test
130 | user: test
131 | date: Thu Jan 01 00:00:09 1970 +0000
131 | date: Thu Jan 01 00:00:09 1970 +0000
132 | summary: msg 9
132 | summary: msg 9
133 |
133 |
134 o changeset: 8:453eb4dba229
134 o changeset: 8:453eb4dba229
135 | user: test
135 | user: test
136 | date: Thu Jan 01 00:00:08 1970 +0000
136 | date: Thu Jan 01 00:00:08 1970 +0000
137 | summary: msg 8
137 | summary: msg 8
138 |
138 |
139 o changeset: 7:03750880c6b5
139 o changeset: 7:03750880c6b5
140 | user: test
140 | user: test
141 | date: Thu Jan 01 00:00:07 1970 +0000
141 | date: Thu Jan 01 00:00:07 1970 +0000
142 | summary: msg 7
142 | summary: msg 7
143 |
143 |
144 o changeset: 6:a3d5c6fdf0d3
144 o changeset: 6:a3d5c6fdf0d3
145 | user: test
145 | user: test
146 | date: Thu Jan 01 00:00:06 1970 +0000
146 | date: Thu Jan 01 00:00:06 1970 +0000
147 | summary: msg 6
147 | summary: msg 6
148 |
148 |
149 o changeset: 5:7874a09ea728
149 o changeset: 5:7874a09ea728
150 | user: test
150 | user: test
151 | date: Thu Jan 01 00:00:05 1970 +0000
151 | date: Thu Jan 01 00:00:05 1970 +0000
152 | summary: msg 5
152 | summary: msg 5
153 |
153 |
154 o changeset: 4:9b2ba8336a65
154 o changeset: 4:9b2ba8336a65
155 | user: test
155 | user: test
156 | date: Thu Jan 01 00:00:04 1970 +0000
156 | date: Thu Jan 01 00:00:04 1970 +0000
157 | summary: msg 4
157 | summary: msg 4
158 |
158 |
159 o changeset: 3:b53bea5e2fcb
159 o changeset: 3:b53bea5e2fcb
160 | user: test
160 | user: test
161 | date: Thu Jan 01 00:00:03 1970 +0000
161 | date: Thu Jan 01 00:00:03 1970 +0000
162 | summary: msg 3
162 | summary: msg 3
163 |
163 |
164 o changeset: 2:db07c04beaca
164 o changeset: 2:db07c04beaca
165 | user: test
165 | user: test
166 | date: Thu Jan 01 00:00:02 1970 +0000
166 | date: Thu Jan 01 00:00:02 1970 +0000
167 | summary: msg 2
167 | summary: msg 2
168 |
168 |
169 o changeset: 1:5cd978ea5149
169 o changeset: 1:5cd978ea5149
170 | user: test
170 | user: test
171 | date: Thu Jan 01 00:00:01 1970 +0000
171 | date: Thu Jan 01 00:00:01 1970 +0000
172 | summary: msg 1
172 | summary: msg 1
173 |
173 |
174 o changeset: 0:b99c7b9c8e11
174 o changeset: 0:b99c7b9c8e11
175 user: test
175 user: test
176 date: Thu Jan 01 00:00:00 1970 +0000
176 date: Thu Jan 01 00:00:00 1970 +0000
177 summary: msg 0
177 summary: msg 0
178
178
179
179
180 $ hg up -C
180 $ hg up -C
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182
182
183 bisect test
183 bisect test
184
184
185 $ hg bisect -r
185 $ hg bisect -r
186 $ hg bisect -b
186 $ hg bisect -b
187 $ hg status -v
187 $ hg status -v
188 # The repository is in an unfinished *bisect* state.
188 # The repository is in an unfinished *bisect* state.
189
189
190 # To mark the changeset good: hg bisect --good
190 # To mark the changeset good: hg bisect --good
191 # To mark the changeset bad: hg bisect --bad
191 # To mark the changeset bad: hg bisect --bad
192 # To abort: hg bisect --reset
192 # To abort: hg bisect --reset
193
193
194 $ hg status -v --config commands.status.skipstates=bisect
194 $ hg status -v --config commands.status.skipstates=bisect
195 $ hg summary
195 $ hg summary
196 parent: 31:58c80a7c8a40 tip
196 parent: 31:58c80a7c8a40 tip
197 msg 31
197 msg 31
198 branch: default
198 branch: default
199 commit: (clean)
199 commit: (clean)
200 update: (current)
200 update: (current)
201 phases: 32 draft
201 phases: 32 draft
202 $ hg bisect -g 1
202 $ hg bisect -g 1
203 Testing changeset 16:a2e6ea4973e9 "msg 16" (30 changesets remaining, ~4 tests)
203 Testing changeset 16:a2e6ea4973e9 "msg 16" (30 changesets remaining, ~4 tests)
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 $ hg bisect -g
205 $ hg bisect -g
206 Testing changeset 23:5ec79163bff4 "msg 23" (15 changesets remaining, ~3 tests)
206 Testing changeset 23:5ec79163bff4 "msg 23" (15 changesets remaining, ~3 tests)
207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
208
208
209 skip
209 skip
210
210
211 $ hg bisect -s
211 $ hg bisect -s
212 Testing changeset 24:10e0acd3809e "msg 24" (15 changesets remaining, ~3 tests)
212 Testing changeset 24:10e0acd3809e "msg 24" (15 changesets remaining, ~3 tests)
213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 $ hg bisect -g
214 $ hg bisect -g
215 Testing changeset 27:288867a866e9 "msg 27" (7 changesets remaining, ~2 tests)
215 Testing changeset 27:288867a866e9 "msg 27" (7 changesets remaining, ~2 tests)
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 $ hg bisect -g
217 $ hg bisect -g
218 Testing changeset 29:b5bd63375ab9 "msg 29" (4 changesets remaining, ~2 tests)
218 Testing changeset 29:b5bd63375ab9 "msg 29" (4 changesets remaining, ~2 tests)
219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
219 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 $ hg bisect -b
220 $ hg bisect -b
221 Testing changeset 28:8e0c2264c8af "msg 28" (2 changesets remaining, ~1 tests)
221 Testing changeset 28:8e0c2264c8af "msg 28" (2 changesets remaining, ~1 tests)
222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ hg bisect -g
223 $ hg bisect -g
224 The first bad revision is:
224 The first bad revision is:
225 changeset: 29:b5bd63375ab9
225 changeset: 29:b5bd63375ab9
226 user: test
226 user: test
227 date: Thu Jan 01 00:00:29 1970 +0000
227 date: Thu Jan 01 00:00:29 1970 +0000
228 summary: msg 29
228 summary: msg 29
229
229
230
230
231 mark revsets instead of single revs
231 mark revsets instead of single revs
232
232
233 $ hg bisect -r
233 $ hg bisect -r
234 $ hg bisect -b "0::3"
234 $ hg bisect -b "0::3"
235 $ hg bisect -s "13::16"
235 $ hg bisect -s "13::16"
236 $ hg bisect -g "26::tip"
236 $ hg bisect -g "26::tip"
237 Testing changeset 12:1941b52820a5 "msg 12" (23 changesets remaining, ~4 tests)
237 Testing changeset 12:1941b52820a5 "msg 12" (23 changesets remaining, ~4 tests)
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 $ cat .hg/bisect.state
239 $ cat .hg/bisect.state
240 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
240 bad b99c7b9c8e11558adef3fad9af211c58d46f325b
241 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
241 bad 5cd978ea51499179507ee7b6f340d2dbaa401185
242 bad db07c04beaca44cf24832541e7f4a2346a95275b
242 bad db07c04beaca44cf24832541e7f4a2346a95275b
243 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
243 bad b53bea5e2fcb30d3e00bd3409507a5659ce0fd8b
244 current 1941b52820a544549596820a8ae006842b0e2c64
244 current 1941b52820a544549596820a8ae006842b0e2c64
245 good 3efc6fd51aeb8594398044c6c846ca59ae021203
245 good 3efc6fd51aeb8594398044c6c846ca59ae021203
246 good 288867a866e9adb7a29880b66936c874b80f4651
246 good 288867a866e9adb7a29880b66936c874b80f4651
247 good 8e0c2264c8af790daf3585ada0669d93dee09c83
247 good 8e0c2264c8af790daf3585ada0669d93dee09c83
248 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
248 good b5bd63375ab9a290419f2024b7f4ee9ea7ce90a8
249 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
249 good ed2d2f24b11c368fa8aa0da9f4e1db580abade59
250 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
250 good 58c80a7c8a4025a94cedaf7b4a4e3124e8909a96
251 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
251 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
252 skip ce8f0998e922c179e80819d5066fbe46e2998784
252 skip ce8f0998e922c179e80819d5066fbe46e2998784
253 skip e7fa0811edb063f6319531f0d0a865882138e180
253 skip e7fa0811edb063f6319531f0d0a865882138e180
254 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
254 skip a2e6ea4973e9196ddd3386493b0c214b41fd97d3
255
255
256 bisect reverse test
256 bisect reverse test
257
257
258 $ hg bisect -r
258 $ hg bisect -r
259 $ hg bisect -b null
259 $ hg bisect -b null
260 $ hg bisect -g tip
260 $ hg bisect -g tip
261 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
261 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
262 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 $ hg bisect -g
263 $ hg bisect -g
264 Testing changeset 7:03750880c6b5 "msg 7" (16 changesets remaining, ~4 tests)
264 Testing changeset 7:03750880c6b5 "msg 7" (16 changesets remaining, ~4 tests)
265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
266
266
267 skip
267 skip
268
268
269 $ hg bisect -s
269 $ hg bisect -s
270 Testing changeset 6:a3d5c6fdf0d3 "msg 6" (16 changesets remaining, ~4 tests)
270 Testing changeset 6:a3d5c6fdf0d3 "msg 6" (16 changesets remaining, ~4 tests)
271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 $ hg bisect -g
272 $ hg bisect -g
273 Testing changeset 2:db07c04beaca "msg 2" (7 changesets remaining, ~2 tests)
273 Testing changeset 2:db07c04beaca "msg 2" (7 changesets remaining, ~2 tests)
274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
274 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 $ hg bisect -g
275 $ hg bisect -g
276 Testing changeset 0:b99c7b9c8e11 "msg 0" (3 changesets remaining, ~1 tests)
276 Testing changeset 0:b99c7b9c8e11 "msg 0" (3 changesets remaining, ~1 tests)
277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
278 $ hg bisect -b
278 $ hg bisect -b
279 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
279 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
280 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
281 $ hg bisect -g
281 $ hg bisect -g
282 The first good revision is:
282 The first good revision is:
283 changeset: 1:5cd978ea5149
283 changeset: 1:5cd978ea5149
284 user: test
284 user: test
285 date: Thu Jan 01 00:00:01 1970 +0000
285 date: Thu Jan 01 00:00:01 1970 +0000
286 summary: msg 1
286 summary: msg 1
287
287
288
288
289 $ hg bisect -r
289 $ hg bisect -r
290 $ hg bisect -g tip
290 $ hg bisect -g tip
291 $ hg bisect -b tip
291 $ hg bisect -b tip
292 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
292 abort: inconsistent state, 31:58c80a7c8a40 is good and bad
293 [255]
293 [255]
294
294
295 $ hg bisect -r
295 $ hg bisect -r
296 $ hg bisect -g null
296 $ hg bisect -g null
297 $ hg bisect -bU tip
297 $ hg bisect -bU tip
298 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
298 Testing changeset 15:e7fa0811edb0 "msg 15" (32 changesets remaining, ~5 tests)
299 $ hg id
299 $ hg id
300 5cd978ea5149
300 5cd978ea5149
301
301
302
302
303 Issue1228: hg bisect crashes when you skip the last rev in bisection
303 Issue1228: hg bisect crashes when you skip the last rev in bisection
304 Issue1182: hg bisect exception
304 Issue1182: hg bisect exception
305
305
306 $ hg bisect -r
306 $ hg bisect -r
307 $ hg bisect -b 4
307 $ hg bisect -b 4
308 $ hg bisect -g 0
308 $ hg bisect -g 0
309 Testing changeset 2:db07c04beaca "msg 2" (4 changesets remaining, ~2 tests)
309 Testing changeset 2:db07c04beaca "msg 2" (4 changesets remaining, ~2 tests)
310 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
310 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
311 $ hg bisect -s
311 $ hg bisect -s
312 Testing changeset 1:5cd978ea5149 "msg 1" (4 changesets remaining, ~2 tests)
312 Testing changeset 1:5cd978ea5149 "msg 1" (4 changesets remaining, ~2 tests)
313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
314 $ hg bisect -s
314 $ hg bisect -s
315 Testing changeset 3:b53bea5e2fcb "msg 3" (4 changesets remaining, ~2 tests)
315 Testing changeset 3:b53bea5e2fcb "msg 3" (4 changesets remaining, ~2 tests)
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 $ hg bisect -s
317 $ hg bisect -s
318 Due to skipped revisions, the first bad revision could be any of:
318 Due to skipped revisions, the first bad revision could be any of:
319 changeset: 1:5cd978ea5149
319 changeset: 1:5cd978ea5149
320 user: test
320 user: test
321 date: Thu Jan 01 00:00:01 1970 +0000
321 date: Thu Jan 01 00:00:01 1970 +0000
322 summary: msg 1
322 summary: msg 1
323
323
324 changeset: 2:db07c04beaca
324 changeset: 2:db07c04beaca
325 user: test
325 user: test
326 date: Thu Jan 01 00:00:02 1970 +0000
326 date: Thu Jan 01 00:00:02 1970 +0000
327 summary: msg 2
327 summary: msg 2
328
328
329 changeset: 3:b53bea5e2fcb
329 changeset: 3:b53bea5e2fcb
330 user: test
330 user: test
331 date: Thu Jan 01 00:00:03 1970 +0000
331 date: Thu Jan 01 00:00:03 1970 +0000
332 summary: msg 3
332 summary: msg 3
333
333
334 changeset: 4:9b2ba8336a65
334 changeset: 4:9b2ba8336a65
335 user: test
335 user: test
336 date: Thu Jan 01 00:00:04 1970 +0000
336 date: Thu Jan 01 00:00:04 1970 +0000
337 summary: msg 4
337 summary: msg 4
338
338
339
339
340
340
341 reproduce non converging bisect, issue1182
341 reproduce non converging bisect, issue1182
342
342
343 $ hg bisect -r
343 $ hg bisect -r
344 $ hg bisect -g 0
344 $ hg bisect -g 0
345 $ hg bisect -b 2
345 $ hg bisect -b 2
346 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
346 Testing changeset 1:5cd978ea5149 "msg 1" (2 changesets remaining, ~1 tests)
347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 $ hg bisect -s
348 $ hg bisect -s
349 Due to skipped revisions, the first bad revision could be any of:
349 Due to skipped revisions, the first bad revision could be any of:
350 changeset: 1:5cd978ea5149
350 changeset: 1:5cd978ea5149
351 user: test
351 user: test
352 date: Thu Jan 01 00:00:01 1970 +0000
352 date: Thu Jan 01 00:00:01 1970 +0000
353 summary: msg 1
353 summary: msg 1
354
354
355 changeset: 2:db07c04beaca
355 changeset: 2:db07c04beaca
356 user: test
356 user: test
357 date: Thu Jan 01 00:00:02 1970 +0000
357 date: Thu Jan 01 00:00:02 1970 +0000
358 summary: msg 2
358 summary: msg 2
359
359
360
360
361
361
362 test no action
362 test no action
363
363
364 $ hg bisect -r
364 $ hg bisect -r
365 $ hg bisect
365 $ hg bisect
366 abort: cannot bisect (no known good revisions)
366 abort: cannot bisect (no known good revisions)
367 [20]
367 [20]
368
368
369
369
370 reproduce AssertionError, issue1445
370 reproduce AssertionError, issue1445
371
371
372 $ hg bisect -r
372 $ hg bisect -r
373 $ hg bisect -b 6
373 $ hg bisect -b 6
374 $ hg bisect -g 0
374 $ hg bisect -g 0
375 Testing changeset 3:b53bea5e2fcb "msg 3" (6 changesets remaining, ~2 tests)
375 Testing changeset 3:b53bea5e2fcb "msg 3" (6 changesets remaining, ~2 tests)
376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
376 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 $ hg bisect -s
377 $ hg bisect -s
378 Testing changeset 2:db07c04beaca "msg 2" (6 changesets remaining, ~2 tests)
378 Testing changeset 2:db07c04beaca "msg 2" (6 changesets remaining, ~2 tests)
379 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
379 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
380 $ hg bisect -s
380 $ hg bisect -s
381 Testing changeset 4:9b2ba8336a65 "msg 4" (6 changesets remaining, ~2 tests)
381 Testing changeset 4:9b2ba8336a65 "msg 4" (6 changesets remaining, ~2 tests)
382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 $ hg bisect -s
383 $ hg bisect -s
384 Testing changeset 1:5cd978ea5149 "msg 1" (6 changesets remaining, ~2 tests)
384 Testing changeset 1:5cd978ea5149 "msg 1" (6 changesets remaining, ~2 tests)
385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
385 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 $ hg bisect -s
386 $ hg bisect -s
387 Testing changeset 5:7874a09ea728 "msg 5" (6 changesets remaining, ~2 tests)
387 Testing changeset 5:7874a09ea728 "msg 5" (6 changesets remaining, ~2 tests)
388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
388 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 $ hg bisect -g
389 $ hg bisect -g
390 The first bad revision is:
390 The first bad revision is:
391 changeset: 6:a3d5c6fdf0d3
391 changeset: 6:a3d5c6fdf0d3
392 user: test
392 user: test
393 date: Thu Jan 01 00:00:06 1970 +0000
393 date: Thu Jan 01 00:00:06 1970 +0000
394 summary: msg 6
394 summary: msg 6
395
395
396 $ hg log -r "bisect(good)"
396 $ hg log -r "bisect(good)"
397 changeset: 0:b99c7b9c8e11
397 changeset: 0:b99c7b9c8e11
398 user: test
398 user: test
399 date: Thu Jan 01 00:00:00 1970 +0000
399 date: Thu Jan 01 00:00:00 1970 +0000
400 summary: msg 0
400 summary: msg 0
401
401
402 changeset: 5:7874a09ea728
402 changeset: 5:7874a09ea728
403 user: test
403 user: test
404 date: Thu Jan 01 00:00:05 1970 +0000
404 date: Thu Jan 01 00:00:05 1970 +0000
405 summary: msg 5
405 summary: msg 5
406
406
407 $ hg log -r "bisect(bad)"
407 $ hg log -r "bisect(bad)"
408 changeset: 6:a3d5c6fdf0d3
408 changeset: 6:a3d5c6fdf0d3
409 user: test
409 user: test
410 date: Thu Jan 01 00:00:06 1970 +0000
410 date: Thu Jan 01 00:00:06 1970 +0000
411 summary: msg 6
411 summary: msg 6
412
412
413 $ hg log -r "bisect(current)"
413 $ hg log -r "bisect(current)"
414 changeset: 5:7874a09ea728
414 changeset: 5:7874a09ea728
415 user: test
415 user: test
416 date: Thu Jan 01 00:00:05 1970 +0000
416 date: Thu Jan 01 00:00:05 1970 +0000
417 summary: msg 5
417 summary: msg 5
418
418
419 $ hg log -r "bisect(skip)"
419 $ hg log -r "bisect(skip)"
420 changeset: 1:5cd978ea5149
420 changeset: 1:5cd978ea5149
421 user: test
421 user: test
422 date: Thu Jan 01 00:00:01 1970 +0000
422 date: Thu Jan 01 00:00:01 1970 +0000
423 summary: msg 1
423 summary: msg 1
424
424
425 changeset: 2:db07c04beaca
425 changeset: 2:db07c04beaca
426 user: test
426 user: test
427 date: Thu Jan 01 00:00:02 1970 +0000
427 date: Thu Jan 01 00:00:02 1970 +0000
428 summary: msg 2
428 summary: msg 2
429
429
430 changeset: 3:b53bea5e2fcb
430 changeset: 3:b53bea5e2fcb
431 user: test
431 user: test
432 date: Thu Jan 01 00:00:03 1970 +0000
432 date: Thu Jan 01 00:00:03 1970 +0000
433 summary: msg 3
433 summary: msg 3
434
434
435 changeset: 4:9b2ba8336a65
435 changeset: 4:9b2ba8336a65
436 user: test
436 user: test
437 date: Thu Jan 01 00:00:04 1970 +0000
437 date: Thu Jan 01 00:00:04 1970 +0000
438 summary: msg 4
438 summary: msg 4
439
439
440
440
441 test legacy bisected() keyword
441 test legacy bisected() keyword
442
442
443 $ hg log -r "bisected(bad)"
443 $ hg log -r "bisected(bad)"
444 changeset: 6:a3d5c6fdf0d3
444 changeset: 6:a3d5c6fdf0d3
445 user: test
445 user: test
446 date: Thu Jan 01 00:00:06 1970 +0000
446 date: Thu Jan 01 00:00:06 1970 +0000
447 summary: msg 6
447 summary: msg 6
448
448
449
449
450 $ set +e
450 $ set +e
451
451
452 test invalid command
452 test invalid command
453 assuming that the shell returns 127 if command not found ...
453 assuming that the shell returns 127 if command not found ...
454
454
455 $ hg bisect -r
455 $ hg bisect -r
456 $ hg bisect --command 'exit 127'
456 $ hg bisect --command 'exit 127'
457 abort: failed to execute exit 127
457 abort: failed to execute exit 127
458 [255]
458 [255]
459
459
460
460
461 test bisecting command
461 test bisecting command
462
462
463 $ cat > script.py <<EOF
463 $ cat > "$TESTTMP/script.py" <<EOF
464 > #!$PYTHON
464 > #!$PYTHON
465 > import sys
465 > import sys
466 > from mercurial import hg, ui as uimod
466 > from mercurial import hg, ui as uimod
467 > repo = hg.repository(uimod.ui.load(), b'.')
467 > repo = hg.repository(uimod.ui.load(), b'.')
468 > if repo[b'.'].rev() < 6:
468 > if repo[b'.'].rev() < 6:
469 > sys.exit(1)
469 > sys.exit(1)
470 > EOF
470 > EOF
471 $ chmod +x script.py
471 $ chmod +x "$TESTTMP/script.py"
472 $ hg bisect -r
472 $ hg bisect -r
473 $ hg up -qr tip
473 $ hg up -qr tip
474 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
474 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
475 changeset 31:58c80a7c8a40 tip "msg 31": good
475 changeset 31:58c80a7c8a40 tip "msg 31": good
476 abort: cannot bisect (no known bad revisions)
476 abort: cannot bisect (no known bad revisions)
477 [20]
477 [20]
478 $ hg up -qr 0
478 $ hg up -qr 0
479 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
479 $ hg bisect --command "\"$PYTHON\" \"$TESTTMP/script.py\" and some parameters"
480 changeset 0:b99c7b9c8e11 "msg 0": bad
480 changeset 0:b99c7b9c8e11 "msg 0": bad
481 changeset 15:e7fa0811edb0 "msg 15": good
481 changeset 15:e7fa0811edb0 "msg 15": good
482 changeset 7:03750880c6b5 "msg 7": good
482 changeset 7:03750880c6b5 "msg 7": good
483 changeset 3:b53bea5e2fcb "msg 3": bad
483 changeset 3:b53bea5e2fcb "msg 3": bad
484 changeset 5:7874a09ea728 "msg 5": bad
484 changeset 5:7874a09ea728 "msg 5": bad
485 changeset 6:a3d5c6fdf0d3 "msg 6": good
485 changeset 6:a3d5c6fdf0d3 "msg 6": good
486 The first good revision is:
486 The first good revision is:
487 changeset: 6:a3d5c6fdf0d3
487 changeset: 6:a3d5c6fdf0d3
488 user: test
488 user: test
489 date: Thu Jan 01 00:00:06 1970 +0000
489 date: Thu Jan 01 00:00:06 1970 +0000
490 summary: msg 6
490 summary: msg 6
491
491
492
492
493
493
494 test bisecting via a command without updating the working dir, and
494 test bisecting via a command without updating the working dir, and
495 ensure that the bisect state file is updated before running a test
495 ensure that the bisect state file is updated before running a test
496 command
496 command
497
497
498 $ hg update null
498 $ hg update null
499 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
499 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
500 $ cat > script.sh <<'EOF'
500 $ cat > "$TESTTMP/script.sh" <<'EOF'
501 > #!/bin/sh
501 > #!/bin/sh
502 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
502 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
503 > current="`hg log -r \"bisect(current)\" --template {node}`"
503 > current="`hg log -r \"bisect(current)\" --template {node}`"
504 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
504 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
505 > rev="`hg log -r $HG_NODE --template {rev}`"
505 > rev="`hg log -r $HG_NODE --template {rev}`"
506 > test "$rev" -ge 6
506 > test "$rev" -ge 6
507 > EOF
507 > EOF
508 $ chmod +x script.sh
508 $ chmod +x "$TESTTMP/script.sh"
509 $ hg bisect -r
509 $ hg bisect -r
510 $ hg bisect --good tip --noupdate
510 $ hg bisect --good tip --noupdate
511 $ hg bisect --bad 0 --noupdate
511 $ hg bisect --bad 0 --noupdate
512 Testing changeset 15:e7fa0811edb0 "msg 15" (31 changesets remaining, ~4 tests)
512 Testing changeset 15:e7fa0811edb0 "msg 15" (31 changesets remaining, ~4 tests)
513 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
513 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params" --noupdate
514 changeset 15:e7fa0811edb0 "msg 15": good
514 changeset 15:e7fa0811edb0 "msg 15": good
515 changeset 7:03750880c6b5 "msg 7": good
515 changeset 7:03750880c6b5 "msg 7": good
516 changeset 3:b53bea5e2fcb "msg 3": bad
516 changeset 3:b53bea5e2fcb "msg 3": bad
517 changeset 5:7874a09ea728 "msg 5": bad
517 changeset 5:7874a09ea728 "msg 5": bad
518 changeset 6:a3d5c6fdf0d3 "msg 6": good
518 changeset 6:a3d5c6fdf0d3 "msg 6": good
519 The first good revision is:
519 The first good revision is:
520 changeset: 6:a3d5c6fdf0d3
520 changeset: 6:a3d5c6fdf0d3
521 user: test
521 user: test
522 date: Thu Jan 01 00:00:06 1970 +0000
522 date: Thu Jan 01 00:00:06 1970 +0000
523 summary: msg 6
523 summary: msg 6
524
524
525
525
526 ensure that we still don't have a working dir
526 ensure that we still don't have a working dir
527
527
528 $ hg parents
528 $ hg parents
529
529
530
530
531 test the same case, this time with updating
531 test the same case, this time with updating
532
532
533 $ cat > script.sh <<'EOF'
533 $ cat > "$TESTTMP/script.sh" <<'EOF'
534 > #!/bin/sh
534 > #!/bin/sh
535 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
535 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
536 > current="`hg log -r \"bisect(current)\" --template {node}`"
536 > current="`hg log -r \"bisect(current)\" --template {node}`"
537 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
537 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
538 > rev="`hg log -r . --template {rev}`"
538 > rev="`hg log -r . --template {rev}`"
539 > test "$rev" -ge 6
539 > test "$rev" -ge 6
540 > EOF
540 > EOF
541 $ chmod +x script.sh
541 $ chmod +x "$TESTTMP/script.sh"
542 $ hg bisect -r
542 $ hg bisect -r
543 $ hg up -qr tip
543 $ hg up -qr tip
544 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
544 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
545 changeset 31:58c80a7c8a40 tip "msg 31": good
545 changeset 31:58c80a7c8a40 tip "msg 31": good
546 abort: cannot bisect (no known bad revisions)
546 abort: cannot bisect (no known bad revisions)
547 [20]
547 [20]
548 $ hg up -qr 0
548 $ hg up -qr 0
549 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
549 $ hg bisect --command "sh \"$TESTTMP/script.sh\" and some params"
550 changeset 0:b99c7b9c8e11 "msg 0": bad
550 changeset 0:b99c7b9c8e11 "msg 0": bad
551 changeset 15:e7fa0811edb0 "msg 15": good
551 changeset 15:e7fa0811edb0 "msg 15": good
552 changeset 7:03750880c6b5 "msg 7": good
552 changeset 7:03750880c6b5 "msg 7": good
553 changeset 3:b53bea5e2fcb "msg 3": bad
553 changeset 3:b53bea5e2fcb "msg 3": bad
554 changeset 5:7874a09ea728 "msg 5": bad
554 changeset 5:7874a09ea728 "msg 5": bad
555 changeset 6:a3d5c6fdf0d3 "msg 6": good
555 changeset 6:a3d5c6fdf0d3 "msg 6": good
556 The first good revision is:
556 The first good revision is:
557 changeset: 6:a3d5c6fdf0d3
557 changeset: 6:a3d5c6fdf0d3
558 user: test
558 user: test
559 date: Thu Jan 01 00:00:06 1970 +0000
559 date: Thu Jan 01 00:00:06 1970 +0000
560 summary: msg 6
560 summary: msg 6
561
561
562 $ hg graft -q 15
562 $ hg graft -q 15
563 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
563 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
564 abort: unresolved conflicts, can't continue
564 abort: unresolved conflicts, can't continue
565 (use 'hg resolve' and 'hg graft --continue')
565 (use 'hg resolve' and 'hg graft --continue')
566 [1]
566 [1]
567 $ hg bisect --reset
567 $ hg bisect --reset
568 $ hg up -C .
568 $ hg up -C .
569 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
569 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
570
570
571 Check that bisect does not break on obsolete changesets
571 Check that bisect does not break on obsolete changesets
572 =========================================================
572 =========================================================
573
573
574 $ cat >> $HGRCPATH << EOF
574 $ cat >> $HGRCPATH << EOF
575 > [experimental]
575 > [experimental]
576 > evolution.createmarkers=True
576 > evolution.createmarkers=True
577 > EOF
577 > EOF
578
578
579 tip is obsolete
579 tip is obsolete
580 ---------------------
580 ---------------------
581
581
582 $ hg debugobsolete `hg id --debug -i -r tip`
582 $ hg debugobsolete `hg id --debug -i -r tip`
583 1 new obsolescence markers
583 1 new obsolescence markers
584 obsoleted 1 changesets
584 obsoleted 1 changesets
585 $ hg bisect --reset
585 $ hg bisect --reset
586 $ hg bisect --good 15
586 $ hg bisect --good 15
587 $ hg bisect --bad 30
587 $ hg bisect --bad 30
588 Testing changeset 22:06c7993750ce "msg 22" (15 changesets remaining, ~3 tests)
588 Testing changeset 22:06c7993750ce "msg 22" (15 changesets remaining, ~3 tests)
589 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
589 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
590 $ hg bisect --command true
590 $ hg bisect --command true
591 changeset 22:06c7993750ce "msg 22": good
591 changeset 22:06c7993750ce "msg 22": good
592 changeset 26:3efc6fd51aeb "msg 26": good
592 changeset 26:3efc6fd51aeb "msg 26": good
593 changeset 28:8e0c2264c8af "msg 28": good
593 changeset 28:8e0c2264c8af "msg 28": good
594 changeset 29:b5bd63375ab9 "msg 29": good
594 changeset 29:b5bd63375ab9 "msg 29": good
595 The first bad revision is:
595 The first bad revision is:
596 changeset: 30:ed2d2f24b11c
596 changeset: 30:ed2d2f24b11c
597 tag: tip
597 tag: tip
598 user: test
598 user: test
599 date: Thu Jan 01 00:00:30 1970 +0000
599 date: Thu Jan 01 00:00:30 1970 +0000
600 summary: msg 30
600 summary: msg 30
601
601
602
602
603 Rewritten commits should not crash
603 Rewritten commits should not crash
604
604
605 $ hg co 29
605 $ hg co 29
606 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
606 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 $ hg revert --all -r 30
607 $ hg revert --all -r 30
608 reverting a
608 reverting a
609 $ hg commit -m 'msg 30 -- fixed'
609 $ hg commit -m 'msg 30 -- fixed'
610 created new head
610 created new head
611 $ hg debugobsolete `hg id --debug -i -r 30` `hg id --debug -i -r .`
611 $ hg debugobsolete `hg id --debug -i -r 30` `hg id --debug -i -r .`
612 1 new obsolescence markers
612 1 new obsolescence markers
613 obsoleted 1 changesets
613 obsoleted 1 changesets
614 $ hg bisect
614 $ hg bisect
615 The first bad revision is:
615 The first bad revision is:
616 changeset: 30:ed2d2f24b11c
616 changeset: 30:ed2d2f24b11c
617 user: test
617 user: test
618 date: Thu Jan 01 00:00:30 1970 +0000
618 date: Thu Jan 01 00:00:30 1970 +0000
619 obsolete: rewritten as 32:8a638ebd1122
619 obsolete: rewritten as 32:8a638ebd1122
620 summary: msg 30
620 summary: msg 30
621
621
622
622
623 Log template does not crash
623 Log template does not crash
624
624
625 $ hg log -GTbisect -r 15::
625 $ hg log -GTbisect -r 15::
626 @ changeset: 32:8a638ebd1122
626 @ changeset: 32:8a638ebd1122
627 | bisect: good (implicit)
627 | bisect: good (implicit)
628 | tag: tip
628 | tag: tip
629 | parent: 29:b5bd63375ab9
629 | parent: 29:b5bd63375ab9
630 | user: test
630 | user: test
631 | date: Thu Jan 01 00:00:00 1970 +0000
631 | date: Thu Jan 01 00:00:00 1970 +0000
632 | summary: msg 30 -- fixed
632 | summary: msg 30 -- fixed
633 |
633 |
634 o changeset: 29:b5bd63375ab9
634 o changeset: 29:b5bd63375ab9
635 | bisect: good
635 | bisect: good
636 | user: test
636 | user: test
637 | date: Thu Jan 01 00:00:29 1970 +0000
637 | date: Thu Jan 01 00:00:29 1970 +0000
638 | summary: msg 29
638 | summary: msg 29
639 |
639 |
640 o changeset: 28:8e0c2264c8af
640 o changeset: 28:8e0c2264c8af
641 | bisect: good
641 | bisect: good
642 | user: test
642 | user: test
643 | date: Thu Jan 01 00:00:28 1970 +0000
643 | date: Thu Jan 01 00:00:28 1970 +0000
644 | summary: msg 28
644 | summary: msg 28
645 |
645 |
646 o changeset: 27:288867a866e9
646 o changeset: 27:288867a866e9
647 | bisect: ignored
647 | bisect: ignored
648 | user: test
648 | user: test
649 | date: Thu Jan 01 00:00:27 1970 +0000
649 | date: Thu Jan 01 00:00:27 1970 +0000
650 | summary: msg 27
650 | summary: msg 27
651 |
651 |
652 o changeset: 26:3efc6fd51aeb
652 o changeset: 26:3efc6fd51aeb
653 | bisect: good
653 | bisect: good
654 | user: test
654 | user: test
655 | date: Thu Jan 01 00:00:26 1970 +0000
655 | date: Thu Jan 01 00:00:26 1970 +0000
656 | summary: msg 26
656 | summary: msg 26
657 |
657 |
658 o changeset: 25:02a84173a97a
658 o changeset: 25:02a84173a97a
659 | bisect: ignored
659 | bisect: ignored
660 | user: test
660 | user: test
661 | date: Thu Jan 01 00:00:25 1970 +0000
661 | date: Thu Jan 01 00:00:25 1970 +0000
662 | summary: msg 25
662 | summary: msg 25
663 |
663 |
664 o changeset: 24:10e0acd3809e
664 o changeset: 24:10e0acd3809e
665 | bisect: ignored
665 | bisect: ignored
666 | user: test
666 | user: test
667 | date: Thu Jan 01 00:00:24 1970 +0000
667 | date: Thu Jan 01 00:00:24 1970 +0000
668 | summary: msg 24
668 | summary: msg 24
669 |
669 |
670 o changeset: 23:5ec79163bff4
670 o changeset: 23:5ec79163bff4
671 | bisect: ignored
671 | bisect: ignored
672 | user: test
672 | user: test
673 | date: Thu Jan 01 00:00:23 1970 +0000
673 | date: Thu Jan 01 00:00:23 1970 +0000
674 | summary: msg 23
674 | summary: msg 23
675 |
675 |
676 o changeset: 22:06c7993750ce
676 o changeset: 22:06c7993750ce
677 | bisect: good
677 | bisect: good
678 | user: test
678 | user: test
679 | date: Thu Jan 01 00:00:22 1970 +0000
679 | date: Thu Jan 01 00:00:22 1970 +0000
680 | summary: msg 22
680 | summary: msg 22
681 |
681 |
682 o changeset: 21:e5db6aa3fe2a
682 o changeset: 21:e5db6aa3fe2a
683 | bisect: ignored
683 | bisect: ignored
684 | user: test
684 | user: test
685 | date: Thu Jan 01 00:00:21 1970 +0000
685 | date: Thu Jan 01 00:00:21 1970 +0000
686 | summary: msg 21
686 | summary: msg 21
687 |
687 |
688 o changeset: 20:7128fb4fdbc9
688 o changeset: 20:7128fb4fdbc9
689 | bisect: ignored
689 | bisect: ignored
690 | user: test
690 | user: test
691 | date: Thu Jan 01 00:00:20 1970 +0000
691 | date: Thu Jan 01 00:00:20 1970 +0000
692 | summary: msg 20
692 | summary: msg 20
693 |
693 |
694 o changeset: 19:52798545b482
694 o changeset: 19:52798545b482
695 | bisect: ignored
695 | bisect: ignored
696 | user: test
696 | user: test
697 | date: Thu Jan 01 00:00:19 1970 +0000
697 | date: Thu Jan 01 00:00:19 1970 +0000
698 | summary: msg 19
698 | summary: msg 19
699 |
699 |
700 o changeset: 18:86977a90077e
700 o changeset: 18:86977a90077e
701 | bisect: ignored
701 | bisect: ignored
702 | user: test
702 | user: test
703 | date: Thu Jan 01 00:00:18 1970 +0000
703 | date: Thu Jan 01 00:00:18 1970 +0000
704 | summary: msg 18
704 | summary: msg 18
705 |
705 |
706 o changeset: 17:03515f4a9080
706 o changeset: 17:03515f4a9080
707 | bisect: ignored
707 | bisect: ignored
708 | user: test
708 | user: test
709 | date: Thu Jan 01 00:00:17 1970 +0000
709 | date: Thu Jan 01 00:00:17 1970 +0000
710 | summary: msg 17
710 | summary: msg 17
711 |
711 |
712 o changeset: 16:a2e6ea4973e9
712 o changeset: 16:a2e6ea4973e9
713 | bisect: ignored
713 | bisect: ignored
714 | user: test
714 | user: test
715 | date: Thu Jan 01 00:00:16 1970 +0000
715 | date: Thu Jan 01 00:00:16 1970 +0000
716 | summary: msg 16
716 | summary: msg 16
717 |
717 |
718 o changeset: 15:e7fa0811edb0
718 o changeset: 15:e7fa0811edb0
719 | bisect: good
719 | bisect: good
720 ~ user: test
720 ~ user: test
721 date: Thu Jan 01 00:00:15 1970 +0000
721 date: Thu Jan 01 00:00:15 1970 +0000
722 summary: msg 15
722 summary: msg 15
723
723
724 $ hg debugobsolete --delete `hg debugobsolete --index -T'{index}\n' | tail -1`
724 $ hg debugobsolete --delete `hg debugobsolete --index -T'{index}\n' | tail -1`
725 deleted 1 obsolescence markers
725 deleted 1 obsolescence markers
726
726
727 Changeset in the bad:good range is obsolete
727 Changeset in the bad:good range is obsolete
728 ---------------------------------------------
728 ---------------------------------------------
729
729
730 $ hg up 30
730 $ hg up 30
731 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
731 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
732 $ echo 'a' >> a
732 $ echo 'a' >> a
733 $ hg ci -m "msg 32" -d "32 0"
733 $ hg ci -m "msg 32" -d "32 0"
734 $ hg bisect --reset
734 $ hg bisect --reset
735 $ hg bisect --good .
735 $ hg bisect --good .
736 $ hg bisect --bad 25
736 $ hg bisect --bad 25
737 Testing changeset 28:8e0c2264c8af "msg 28" (6 changesets remaining, ~2 tests)
737 Testing changeset 28:8e0c2264c8af "msg 28" (6 changesets remaining, ~2 tests)
738 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
738 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
739 $ hg bisect --command true
739 $ hg bisect --command true
740 changeset 28:8e0c2264c8af "msg 28": good
740 changeset 28:8e0c2264c8af "msg 28": good
741 changeset 26:3efc6fd51aeb "msg 26": good
741 changeset 26:3efc6fd51aeb "msg 26": good
742 The first good revision is:
742 The first good revision is:
743 changeset: 26:3efc6fd51aeb
743 changeset: 26:3efc6fd51aeb
744 user: test
744 user: test
745 date: Thu Jan 01 00:00:26 1970 +0000
745 date: Thu Jan 01 00:00:26 1970 +0000
746 summary: msg 26
746 summary: msg 26
747
747
748 Test the validation message when exclusive options are used:
748 Test the validation message when exclusive options are used:
749
749
750 $ hg bisect -r
750 $ hg bisect -r
751 $ hg bisect -b -c false
751 $ hg bisect -b -c false
752 abort: --bad and --command are incompatible
752 abort: --bad and --command are incompatible
753 [10]
753 [10]
754 $ hg bisect -b -e
754 $ hg bisect -b -e
755 abort: --bad and --extend are incompatible
755 abort: --bad and --extend are incompatible
756 [10]
756 [10]
757 $ hg bisect -b -g
757 $ hg bisect -b -g
758 abort: --bad and --good are incompatible
758 abort: --bad and --good are incompatible
759 [10]
759 [10]
760 $ hg bisect -b -r
760 $ hg bisect -b -r
761 abort: --bad and --reset are incompatible
761 abort: --bad and --reset are incompatible
762 [10]
762 [10]
763 $ hg bisect -b -s
763 $ hg bisect -b -s
764 abort: --bad and --skip are incompatible
764 abort: --bad and --skip are incompatible
765 [10]
765 [10]
766 $ hg bisect -c false -e
766 $ hg bisect -c false -e
767 abort: --command and --extend are incompatible
767 abort: --command and --extend are incompatible
768 [10]
768 [10]
769 $ hg bisect -c false -g
769 $ hg bisect -c false -g
770 abort: --command and --good are incompatible
770 abort: --command and --good are incompatible
771 [10]
771 [10]
772 $ hg bisect -c false -r
772 $ hg bisect -c false -r
773 abort: --command and --reset are incompatible
773 abort: --command and --reset are incompatible
774 [10]
774 [10]
775 $ hg bisect -c false -s
775 $ hg bisect -c false -s
776 abort: --command and --skip are incompatible
776 abort: --command and --skip are incompatible
777 [10]
777 [10]
778 $ hg bisect -e -g
778 $ hg bisect -e -g
779 abort: --extend and --good are incompatible
779 abort: --extend and --good are incompatible
780 [10]
780 [10]
781 $ hg bisect -e -r
781 $ hg bisect -e -r
782 abort: --extend and --reset are incompatible
782 abort: --extend and --reset are incompatible
783 [10]
783 [10]
784 $ hg bisect -e -s
784 $ hg bisect -e -s
785 abort: --extend and --skip are incompatible
785 abort: --extend and --skip are incompatible
786 [10]
786 [10]
787 $ hg bisect -g -r
787 $ hg bisect -g -r
788 abort: --good and --reset are incompatible
788 abort: --good and --reset are incompatible
789 [10]
789 [10]
790 $ hg bisect -g -s
790 $ hg bisect -g -s
791 abort: --good and --skip are incompatible
791 abort: --good and --skip are incompatible
792 [10]
792 [10]
793 $ hg bisect -r -s
793 $ hg bisect -r -s
794 abort: --reset and --skip are incompatible
794 abort: --reset and --skip are incompatible
795 [10]
795 [10]
@@ -1,248 +1,249 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 no bookmarks
4 no bookmarks
4
5
5 $ hg bookmarks
6 $ hg bookmarks
6 no bookmarks set
7 no bookmarks set
7
8
8 set bookmark X
9 set bookmark X
9
10
10 $ hg bookmark X
11 $ hg bookmark X
11
12
12 list bookmarks
13 list bookmarks
13
14
14 $ hg bookmark
15 $ hg bookmark
15 * X -1:000000000000
16 * X -1:000000000000
16
17
17 list bookmarks with color
18 list bookmarks with color
18
19
19 $ hg --config extensions.color= --config color.mode=ansi \
20 $ hg --config extensions.color= --config color.mode=ansi \
20 > bookmark --color=always
21 > bookmark --color=always
21 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
22 \x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc)
22
23
23 update to bookmark X
24 update to bookmark X
24
25
25 $ hg bookmarks
26 $ hg bookmarks
26 * X -1:000000000000
27 * X -1:000000000000
27 $ hg update X
28 $ hg update X
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29
30
30 list bookmarks
31 list bookmarks
31
32
32 $ hg bookmarks
33 $ hg bookmarks
33 * X -1:000000000000
34 * X -1:000000000000
34
35
35 rename
36 rename
36
37
37 $ hg bookmark -m X Z
38 $ hg bookmark -m X Z
38
39
39 list bookmarks
40 list bookmarks
40
41
41 $ cat .hg/bookmarks.current
42 $ cat .hg/bookmarks.current
42 Z (no-eol)
43 Z (no-eol)
43 $ cat .hg/bookmarks
44 $ cat .hg/bookmarks
44 0000000000000000000000000000000000000000 Z
45 0000000000000000000000000000000000000000 Z
45 $ hg bookmarks
46 $ hg bookmarks
46 * Z -1:000000000000
47 * Z -1:000000000000
47
48
48 new bookmarks X and Y, first one made active
49 new bookmarks X and Y, first one made active
49
50
50 $ hg bookmark Y X
51 $ hg bookmark Y X
51
52
52 list bookmarks
53 list bookmarks
53
54
54 $ hg bookmark
55 $ hg bookmark
55 X -1:000000000000
56 X -1:000000000000
56 * Y -1:000000000000
57 * Y -1:000000000000
57 Z -1:000000000000
58 Z -1:000000000000
58
59
59 $ hg bookmark -d X
60 $ hg bookmark -d X
60
61
61 commit
62 commit
62
63
63 $ echo 'b' > b
64 $ echo 'b' > b
64 $ hg add b
65 $ hg add b
65 $ hg commit -m'test'
66 $ hg commit -m'test'
66
67
67 list bookmarks
68 list bookmarks
68
69
69 $ hg bookmark
70 $ hg bookmark
70 * Y 0:719295282060
71 * Y 0:719295282060
71 Z -1:000000000000
72 Z -1:000000000000
72
73
73 Verify that switching to Z updates the active bookmark:
74 Verify that switching to Z updates the active bookmark:
74 $ hg update Z
75 $ hg update Z
75 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
76 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
76 (activating bookmark Z)
77 (activating bookmark Z)
77 $ hg bookmark
78 $ hg bookmark
78 Y 0:719295282060
79 Y 0:719295282060
79 * Z -1:000000000000
80 * Z -1:000000000000
80
81
81 Switch back to Y for the remaining tests in this file:
82 Switch back to Y for the remaining tests in this file:
82 $ hg update Y
83 $ hg update Y
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 (activating bookmark Y)
85 (activating bookmark Y)
85
86
86 delete bookmarks
87 delete bookmarks
87
88
88 $ hg bookmark -d Y
89 $ hg bookmark -d Y
89 $ hg bookmark -d Z
90 $ hg bookmark -d Z
90
91
91 list bookmarks
92 list bookmarks
92
93
93 $ hg bookmark
94 $ hg bookmark
94 no bookmarks set
95 no bookmarks set
95
96
96 update to tip
97 update to tip
97
98
98 $ hg update tip
99 $ hg update tip
99 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
100
101
101 set bookmark Y using -r . but make sure that the active
102 set bookmark Y using -r . but make sure that the active
102 bookmark is not activated
103 bookmark is not activated
103
104
104 $ hg bookmark -r . Y
105 $ hg bookmark -r . Y
105
106
106 list bookmarks, Y should not be active
107 list bookmarks, Y should not be active
107
108
108 $ hg bookmark
109 $ hg bookmark
109 Y 0:719295282060
110 Y 0:719295282060
110
111
111 now, activate Y
112 now, activate Y
112
113
113 $ hg up -q Y
114 $ hg up -q Y
114
115
115 set bookmark Z using -i
116 set bookmark Z using -i
116
117
117 $ hg bookmark -r . -i Z
118 $ hg bookmark -r . -i Z
118 $ hg bookmarks
119 $ hg bookmarks
119 * Y 0:719295282060
120 * Y 0:719295282060
120 Z 0:719295282060
121 Z 0:719295282060
121
122
122 deactivate active bookmark using -i
123 deactivate active bookmark using -i
123
124
124 $ hg bookmark -i Y
125 $ hg bookmark -i Y
125 $ hg bookmarks
126 $ hg bookmarks
126 Y 0:719295282060
127 Y 0:719295282060
127 Z 0:719295282060
128 Z 0:719295282060
128
129
129 $ hg up -q Y
130 $ hg up -q Y
130 $ hg bookmark -i
131 $ hg bookmark -i
131 $ hg bookmarks
132 $ hg bookmarks
132 Y 0:719295282060
133 Y 0:719295282060
133 Z 0:719295282060
134 Z 0:719295282060
134 $ hg bookmark -i
135 $ hg bookmark -i
135 no active bookmark
136 no active bookmark
136 $ hg up -q Y
137 $ hg up -q Y
137 $ hg bookmarks
138 $ hg bookmarks
138 * Y 0:719295282060
139 * Y 0:719295282060
139 Z 0:719295282060
140 Z 0:719295282060
140
141
141 deactivate active bookmark while renaming
142 deactivate active bookmark while renaming
142
143
143 $ hg bookmark -i -m Y X
144 $ hg bookmark -i -m Y X
144 $ hg bookmarks
145 $ hg bookmarks
145 X 0:719295282060
146 X 0:719295282060
146 Z 0:719295282060
147 Z 0:719295282060
147
148
148 bare update moves the active bookmark forward and clear the divergent bookmarks
149 bare update moves the active bookmark forward and clear the divergent bookmarks
149
150
150 $ echo a > a
151 $ echo a > a
151 $ hg ci -Am1
152 $ hg ci -Am1
152 adding a
153 adding a
153 $ echo b >> a
154 $ echo b >> a
154 $ hg ci -Am2
155 $ hg ci -Am2
155 $ hg bookmark X@1 -r 1
156 $ hg bookmark X@1 -r 1
156 $ hg bookmark X@2 -r 2
157 $ hg bookmark X@2 -r 2
157 $ hg update X
158 $ hg update X
158 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
159 (activating bookmark X)
160 (activating bookmark X)
160 $ hg bookmarks
161 $ hg bookmarks
161 * X 0:719295282060
162 * X 0:719295282060
162 X@1 1:cc586d725fbe
163 X@1 1:cc586d725fbe
163 X@2 2:49e1c4e84c58
164 X@2 2:49e1c4e84c58
164 Z 0:719295282060
165 Z 0:719295282060
165 $ hg update
166 $ hg update
166 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
167 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
167 updating bookmark X
168 updating bookmark X
168 $ hg bookmarks
169 $ hg bookmarks
169 * X 2:49e1c4e84c58
170 * X 2:49e1c4e84c58
170 Z 0:719295282060
171 Z 0:719295282060
171
172
172 test deleting .hg/bookmarks.current when explicitly updating
173 test deleting .hg/bookmarks.current when explicitly updating
173 to a revision
174 to a revision
174
175
175 $ echo a >> b
176 $ echo a >> b
176 $ hg ci -m.
177 $ hg ci -m.
177 $ hg up -q X
178 $ hg up -q X
178 $ test -f .hg/bookmarks.current
179 $ test -f .hg/bookmarks.current
179
180
180 try to update to it again to make sure we don't
181 try to update to it again to make sure we don't
181 set and then unset it
182 set and then unset it
182
183
183 $ hg up -q X
184 $ hg up -q X
184 $ test -f .hg/bookmarks.current
185 $ test -f .hg/bookmarks.current
185
186
186 $ hg up -q 1
187 $ hg up -q 1
187 $ test -f .hg/bookmarks.current
188 $ test -f .hg/bookmarks.current
188 [1]
189 [1]
189
190
190 when a bookmark is active, hg up -r . is
191 when a bookmark is active, hg up -r . is
191 analogous to hg book -i <active bookmark>
192 analogous to hg book -i <active bookmark>
192
193
193 $ hg up -q X
194 $ hg up -q X
194 $ hg up -q .
195 $ hg up -q .
195 $ test -f .hg/bookmarks.current
196 $ test -f .hg/bookmarks.current
196 [1]
197 [1]
197
198
198 issue 4552 -- simulate a pull moving the active bookmark
199 issue 4552 -- simulate a pull moving the active bookmark
199
200
200 $ hg up -q X
201 $ hg up -q X
201 $ printf "Z" > .hg/bookmarks.current
202 $ printf "Z" > .hg/bookmarks.current
202 $ hg log -T '{activebookmark}\n' -r Z
203 $ hg log -T '{activebookmark}\n' -r Z
203 Z
204 Z
204 $ hg log -T '{bookmarks % "{active}\n"}' -r Z
205 $ hg log -T '{bookmarks % "{active}\n"}' -r Z
205 Z
206 Z
206
207
207 test that updating to closed branch head also advances active bookmark
208 test that updating to closed branch head also advances active bookmark
208
209
209 $ hg commit --close-branch -m "closed"
210 $ hg commit --close-branch -m "closed"
210 $ hg update -q ".^1"
211 $ hg update -q ".^1"
211 $ hg bookmark Y
212 $ hg bookmark Y
212 $ hg bookmarks
213 $ hg bookmarks
213 X 3:4d6bd4bfb1ae
214 X 3:4d6bd4bfb1ae
214 * Y 3:4d6bd4bfb1ae
215 * Y 3:4d6bd4bfb1ae
215 Z 0:719295282060
216 Z 0:719295282060
216 $ hg update
217 $ hg update
217 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 updating bookmark Y
219 updating bookmark Y
219 $ hg bookmarks
220 $ hg bookmarks
220 X 3:4d6bd4bfb1ae
221 X 3:4d6bd4bfb1ae
221 * Y 4:8fa964221e8e
222 * Y 4:8fa964221e8e
222 Z 0:719295282060
223 Z 0:719295282060
223 $ hg parents -q
224 $ hg parents -q
224 4:8fa964221e8e
225 4:8fa964221e8e
225
226
226 Checks command to retrieve active bookmark
227 Checks command to retrieve active bookmark
227 ------------------------------------------
228 ------------------------------------------
228
229
229 display how "{activebookmark}" template is unsuitable for the task
230 display how "{activebookmark}" template is unsuitable for the task
230
231
231 $ hg book -T '- {activebookmark}\n'
232 $ hg book -T '- {activebookmark}\n'
232 -
233 -
233 - Y
234 - Y
234 -
235 -
235
236
236 $ hg book -r . W
237 $ hg book -r . W
237 $ hg book -T '- {activebookmark}\n'
238 $ hg book -T '- {activebookmark}\n'
238 - Y
239 - Y
239 -
240 -
240 - Y
241 - Y
241 -
242 -
242
243
243 $ hg bookmarks -ql .
244 $ hg bookmarks -ql .
244 Y
245 Y
245 $ hg bookmarks --inactive
246 $ hg bookmarks --inactive
246 $ hg bookmarks -ql .
247 $ hg bookmarks -ql .
247 abort: no active bookmark
248 abort: no active bookmark
248 [10]
249 [10]
@@ -1,152 +1,153 b''
1 # init
1 # init
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ echo a > a
5 $ echo a > a
5 $ hg add a
6 $ hg add a
6 $ hg commit -m'a'
7 $ hg commit -m'a'
7 $ echo b > b
8 $ echo b > b
8 $ hg add b
9 $ hg add b
9 $ hg commit -m'b'
10 $ hg commit -m'b'
10 $ hg up -C 0
11 $ hg up -C 0
11 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 $ echo c > c
13 $ echo c > c
13 $ hg add c
14 $ hg add c
14 $ hg commit -m'c'
15 $ hg commit -m'c'
15 created new head
16 created new head
16
17
17 # test merging of diverged bookmarks
18 # test merging of diverged bookmarks
18 $ hg bookmark -r 1 "c@diverge"
19 $ hg bookmark -r 1 "c@diverge"
19 $ hg bookmark -r 1 b
20 $ hg bookmark -r 1 b
20 $ hg bookmark c
21 $ hg bookmark c
21 $ hg bookmarks
22 $ hg bookmarks
22 b 1:d2ae7f538514
23 b 1:d2ae7f538514
23 * c 2:d36c0562f908
24 * c 2:d36c0562f908
24 c@diverge 1:d2ae7f538514
25 c@diverge 1:d2ae7f538514
25 $ hg merge "c@diverge"
26 $ hg merge "c@diverge"
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 (branch merge, don't forget to commit)
28 (branch merge, don't forget to commit)
28 $ hg commit -m'merge'
29 $ hg commit -m'merge'
29 $ hg bookmarks
30 $ hg bookmarks
30 b 1:d2ae7f538514
31 b 1:d2ae7f538514
31 * c 3:b8f96cf4688b
32 * c 3:b8f96cf4688b
32
33
33 $ hg up -C 3
34 $ hg up -C 3
34 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 (leaving bookmark c)
36 (leaving bookmark c)
36 $ echo d > d
37 $ echo d > d
37 $ hg add d
38 $ hg add d
38 $ hg commit -m'd'
39 $ hg commit -m'd'
39
40
40 $ hg up -C 3
41 $ hg up -C 3
41 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 $ echo e > e
43 $ echo e > e
43 $ hg add e
44 $ hg add e
44 $ hg commit -m'e'
45 $ hg commit -m'e'
45 created new head
46 created new head
46 $ hg up -C 5
47 $ hg up -C 5
47 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
48 $ hg bookmark e
49 $ hg bookmark e
49 $ hg bookmarks
50 $ hg bookmarks
50 b 1:d2ae7f538514
51 b 1:d2ae7f538514
51 c 3:b8f96cf4688b
52 c 3:b8f96cf4688b
52 * e 5:26bee9c5bcf3
53 * e 5:26bee9c5bcf3
53
54
54 # the picked side is bookmarked
55 # the picked side is bookmarked
55
56
56 $ hg up -C 4
57 $ hg up -C 4
57 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 (leaving bookmark e)
59 (leaving bookmark e)
59 $ hg merge
60 $ hg merge
60 abort: heads are bookmarked - please merge with an explicit rev
61 abort: heads are bookmarked - please merge with an explicit rev
61 (run 'hg heads' to see all heads, specify rev with -r)
62 (run 'hg heads' to see all heads, specify rev with -r)
62 [255]
63 [255]
63
64
64 # our revision is bookmarked
65 # our revision is bookmarked
65
66
66 $ hg up -C e
67 $ hg up -C e
67 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 (activating bookmark e)
69 (activating bookmark e)
69 $ hg merge
70 $ hg merge
70 abort: no matching bookmark to merge - please merge with an explicit rev or bookmark
71 abort: no matching bookmark to merge - please merge with an explicit rev or bookmark
71 (run 'hg heads' to see all heads, specify rev with -r)
72 (run 'hg heads' to see all heads, specify rev with -r)
72 [255]
73 [255]
73
74
74 # merge bookmark heads
75 # merge bookmark heads
75
76
76 $ hg up -C 4
77 $ hg up -C 4
77 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 (leaving bookmark e)
79 (leaving bookmark e)
79 $ echo f > f
80 $ echo f > f
80 $ hg commit -Am "f"
81 $ hg commit -Am "f"
81 adding f
82 adding f
82 $ hg bookmarks -r 4 "e@diverged"
83 $ hg bookmarks -r 4 "e@diverged"
83 $ hg up -q -C "e@diverged"
84 $ hg up -q -C "e@diverged"
84 $ hg merge
85 $ hg merge
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 (branch merge, don't forget to commit)
87 (branch merge, don't forget to commit)
87 $ hg parents
88 $ hg parents
88 changeset: 4:a0546fcfe0fb
89 changeset: 4:a0546fcfe0fb
89 bookmark: e@diverged
90 bookmark: e@diverged
90 user: test
91 user: test
91 date: Thu Jan 01 00:00:00 1970 +0000
92 date: Thu Jan 01 00:00:00 1970 +0000
92 summary: d
93 summary: d
93
94
94 changeset: 5:26bee9c5bcf3
95 changeset: 5:26bee9c5bcf3
95 bookmark: e
96 bookmark: e
96 parent: 3:b8f96cf4688b
97 parent: 3:b8f96cf4688b
97 user: test
98 user: test
98 date: Thu Jan 01 00:00:00 1970 +0000
99 date: Thu Jan 01 00:00:00 1970 +0000
99 summary: e
100 summary: e
100
101
101 $ hg up -C e
102 $ hg up -C e
102 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
103 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
103 (activating bookmark e)
104 (activating bookmark e)
104 $ hg bookmarks
105 $ hg bookmarks
105 b 1:d2ae7f538514
106 b 1:d2ae7f538514
106 c 3:b8f96cf4688b
107 c 3:b8f96cf4688b
107 * e 5:26bee9c5bcf3
108 * e 5:26bee9c5bcf3
108 e@diverged 4:a0546fcfe0fb
109 e@diverged 4:a0546fcfe0fb
109 $ hg merge
110 $ hg merge
110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 (branch merge, don't forget to commit)
112 (branch merge, don't forget to commit)
112 $ hg commit -m'merge'
113 $ hg commit -m'merge'
113 $ hg bookmarks
114 $ hg bookmarks
114 b 1:d2ae7f538514
115 b 1:d2ae7f538514
115 c 3:b8f96cf4688b
116 c 3:b8f96cf4688b
116 * e 7:ca784329f0ba
117 * e 7:ca784329f0ba
117
118
118 # test warning when all heads are inactive bookmarks
119 # test warning when all heads are inactive bookmarks
119
120
120 $ hg up -C 6
121 $ hg up -C 6
121 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
122 (leaving bookmark e)
123 (leaving bookmark e)
123 $ echo g > g
124 $ echo g > g
124 $ hg commit -Am 'g'
125 $ hg commit -Am 'g'
125 adding g
126 adding g
126 $ hg bookmark -i g
127 $ hg bookmark -i g
127 $ hg bookmarks
128 $ hg bookmarks
128 b 1:d2ae7f538514
129 b 1:d2ae7f538514
129 c 3:b8f96cf4688b
130 c 3:b8f96cf4688b
130 e 7:ca784329f0ba
131 e 7:ca784329f0ba
131 g 8:04dd21731d95
132 g 8:04dd21731d95
132 $ hg heads
133 $ hg heads
133 changeset: 8:04dd21731d95
134 changeset: 8:04dd21731d95
134 bookmark: g
135 bookmark: g
135 tag: tip
136 tag: tip
136 parent: 6:be381d1126a0
137 parent: 6:be381d1126a0
137 user: test
138 user: test
138 date: Thu Jan 01 00:00:00 1970 +0000
139 date: Thu Jan 01 00:00:00 1970 +0000
139 summary: g
140 summary: g
140
141
141 changeset: 7:ca784329f0ba
142 changeset: 7:ca784329f0ba
142 bookmark: e
143 bookmark: e
143 parent: 5:26bee9c5bcf3
144 parent: 5:26bee9c5bcf3
144 parent: 4:a0546fcfe0fb
145 parent: 4:a0546fcfe0fb
145 user: test
146 user: test
146 date: Thu Jan 01 00:00:00 1970 +0000
147 date: Thu Jan 01 00:00:00 1970 +0000
147 summary: merge
148 summary: merge
148
149
149 $ hg merge
150 $ hg merge
150 abort: heads are bookmarked - please merge with an explicit rev
151 abort: heads are bookmarked - please merge with an explicit rev
151 (run 'hg heads' to see all heads, specify rev with -r)
152 (run 'hg heads' to see all heads, specify rev with -r)
152 [255]
153 [255]
@@ -1,105 +1,106 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "rebase=" >> $HGRCPATH
2 $ echo "rebase=" >> $HGRCPATH
3
3
4 initialize repository
4 initialize repository
5
5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7
8
8 $ echo 'a' > a
9 $ echo 'a' > a
9 $ hg ci -A -m "0"
10 $ hg ci -A -m "0"
10 adding a
11 adding a
11
12
12 $ echo 'b' > b
13 $ echo 'b' > b
13 $ hg ci -A -m "1"
14 $ hg ci -A -m "1"
14 adding b
15 adding b
15
16
16 $ hg up 0
17 $ hg up 0
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18 $ echo 'c' > c
19 $ echo 'c' > c
19 $ hg ci -A -m "2"
20 $ hg ci -A -m "2"
20 adding c
21 adding c
21 created new head
22 created new head
22
23
23 $ echo 'd' > d
24 $ echo 'd' > d
24 $ hg ci -A -m "3"
25 $ hg ci -A -m "3"
25 adding d
26 adding d
26
27
27 $ hg bookmark -r 1 one
28 $ hg bookmark -r 1 one
28 $ hg bookmark -r 3 two
29 $ hg bookmark -r 3 two
29 $ hg up -q two
30 $ hg up -q two
30
31
31 bookmark list
32 bookmark list
32
33
33 $ hg bookmark
34 $ hg bookmark
34 one 1:925d80f479bb
35 one 1:925d80f479bb
35 * two 3:2ae46b1d99a7
36 * two 3:2ae46b1d99a7
36
37
37 rebase
38 rebase
38
39
39 $ hg rebase -s two -d one
40 $ hg rebase -s two -d one
40 rebasing 3:2ae46b1d99a7 two tip "3"
41 rebasing 3:2ae46b1d99a7 two tip "3"
41 saved backup bundle to $TESTTMP/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
42 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/2ae46b1d99a7-e6b057bc-rebase.hg
42
43
43 $ hg log
44 $ hg log
44 changeset: 3:42e5ed2cdcf4
45 changeset: 3:42e5ed2cdcf4
45 bookmark: two
46 bookmark: two
46 tag: tip
47 tag: tip
47 parent: 1:925d80f479bb
48 parent: 1:925d80f479bb
48 user: test
49 user: test
49 date: Thu Jan 01 00:00:00 1970 +0000
50 date: Thu Jan 01 00:00:00 1970 +0000
50 summary: 3
51 summary: 3
51
52
52 changeset: 2:db815d6d32e6
53 changeset: 2:db815d6d32e6
53 parent: 0:f7b1eb17ad24
54 parent: 0:f7b1eb17ad24
54 user: test
55 user: test
55 date: Thu Jan 01 00:00:00 1970 +0000
56 date: Thu Jan 01 00:00:00 1970 +0000
56 summary: 2
57 summary: 2
57
58
58 changeset: 1:925d80f479bb
59 changeset: 1:925d80f479bb
59 bookmark: one
60 bookmark: one
60 user: test
61 user: test
61 date: Thu Jan 01 00:00:00 1970 +0000
62 date: Thu Jan 01 00:00:00 1970 +0000
62 summary: 1
63 summary: 1
63
64
64 changeset: 0:f7b1eb17ad24
65 changeset: 0:f7b1eb17ad24
65 user: test
66 user: test
66 date: Thu Jan 01 00:00:00 1970 +0000
67 date: Thu Jan 01 00:00:00 1970 +0000
67 summary: 0
68 summary: 0
68
69
69 aborted rebase should restore active bookmark.
70 aborted rebase should restore active bookmark.
70
71
71 $ hg up 1
72 $ hg up 1
72 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
73 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
73 (leaving bookmark two)
74 (leaving bookmark two)
74 $ echo 'e' > d
75 $ echo 'e' > d
75 $ hg ci -A -m "4"
76 $ hg ci -A -m "4"
76 adding d
77 adding d
77 created new head
78 created new head
78 $ hg bookmark three
79 $ hg bookmark three
79 $ hg rebase -s three -d two
80 $ hg rebase -s three -d two
80 rebasing 4:dd7c838e8362 three tip "4"
81 rebasing 4:dd7c838e8362 three tip "4"
81 merging d
82 merging d
82 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
83 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
83 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
84 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
84 [240]
85 [240]
85 $ hg rebase --abort
86 $ hg rebase --abort
86 rebase aborted
87 rebase aborted
87 $ hg bookmark
88 $ hg bookmark
88 one 1:925d80f479bb
89 one 1:925d80f479bb
89 * three 4:dd7c838e8362
90 * three 4:dd7c838e8362
90 two 3:42e5ed2cdcf4
91 two 3:42e5ed2cdcf4
91
92
92 after aborted rebase, restoring a bookmark that has been removed should not fail
93 after aborted rebase, restoring a bookmark that has been removed should not fail
93
94
94 $ hg rebase -s three -d two
95 $ hg rebase -s three -d two
95 rebasing 4:dd7c838e8362 three tip "4"
96 rebasing 4:dd7c838e8362 three tip "4"
96 merging d
97 merging d
97 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
98 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
98 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
99 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
99 [240]
100 [240]
100 $ hg bookmark -d three
101 $ hg bookmark -d three
101 $ hg rebase --abort
102 $ hg rebase --abort
102 rebase aborted
103 rebase aborted
103 $ hg bookmark
104 $ hg bookmark
104 one 1:925d80f479bb
105 one 1:925d80f479bb
105 two 3:42e5ed2cdcf4
106 two 3:42e5ed2cdcf4
@@ -1,127 +1,128 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo 0 > a
3 $ echo 0 > a
3 $ echo 0 > b
4 $ echo 0 > b
4 $ hg ci -A -m m
5 $ hg ci -A -m m
5 adding a
6 adding a
6 adding b
7 adding b
7 $ hg rm a
8 $ hg rm a
8 $ hg cat a
9 $ hg cat a
9 0
10 0
10 $ hg cat --decode a # more tests in test-encode
11 $ hg cat --decode a # more tests in test-encode
11 0
12 0
12 $ echo 1 > b
13 $ echo 1 > b
13 $ hg ci -m m
14 $ hg ci -m m
14 $ echo 2 > b
15 $ echo 2 > b
15 $ hg cat -r 0 a
16 $ hg cat -r 0 a
16 0
17 0
17 $ hg cat -r 0 b
18 $ hg cat -r 0 b
18 0
19 0
19 $ hg cat -r 1 a
20 $ hg cat -r 1 a
20 a: no such file in rev 7040230c159c
21 a: no such file in rev 7040230c159c
21 [1]
22 [1]
22 $ hg cat -r 1 b
23 $ hg cat -r 1 b
23 1
24 1
24
25
25 Test multiple files
26 Test multiple files
26
27
27 $ echo 3 > c
28 $ echo 3 > c
28 $ hg ci -Am addmore c
29 $ hg ci -Am addmore c
29 $ hg cat b c
30 $ hg cat b c
30 1
31 1
31 3
32 3
32 $ hg cat .
33 $ hg cat .
33 1
34 1
34 3
35 3
35 $ hg cat . c
36 $ hg cat . c
36 1
37 1
37 3
38 3
38
39
39 Test fileset
40 Test fileset
40
41
41 $ hg cat 'set:not(b) or a'
42 $ hg cat 'set:not(b) or a'
42 3
43 3
43 $ hg cat 'set:c or b'
44 $ hg cat 'set:c or b'
44 1
45 1
45 3
46 3
46
47
47 $ mkdir tmp
48 $ mkdir tmp
48 $ hg cat --output tmp/HH_%H c
49 $ hg cat --output tmp/HH_%H c
49 $ hg cat --output tmp/RR_%R c
50 $ hg cat --output tmp/RR_%R c
50 $ hg cat --output tmp/h_%h c
51 $ hg cat --output tmp/h_%h c
51 $ hg cat --output tmp/r_%r c
52 $ hg cat --output tmp/r_%r c
52 $ hg cat --output tmp/%s_s c
53 $ hg cat --output tmp/%s_s c
53 $ hg cat --output tmp/%d%%_d c
54 $ hg cat --output tmp/%d%%_d c
54 $ hg cat --output tmp/%p_p c
55 $ hg cat --output tmp/%p_p c
55 $ hg log -r . --template "{rev}: {node|short}\n"
56 $ hg log -r . --template "{rev}: {node|short}\n"
56 2: 45116003780e
57 2: 45116003780e
57 $ find tmp -type f | sort
58 $ find tmp -type f | sort
58 tmp/.%_d
59 tmp/.%_d
59 tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9
60 tmp/HH_45116003780e3678b333fb2c99fa7d559c8457e9
60 tmp/RR_2
61 tmp/RR_2
61 tmp/c_p
62 tmp/c_p
62 tmp/c_s
63 tmp/c_s
63 tmp/h_45116003780e
64 tmp/h_45116003780e
64 tmp/r_2
65 tmp/r_2
65
66
66 Test template output
67 Test template output
67
68
68 $ hg --cwd tmp cat ../b ../c -T '== {path|relpath} ({path}) r{rev} ==\n{data}'
69 $ hg --cwd tmp cat ../b ../c -T '== {path|relpath} ({path}) r{rev} ==\n{data}'
69 == ../b (b) r2 ==
70 == ../b (b) r2 ==
70 1
71 1
71 == ../c (c) r2 ==
72 == ../c (c) r2 ==
72 3
73 3
73
74
74 $ hg cat b c -Tjson --output -
75 $ hg cat b c -Tjson --output -
75 [
76 [
76 {
77 {
77 "data": "1\n",
78 "data": "1\n",
78 "path": "b"
79 "path": "b"
79 },
80 },
80 {
81 {
81 "data": "3\n",
82 "data": "3\n",
82 "path": "c"
83 "path": "c"
83 }
84 }
84 ]
85 ]
85
86
86 $ hg cat b c -Tjson --output 'tmp/%p.json'
87 $ hg cat b c -Tjson --output 'tmp/%p.json'
87 $ cat tmp/b.json
88 $ cat tmp/b.json
88 [
89 [
89 {
90 {
90 "data": "1\n",
91 "data": "1\n",
91 "path": "b"
92 "path": "b"
92 }
93 }
93 ]
94 ]
94 $ cat tmp/c.json
95 $ cat tmp/c.json
95 [
96 [
96 {
97 {
97 "data": "3\n",
98 "data": "3\n",
98 "path": "c"
99 "path": "c"
99 }
100 }
100 ]
101 ]
101
102
102 Test working directory
103 Test working directory
103
104
104 $ echo b-wdir > b
105 $ echo b-wdir > b
105 $ hg cat -r 'wdir()' b
106 $ hg cat -r 'wdir()' b
106 b-wdir
107 b-wdir
107
108
108 Environment variables are not visible by default
109 Environment variables are not visible by default
109
110
110 $ PATTERN='t4' hg log -r '.' -T "{ifcontains('PATTERN', envvars, 'yes', 'no')}\n"
111 $ PATTERN='t4' hg log -r '.' -T "{ifcontains('PATTERN', envvars, 'yes', 'no')}\n"
111 no
112 no
112
113
113 Environment variable visibility can be explicit
114 Environment variable visibility can be explicit
114
115
115 $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \
116 $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \
116 > --config "experimental.exportableenviron=PATTERN"
117 > --config "experimental.exportableenviron=PATTERN"
117 PATTERN -> t4
118 PATTERN -> t4
118
119
119 Test behavior of output when directory structure does not already exist
120 Test behavior of output when directory structure does not already exist
120
121
121 $ mkdir foo
122 $ mkdir foo
122 $ echo a > foo/a
123 $ echo a > foo/a
123 $ hg add foo/a
124 $ hg add foo/a
124 $ hg commit -qm "add foo/a"
125 $ hg commit -qm "add foo/a"
125 $ hg cat --output "output/%p" foo/a
126 $ hg cat --output "output/%p" foo/a
126 $ cat output/foo/a
127 $ cat output/foo/a
127 a
128 a
@@ -1,112 +1,113 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo foo > bar
3 $ echo foo > bar
3 $ hg commit -Am default
4 $ hg commit -Am default
4 adding bar
5 adding bar
5 $ hg up -r null
6 $ hg up -r null
6 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7 $ hg branch mine
8 $ hg branch mine
8 marked working directory as branch mine
9 marked working directory as branch mine
9 (branches are permanent and global, did you want a bookmark?)
10 (branches are permanent and global, did you want a bookmark?)
10 $ echo hello > world
11 $ echo hello > world
11 $ hg commit -Am hello
12 $ hg commit -Am hello
12 adding world
13 adding world
13 $ hg up -r null
14 $ hg up -r null
14 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
15 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
15 $ hg branch other
16 $ hg branch other
16 marked working directory as branch other
17 marked working directory as branch other
17 $ echo good > bye
18 $ echo good > bye
18 $ hg commit -Am other
19 $ hg commit -Am other
19 adding bye
20 adding bye
20 $ hg up -r mine
21 $ hg up -r mine
21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22
23
23 $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
24 $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
24 abort: cannot specify both --noupdate and --updaterev
25 abort: cannot specify both --noupdate and --updaterev
25 [10]
26 [10]
26
27
27 $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
28 $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
28 adding changesets
29 adding changesets
29 adding manifests
30 adding manifests
30 adding file changes
31 adding file changes
31 added 3 changesets with 3 changes to 3 files (+2 heads)
32 added 3 changesets with 3 changes to 3 files (+2 heads)
32 new changesets 8c68ee086fd0:fcc393352796
33 new changesets 8c68ee086fd0:fcc393352796
33 $ rm -rf ../b
34 $ rm -rf ../b
34
35
35 $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
36 $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
36 adding changesets
37 adding changesets
37 adding manifests
38 adding manifests
38 adding file changes
39 adding file changes
39 added 3 changesets with 3 changes to 3 files (+2 heads)
40 added 3 changesets with 3 changes to 3 files (+2 heads)
40 new changesets 8c68ee086fd0:fcc393352796
41 new changesets 8c68ee086fd0:fcc393352796
41 updating to branch mine
42 updating to branch mine
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ rm -rf ../b
44 $ rm -rf ../b
44
45
45 $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
46 $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
46 adding changesets
47 adding changesets
47 adding manifests
48 adding manifests
48 adding file changes
49 adding file changes
49 added 3 changesets with 3 changes to 3 files (+2 heads)
50 added 3 changesets with 3 changes to 3 files (+2 heads)
50 new changesets 8c68ee086fd0:fcc393352796
51 new changesets 8c68ee086fd0:fcc393352796
51 updating to branch default
52 updating to branch default
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 $ rm -rf ../b
54 $ rm -rf ../b
54
55
55 $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
56 $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
56 adding changesets
57 adding changesets
57 adding manifests
58 adding manifests
58 adding file changes
59 adding file changes
59 added 3 changesets with 3 changes to 3 files (+2 heads)
60 added 3 changesets with 3 changes to 3 files (+2 heads)
60 new changesets 8c68ee086fd0:fcc393352796
61 new changesets 8c68ee086fd0:fcc393352796
61 updating to branch mine
62 updating to branch mine
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ rm -rf ../b
64 $ rm -rf ../b
64
65
65 $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
66 $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
66 adding changesets
67 adding changesets
67 adding manifests
68 adding manifests
68 adding file changes
69 adding file changes
69 added 3 changesets with 3 changes to 3 files (+2 heads)
70 added 3 changesets with 3 changes to 3 files (+2 heads)
70 new changesets 8c68ee086fd0:fcc393352796
71 new changesets 8c68ee086fd0:fcc393352796
71 updating to branch other
72 updating to branch other
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 $ rm -rf ../b
74 $ rm -rf ../b
74
75
75 Test -r mine ... mine is ignored:
76 Test -r mine ... mine is ignored:
76
77
77 $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
78 $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
78 adding changesets
79 adding changesets
79 adding manifests
80 adding manifests
80 adding file changes
81 adding file changes
81 added 3 changesets with 3 changes to 3 files (+2 heads)
82 added 3 changesets with 3 changes to 3 files (+2 heads)
82 new changesets 8c68ee086fd0:fcc393352796
83 new changesets 8c68ee086fd0:fcc393352796
83 updating to branch other
84 updating to branch other
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 $ rm -rf ../b
86 $ rm -rf ../b
86
87
87 $ hg clone .#other ../b -b default -b mine
88 $ hg clone .#other ../b -b default -b mine
88 adding changesets
89 adding changesets
89 adding manifests
90 adding manifests
90 adding file changes
91 adding file changes
91 added 3 changesets with 3 changes to 3 files (+2 heads)
92 added 3 changesets with 3 changes to 3 files (+2 heads)
92 new changesets 8c68ee086fd0:fcc393352796
93 new changesets 8c68ee086fd0:fcc393352796
93 updating to branch default
94 updating to branch default
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 $ rm -rf ../b
96 $ rm -rf ../b
96
97
97 $ hg clone .#other ../b
98 $ hg clone .#other ../b
98 adding changesets
99 adding changesets
99 adding manifests
100 adding manifests
100 adding file changes
101 adding file changes
101 added 1 changesets with 1 changes to 1 files
102 added 1 changesets with 1 changes to 1 files
102 new changesets fcc393352796
103 new changesets fcc393352796
103 updating to branch other
104 updating to branch other
104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 $ rm -rf ../b
106 $ rm -rf ../b
106
107
107 $ hg clone -U . ../c -r 1 -r 2 > /dev/null
108 $ hg clone -U . ../c -r 1 -r 2 > /dev/null
108 $ hg clone ../c ../b
109 $ hg clone ../c ../b
109 updating to branch other
110 updating to branch other
110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 $ rm -rf ../b ../c
112 $ rm -rf ../b ../c
112
113
@@ -1,1330 +1,1331 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 Setup:
4 Setup:
4
5
5 $ echo a >> a
6 $ echo a >> a
6 $ hg ci -Am 'base'
7 $ hg ci -Am 'base'
7 adding a
8 adding a
8
9
9 Refuse to amend public csets:
10 Refuse to amend public csets:
10
11
11 $ hg phase -r . -p
12 $ hg phase -r . -p
12 $ hg ci --amend
13 $ hg ci --amend
13 abort: cannot amend public changesets: ad120869acf0
14 abort: cannot amend public changesets: ad120869acf0
14 (see 'hg help phases' for details)
15 (see 'hg help phases' for details)
15 [10]
16 [10]
16 $ hg phase -r . -f -d
17 $ hg phase -r . -f -d
17
18
18 $ echo a >> a
19 $ echo a >> a
19 $ hg ci -Am 'base1'
20 $ hg ci -Am 'base1'
20
21
21 Nothing to amend:
22 Nothing to amend:
22
23
23 $ hg ci --amend -m 'base1'
24 $ hg ci --amend -m 'base1'
24 nothing changed
25 nothing changed
25 [1]
26 [1]
26
27
27 $ cat >> $HGRCPATH <<EOF
28 $ cat >> $HGRCPATH <<EOF
28 > [hooks]
29 > [hooks]
29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 > EOF
31 > EOF
31
32
32 Amending changeset with changes in working dir:
33 Amending changeset with changes in working dir:
33 (and check that --message does not trigger an editor)
34 (and check that --message does not trigger an editor)
34
35
35 $ echo a >> a
36 $ echo a >> a
36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 43f1ba15f28a tip
39 43f1ba15f28a tip
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 $ hg diff -c .
42 $ hg diff -c .
42 diff -r ad120869acf0 -r 43f1ba15f28a a
43 diff -r ad120869acf0 -r 43f1ba15f28a a
43 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 @@ -1,1 +1,3 @@
46 @@ -1,1 +1,3 @@
46 a
47 a
47 +a
48 +a
48 +a
49 +a
49 $ hg log
50 $ hg log
50 changeset: 1:43f1ba15f28a
51 changeset: 1:43f1ba15f28a
51 tag: tip
52 tag: tip
52 user: test
53 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
54 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: amend base1
55 summary: amend base1
55
56
56 changeset: 0:ad120869acf0
57 changeset: 0:ad120869acf0
57 user: test
58 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
59 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: base
60 summary: base
60
61
61
62
62 Check proper abort for empty message
63 Check proper abort for empty message
63
64
64 $ cat > editor.sh << '__EOF__'
65 $ cat > editor.sh << '__EOF__'
65 > #!/bin/sh
66 > #!/bin/sh
66 > echo "" > "$1"
67 > echo "" > "$1"
67 > __EOF__
68 > __EOF__
68
69
69 Update the existing file to ensure that the dirstate is not in pending state
70 Update the existing file to ensure that the dirstate is not in pending state
70 (where the status of some files in the working copy is not known yet). This in
71 (where the status of some files in the working copy is not known yet). This in
71 turn ensures that when the transaction is aborted due to an empty message during
72 turn ensures that when the transaction is aborted due to an empty message during
72 the amend, there should be no rollback.
73 the amend, there should be no rollback.
73 $ echo a >> a
74 $ echo a >> a
74
75
75 $ echo b > b
76 $ echo b > b
76 $ hg add b
77 $ hg add b
77 $ hg summary
78 $ hg summary
78 parent: 1:43f1ba15f28a tip
79 parent: 1:43f1ba15f28a tip
79 amend base1
80 amend base1
80 branch: default
81 branch: default
81 commit: 1 modified, 1 added, 1 unknown
82 commit: 1 modified, 1 added, 1 unknown
82 update: (current)
83 update: (current)
83 phases: 2 draft
84 phases: 2 draft
84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 abort: empty commit message
86 abort: empty commit message
86 [10]
87 [10]
87 $ hg summary
88 $ hg summary
88 parent: 1:43f1ba15f28a tip
89 parent: 1:43f1ba15f28a tip
89 amend base1
90 amend base1
90 branch: default
91 branch: default
91 commit: 1 modified, 1 added, 1 unknown
92 commit: 1 modified, 1 added, 1 unknown
92 update: (current)
93 update: (current)
93 phases: 2 draft
94 phases: 2 draft
94
95
95 Add new file along with modified existing file:
96 Add new file along with modified existing file:
96 $ hg ci --amend -m 'amend base1 new file'
97 $ hg ci --amend -m 'amend base1 new file'
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98
99
99 Remove file that was added in amended commit:
100 Remove file that was added in amended commit:
100 (and test logfile option)
101 (and test logfile option)
101 (and test that logfile option do not trigger an editor)
102 (and test that logfile option do not trigger an editor)
102
103
103 $ hg rm b
104 $ hg rm b
104 $ echo 'amend base1 remove new file' > ../logfile
105 $ echo 'amend base1 remove new file' > ../logfile
105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107
108
108 $ hg cat b
109 $ hg cat b
109 b: no such file in rev 47343646fa3d
110 b: no such file in rev 47343646fa3d
110 [1]
111 [1]
111
112
112 No changes, just a different message:
113 No changes, just a different message:
113
114
114 $ hg ci -v --amend -m 'no changes, new message'
115 $ hg ci -v --amend -m 'no changes, new message'
115 amending changeset 47343646fa3d
116 amending changeset 47343646fa3d
116 copying changeset 47343646fa3d to ad120869acf0
117 copying changeset 47343646fa3d to ad120869acf0
117 committing files:
118 committing files:
118 a
119 a
119 committing manifest
120 committing manifest
120 committing changelog
121 committing changelog
121 1 changesets found
122 1 changesets found
122 uncompressed size of bundle content:
123 uncompressed size of bundle content:
123 254 (changelog)
124 254 (changelog)
124 163 (manifests)
125 163 (manifests)
125 131 a
126 131 a
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 1 changesets found
128 1 changesets found
128 uncompressed size of bundle content:
129 uncompressed size of bundle content:
129 250 (changelog)
130 250 (changelog)
130 163 (manifests)
131 163 (manifests)
131 131 a
132 131 a
132 adding branch
133 adding branch
133 adding changesets
134 adding changesets
134 adding manifests
135 adding manifests
135 adding file changes
136 adding file changes
136 added 1 changesets with 1 changes to 1 files
137 added 1 changesets with 1 changes to 1 files
137 committed changeset 1:401431e913a1
138 committed changeset 1:401431e913a1
138 $ hg diff -c .
139 $ hg diff -c .
139 diff -r ad120869acf0 -r 401431e913a1 a
140 diff -r ad120869acf0 -r 401431e913a1 a
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 @@ -1,1 +1,4 @@
143 @@ -1,1 +1,4 @@
143 a
144 a
144 +a
145 +a
145 +a
146 +a
146 +a
147 +a
147 $ hg log
148 $ hg log
148 changeset: 1:401431e913a1
149 changeset: 1:401431e913a1
149 tag: tip
150 tag: tip
150 user: test
151 user: test
151 date: Thu Jan 01 00:00:00 1970 +0000
152 date: Thu Jan 01 00:00:00 1970 +0000
152 summary: no changes, new message
153 summary: no changes, new message
153
154
154 changeset: 0:ad120869acf0
155 changeset: 0:ad120869acf0
155 user: test
156 user: test
156 date: Thu Jan 01 00:00:00 1970 +0000
157 date: Thu Jan 01 00:00:00 1970 +0000
157 summary: base
158 summary: base
158
159
159
160
160 Disable default date on commit so when -d isn't given, the old date is preserved:
161 Disable default date on commit so when -d isn't given, the old date is preserved:
161
162
162 $ echo '[defaults]' >> $HGRCPATH
163 $ echo '[defaults]' >> $HGRCPATH
163 $ echo 'commit=' >> $HGRCPATH
164 $ echo 'commit=' >> $HGRCPATH
164
165
165 Test -u/-d:
166 Test -u/-d:
166
167
167 $ cat > .hg/checkeditform.sh <<EOF
168 $ cat > .hg/checkeditform.sh <<EOF
168 > env | grep HGEDITFORM
169 > env | grep HGEDITFORM
169 > true
170 > true
170 > EOF
171 > EOF
171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 HGEDITFORM=commit.amend.normal
173 HGEDITFORM=commit.amend.normal
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 $ echo a >> a
175 $ echo a >> a
175 $ hg ci --amend -u foo -d '1 0'
176 $ hg ci --amend -u foo -d '1 0'
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 $ hg log -r .
178 $ hg log -r .
178 changeset: 1:a9a13940fc03
179 changeset: 1:a9a13940fc03
179 tag: tip
180 tag: tip
180 user: foo
181 user: foo
181 date: Thu Jan 01 00:00:01 1970 +0000
182 date: Thu Jan 01 00:00:01 1970 +0000
182 summary: no changes, new message
183 summary: no changes, new message
183
184
184
185
185 Open editor with old commit message if a message isn't given otherwise:
186 Open editor with old commit message if a message isn't given otherwise:
186
187
187 $ cat > editor.sh << '__EOF__'
188 $ cat > editor.sh << '__EOF__'
188 > #!/bin/sh
189 > #!/bin/sh
189 > cat $1
190 > cat $1
190 > echo "another precious commit message" > "$1"
191 > echo "another precious commit message" > "$1"
191 > __EOF__
192 > __EOF__
192
193
193 at first, test saving last-message.txt
194 at first, test saving last-message.txt
194
195
195 $ cat > .hg/hgrc << '__EOF__'
196 $ cat > .hg/hgrc << '__EOF__'
196 > [hooks]
197 > [hooks]
197 > pretxncommit.test-saving-last-message = false
198 > pretxncommit.test-saving-last-message = false
198 > __EOF__
199 > __EOF__
199
200
200 $ rm -f .hg/last-message.txt
201 $ rm -f .hg/last-message.txt
201 $ hg commit --amend -v -m "message given from command line"
202 $ hg commit --amend -v -m "message given from command line"
202 amending changeset a9a13940fc03
203 amending changeset a9a13940fc03
203 copying changeset a9a13940fc03 to ad120869acf0
204 copying changeset a9a13940fc03 to ad120869acf0
204 committing files:
205 committing files:
205 a
206 a
206 committing manifest
207 committing manifest
207 committing changelog
208 committing changelog
208 running hook pretxncommit.test-saving-last-message: false
209 running hook pretxncommit.test-saving-last-message: false
209 transaction abort!
210 transaction abort!
210 rollback completed
211 rollback completed
211 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 [40]
213 [40]
213 $ cat .hg/last-message.txt
214 $ cat .hg/last-message.txt
214 message given from command line (no-eol)
215 message given from command line (no-eol)
215
216
216 $ rm -f .hg/last-message.txt
217 $ rm -f .hg/last-message.txt
217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 amending changeset a9a13940fc03
219 amending changeset a9a13940fc03
219 copying changeset a9a13940fc03 to ad120869acf0
220 copying changeset a9a13940fc03 to ad120869acf0
220 no changes, new message
221 no changes, new message
221
222
222
223
223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 HG: Leave message empty to abort commit.
225 HG: Leave message empty to abort commit.
225 HG: --
226 HG: --
226 HG: user: foo
227 HG: user: foo
227 HG: branch 'default'
228 HG: branch 'default'
228 HG: changed a
229 HG: changed a
229 committing files:
230 committing files:
230 a
231 a
231 committing manifest
232 committing manifest
232 committing changelog
233 committing changelog
233 running hook pretxncommit.test-saving-last-message: false
234 running hook pretxncommit.test-saving-last-message: false
234 transaction abort!
235 transaction abort!
235 rollback completed
236 rollback completed
236 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 [40]
238 [40]
238
239
239 $ cat .hg/last-message.txt
240 $ cat .hg/last-message.txt
240 another precious commit message
241 another precious commit message
241
242
242 $ cat > .hg/hgrc << '__EOF__'
243 $ cat > .hg/hgrc << '__EOF__'
243 > [hooks]
244 > [hooks]
244 > pretxncommit.test-saving-last-message =
245 > pretxncommit.test-saving-last-message =
245 > __EOF__
246 > __EOF__
246
247
247 then, test editing custom commit message
248 then, test editing custom commit message
248
249
249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 amending changeset a9a13940fc03
251 amending changeset a9a13940fc03
251 copying changeset a9a13940fc03 to ad120869acf0
252 copying changeset a9a13940fc03 to ad120869acf0
252 no changes, new message
253 no changes, new message
253
254
254
255
255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 HG: Leave message empty to abort commit.
257 HG: Leave message empty to abort commit.
257 HG: --
258 HG: --
258 HG: user: foo
259 HG: user: foo
259 HG: branch 'default'
260 HG: branch 'default'
260 HG: changed a
261 HG: changed a
261 committing files:
262 committing files:
262 a
263 a
263 committing manifest
264 committing manifest
264 committing changelog
265 committing changelog
265 1 changesets found
266 1 changesets found
266 uncompressed size of bundle content:
267 uncompressed size of bundle content:
267 249 (changelog)
268 249 (changelog)
268 163 (manifests)
269 163 (manifests)
269 133 a
270 133 a
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 1 changesets found
272 1 changesets found
272 uncompressed size of bundle content:
273 uncompressed size of bundle content:
273 257 (changelog)
274 257 (changelog)
274 163 (manifests)
275 163 (manifests)
275 133 a
276 133 a
276 adding branch
277 adding branch
277 adding changesets
278 adding changesets
278 adding manifests
279 adding manifests
279 adding file changes
280 adding file changes
280 added 1 changesets with 1 changes to 1 files
281 added 1 changesets with 1 changes to 1 files
281 committed changeset 1:64a124ba1b44
282 committed changeset 1:64a124ba1b44
282
283
283 Same, but with changes in working dir (different code path):
284 Same, but with changes in working dir (different code path):
284
285
285 $ echo a >> a
286 $ echo a >> a
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 amending changeset 64a124ba1b44
288 amending changeset 64a124ba1b44
288 another precious commit message
289 another precious commit message
289
290
290
291
291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 HG: Leave message empty to abort commit.
293 HG: Leave message empty to abort commit.
293 HG: --
294 HG: --
294 HG: user: foo
295 HG: user: foo
295 HG: branch 'default'
296 HG: branch 'default'
296 HG: changed a
297 HG: changed a
297 committing files:
298 committing files:
298 a
299 a
299 committing manifest
300 committing manifest
300 committing changelog
301 committing changelog
301 1 changesets found
302 1 changesets found
302 uncompressed size of bundle content:
303 uncompressed size of bundle content:
303 257 (changelog)
304 257 (changelog)
304 163 (manifests)
305 163 (manifests)
305 133 a
306 133 a
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 1 changesets found
308 1 changesets found
308 uncompressed size of bundle content:
309 uncompressed size of bundle content:
309 257 (changelog)
310 257 (changelog)
310 163 (manifests)
311 163 (manifests)
311 135 a
312 135 a
312 adding branch
313 adding branch
313 adding changesets
314 adding changesets
314 adding manifests
315 adding manifests
315 adding file changes
316 adding file changes
316 added 1 changesets with 1 changes to 1 files
317 added 1 changesets with 1 changes to 1 files
317 committed changeset 1:7892795b8e38
318 committed changeset 1:7892795b8e38
318
319
319 $ rm editor.sh
320 $ rm editor.sh
320 $ hg log -r .
321 $ hg log -r .
321 changeset: 1:7892795b8e38
322 changeset: 1:7892795b8e38
322 tag: tip
323 tag: tip
323 user: foo
324 user: foo
324 date: Thu Jan 01 00:00:01 1970 +0000
325 date: Thu Jan 01 00:00:01 1970 +0000
325 summary: another precious commit message
326 summary: another precious commit message
326
327
327
328
328 Moving bookmarks, preserve active bookmark:
329 Moving bookmarks, preserve active bookmark:
329
330
330 $ hg book book1
331 $ hg book book1
331 $ hg book book2
332 $ hg book book2
332 $ hg ci --amend -m 'move bookmarks'
333 $ hg ci --amend -m 'move bookmarks'
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 $ hg book
335 $ hg book
335 book1 1:8311f17e2616
336 book1 1:8311f17e2616
336 * book2 1:8311f17e2616
337 * book2 1:8311f17e2616
337 $ echo a >> a
338 $ echo a >> a
338 $ hg ci --amend -m 'move bookmarks'
339 $ hg ci --amend -m 'move bookmarks'
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 $ hg book
341 $ hg book
341 book1 1:a3b65065808c
342 book1 1:a3b65065808c
342 * book2 1:a3b65065808c
343 * book2 1:a3b65065808c
343
344
344 abort does not loose bookmarks
345 abort does not loose bookmarks
345
346
346 $ cat > editor.sh << '__EOF__'
347 $ cat > editor.sh << '__EOF__'
347 > #!/bin/sh
348 > #!/bin/sh
348 > echo "" > "$1"
349 > echo "" > "$1"
349 > __EOF__
350 > __EOF__
350 $ echo a >> a
351 $ echo a >> a
351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 abort: empty commit message
353 abort: empty commit message
353 [10]
354 [10]
354 $ hg book
355 $ hg book
355 book1 1:a3b65065808c
356 book1 1:a3b65065808c
356 * book2 1:a3b65065808c
357 * book2 1:a3b65065808c
357 $ hg revert -Caq
358 $ hg revert -Caq
358 $ rm editor.sh
359 $ rm editor.sh
359
360
360 $ echo '[defaults]' >> $HGRCPATH
361 $ echo '[defaults]' >> $HGRCPATH
361 $ echo "commit=-d '0 0'" >> $HGRCPATH
362 $ echo "commit=-d '0 0'" >> $HGRCPATH
362
363
363 Moving branches:
364 Moving branches:
364
365
365 $ hg branch foo
366 $ hg branch foo
366 marked working directory as branch foo
367 marked working directory as branch foo
367 (branches are permanent and global, did you want a bookmark?)
368 (branches are permanent and global, did you want a bookmark?)
368 $ echo a >> a
369 $ echo a >> a
369 $ hg ci -m 'branch foo'
370 $ hg ci -m 'branch foo'
370 $ hg branch default -f
371 $ hg branch default -f
371 marked working directory as branch default
372 marked working directory as branch default
372 $ hg ci --amend -m 'back to default'
373 $ hg ci --amend -m 'back to default'
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 $ hg branches
375 $ hg branches
375 default 2:9c07515f2650
376 default 2:9c07515f2650
376
377
377 Close branch:
378 Close branch:
378
379
379 $ hg up -q 0
380 $ hg up -q 0
380 $ echo b >> b
381 $ echo b >> b
381 $ hg branch foo
382 $ hg branch foo
382 marked working directory as branch foo
383 marked working directory as branch foo
383 (branches are permanent and global, did you want a bookmark?)
384 (branches are permanent and global, did you want a bookmark?)
384 $ hg ci -Am 'fork'
385 $ hg ci -Am 'fork'
385 adding b
386 adding b
386 $ echo b >> b
387 $ echo b >> b
387 $ hg ci -mb
388 $ hg ci -mb
388 $ hg ci --amend --close-branch -m 'closing branch foo'
389 $ hg ci --amend --close-branch -m 'closing branch foo'
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390
391
391 Same thing, different code path:
392 Same thing, different code path:
392
393
393 $ echo b >> b
394 $ echo b >> b
394 $ hg ci -m 'reopen branch'
395 $ hg ci -m 'reopen branch'
395 reopening closed branch head 4
396 reopening closed branch head 4
396 $ echo b >> b
397 $ echo b >> b
397 $ hg ci --amend --close-branch
398 $ hg ci --amend --close-branch
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 $ hg branches
400 $ hg branches
400 default 2:9c07515f2650
401 default 2:9c07515f2650
401
402
402 Refuse to amend during a merge:
403 Refuse to amend during a merge:
403
404
404 $ hg up -q default
405 $ hg up -q default
405 $ hg merge foo
406 $ hg merge foo
406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 (branch merge, don't forget to commit)
408 (branch merge, don't forget to commit)
408 $ hg ci --amend
409 $ hg ci --amend
409 abort: cannot amend changesets while merging
410 abort: cannot amend changesets while merging
410 [20]
411 [20]
411 $ hg ci -m 'merge'
412 $ hg ci -m 'merge'
412
413
413 Refuse to amend if there is a merge conflict (issue5805):
414 Refuse to amend if there is a merge conflict (issue5805):
414
415
415 $ hg up -q foo
416 $ hg up -q foo
416 $ echo c > a
417 $ echo c > a
417 $ hg up default -t :fail
418 $ hg up default -t :fail
418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 use 'hg resolve' to retry unresolved file merges
420 use 'hg resolve' to retry unresolved file merges
420 [1]
421 [1]
421 $ hg resolve -l
422 $ hg resolve -l
422 U a
423 U a
423
424
424 $ hg ci --amend
425 $ hg ci --amend
425 abort: unresolved merge conflicts (see 'hg help resolve')
426 abort: unresolved merge conflicts (see 'hg help resolve')
426 [20]
427 [20]
427
428
428 $ hg up -qC .
429 $ hg up -qC .
429
430
430 Follow copies/renames:
431 Follow copies/renames:
431
432
432 $ hg mv b c
433 $ hg mv b c
433 $ hg ci -m 'b -> c'
434 $ hg ci -m 'b -> c'
434 $ hg mv c d
435 $ hg mv c d
435 $ hg ci --amend -m 'b -> d'
436 $ hg ci --amend -m 'b -> d'
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 $ hg st --rev '.^' --copies d
438 $ hg st --rev '.^' --copies d
438 A d
439 A d
439 b
440 b
440 $ hg cp d e
441 $ hg cp d e
441 $ hg ci -m 'e = d'
442 $ hg ci -m 'e = d'
442 $ hg cp e f
443 $ hg cp e f
443 $ hg ci --amend -m 'f = d'
444 $ hg ci --amend -m 'f = d'
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 $ hg st --rev '.^' --copies f
446 $ hg st --rev '.^' --copies f
446 A f
447 A f
447 d
448 d
448
449
449 $ mv f f.orig
450 $ mv f f.orig
450 $ hg rm -A f
451 $ hg rm -A f
451 $ hg ci -m removef
452 $ hg ci -m removef
452 $ hg cp a f
453 $ hg cp a f
453 $ mv f.orig f
454 $ mv f.orig f
454 $ hg ci --amend -m replacef
455 $ hg ci --amend -m replacef
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 $ hg st --change . --copies
457 $ hg st --change . --copies
457 $ hg log -r . --template "{file_copies}\n"
458 $ hg log -r . --template "{file_copies}\n"
458
459
459
460
460 Move added file (issue3410):
461 Move added file (issue3410):
461
462
462 $ echo g >> g
463 $ echo g >> g
463 $ hg ci -Am g
464 $ hg ci -Am g
464 adding g
465 adding g
465 $ hg mv g h
466 $ hg mv g h
466 $ hg ci --amend
467 $ hg ci --amend
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 $ hg st --change . --copies h
469 $ hg st --change . --copies h
469 A h
470 A h
470 $ hg log -r . --template "{file_copies}\n"
471 $ hg log -r . --template "{file_copies}\n"
471
472
472
473
473 Can't rollback an amend:
474 Can't rollback an amend:
474
475
475 $ hg rollback
476 $ hg rollback
476 no rollback information available
477 no rollback information available
477 [1]
478 [1]
478
479
479 Preserve extra dict (issue3430):
480 Preserve extra dict (issue3430):
480
481
481 $ hg branch a
482 $ hg branch a
482 marked working directory as branch a
483 marked working directory as branch a
483 (branches are permanent and global, did you want a bookmark?)
484 (branches are permanent and global, did you want a bookmark?)
484 $ echo a >> a
485 $ echo a >> a
485 $ hg ci -ma
486 $ hg ci -ma
486 $ hg ci --amend -m "a'"
487 $ hg ci --amend -m "a'"
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 $ hg log -r . --template "{branch}\n"
489 $ hg log -r . --template "{branch}\n"
489 a
490 a
490 $ hg ci --amend -m "a''"
491 $ hg ci --amend -m "a''"
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 $ hg log -r . --template "{branch}\n"
493 $ hg log -r . --template "{branch}\n"
493 a
494 a
494
495
495 Also preserve other entries in the dict that are in the old commit,
496 Also preserve other entries in the dict that are in the old commit,
496 first graft something so there's an additional entry:
497 first graft something so there's an additional entry:
497
498
498 $ hg up 0 -q
499 $ hg up 0 -q
499 $ echo z > z
500 $ echo z > z
500 $ hg ci -Am 'fork'
501 $ hg ci -Am 'fork'
501 adding z
502 adding z
502 created new head
503 created new head
503 $ hg up 11
504 $ hg up 11
504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 $ hg graft 12
506 $ hg graft 12
506 grafting 12:2647734878ef "fork" (tip)
507 grafting 12:2647734878ef "fork" (tip)
507 $ hg ci --amend -m 'graft amend'
508 $ hg ci --amend -m 'graft amend'
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 $ hg log -r . --debug | grep extra
510 $ hg log -r . --debug | grep extra
510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 extra: branch=a
512 extra: branch=a
512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513
514
514 Preserve phase
515 Preserve phase
515
516
516 $ hg phase '.^::.'
517 $ hg phase '.^::.'
517 11: draft
518 11: draft
518 13: draft
519 13: draft
519 $ hg phase --secret --force .
520 $ hg phase --secret --force .
520 $ hg phase '.^::.'
521 $ hg phase '.^::.'
521 11: draft
522 11: draft
522 13: secret
523 13: secret
523 $ hg commit --amend -m 'amend for phase' -q
524 $ hg commit --amend -m 'amend for phase' -q
524 $ hg phase '.^::.'
525 $ hg phase '.^::.'
525 11: draft
526 11: draft
526 13: secret
527 13: secret
527
528
528 Test amend with obsolete
529 Test amend with obsolete
529 ---------------------------
530 ---------------------------
530
531
531 Enable obsolete
532 Enable obsolete
532
533
533 $ cat >> $HGRCPATH << EOF
534 $ cat >> $HGRCPATH << EOF
534 > [experimental]
535 > [experimental]
535 > evolution.createmarkers=True
536 > evolution.createmarkers=True
536 > evolution.allowunstable=True
537 > evolution.allowunstable=True
537 > EOF
538 > EOF
538
539
539 Amend with no files changes
540 Amend with no files changes
540
541
541 $ hg id -n
542 $ hg id -n
542 13
543 13
543 $ hg ci --amend -m 'babar'
544 $ hg ci --amend -m 'babar'
544 $ hg id -n
545 $ hg id -n
545 14
546 14
546 $ hg log -Gl 3 --style=compact
547 $ hg log -Gl 3 --style=compact
547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 | babar
549 | babar
549 |
550 |
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 | | fork
552 | | fork
552 | ~
553 | ~
553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 | a''
555 | a''
555 ~
556 ~
556 $ hg log -Gl 4 --hidden --style=compact
557 $ hg log -Gl 4 --hidden --style=compact
557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 | babar
559 | babar
559 |
560 |
560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 |/ amend for phase
562 |/ amend for phase
562 |
563 |
563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 | | fork
565 | | fork
565 | ~
566 | ~
566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 | a''
568 | a''
568 ~
569 ~
569
570
570 Amend with files changes
571 Amend with files changes
571
572
572 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 ride of)
574 ride of)
574
575
575 $ echo 'babar' >> a
576 $ echo 'babar' >> a
576 $ hg commit --amend
577 $ hg commit --amend
577 $ hg log -Gl 6 --hidden --style=compact
578 $ hg log -Gl 6 --hidden --style=compact
578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 | babar
580 | babar
580 |
581 |
581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 |/ babar
583 |/ babar
583 |
584 |
584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 |/ amend for phase
586 |/ amend for phase
586 |
587 |
587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 | | fork
589 | | fork
589 | ~
590 | ~
590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 | a''
592 | a''
592 |
593 |
593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 | g
595 | g
595 ~
596 ~
596
597
597
598
598 Test that amend does not make it easy to create obsolescence cycle
599 Test that amend does not make it easy to create obsolescence cycle
599 ---------------------------------------------------------------------
600 ---------------------------------------------------------------------
600
601
601 $ hg id -r 14 --hidden
602 $ hg id -r 14 --hidden
602 682950e85999 (a)
603 682950e85999 (a)
603 $ hg revert -ar 14 --hidden
604 $ hg revert -ar 14 --hidden
604 reverting a
605 reverting a
605 $ hg commit --amend
606 $ hg commit --amend
606 $ hg id
607 $ hg id
607 37973c7e0b61 (a) tip
608 37973c7e0b61 (a) tip
608
609
609 Test that rewriting leaving instability behind is allowed
610 Test that rewriting leaving instability behind is allowed
610 ---------------------------------------------------------------------
611 ---------------------------------------------------------------------
611
612
612 $ hg up '.^'
613 $ hg up '.^'
613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 $ echo 'b' >> a
615 $ echo 'b' >> a
615 $ hg log --style compact -r 'children(.)'
616 $ hg log --style compact -r 'children(.)'
616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 babar
618 babar
618
619
619 $ hg commit --amend
620 $ hg commit --amend
620 1 new orphan changesets
621 1 new orphan changesets
621 $ hg log -r 'orphan()'
622 $ hg log -r 'orphan()'
622 changeset: 16:37973c7e0b61
623 changeset: 16:37973c7e0b61
623 branch: a
624 branch: a
624 parent: 11:0ddb275cfad1
625 parent: 11:0ddb275cfad1
625 user: test
626 user: test
626 date: Thu Jan 01 00:00:00 1970 +0000
627 date: Thu Jan 01 00:00:00 1970 +0000
627 instability: orphan
628 instability: orphan
628 summary: babar
629 summary: babar
629
630
630
631
631 Amend a merge changeset (with renames and conflicts from the second parent):
632 Amend a merge changeset (with renames and conflicts from the second parent):
632
633
633 $ hg up -q default
634 $ hg up -q default
634 $ hg branch -q bar
635 $ hg branch -q bar
635 $ hg cp a aa
636 $ hg cp a aa
636 $ hg mv z zz
637 $ hg mv z zz
637 $ echo cc > cc
638 $ echo cc > cc
638 $ hg add cc
639 $ hg add cc
639 $ hg ci -m aazzcc
640 $ hg ci -m aazzcc
640 $ hg up -q default
641 $ hg up -q default
641 $ echo a >> a
642 $ echo a >> a
642 $ echo dd > cc
643 $ echo dd > cc
643 $ hg add cc
644 $ hg add cc
644 $ hg ci -m aa
645 $ hg ci -m aa
645 $ hg merge -q bar
646 $ hg merge -q bar
646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 [1]
648 [1]
648 $ hg resolve -m cc
649 $ hg resolve -m cc
649 (no more unresolved files)
650 (no more unresolved files)
650 $ hg ci -m 'merge bar'
651 $ hg ci -m 'merge bar'
651 $ hg log --config diff.git=1 -pr .
652 $ hg log --config diff.git=1 -pr .
652 changeset: 20:5aba7f3726e6
653 changeset: 20:5aba7f3726e6
653 tag: tip
654 tag: tip
654 parent: 19:30d96aeaf27b
655 parent: 19:30d96aeaf27b
655 parent: 18:1aa437659d19
656 parent: 18:1aa437659d19
656 user: test
657 user: test
657 date: Thu Jan 01 00:00:00 1970 +0000
658 date: Thu Jan 01 00:00:00 1970 +0000
658 summary: merge bar
659 summary: merge bar
659
660
660 diff --git a/a b/aa
661 diff --git a/a b/aa
661 copy from a
662 copy from a
662 copy to aa
663 copy to aa
663 diff --git a/cc b/cc
664 diff --git a/cc b/cc
664 --- a/cc
665 --- a/cc
665 +++ b/cc
666 +++ b/cc
666 @@ -1,1 +1,5 @@
667 @@ -1,1 +1,5 @@
667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 dd
669 dd
669 +=======
670 +=======
670 +cc
671 +cc
671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 diff --git a/z b/zz
673 diff --git a/z b/zz
673 rename from z
674 rename from z
674 rename to zz
675 rename to zz
675
676
676 $ hg debugrename aa
677 $ hg debugrename aa
677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 $ hg debugrename zz
679 $ hg debugrename zz
679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 $ hg debugrename cc
681 $ hg debugrename cc
681 cc not renamed
682 cc not renamed
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 HGEDITFORM=commit.amend.merge
684 HGEDITFORM=commit.amend.merge
684 $ hg log --config diff.git=1 -pr .
685 $ hg log --config diff.git=1 -pr .
685 changeset: 21:4b0631ef043e
686 changeset: 21:4b0631ef043e
686 tag: tip
687 tag: tip
687 parent: 19:30d96aeaf27b
688 parent: 19:30d96aeaf27b
688 parent: 18:1aa437659d19
689 parent: 18:1aa437659d19
689 user: test
690 user: test
690 date: Thu Jan 01 00:00:00 1970 +0000
691 date: Thu Jan 01 00:00:00 1970 +0000
691 summary: merge bar (amend message)
692 summary: merge bar (amend message)
692
693
693 diff --git a/a b/aa
694 diff --git a/a b/aa
694 copy from a
695 copy from a
695 copy to aa
696 copy to aa
696 diff --git a/cc b/cc
697 diff --git a/cc b/cc
697 --- a/cc
698 --- a/cc
698 +++ b/cc
699 +++ b/cc
699 @@ -1,1 +1,5 @@
700 @@ -1,1 +1,5 @@
700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 dd
702 dd
702 +=======
703 +=======
703 +cc
704 +cc
704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 diff --git a/z b/zz
706 diff --git a/z b/zz
706 rename from z
707 rename from z
707 rename to zz
708 rename to zz
708
709
709 $ hg debugrename aa
710 $ hg debugrename aa
710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 $ hg debugrename zz
712 $ hg debugrename zz
712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 $ hg debugrename cc
714 $ hg debugrename cc
714 cc not renamed
715 cc not renamed
715 $ hg mv zz z
716 $ hg mv zz z
716 $ hg ci --amend -m 'merge bar (undo rename)'
717 $ hg ci --amend -m 'merge bar (undo rename)'
717 $ hg log --config diff.git=1 -pr .
718 $ hg log --config diff.git=1 -pr .
718 changeset: 22:06423be42d60
719 changeset: 22:06423be42d60
719 tag: tip
720 tag: tip
720 parent: 19:30d96aeaf27b
721 parent: 19:30d96aeaf27b
721 parent: 18:1aa437659d19
722 parent: 18:1aa437659d19
722 user: test
723 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000
724 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: merge bar (undo rename)
725 summary: merge bar (undo rename)
725
726
726 diff --git a/a b/aa
727 diff --git a/a b/aa
727 copy from a
728 copy from a
728 copy to aa
729 copy to aa
729 diff --git a/cc b/cc
730 diff --git a/cc b/cc
730 --- a/cc
731 --- a/cc
731 +++ b/cc
732 +++ b/cc
732 @@ -1,1 +1,5 @@
733 @@ -1,1 +1,5 @@
733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 dd
735 dd
735 +=======
736 +=======
736 +cc
737 +cc
737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738
739
739 $ hg debugrename z
740 $ hg debugrename z
740 z not renamed
741 z not renamed
741
742
742 Amend a merge changeset (with renames during the merge):
743 Amend a merge changeset (with renames during the merge):
743
744
744 $ hg up -q bar
745 $ hg up -q bar
745 $ echo x > x
746 $ echo x > x
746 $ hg add x
747 $ hg add x
747 $ hg ci -m x
748 $ hg ci -m x
748 $ hg up -q default
749 $ hg up -q default
749 $ hg merge -q bar
750 $ hg merge -q bar
750 $ hg mv aa aaa
751 $ hg mv aa aaa
751 $ echo aa >> aaa
752 $ echo aa >> aaa
752 $ hg ci -m 'merge bar again'
753 $ hg ci -m 'merge bar again'
753 $ hg log --config diff.git=1 -pr .
754 $ hg log --config diff.git=1 -pr .
754 changeset: 24:a89974a20457
755 changeset: 24:a89974a20457
755 tag: tip
756 tag: tip
756 parent: 22:06423be42d60
757 parent: 22:06423be42d60
757 parent: 23:4c94d5bc65f5
758 parent: 23:4c94d5bc65f5
758 user: test
759 user: test
759 date: Thu Jan 01 00:00:00 1970 +0000
760 date: Thu Jan 01 00:00:00 1970 +0000
760 summary: merge bar again
761 summary: merge bar again
761
762
762 diff --git a/aa b/aa
763 diff --git a/aa b/aa
763 deleted file mode 100644
764 deleted file mode 100644
764 --- a/aa
765 --- a/aa
765 +++ /dev/null
766 +++ /dev/null
766 @@ -1,2 +0,0 @@
767 @@ -1,2 +0,0 @@
767 -a
768 -a
768 -a
769 -a
769 diff --git a/aaa b/aaa
770 diff --git a/aaa b/aaa
770 new file mode 100644
771 new file mode 100644
771 --- /dev/null
772 --- /dev/null
772 +++ b/aaa
773 +++ b/aaa
773 @@ -0,0 +1,3 @@
774 @@ -0,0 +1,3 @@
774 +a
775 +a
775 +a
776 +a
776 +aa
777 +aa
777 diff --git a/x b/x
778 diff --git a/x b/x
778 new file mode 100644
779 new file mode 100644
779 --- /dev/null
780 --- /dev/null
780 +++ b/x
781 +++ b/x
781 @@ -0,0 +1,1 @@
782 @@ -0,0 +1,1 @@
782 +x
783 +x
783
784
784 $ hg debugrename aaa
785 $ hg debugrename aaa
785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786
787
787 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
788 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
788 in p1 too, but it was recorded as copied from p2.
789 in p1 too, but it was recorded as copied from p2.
789 $ echo modified >> aaa
790 $ echo modified >> aaa
790 $ hg co -m '.^' -t :merge3
791 $ hg co -m '.^' -t :merge3
791 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
792 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
792 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
793 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
793 What do you want to do? u
794 What do you want to do? u
794 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
795 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
795 use 'hg resolve' to retry unresolved file merges
796 use 'hg resolve' to retry unresolved file merges
796 [1]
797 [1]
797 $ hg co -C tip
798 $ hg co -C tip
798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
799 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
799
800
800 $ hg mv aaa aa
801 $ hg mv aaa aa
801 $ hg ci --amend -m 'merge bar again (undo rename)'
802 $ hg ci --amend -m 'merge bar again (undo rename)'
802 $ hg log --config diff.git=1 -pr .
803 $ hg log --config diff.git=1 -pr .
803 changeset: 25:282080768800
804 changeset: 25:282080768800
804 tag: tip
805 tag: tip
805 parent: 22:06423be42d60
806 parent: 22:06423be42d60
806 parent: 23:4c94d5bc65f5
807 parent: 23:4c94d5bc65f5
807 user: test
808 user: test
808 date: Thu Jan 01 00:00:00 1970 +0000
809 date: Thu Jan 01 00:00:00 1970 +0000
809 summary: merge bar again (undo rename)
810 summary: merge bar again (undo rename)
810
811
811 diff --git a/aa b/aa
812 diff --git a/aa b/aa
812 --- a/aa
813 --- a/aa
813 +++ b/aa
814 +++ b/aa
814 @@ -1,2 +1,3 @@
815 @@ -1,2 +1,3 @@
815 a
816 a
816 a
817 a
817 +aa
818 +aa
818 diff --git a/x b/x
819 diff --git a/x b/x
819 new file mode 100644
820 new file mode 100644
820 --- /dev/null
821 --- /dev/null
821 +++ b/x
822 +++ b/x
822 @@ -0,0 +1,1 @@
823 @@ -0,0 +1,1 @@
823 +x
824 +x
824
825
825 $ hg debugrename aa
826 $ hg debugrename aa
826 aa not renamed
827 aa not renamed
827 $ hg debugrename -r '.^' aa
828 $ hg debugrename -r '.^' aa
828 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
829 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
829
830
830 Amend a merge changeset (with manifest-level conflicts):
831 Amend a merge changeset (with manifest-level conflicts):
831
832
832 $ hg up -q bar
833 $ hg up -q bar
833 $ hg rm aa
834 $ hg rm aa
834 $ hg ci -m 'rm aa'
835 $ hg ci -m 'rm aa'
835 $ hg up -q default
836 $ hg up -q default
836 $ echo aa >> aa
837 $ echo aa >> aa
837 $ hg ci -m aa
838 $ hg ci -m aa
838 $ hg merge -q bar --config ui.interactive=True << EOF
839 $ hg merge -q bar --config ui.interactive=True << EOF
839 > c
840 > c
840 > EOF
841 > EOF
841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
842 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
842 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
843 You can use (c)hanged version, (d)elete, or leave (u)nresolved.
843 What do you want to do? c
844 What do you want to do? c
844 $ hg ci -m 'merge bar (with conflicts)'
845 $ hg ci -m 'merge bar (with conflicts)'
845 $ hg log --config diff.git=1 -pr .
846 $ hg log --config diff.git=1 -pr .
846 changeset: 28:ed15db12298d
847 changeset: 28:ed15db12298d
847 tag: tip
848 tag: tip
848 parent: 27:eb5adec0b43b
849 parent: 27:eb5adec0b43b
849 parent: 26:67db8847a540
850 parent: 26:67db8847a540
850 user: test
851 user: test
851 date: Thu Jan 01 00:00:00 1970 +0000
852 date: Thu Jan 01 00:00:00 1970 +0000
852 summary: merge bar (with conflicts)
853 summary: merge bar (with conflicts)
853
854
854
855
855 $ hg rm aa
856 $ hg rm aa
856 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
857 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
857 $ hg log --config diff.git=1 -pr .
858 $ hg log --config diff.git=1 -pr .
858 changeset: 29:0eeafd043f63
859 changeset: 29:0eeafd043f63
859 tag: tip
860 tag: tip
860 parent: 27:eb5adec0b43b
861 parent: 27:eb5adec0b43b
861 parent: 26:67db8847a540
862 parent: 26:67db8847a540
862 user: test
863 user: test
863 date: Thu Jan 01 00:00:00 1970 +0000
864 date: Thu Jan 01 00:00:00 1970 +0000
864 summary: merge bar (with conflicts, amended)
865 summary: merge bar (with conflicts, amended)
865
866
866 diff --git a/aa b/aa
867 diff --git a/aa b/aa
867 deleted file mode 100644
868 deleted file mode 100644
868 --- a/aa
869 --- a/aa
869 +++ /dev/null
870 +++ /dev/null
870 @@ -1,4 +0,0 @@
871 @@ -1,4 +0,0 @@
871 -a
872 -a
872 -a
873 -a
873 -aa
874 -aa
874 -aa
875 -aa
875
876
876 Issue 3445: amending with --close-branch a commit that created a new head should fail
877 Issue 3445: amending with --close-branch a commit that created a new head should fail
877 This shouldn't be possible:
878 This shouldn't be possible:
878
879
879 $ hg up -q default
880 $ hg up -q default
880 $ hg branch closewithamend
881 $ hg branch closewithamend
881 marked working directory as branch closewithamend
882 marked working directory as branch closewithamend
882 $ echo foo > foo
883 $ echo foo > foo
883 $ hg add foo
884 $ hg add foo
884 $ hg ci -m..
885 $ hg ci -m..
885 $ hg ci --amend --close-branch -m 'closing'
886 $ hg ci --amend --close-branch -m 'closing'
886 abort: can only close branch heads
887 abort: can only close branch heads
887 [10]
888 [10]
888
889
889 This silliness fails:
890 This silliness fails:
890
891
891 $ hg branch silliness
892 $ hg branch silliness
892 marked working directory as branch silliness
893 marked working directory as branch silliness
893 $ echo b >> b
894 $ echo b >> b
894 $ hg ci --close-branch -m'open and close'
895 $ hg ci --close-branch -m'open and close'
895 abort: branch "silliness" has no heads to close
896 abort: branch "silliness" has no heads to close
896 [10]
897 [10]
897
898
898 Test that amend with --secret creates new secret changeset forcibly
899 Test that amend with --secret creates new secret changeset forcibly
899 ---------------------------------------------------------------------
900 ---------------------------------------------------------------------
900
901
901 $ hg phase '.^::.'
902 $ hg phase '.^::.'
902 29: draft
903 29: draft
903 30: draft
904 30: draft
904 $ hg commit --amend --secret -m 'amend as secret' -q
905 $ hg commit --amend --secret -m 'amend as secret' -q
905 $ hg phase '.^::.'
906 $ hg phase '.^::.'
906 29: draft
907 29: draft
907 31: secret
908 31: secret
908
909
909 Test that amend with --edit invokes editor forcibly
910 Test that amend with --edit invokes editor forcibly
910 ---------------------------------------------------
911 ---------------------------------------------------
911
912
912 $ hg parents --template "{desc}\n"
913 $ hg parents --template "{desc}\n"
913 amend as secret
914 amend as secret
914 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
915 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
915 $ hg parents --template "{desc}\n"
916 $ hg parents --template "{desc}\n"
916 editor should be suppressed
917 editor should be suppressed
917
918
918 $ hg status --rev '.^1::.'
919 $ hg status --rev '.^1::.'
919 A foo
920 A foo
920 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
921 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
921 editor should be invoked
922 editor should be invoked
922
923
923
924
924 HG: Enter commit message. Lines beginning with 'HG:' are removed.
925 HG: Enter commit message. Lines beginning with 'HG:' are removed.
925 HG: Leave message empty to abort commit.
926 HG: Leave message empty to abort commit.
926 HG: --
927 HG: --
927 HG: user: test
928 HG: user: test
928 HG: branch 'silliness'
929 HG: branch 'silliness'
929 HG: added foo
930 HG: added foo
930 $ hg parents --template "{desc}\n"
931 $ hg parents --template "{desc}\n"
931 editor should be invoked
932 editor should be invoked
932
933
933 Test that amend with --no-edit avoids the editor
934 Test that amend with --no-edit avoids the editor
934 ------------------------------------------------
935 ------------------------------------------------
935
936
936 $ hg commit --amend -m "before anything happens"
937 $ hg commit --amend -m "before anything happens"
937 $ hg parents --template "{desc}\n"
938 $ hg parents --template "{desc}\n"
938 before anything happens
939 before anything happens
939 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
940 $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
940 $ hg parents --template "{desc}\n"
941 $ hg parents --template "{desc}\n"
941 editor should be suppressed
942 editor should be suppressed
942
943
943 (We need a file change here since we won't have a message change)
944 (We need a file change here since we won't have a message change)
944 $ cp foo foo.orig
945 $ cp foo foo.orig
945 $ echo hi >> foo
946 $ echo hi >> foo
946 $ HGEDITOR=cat hg commit --amend --no-edit
947 $ HGEDITOR=cat hg commit --amend --no-edit
947 $ hg parents --template "{desc}\n"
948 $ hg parents --template "{desc}\n"
948 editor should be suppressed
949 editor should be suppressed
949 $ hg status -mar
950 $ hg status -mar
950 (Let's undo adding that "hi" so later tests don't need to be adjusted)
951 (Let's undo adding that "hi" so later tests don't need to be adjusted)
951 $ mv foo.orig foo
952 $ mv foo.orig foo
952 $ hg commit --amend --no-edit
953 $ hg commit --amend --no-edit
953
954
954 Test that "diff()" in committemplate works correctly for amending
955 Test that "diff()" in committemplate works correctly for amending
955 -----------------------------------------------------------------
956 -----------------------------------------------------------------
956
957
957 $ cat >> .hg/hgrc <<EOF
958 $ cat >> .hg/hgrc <<EOF
958 > [committemplate]
959 > [committemplate]
959 > changeset.commit.amend = {desc}\n
960 > changeset.commit.amend = {desc}\n
960 > HG: {revset('parents()') % 'parent: {desc|firstline}\n'}
961 > HG: {revset('parents()') % 'parent: {desc|firstline}\n'}
961 > HG: M: {file_mods}
962 > HG: M: {file_mods}
962 > HG: A: {file_adds}
963 > HG: A: {file_adds}
963 > HG: R: {file_dels}
964 > HG: R: {file_dels}
964 > {splitlines(diff()) % 'HG: {line}\n'}
965 > {splitlines(diff()) % 'HG: {line}\n'}
965 > EOF
966 > EOF
966
967
967 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
968 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
968 M:
969 M:
969 A: foo
970 A: foo
970 R:
971 R:
971 $ hg status -amr
972 $ hg status -amr
972 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
973 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
973 expecting diff of foo
974 expecting diff of foo
974
975
975 HG: parent: editor should be suppressed
976 HG: parent: editor should be suppressed
976
977
977 HG: M:
978 HG: M:
978 HG: A: foo
979 HG: A: foo
979 HG: R:
980 HG: R:
980 HG: diff -r 0eeafd043f63 foo
981 HG: diff -r 0eeafd043f63 foo
981 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
982 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
982 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
983 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
983 HG: @@ -0,0 +1,1 @@
984 HG: @@ -0,0 +1,1 @@
984 HG: +foo
985 HG: +foo
985
986
986 $ echo y > y
987 $ echo y > y
987 $ hg add y
988 $ hg add y
988 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
989 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
989 expecting diff of foo and y
990 expecting diff of foo and y
990
991
991 HG: parent: expecting diff of foo
992 HG: parent: expecting diff of foo
992
993
993 HG: M:
994 HG: M:
994 HG: A: foo y
995 HG: A: foo y
995 HG: R:
996 HG: R:
996 HG: diff -r 0eeafd043f63 foo
997 HG: diff -r 0eeafd043f63 foo
997 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
998 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
998 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
999 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
999 HG: @@ -0,0 +1,1 @@
1000 HG: @@ -0,0 +1,1 @@
1000 HG: +foo
1001 HG: +foo
1001 HG: diff -r 0eeafd043f63 y
1002 HG: diff -r 0eeafd043f63 y
1002 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1003 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1003 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1004 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1004 HG: @@ -0,0 +1,1 @@
1005 HG: @@ -0,0 +1,1 @@
1005 HG: +y
1006 HG: +y
1006
1007
1007 $ hg rm a
1008 $ hg rm a
1008 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1009 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
1009 expecting diff of a, foo and y
1010 expecting diff of a, foo and y
1010
1011
1011 HG: parent: expecting diff of foo and y
1012 HG: parent: expecting diff of foo and y
1012
1013
1013 HG: M:
1014 HG: M:
1014 HG: A: foo y
1015 HG: A: foo y
1015 HG: R: a
1016 HG: R: a
1016 HG: diff -r 0eeafd043f63 a
1017 HG: diff -r 0eeafd043f63 a
1017 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1018 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1018 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1019 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1019 HG: @@ -1,2 +0,0 @@
1020 HG: @@ -1,2 +0,0 @@
1020 HG: -a
1021 HG: -a
1021 HG: -a
1022 HG: -a
1022 HG: diff -r 0eeafd043f63 foo
1023 HG: diff -r 0eeafd043f63 foo
1023 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1024 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1024 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1025 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1025 HG: @@ -0,0 +1,1 @@
1026 HG: @@ -0,0 +1,1 @@
1026 HG: +foo
1027 HG: +foo
1027 HG: diff -r 0eeafd043f63 y
1028 HG: diff -r 0eeafd043f63 y
1028 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1029 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1029 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1030 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1030 HG: @@ -0,0 +1,1 @@
1031 HG: @@ -0,0 +1,1 @@
1031 HG: +y
1032 HG: +y
1032
1033
1033 $ hg rm x
1034 $ hg rm x
1034 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1035 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1035 expecting diff of a, foo, x and y
1036 expecting diff of a, foo, x and y
1036
1037
1037 HG: parent: expecting diff of a, foo and y
1038 HG: parent: expecting diff of a, foo and y
1038
1039
1039 HG: M:
1040 HG: M:
1040 HG: A: foo y
1041 HG: A: foo y
1041 HG: R: a x
1042 HG: R: a x
1042 HG: diff -r 0eeafd043f63 a
1043 HG: diff -r 0eeafd043f63 a
1043 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1044 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1044 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1045 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1045 HG: @@ -1,2 +0,0 @@
1046 HG: @@ -1,2 +0,0 @@
1046 HG: -a
1047 HG: -a
1047 HG: -a
1048 HG: -a
1048 HG: diff -r 0eeafd043f63 foo
1049 HG: diff -r 0eeafd043f63 foo
1049 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1050 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1051 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1051 HG: @@ -0,0 +1,1 @@
1052 HG: @@ -0,0 +1,1 @@
1052 HG: +foo
1053 HG: +foo
1053 HG: diff -r 0eeafd043f63 x
1054 HG: diff -r 0eeafd043f63 x
1054 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1055 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1055 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1056 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1056 HG: @@ -1,1 +0,0 @@
1057 HG: @@ -1,1 +0,0 @@
1057 HG: -x
1058 HG: -x
1058 HG: diff -r 0eeafd043f63 y
1059 HG: diff -r 0eeafd043f63 y
1059 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1060 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1060 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1061 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1061 HG: @@ -0,0 +1,1 @@
1062 HG: @@ -0,0 +1,1 @@
1062 HG: +y
1063 HG: +y
1063
1064
1064 $ echo cccc >> cc
1065 $ echo cccc >> cc
1065 $ hg status -amr
1066 $ hg status -amr
1066 M cc
1067 M cc
1067 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1068 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1068 cc should be excluded
1069 cc should be excluded
1069
1070
1070 HG: parent: expecting diff of a, foo, x and y
1071 HG: parent: expecting diff of a, foo, x and y
1071
1072
1072 HG: M:
1073 HG: M:
1073 HG: A: foo y
1074 HG: A: foo y
1074 HG: R: a x
1075 HG: R: a x
1075 HG: diff -r 0eeafd043f63 a
1076 HG: diff -r 0eeafd043f63 a
1076 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1077 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1077 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1078 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1078 HG: @@ -1,2 +0,0 @@
1079 HG: @@ -1,2 +0,0 @@
1079 HG: -a
1080 HG: -a
1080 HG: -a
1081 HG: -a
1081 HG: diff -r 0eeafd043f63 foo
1082 HG: diff -r 0eeafd043f63 foo
1082 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1083 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1083 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1084 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1084 HG: @@ -0,0 +1,1 @@
1085 HG: @@ -0,0 +1,1 @@
1085 HG: +foo
1086 HG: +foo
1086 HG: diff -r 0eeafd043f63 x
1087 HG: diff -r 0eeafd043f63 x
1087 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1088 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1088 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1089 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1089 HG: @@ -1,1 +0,0 @@
1090 HG: @@ -1,1 +0,0 @@
1090 HG: -x
1091 HG: -x
1091 HG: diff -r 0eeafd043f63 y
1092 HG: diff -r 0eeafd043f63 y
1092 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1093 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1093 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1094 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1094 HG: @@ -0,0 +1,1 @@
1095 HG: @@ -0,0 +1,1 @@
1095 HG: +y
1096 HG: +y
1096
1097
1097 Check for issue4405
1098 Check for issue4405
1098 -------------------
1099 -------------------
1099
1100
1100 Setup the repo with a file that gets moved in a second commit.
1101 Setup the repo with a file that gets moved in a second commit.
1101 $ hg init repo
1102 $ hg init repo
1102 $ cd repo
1103 $ cd repo
1103 $ touch a0
1104 $ touch a0
1104 $ hg add a0
1105 $ hg add a0
1105 $ hg commit -m a0
1106 $ hg commit -m a0
1106 $ hg mv a0 a1
1107 $ hg mv a0 a1
1107 $ hg commit -m a1
1108 $ hg commit -m a1
1108 $ hg up -q 0
1109 $ hg up -q 0
1109 $ hg log -G --template '{rev} {desc}'
1110 $ hg log -G --template '{rev} {desc}'
1110 o 1 a1
1111 o 1 a1
1111 |
1112 |
1112 @ 0 a0
1113 @ 0 a0
1113
1114
1114
1115
1115 Now we branch the repro, but re-use the file contents, so we have a divergence
1116 Now we branch the repro, but re-use the file contents, so we have a divergence
1116 in the file revlog topology and the changelog topology.
1117 in the file revlog topology and the changelog topology.
1117 $ hg revert --rev 1 --all
1118 $ hg revert --rev 1 --all
1118 removing a0
1119 removing a0
1119 adding a1
1120 adding a1
1120 $ hg ci -qm 'a1-amend'
1121 $ hg ci -qm 'a1-amend'
1121 $ hg log -G --template '{rev} {desc}'
1122 $ hg log -G --template '{rev} {desc}'
1122 @ 2 a1-amend
1123 @ 2 a1-amend
1123 |
1124 |
1124 | o 1 a1
1125 | o 1 a1
1125 |/
1126 |/
1126 o 0 a0
1127 o 0 a0
1127
1128
1128
1129
1129 The way mercurial does amends is by folding the working copy and old commit
1130 The way mercurial does amends is by folding the working copy and old commit
1130 together into another commit (rev 3). During this process, _findlimit is called
1131 together into another commit (rev 3). During this process, _findlimit is called
1131 to check how far back to look for the transitive closure of file copy
1132 to check how far back to look for the transitive closure of file copy
1132 information, but due to the divergence of the filelog and changelog graph
1133 information, but due to the divergence of the filelog and changelog graph
1133 topologies, before _findlimit was fixed, it returned a rev which was not far
1134 topologies, before _findlimit was fixed, it returned a rev which was not far
1134 enough back in this case.
1135 enough back in this case.
1135 $ hg mv a1 a2
1136 $ hg mv a1 a2
1136 $ hg status --copies --rev 0
1137 $ hg status --copies --rev 0
1137 A a2
1138 A a2
1138 a0
1139 a0
1139 R a0
1140 R a0
1140 $ hg ci --amend -q
1141 $ hg ci --amend -q
1141 $ hg log -G --template '{rev} {desc}'
1142 $ hg log -G --template '{rev} {desc}'
1142 @ 3 a1-amend
1143 @ 3 a1-amend
1143 |
1144 |
1144 | o 1 a1
1145 | o 1 a1
1145 |/
1146 |/
1146 o 0 a0
1147 o 0 a0
1147
1148
1148
1149
1149 Before the fix, the copy information was lost.
1150 Before the fix, the copy information was lost.
1150 $ hg status --copies --rev 0
1151 $ hg status --copies --rev 0
1151 A a2
1152 A a2
1152 a0
1153 a0
1153 R a0
1154 R a0
1154 $ cd ..
1155 $ cd ..
1155
1156
1156 Check that amend properly preserve rename from directory rename (issue-4516)
1157 Check that amend properly preserve rename from directory rename (issue-4516)
1157
1158
1158 If a parent of the merge renames a full directory, any files added to the old
1159 If a parent of the merge renames a full directory, any files added to the old
1159 directory in the other parent will be renamed to the new directory. For some
1160 directory in the other parent will be renamed to the new directory. For some
1160 reason, the rename metadata was when amending such merge. This test ensure we
1161 reason, the rename metadata was when amending such merge. This test ensure we
1161 do not regress. We have a dedicated repo because it needs a setup with renamed
1162 do not regress. We have a dedicated repo because it needs a setup with renamed
1162 directory)
1163 directory)
1163
1164
1164 $ hg init issue4516
1165 $ hg init issue4516
1165 $ cd issue4516
1166 $ cd issue4516
1166 $ mkdir olddirname
1167 $ mkdir olddirname
1167 $ echo line1 > olddirname/commonfile.py
1168 $ echo line1 > olddirname/commonfile.py
1168 $ hg add olddirname/commonfile.py
1169 $ hg add olddirname/commonfile.py
1169 $ hg ci -m first
1170 $ hg ci -m first
1170
1171
1171 $ hg branch newdirname
1172 $ hg branch newdirname
1172 marked working directory as branch newdirname
1173 marked working directory as branch newdirname
1173 (branches are permanent and global, did you want a bookmark?)
1174 (branches are permanent and global, did you want a bookmark?)
1174 $ hg mv olddirname newdirname
1175 $ hg mv olddirname newdirname
1175 moving olddirname/commonfile.py to newdirname/commonfile.py
1176 moving olddirname/commonfile.py to newdirname/commonfile.py
1176 $ hg ci -m rename
1177 $ hg ci -m rename
1177
1178
1178 $ hg update default
1179 $ hg update default
1179 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1180 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1180 $ echo line1 > olddirname/newfile.py
1181 $ echo line1 > olddirname/newfile.py
1181 $ hg add olddirname/newfile.py
1182 $ hg add olddirname/newfile.py
1182 $ hg ci -m log
1183 $ hg ci -m log
1183
1184
1184 $ hg up newdirname
1185 $ hg up newdirname
1185 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1186 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1186 $ # create newdirname/newfile.py
1187 $ # create newdirname/newfile.py
1187 $ hg merge default
1188 $ hg merge default
1188 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1189 (branch merge, don't forget to commit)
1190 (branch merge, don't forget to commit)
1190 $ hg ci -m add
1191 $ hg ci -m add
1191 $
1192 $
1192 $ hg debugrename newdirname/newfile.py
1193 $ hg debugrename newdirname/newfile.py
1193 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1194 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1194 $ hg status -C --change .
1195 $ hg status -C --change .
1195 A newdirname/newfile.py
1196 A newdirname/newfile.py
1196 $ hg status -C --rev 1
1197 $ hg status -C --rev 1
1197 A newdirname/newfile.py
1198 A newdirname/newfile.py
1198 $ hg status -C --rev 2
1199 $ hg status -C --rev 2
1199 A newdirname/commonfile.py
1200 A newdirname/commonfile.py
1200 olddirname/commonfile.py
1201 olddirname/commonfile.py
1201 A newdirname/newfile.py
1202 A newdirname/newfile.py
1202 olddirname/newfile.py
1203 olddirname/newfile.py
1203 R olddirname/commonfile.py
1204 R olddirname/commonfile.py
1204 R olddirname/newfile.py
1205 R olddirname/newfile.py
1205 $ hg debugindex newdirname/newfile.py
1206 $ hg debugindex newdirname/newfile.py
1206 rev linkrev nodeid p1-nodeid p2-nodeid
1207 rev linkrev nodeid p1-nodeid p2-nodeid
1207 0 3 34a4d536c0c0 000000000000 000000000000
1208 0 3 34a4d536c0c0 000000000000 000000000000
1208
1209
1209 $ echo a >> newdirname/commonfile.py
1210 $ echo a >> newdirname/commonfile.py
1210 $ hg ci --amend -m bug
1211 $ hg ci --amend -m bug
1211 $ hg debugrename newdirname/newfile.py
1212 $ hg debugrename newdirname/newfile.py
1212 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1213 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1213 $ hg debugindex newdirname/newfile.py
1214 $ hg debugindex newdirname/newfile.py
1214 rev linkrev nodeid p1-nodeid p2-nodeid
1215 rev linkrev nodeid p1-nodeid p2-nodeid
1215 0 3 34a4d536c0c0 000000000000 000000000000
1216 0 3 34a4d536c0c0 000000000000 000000000000
1216
1217
1217 #if execbit
1218 #if execbit
1218
1219
1219 Test if amend preserves executable bit changes
1220 Test if amend preserves executable bit changes
1220 $ chmod +x newdirname/commonfile.py
1221 $ chmod +x newdirname/commonfile.py
1221 $ hg ci -m chmod
1222 $ hg ci -m chmod
1222 $ hg ci --amend -m "chmod amended"
1223 $ hg ci --amend -m "chmod amended"
1223 $ hg ci --amend -m "chmod amended second time"
1224 $ hg ci --amend -m "chmod amended second time"
1224 $ hg log -p --git -r .
1225 $ hg log -p --git -r .
1225 changeset: 7:b1326f52dddf
1226 changeset: 7:b1326f52dddf
1226 branch: newdirname
1227 branch: newdirname
1227 tag: tip
1228 tag: tip
1228 parent: 4:7fd235f7cb2f
1229 parent: 4:7fd235f7cb2f
1229 user: test
1230 user: test
1230 date: Thu Jan 01 00:00:00 1970 +0000
1231 date: Thu Jan 01 00:00:00 1970 +0000
1231 summary: chmod amended second time
1232 summary: chmod amended second time
1232
1233
1233 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1234 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1234 old mode 100644
1235 old mode 100644
1235 new mode 100755
1236 new mode 100755
1236
1237
1237 #endif
1238 #endif
1238
1239
1239 Test amend with file inclusion options
1240 Test amend with file inclusion options
1240 --------------------------------------
1241 --------------------------------------
1241
1242
1242 These tests ensure that we are always amending some files that were part of the
1243 These tests ensure that we are always amending some files that were part of the
1243 pre-amend commit. We want to test that the remaining files in the pre-amend
1244 pre-amend commit. We want to test that the remaining files in the pre-amend
1244 commit were not changed in the amended commit. We do so by performing a diff of
1245 commit were not changed in the amended commit. We do so by performing a diff of
1245 the amended commit against its parent commit.
1246 the amended commit against its parent commit.
1246 $ cd ..
1247 $ cd ..
1247 $ hg init testfileinclusions
1248 $ hg init testfileinclusions
1248 $ cd testfileinclusions
1249 $ cd testfileinclusions
1249 $ echo a > a
1250 $ echo a > a
1250 $ echo b > b
1251 $ echo b > b
1251 $ hg commit -Aqm "Adding a and b"
1252 $ hg commit -Aqm "Adding a and b"
1252
1253
1253 Only add changes to a particular file
1254 Only add changes to a particular file
1254 $ echo a >> a
1255 $ echo a >> a
1255 $ echo b >> b
1256 $ echo b >> b
1256 $ hg commit --amend -I a
1257 $ hg commit --amend -I a
1257 $ hg diff --git -r null -r .
1258 $ hg diff --git -r null -r .
1258 diff --git a/a b/a
1259 diff --git a/a b/a
1259 new file mode 100644
1260 new file mode 100644
1260 --- /dev/null
1261 --- /dev/null
1261 +++ b/a
1262 +++ b/a
1262 @@ -0,0 +1,2 @@
1263 @@ -0,0 +1,2 @@
1263 +a
1264 +a
1264 +a
1265 +a
1265 diff --git a/b b/b
1266 diff --git a/b b/b
1266 new file mode 100644
1267 new file mode 100644
1267 --- /dev/null
1268 --- /dev/null
1268 +++ b/b
1269 +++ b/b
1269 @@ -0,0 +1,1 @@
1270 @@ -0,0 +1,1 @@
1270 +b
1271 +b
1271
1272
1272 $ echo a >> a
1273 $ echo a >> a
1273 $ hg commit --amend b
1274 $ hg commit --amend b
1274 $ hg diff --git -r null -r .
1275 $ hg diff --git -r null -r .
1275 diff --git a/a b/a
1276 diff --git a/a b/a
1276 new file mode 100644
1277 new file mode 100644
1277 --- /dev/null
1278 --- /dev/null
1278 +++ b/a
1279 +++ b/a
1279 @@ -0,0 +1,2 @@
1280 @@ -0,0 +1,2 @@
1280 +a
1281 +a
1281 +a
1282 +a
1282 diff --git a/b b/b
1283 diff --git a/b b/b
1283 new file mode 100644
1284 new file mode 100644
1284 --- /dev/null
1285 --- /dev/null
1285 +++ b/b
1286 +++ b/b
1286 @@ -0,0 +1,2 @@
1287 @@ -0,0 +1,2 @@
1287 +b
1288 +b
1288 +b
1289 +b
1289
1290
1290 Exclude changes to a particular file
1291 Exclude changes to a particular file
1291 $ echo b >> b
1292 $ echo b >> b
1292 $ hg commit --amend -X a
1293 $ hg commit --amend -X a
1293 $ hg diff --git -r null -r .
1294 $ hg diff --git -r null -r .
1294 diff --git a/a b/a
1295 diff --git a/a b/a
1295 new file mode 100644
1296 new file mode 100644
1296 --- /dev/null
1297 --- /dev/null
1297 +++ b/a
1298 +++ b/a
1298 @@ -0,0 +1,2 @@
1299 @@ -0,0 +1,2 @@
1299 +a
1300 +a
1300 +a
1301 +a
1301 diff --git a/b b/b
1302 diff --git a/b b/b
1302 new file mode 100644
1303 new file mode 100644
1303 --- /dev/null
1304 --- /dev/null
1304 +++ b/b
1305 +++ b/b
1305 @@ -0,0 +1,3 @@
1306 @@ -0,0 +1,3 @@
1306 +b
1307 +b
1307 +b
1308 +b
1308 +b
1309 +b
1309
1310
1310 Check the addremove flag
1311 Check the addremove flag
1311 $ echo c > c
1312 $ echo c > c
1312 $ rm a
1313 $ rm a
1313 $ hg commit --amend -A
1314 $ hg commit --amend -A
1314 removing a
1315 removing a
1315 adding c
1316 adding c
1316 $ hg diff --git -r null -r .
1317 $ hg diff --git -r null -r .
1317 diff --git a/b b/b
1318 diff --git a/b b/b
1318 new file mode 100644
1319 new file mode 100644
1319 --- /dev/null
1320 --- /dev/null
1320 +++ b/b
1321 +++ b/b
1321 @@ -0,0 +1,3 @@
1322 @@ -0,0 +1,3 @@
1322 +b
1323 +b
1323 +b
1324 +b
1324 +b
1325 +b
1325 diff --git a/c b/c
1326 diff --git a/c b/c
1326 new file mode 100644
1327 new file mode 100644
1327 --- /dev/null
1328 --- /dev/null
1328 +++ b/c
1329 +++ b/c
1329 @@ -0,0 +1,1 @@
1330 @@ -0,0 +1,1 @@
1330 +c
1331 +c
@@ -1,422 +1,423 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ cat << EOF > a
3 $ cat << EOF > a
3 > Small Mathematical Series.
4 > Small Mathematical Series.
4 > One
5 > One
5 > Two
6 > Two
6 > Three
7 > Three
7 > Four
8 > Four
8 > Five
9 > Five
9 > Hop we are done.
10 > Hop we are done.
10 > EOF
11 > EOF
11 $ hg add a
12 $ hg add a
12 $ hg commit -m ancestor
13 $ hg commit -m ancestor
13 $ cat << EOF > a
14 $ cat << EOF > a
14 > Small Mathematical Series.
15 > Small Mathematical Series.
15 > 1
16 > 1
16 > 2
17 > 2
17 > 3
18 > 3
18 > 4
19 > 4
19 > 5
20 > 5
20 > Hop we are done.
21 > Hop we are done.
21 > EOF
22 > EOF
22 $ hg commit -m branch1
23 $ hg commit -m branch1
23 $ hg co 0
24 $ hg co 0
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 $ cat << EOF > a
26 $ cat << EOF > a
26 > Small Mathematical Series.
27 > Small Mathematical Series.
27 > 1
28 > 1
28 > 2
29 > 2
29 > 3
30 > 3
30 > 6
31 > 6
31 > 8
32 > 8
32 > Hop we are done.
33 > Hop we are done.
33 > EOF
34 > EOF
34 $ hg commit -m branch2
35 $ hg commit -m branch2
35 created new head
36 created new head
36
37
37 $ hg merge 1
38 $ hg merge 1
38 merging a
39 merging a
39 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
40 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
41 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
42 [1]
43 [1]
43
44
44 $ hg id
45 $ hg id
45 618808747361+c0c68e4fe667+ tip
46 618808747361+c0c68e4fe667+ tip
46
47
47 $ echo "[commands]" >> $HGRCPATH
48 $ echo "[commands]" >> $HGRCPATH
48 $ echo "status.verbose=true" >> $HGRCPATH
49 $ echo "status.verbose=true" >> $HGRCPATH
49 $ hg status
50 $ hg status
50 M a
51 M a
51 ? a.orig
52 ? a.orig
52 # The repository is in an unfinished *merge* state.
53 # The repository is in an unfinished *merge* state.
53
54
54 # Unresolved merge conflicts:
55 # Unresolved merge conflicts:
55 #
56 #
56 # a
57 # a
57 #
58 #
58 # To mark files as resolved: hg resolve --mark FILE
59 # To mark files as resolved: hg resolve --mark FILE
59
60
60 # To continue: hg commit
61 # To continue: hg commit
61 # To abort: hg merge --abort
62 # To abort: hg merge --abort
62
63
63 $ hg status -Tjson
64 $ hg status -Tjson
64 [
65 [
65 {
66 {
66 "itemtype": "file",
67 "itemtype": "file",
67 "path": "a",
68 "path": "a",
68 "status": "M",
69 "status": "M",
69 "unresolved": true
70 "unresolved": true
70 },
71 },
71 {
72 {
72 "itemtype": "file",
73 "itemtype": "file",
73 "path": "a.orig",
74 "path": "a.orig",
74 "status": "?"
75 "status": "?"
75 },
76 },
76 {
77 {
77 "itemtype": "morestatus",
78 "itemtype": "morestatus",
78 "unfinished": "merge",
79 "unfinished": "merge",
79 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
80 "unfinishedmsg": "To continue: hg commit\nTo abort: hg merge --abort"
80 }
81 }
81 ]
82 ]
82
83
83 $ hg status -0
84 $ hg status -0
84 M a\x00? a.orig\x00 (no-eol) (esc)
85 M a\x00? a.orig\x00 (no-eol) (esc)
85 $ cat a
86 $ cat a
86 Small Mathematical Series.
87 Small Mathematical Series.
87 1
88 1
88 2
89 2
89 3
90 3
90 <<<<<<< working copy: 618808747361 - test: branch2
91 <<<<<<< working copy: 618808747361 - test: branch2
91 6
92 6
92 8
93 8
93 =======
94 =======
94 4
95 4
95 5
96 5
96 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
97 >>>>>>> merge rev: c0c68e4fe667 - test: branch1
97 Hop we are done.
98 Hop we are done.
98
99
99 $ hg status --config commands.status.verbose=0
100 $ hg status --config commands.status.verbose=0
100 M a
101 M a
101 ? a.orig
102 ? a.orig
102
103
103 Verify custom conflict markers
104 Verify custom conflict markers
104
105
105 $ hg up -q --clean .
106 $ hg up -q --clean .
106 $ cat <<EOF >> .hg/hgrc
107 $ cat <<EOF >> .hg/hgrc
107 > [command-templates]
108 > [command-templates]
108 > mergemarker = '{author} {rev}'
109 > mergemarker = '{author} {rev}'
109 > EOF
110 > EOF
110
111
111 $ hg merge 1
112 $ hg merge 1
112 merging a
113 merging a
113 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
114 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
114 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
115 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
116 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
116 [1]
117 [1]
117
118
118 $ cat a
119 $ cat a
119 Small Mathematical Series.
120 Small Mathematical Series.
120 1
121 1
121 2
122 2
122 3
123 3
123 <<<<<<< working copy: test 2
124 <<<<<<< working copy: test 2
124 6
125 6
125 8
126 8
126 =======
127 =======
127 4
128 4
128 5
129 5
129 >>>>>>> merge rev: test 1
130 >>>>>>> merge rev: test 1
130 Hop we are done.
131 Hop we are done.
131
132
132 Verify custom conflict markers with legacy config name
133 Verify custom conflict markers with legacy config name
133
134
134 $ hg up -q --clean .
135 $ hg up -q --clean .
135 $ cat <<EOF >> .hg/hgrc
136 $ cat <<EOF >> .hg/hgrc
136 > [ui]
137 > [ui]
137 > mergemarkertemplate = '{author} {rev}'
138 > mergemarkertemplate = '{author} {rev}'
138 > EOF
139 > EOF
139
140
140 $ hg merge 1
141 $ hg merge 1
141 merging a
142 merging a
142 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
143 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
143 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
144 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
144 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
145 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
145 [1]
146 [1]
146
147
147 $ cat a
148 $ cat a
148 Small Mathematical Series.
149 Small Mathematical Series.
149 1
150 1
150 2
151 2
151 3
152 3
152 <<<<<<< working copy: test 2
153 <<<<<<< working copy: test 2
153 6
154 6
154 8
155 8
155 =======
156 =======
156 4
157 4
157 5
158 5
158 >>>>>>> merge rev: test 1
159 >>>>>>> merge rev: test 1
159 Hop we are done.
160 Hop we are done.
160
161
161 Verify line splitting of custom conflict marker which causes multiple lines
162 Verify line splitting of custom conflict marker which causes multiple lines
162
163
163 $ hg up -q --clean .
164 $ hg up -q --clean .
164 $ cat >> .hg/hgrc <<EOF
165 $ cat >> .hg/hgrc <<EOF
165 > [command-templates]
166 > [command-templates]
166 > mergemarker={author} {rev}\nfoo\nbar\nbaz
167 > mergemarker={author} {rev}\nfoo\nbar\nbaz
167 > EOF
168 > EOF
168
169
169 $ hg -q merge 1
170 $ hg -q merge 1
170 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
171 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
171 [1]
172 [1]
172
173
173 $ cat a
174 $ cat a
174 Small Mathematical Series.
175 Small Mathematical Series.
175 1
176 1
176 2
177 2
177 3
178 3
178 <<<<<<< working copy: test 2
179 <<<<<<< working copy: test 2
179 6
180 6
180 8
181 8
181 =======
182 =======
182 4
183 4
183 5
184 5
184 >>>>>>> merge rev: test 1
185 >>>>>>> merge rev: test 1
185 Hop we are done.
186 Hop we are done.
186
187
187 Verify line trimming of custom conflict marker using multi-byte characters
188 Verify line trimming of custom conflict marker using multi-byte characters
188
189
189 $ hg up -q --clean .
190 $ hg up -q --clean .
190 $ "$PYTHON" <<EOF
191 $ "$PYTHON" <<EOF
191 > fp = open('logfile', 'wb')
192 > fp = open('logfile', 'wb')
192 > fp.write(b'12345678901234567890123456789012345678901234567890' +
193 > fp.write(b'12345678901234567890123456789012345678901234567890' +
193 > b'1234567890') # there are 5 more columns for 80 columns
194 > b'1234567890') # there are 5 more columns for 80 columns
194 >
195 >
195 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
196 > # 2 x 4 = 8 columns, but 3 x 4 = 12 bytes
196 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
197 > fp.write(u'\u3042\u3044\u3046\u3048'.encode('utf-8'))
197 >
198 >
198 > fp.close()
199 > fp.close()
199 > EOF
200 > EOF
200 $ hg add logfile
201 $ hg add logfile
201 $ hg --encoding utf-8 commit --logfile logfile
202 $ hg --encoding utf-8 commit --logfile logfile
202
203
203 $ cat >> .hg/hgrc <<EOF
204 $ cat >> .hg/hgrc <<EOF
204 > [command-templates]
205 > [command-templates]
205 > mergemarker={desc|firstline}
206 > mergemarker={desc|firstline}
206 > EOF
207 > EOF
207
208
208 $ hg -q --encoding utf-8 merge 1
209 $ hg -q --encoding utf-8 merge 1
209 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
210 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
210 [1]
211 [1]
211
212
212 $ cat a
213 $ cat a
213 Small Mathematical Series.
214 Small Mathematical Series.
214 1
215 1
215 2
216 2
216 3
217 3
217 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
218 <<<<<<< working copy: 1234567890123456789012345678901234567890123456789012345...
218 6
219 6
219 8
220 8
220 =======
221 =======
221 4
222 4
222 5
223 5
223 >>>>>>> merge rev: branch1
224 >>>>>>> merge rev: branch1
224 Hop we are done.
225 Hop we are done.
225
226
226 Verify basic conflict markers
227 Verify basic conflict markers
227
228
228 $ hg up -q --clean 2
229 $ hg up -q --clean 2
229 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
230 $ printf "\n[ui]\nmergemarkers=basic\n" >> .hg/hgrc
230
231
231 $ hg merge 1
232 $ hg merge 1
232 merging a
233 merging a
233 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
234 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
234 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
235 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
235 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
236 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
236 [1]
237 [1]
237
238
238 $ cat a
239 $ cat a
239 Small Mathematical Series.
240 Small Mathematical Series.
240 1
241 1
241 2
242 2
242 3
243 3
243 <<<<<<< working copy
244 <<<<<<< working copy
244 6
245 6
245 8
246 8
246 =======
247 =======
247 4
248 4
248 5
249 5
249 >>>>>>> merge rev
250 >>>>>>> merge rev
250 Hop we are done.
251 Hop we are done.
251
252
252 internal:merge3
253 internal:merge3
253
254
254 $ hg up -q --clean .
255 $ hg up -q --clean .
255
256
256 $ hg merge 1 --tool internal:merge3
257 $ hg merge 1 --tool internal:merge3
257 merging a
258 merging a
258 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
259 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
260 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
261 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
261 [1]
262 [1]
262 $ cat a
263 $ cat a
263 Small Mathematical Series.
264 Small Mathematical Series.
264 <<<<<<< working copy
265 <<<<<<< working copy
265 1
266 1
266 2
267 2
267 3
268 3
268 6
269 6
269 8
270 8
270 ||||||| common ancestor
271 ||||||| common ancestor
271 One
272 One
272 Two
273 Two
273 Three
274 Three
274 Four
275 Four
275 Five
276 Five
276 =======
277 =======
277 1
278 1
278 2
279 2
279 3
280 3
280 4
281 4
281 5
282 5
282 >>>>>>> merge rev
283 >>>>>>> merge rev
283 Hop we are done.
284 Hop we are done.
284
285
285 internal:mergediff
286 internal:mergediff
286
287
287 $ hg co -C 1
288 $ hg co -C 1
288 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ cat << EOF > a
290 $ cat << EOF > a
290 > Small Mathematical Series.
291 > Small Mathematical Series.
291 > 1
292 > 1
292 > 2
293 > 2
293 > 3
294 > 3
294 > 4
295 > 4
295 > 4.5
296 > 4.5
296 > 5
297 > 5
297 > Hop we are done.
298 > Hop we are done.
298 > EOF
299 > EOF
299 $ hg co -m 2 -t internal:mergediff
300 $ hg co -m 2 -t internal:mergediff
300 merging a
301 merging a
301 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
302 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
302 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
303 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
303 use 'hg resolve' to retry unresolved file merges
304 use 'hg resolve' to retry unresolved file merges
304 [1]
305 [1]
305 $ cat a
306 $ cat a
306 Small Mathematical Series.
307 Small Mathematical Series.
307 1
308 1
308 2
309 2
309 3
310 3
310 <<<<<<<
311 <<<<<<<
311 ------- working copy parent
312 ------- working copy parent
312 +++++++ working copy
313 +++++++ working copy
313 4
314 4
314 +4.5
315 +4.5
315 5
316 5
316 ======= destination
317 ======= destination
317 6
318 6
318 8
319 8
319 >>>>>>>
320 >>>>>>>
320 Hop we are done.
321 Hop we are done.
321 Test the same thing as above but modify a bit more so we instead get the working
322 Test the same thing as above but modify a bit more so we instead get the working
322 copy in full and the diff from base to destination.
323 copy in full and the diff from base to destination.
323 $ hg co -C 1
324 $ hg co -C 1
324 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 $ cat << EOF > a
326 $ cat << EOF > a
326 > Small Mathematical Series.
327 > Small Mathematical Series.
327 > 1
328 > 1
328 > 2
329 > 2
329 > 3.5
330 > 3.5
330 > 4.5
331 > 4.5
331 > 5.5
332 > 5.5
332 > Hop we are done.
333 > Hop we are done.
333 > EOF
334 > EOF
334 $ hg co -m 2 -t internal:mergediff
335 $ hg co -m 2 -t internal:mergediff
335 merging a
336 merging a
336 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
337 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
337 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
338 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
338 use 'hg resolve' to retry unresolved file merges
339 use 'hg resolve' to retry unresolved file merges
339 [1]
340 [1]
340 $ cat a
341 $ cat a
341 Small Mathematical Series.
342 Small Mathematical Series.
342 1
343 1
343 2
344 2
344 <<<<<<<
345 <<<<<<<
345 ======= working copy
346 ======= working copy
346 3.5
347 3.5
347 4.5
348 4.5
348 5.5
349 5.5
349 ------- working copy parent
350 ------- working copy parent
350 +++++++ destination
351 +++++++ destination
351 3
352 3
352 -4
353 -4
353 -5
354 -5
354 +6
355 +6
355 +8
356 +8
356 >>>>>>>
357 >>>>>>>
357 Hop we are done.
358 Hop we are done.
358
359
359 Add some unconflicting changes on each head, to make sure we really
360 Add some unconflicting changes on each head, to make sure we really
360 are merging, unlike :local and :other
361 are merging, unlike :local and :other
361
362
362 $ hg up -C
363 $ hg up -C
363 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
364 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
365 updated to "e0693e20f496: 123456789012345678901234567890123456789012345678901234567890????"
365 1 other heads for branch "default"
366 1 other heads for branch "default"
366 $ printf "\n\nEnd of file\n" >> a
367 $ printf "\n\nEnd of file\n" >> a
367 $ hg ci -m "Add some stuff at the end"
368 $ hg ci -m "Add some stuff at the end"
368 $ hg up -r 1
369 $ hg up -r 1
369 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
370 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
370 $ printf "Start of file\n\n\n" > tmp
371 $ printf "Start of file\n\n\n" > tmp
371 $ cat a >> tmp
372 $ cat a >> tmp
372 $ mv tmp a
373 $ mv tmp a
373 $ hg ci -m "Add some stuff at the beginning"
374 $ hg ci -m "Add some stuff at the beginning"
374
375
375 Now test :merge-other and :merge-local
376 Now test :merge-other and :merge-local
376
377
377 $ hg merge
378 $ hg merge
378 merging a
379 merging a
379 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
380 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
380 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
381 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
381 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
382 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
382 [1]
383 [1]
383 $ hg resolve --tool :merge-other a
384 $ hg resolve --tool :merge-other a
384 merging a
385 merging a
385 (no more unresolved files)
386 (no more unresolved files)
386 $ cat a
387 $ cat a
387 Start of file
388 Start of file
388
389
389
390
390 Small Mathematical Series.
391 Small Mathematical Series.
391 1
392 1
392 2
393 2
393 3
394 3
394 6
395 6
395 8
396 8
396 Hop we are done.
397 Hop we are done.
397
398
398
399
399 End of file
400 End of file
400
401
401 $ hg up -C
402 $ hg up -C
402 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
403 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
403 updated to "18b51d585961: Add some stuff at the beginning"
404 updated to "18b51d585961: Add some stuff at the beginning"
404 1 other heads for branch "default"
405 1 other heads for branch "default"
405 $ hg merge --tool :merge-local
406 $ hg merge --tool :merge-local
406 merging a
407 merging a
407 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
408 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
408 (branch merge, don't forget to commit)
409 (branch merge, don't forget to commit)
409 $ cat a
410 $ cat a
410 Start of file
411 Start of file
411
412
412
413
413 Small Mathematical Series.
414 Small Mathematical Series.
414 1
415 1
415 2
416 2
416 3
417 3
417 4
418 4
418 5
419 5
419 Hop we are done.
420 Hop we are done.
420
421
421
422
422 End of file
423 End of file
@@ -1,82 +1,83 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo foo > a
3 $ echo foo > a
3 $ hg add a
4 $ hg add a
4 $ hg commit -m "1"
5 $ hg commit -m "1"
5
6
6 $ echo bar > b
7 $ echo bar > b
7 $ hg add b
8 $ hg add b
8 $ hg remove a
9 $ hg remove a
9
10
10 Should show a removed and b added:
11 Should show a removed and b added:
11
12
12 $ hg status
13 $ hg status
13 A b
14 A b
14 R a
15 R a
15
16
16 $ hg revert --all
17 $ hg revert --all
17 forgetting b
18 forgetting b
18 undeleting a
19 undeleting a
19
20
20 Should show b unknown and a back to normal:
21 Should show b unknown and a back to normal:
21
22
22 $ hg status
23 $ hg status
23 ? b
24 ? b
24
25
25 $ rm b
26 $ rm b
26
27
27 $ hg co -C 0
28 $ hg co -C 0
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 $ echo foo-a > a
30 $ echo foo-a > a
30 $ hg commit -m "2a"
31 $ hg commit -m "2a"
31
32
32 $ hg co -C 0
33 $ hg co -C 0
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ echo foo-b > a
35 $ echo foo-b > a
35 $ hg commit -m "2b"
36 $ hg commit -m "2b"
36 created new head
37 created new head
37
38
38 $ HGMERGE=true hg merge 1
39 $ HGMERGE=true hg merge 1
39 merging a
40 merging a
40 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
41 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
41 (branch merge, don't forget to commit)
42 (branch merge, don't forget to commit)
42
43
43 Should show foo-b:
44 Should show foo-b:
44
45
45 $ cat a
46 $ cat a
46 foo-b
47 foo-b
47
48
48 $ echo bar > b
49 $ echo bar > b
49 $ hg add b
50 $ hg add b
50 $ rm a
51 $ rm a
51 $ hg remove a
52 $ hg remove a
52
53
53 Should show a removed and b added:
54 Should show a removed and b added:
54
55
55 $ hg status
56 $ hg status
56 A b
57 A b
57 R a
58 R a
58
59
59 Revert should fail:
60 Revert should fail:
60
61
61 $ hg revert
62 $ hg revert
62 abort: uncommitted merge with no revision specified
63 abort: uncommitted merge with no revision specified
63 (use 'hg update' or see 'hg help revert')
64 (use 'hg update' or see 'hg help revert')
64 [10]
65 [10]
65
66
66 Revert should be ok now:
67 Revert should be ok now:
67
68
68 $ hg revert -r2 --all
69 $ hg revert -r2 --all
69 forgetting b
70 forgetting b
70 undeleting a
71 undeleting a
71
72
72 Should show b unknown and a marked modified (merged):
73 Should show b unknown and a marked modified (merged):
73
74
74 $ hg status
75 $ hg status
75 M a
76 M a
76 ? b
77 ? b
77
78
78 Should show foo-b:
79 Should show foo-b:
79
80
80 $ cat a
81 $ cat a
81 foo-b
82 foo-b
82
83
@@ -1,67 +1,68 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ cat > .hg/hgrc <<EOF
4 $ cat > .hg/hgrc <<EOF
4 > [extensions]
5 > [extensions]
5 > prefixfilter = prefix.py
6 > prefixfilter = prefix.py
6 > [encode]
7 > [encode]
7 > *.txt = stripprefix: Copyright 2046, The Masters
8 > *.txt = stripprefix: Copyright 2046, The Masters
8 > [decode]
9 > [decode]
9 > *.txt = insertprefix: Copyright 2046, The Masters
10 > *.txt = insertprefix: Copyright 2046, The Masters
10 > EOF
11 > EOF
11
12
12 $ cat > prefix.py <<EOF
13 $ cat > prefix.py <<EOF
13 > from mercurial import error
14 > from mercurial import error
14 > def stripprefix(s, cmd, filename, **kwargs):
15 > def stripprefix(s, cmd, filename, **kwargs):
15 > header = b'%s\n' % cmd
16 > header = b'%s\n' % cmd
16 > if s[:len(header)] != header:
17 > if s[:len(header)] != header:
17 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
18 > raise error.Abort(b'missing header "%s" in %s' % (cmd, filename))
18 > return s[len(header):]
19 > return s[len(header):]
19 > def insertprefix(s, cmd):
20 > def insertprefix(s, cmd):
20 > return b'%s\n%s' % (cmd, s)
21 > return b'%s\n%s' % (cmd, s)
21 > def reposetup(ui, repo):
22 > def reposetup(ui, repo):
22 > repo.adddatafilter(b'stripprefix:', stripprefix)
23 > repo.adddatafilter(b'stripprefix:', stripprefix)
23 > repo.adddatafilter(b'insertprefix:', insertprefix)
24 > repo.adddatafilter(b'insertprefix:', insertprefix)
24 > EOF
25 > EOF
25
26
26 $ cat > .hgignore <<EOF
27 $ cat > .hgignore <<EOF
27 > .hgignore
28 > .hgignore
28 > prefix.py
29 > prefix.py
29 > prefix.pyc
30 > prefix.pyc
30 > __pycache__/
31 > __pycache__/
31 > EOF
32 > EOF
32
33
33 $ cat > stuff.txt <<EOF
34 $ cat > stuff.txt <<EOF
34 > Copyright 2046, The Masters
35 > Copyright 2046, The Masters
35 > Some stuff to ponder very carefully.
36 > Some stuff to ponder very carefully.
36 > EOF
37 > EOF
37 $ hg add stuff.txt
38 $ hg add stuff.txt
38 $ hg ci -m stuff
39 $ hg ci -m stuff
39
40
40 Repository data:
41 Repository data:
41
42
42 $ hg cat stuff.txt
43 $ hg cat stuff.txt
43 Some stuff to ponder very carefully.
44 Some stuff to ponder very carefully.
44
45
45 Fresh checkout:
46 Fresh checkout:
46
47
47 $ rm stuff.txt
48 $ rm stuff.txt
48 $ hg up -C
49 $ hg up -C
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 $ cat stuff.txt
51 $ cat stuff.txt
51 Copyright 2046, The Masters
52 Copyright 2046, The Masters
52 Some stuff to ponder very carefully.
53 Some stuff to ponder very carefully.
53 $ echo "Very very carefully." >> stuff.txt
54 $ echo "Very very carefully." >> stuff.txt
54 $ hg stat
55 $ hg stat
55 M stuff.txt
56 M stuff.txt
56
57
57 $ echo "Unauthorized material subject to destruction." > morestuff.txt
58 $ echo "Unauthorized material subject to destruction." > morestuff.txt
58
59
59 Problem encoding:
60 Problem encoding:
60
61
61 $ hg add morestuff.txt
62 $ hg add morestuff.txt
62 $ hg ci -m morestuff
63 $ hg ci -m morestuff
63 abort: missing header "Copyright 2046, The Masters" in morestuff.txt
64 abort: missing header "Copyright 2046, The Masters" in morestuff.txt
64 [255]
65 [255]
65 $ hg stat
66 $ hg stat
66 M stuff.txt
67 M stuff.txt
67 A morestuff.txt
68 A morestuff.txt
@@ -1,18 +1,19 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo a > a
3 $ echo a > a
3 $ hg ci -Am t
4 $ hg ci -Am t
4 adding a
5 adding a
5
6
6 $ hg mv a b
7 $ hg mv a b
7 $ hg ci -Am t1
8 $ hg ci -Am t1
8 $ hg debugrename b
9 $ hg debugrename b
9 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
10 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
10
11
11 $ hg mv b a
12 $ hg mv b a
12 $ hg ci -Am t2
13 $ hg ci -Am t2
13 $ hg debugrename a
14 $ hg debugrename a
14 a renamed from b:37d9b5d994eab34eda9c16b195ace52c7b129980
15 a renamed from b:37d9b5d994eab34eda9c16b195ace52c7b129980
15
16
16 $ hg debugrename --rev 1 b
17 $ hg debugrename --rev 1 b
17 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
18 b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
18
19
@@ -1,517 +1,518 b''
1 GNU diff is the reference for all of these results.
1 GNU diff is the reference for all of these results.
2
2
3 Prepare tests:
3 Prepare tests:
4
4
5 $ echo '[alias]' >> $HGRCPATH
5 $ echo '[alias]' >> $HGRCPATH
6 $ echo 'ndiff = diff --nodates' >> $HGRCPATH
6 $ echo 'ndiff = diff --nodates' >> $HGRCPATH
7
7
8 $ hg init
8 $ hg init repo
9 $ cd repo
9 $ printf 'hello world\ngoodbye world\n' >foo
10 $ printf 'hello world\ngoodbye world\n' >foo
10 $ hg ci -Amfoo -ufoo
11 $ hg ci -Amfoo -ufoo
11 adding foo
12 adding foo
12
13
13
14
14 Test added blank lines:
15 Test added blank lines:
15
16
16 $ printf '\nhello world\n\ngoodbye world\n\n' >foo
17 $ printf '\nhello world\n\ngoodbye world\n\n' >foo
17
18
18 >>> two diffs showing three added lines <<<
19 >>> two diffs showing three added lines <<<
19
20
20 $ hg ndiff
21 $ hg ndiff
21 diff -r 540c40a65b78 foo
22 diff -r 540c40a65b78 foo
22 --- a/foo
23 --- a/foo
23 +++ b/foo
24 +++ b/foo
24 @@ -1,2 +1,5 @@
25 @@ -1,2 +1,5 @@
25 +
26 +
26 hello world
27 hello world
27 +
28 +
28 goodbye world
29 goodbye world
29 +
30 +
30 $ hg ndiff -b
31 $ hg ndiff -b
31 diff -r 540c40a65b78 foo
32 diff -r 540c40a65b78 foo
32 --- a/foo
33 --- a/foo
33 +++ b/foo
34 +++ b/foo
34 @@ -1,2 +1,5 @@
35 @@ -1,2 +1,5 @@
35 +
36 +
36 hello world
37 hello world
37 +
38 +
38 goodbye world
39 goodbye world
39 +
40 +
40
41
41 >>> no diffs <<<
42 >>> no diffs <<<
42
43
43 $ hg ndiff -B
44 $ hg ndiff -B
44 $ hg ndiff -Bb
45 $ hg ndiff -Bb
45
46
46
47
47 Test added horizontal space first on a line():
48 Test added horizontal space first on a line():
48
49
49 $ printf '\t hello world\ngoodbye world\n' >foo
50 $ printf '\t hello world\ngoodbye world\n' >foo
50
51
51 >>> four diffs showing added space first on the first line <<<
52 >>> four diffs showing added space first on the first line <<<
52
53
53 $ hg ndiff
54 $ hg ndiff
54 diff -r 540c40a65b78 foo
55 diff -r 540c40a65b78 foo
55 --- a/foo
56 --- a/foo
56 +++ b/foo
57 +++ b/foo
57 @@ -1,2 +1,2 @@
58 @@ -1,2 +1,2 @@
58 -hello world
59 -hello world
59 + hello world
60 + hello world
60 goodbye world
61 goodbye world
61
62
62 $ hg ndiff -b
63 $ hg ndiff -b
63 diff -r 540c40a65b78 foo
64 diff -r 540c40a65b78 foo
64 --- a/foo
65 --- a/foo
65 +++ b/foo
66 +++ b/foo
66 @@ -1,2 +1,2 @@
67 @@ -1,2 +1,2 @@
67 -hello world
68 -hello world
68 + hello world
69 + hello world
69 goodbye world
70 goodbye world
70
71
71 $ hg ndiff -B
72 $ hg ndiff -B
72 diff -r 540c40a65b78 foo
73 diff -r 540c40a65b78 foo
73 --- a/foo
74 --- a/foo
74 +++ b/foo
75 +++ b/foo
75 @@ -1,2 +1,2 @@
76 @@ -1,2 +1,2 @@
76 -hello world
77 -hello world
77 + hello world
78 + hello world
78 goodbye world
79 goodbye world
79
80
80 $ hg ndiff -Bb
81 $ hg ndiff -Bb
81 diff -r 540c40a65b78 foo
82 diff -r 540c40a65b78 foo
82 --- a/foo
83 --- a/foo
83 +++ b/foo
84 +++ b/foo
84 @@ -1,2 +1,2 @@
85 @@ -1,2 +1,2 @@
85 -hello world
86 -hello world
86 + hello world
87 + hello world
87 goodbye world
88 goodbye world
88
89
89
90
90 Test added horizontal space last on a line:
91 Test added horizontal space last on a line:
91
92
92 $ printf 'hello world\t \ngoodbye world\n' >foo
93 $ printf 'hello world\t \ngoodbye world\n' >foo
93
94
94 >>> two diffs showing space appended to the first line <<<
95 >>> two diffs showing space appended to the first line <<<
95
96
96 $ hg ndiff
97 $ hg ndiff
97 diff -r 540c40a65b78 foo
98 diff -r 540c40a65b78 foo
98 --- a/foo
99 --- a/foo
99 +++ b/foo
100 +++ b/foo
100 @@ -1,2 +1,2 @@
101 @@ -1,2 +1,2 @@
101 -hello world
102 -hello world
102 +hello world
103 +hello world
103 goodbye world
104 goodbye world
104
105
105 $ hg ndiff -B
106 $ hg ndiff -B
106 diff -r 540c40a65b78 foo
107 diff -r 540c40a65b78 foo
107 --- a/foo
108 --- a/foo
108 +++ b/foo
109 +++ b/foo
109 @@ -1,2 +1,2 @@
110 @@ -1,2 +1,2 @@
110 -hello world
111 -hello world
111 +hello world
112 +hello world
112 goodbye world
113 goodbye world
113
114
114 >>> no diffs <<<
115 >>> no diffs <<<
115
116
116 $ hg ndiff -b
117 $ hg ndiff -b
117 $ hg ndiff -Bb
118 $ hg ndiff -Bb
118
119
119
120
120 Test added horizontal space in the middle of a word:
121 Test added horizontal space in the middle of a word:
121
122
122 $ printf 'hello world\ngood bye world\n' >foo
123 $ printf 'hello world\ngood bye world\n' >foo
123
124
124 >>> four diffs showing space inserted into "goodbye" <<<
125 >>> four diffs showing space inserted into "goodbye" <<<
125
126
126 $ hg ndiff
127 $ hg ndiff
127 diff -r 540c40a65b78 foo
128 diff -r 540c40a65b78 foo
128 --- a/foo
129 --- a/foo
129 +++ b/foo
130 +++ b/foo
130 @@ -1,2 +1,2 @@
131 @@ -1,2 +1,2 @@
131 hello world
132 hello world
132 -goodbye world
133 -goodbye world
133 +good bye world
134 +good bye world
134
135
135 $ hg ndiff -B
136 $ hg ndiff -B
136 diff -r 540c40a65b78 foo
137 diff -r 540c40a65b78 foo
137 --- a/foo
138 --- a/foo
138 +++ b/foo
139 +++ b/foo
139 @@ -1,2 +1,2 @@
140 @@ -1,2 +1,2 @@
140 hello world
141 hello world
141 -goodbye world
142 -goodbye world
142 +good bye world
143 +good bye world
143
144
144 $ hg ndiff -b
145 $ hg ndiff -b
145 diff -r 540c40a65b78 foo
146 diff -r 540c40a65b78 foo
146 --- a/foo
147 --- a/foo
147 +++ b/foo
148 +++ b/foo
148 @@ -1,2 +1,2 @@
149 @@ -1,2 +1,2 @@
149 hello world
150 hello world
150 -goodbye world
151 -goodbye world
151 +good bye world
152 +good bye world
152
153
153 $ hg ndiff -Bb
154 $ hg ndiff -Bb
154 diff -r 540c40a65b78 foo
155 diff -r 540c40a65b78 foo
155 --- a/foo
156 --- a/foo
156 +++ b/foo
157 +++ b/foo
157 @@ -1,2 +1,2 @@
158 @@ -1,2 +1,2 @@
158 hello world
159 hello world
159 -goodbye world
160 -goodbye world
160 +good bye world
161 +good bye world
161
162
162
163
163 Test increased horizontal whitespace amount:
164 Test increased horizontal whitespace amount:
164
165
165 $ printf 'hello world\ngoodbye\t\t \tworld\n' >foo
166 $ printf 'hello world\ngoodbye\t\t \tworld\n' >foo
166
167
167 >>> two diffs showing changed whitespace amount in the last line <<<
168 >>> two diffs showing changed whitespace amount in the last line <<<
168
169
169 $ hg ndiff
170 $ hg ndiff
170 diff -r 540c40a65b78 foo
171 diff -r 540c40a65b78 foo
171 --- a/foo
172 --- a/foo
172 +++ b/foo
173 +++ b/foo
173 @@ -1,2 +1,2 @@
174 @@ -1,2 +1,2 @@
174 hello world
175 hello world
175 -goodbye world
176 -goodbye world
176 +goodbye world
177 +goodbye world
177
178
178 $ hg ndiff -B
179 $ hg ndiff -B
179 diff -r 540c40a65b78 foo
180 diff -r 540c40a65b78 foo
180 --- a/foo
181 --- a/foo
181 +++ b/foo
182 +++ b/foo
182 @@ -1,2 +1,2 @@
183 @@ -1,2 +1,2 @@
183 hello world
184 hello world
184 -goodbye world
185 -goodbye world
185 +goodbye world
186 +goodbye world
186
187
187 >>> no diffs <<<
188 >>> no diffs <<<
188
189
189 $ hg ndiff -b
190 $ hg ndiff -b
190 $ hg ndiff -Bb
191 $ hg ndiff -Bb
191
192
192
193
193 Test added blank line with horizontal whitespace:
194 Test added blank line with horizontal whitespace:
194
195
195 $ printf 'hello world\n \t\ngoodbye world\n' >foo
196 $ printf 'hello world\n \t\ngoodbye world\n' >foo
196
197
197 >>> three diffs showing added blank line with horizontal space <<<
198 >>> three diffs showing added blank line with horizontal space <<<
198
199
199 $ hg ndiff
200 $ hg ndiff
200 diff -r 540c40a65b78 foo
201 diff -r 540c40a65b78 foo
201 --- a/foo
202 --- a/foo
202 +++ b/foo
203 +++ b/foo
203 @@ -1,2 +1,3 @@
204 @@ -1,2 +1,3 @@
204 hello world
205 hello world
205 +
206 +
206 goodbye world
207 goodbye world
207
208
208 $ hg ndiff -B
209 $ hg ndiff -B
209 diff -r 540c40a65b78 foo
210 diff -r 540c40a65b78 foo
210 --- a/foo
211 --- a/foo
211 +++ b/foo
212 +++ b/foo
212 @@ -1,2 +1,3 @@
213 @@ -1,2 +1,3 @@
213 hello world
214 hello world
214 +
215 +
215 goodbye world
216 goodbye world
216
217
217 $ hg ndiff -b
218 $ hg ndiff -b
218 diff -r 540c40a65b78 foo
219 diff -r 540c40a65b78 foo
219 --- a/foo
220 --- a/foo
220 +++ b/foo
221 +++ b/foo
221 @@ -1,2 +1,3 @@
222 @@ -1,2 +1,3 @@
222 hello world
223 hello world
223 +
224 +
224 goodbye world
225 goodbye world
225
226
226 >>> no diffs <<<
227 >>> no diffs <<<
227
228
228 $ hg ndiff -Bb
229 $ hg ndiff -Bb
229
230
230
231
231 Test added blank line with other whitespace:
232 Test added blank line with other whitespace:
232
233
233 $ printf 'hello world\n \t\ngoodbye world \n' >foo
234 $ printf 'hello world\n \t\ngoodbye world \n' >foo
234
235
235 >>> three diffs showing added blank line with other space <<<
236 >>> three diffs showing added blank line with other space <<<
236
237
237 $ hg ndiff
238 $ hg ndiff
238 diff -r 540c40a65b78 foo
239 diff -r 540c40a65b78 foo
239 --- a/foo
240 --- a/foo
240 +++ b/foo
241 +++ b/foo
241 @@ -1,2 +1,3 @@
242 @@ -1,2 +1,3 @@
242 -hello world
243 -hello world
243 -goodbye world
244 -goodbye world
244 +hello world
245 +hello world
245 +
246 +
246 +goodbye world
247 +goodbye world
247
248
248 $ hg ndiff -B
249 $ hg ndiff -B
249 diff -r 540c40a65b78 foo
250 diff -r 540c40a65b78 foo
250 --- a/foo
251 --- a/foo
251 +++ b/foo
252 +++ b/foo
252 @@ -1,2 +1,3 @@
253 @@ -1,2 +1,3 @@
253 -hello world
254 -hello world
254 -goodbye world
255 -goodbye world
255 +hello world
256 +hello world
256 +
257 +
257 +goodbye world
258 +goodbye world
258
259
259 $ hg ndiff -b
260 $ hg ndiff -b
260 diff -r 540c40a65b78 foo
261 diff -r 540c40a65b78 foo
261 --- a/foo
262 --- a/foo
262 +++ b/foo
263 +++ b/foo
263 @@ -1,2 +1,3 @@
264 @@ -1,2 +1,3 @@
264 hello world
265 hello world
265 +
266 +
266 goodbye world
267 goodbye world
267
268
268 >>> no diffs <<<
269 >>> no diffs <<<
269
270
270 $ hg ndiff -Bb
271 $ hg ndiff -Bb
271
272
272
273
273 Test whitespace changes:
274 Test whitespace changes:
274
275
275 $ printf 'helloworld\ngoodbye\tworld \n' >foo
276 $ printf 'helloworld\ngoodbye\tworld \n' >foo
276
277
277 >>> four diffs showing changed whitespace <<<
278 >>> four diffs showing changed whitespace <<<
278
279
279 $ hg ndiff
280 $ hg ndiff
280 diff -r 540c40a65b78 foo
281 diff -r 540c40a65b78 foo
281 --- a/foo
282 --- a/foo
282 +++ b/foo
283 +++ b/foo
283 @@ -1,2 +1,2 @@
284 @@ -1,2 +1,2 @@
284 -hello world
285 -hello world
285 -goodbye world
286 -goodbye world
286 +helloworld
287 +helloworld
287 +goodbye world
288 +goodbye world
288
289
289 $ hg ndiff -B
290 $ hg ndiff -B
290 diff -r 540c40a65b78 foo
291 diff -r 540c40a65b78 foo
291 --- a/foo
292 --- a/foo
292 +++ b/foo
293 +++ b/foo
293 @@ -1,2 +1,2 @@
294 @@ -1,2 +1,2 @@
294 -hello world
295 -hello world
295 -goodbye world
296 -goodbye world
296 +helloworld
297 +helloworld
297 +goodbye world
298 +goodbye world
298
299
299 $ hg ndiff -b
300 $ hg ndiff -b
300 diff -r 540c40a65b78 foo
301 diff -r 540c40a65b78 foo
301 --- a/foo
302 --- a/foo
302 +++ b/foo
303 +++ b/foo
303 @@ -1,2 +1,2 @@
304 @@ -1,2 +1,2 @@
304 -hello world
305 -hello world
305 +helloworld
306 +helloworld
306 goodbye world
307 goodbye world
307
308
308 $ hg ndiff -Bb
309 $ hg ndiff -Bb
309 diff -r 540c40a65b78 foo
310 diff -r 540c40a65b78 foo
310 --- a/foo
311 --- a/foo
311 +++ b/foo
312 +++ b/foo
312 @@ -1,2 +1,2 @@
313 @@ -1,2 +1,2 @@
313 -hello world
314 -hello world
314 +helloworld
315 +helloworld
315 goodbye world
316 goodbye world
316
317
317 >>> no diffs <<<
318 >>> no diffs <<<
318
319
319 $ hg ndiff -w
320 $ hg ndiff -w
320
321
321
322
322 Test whitespace changes and blank lines:
323 Test whitespace changes and blank lines:
323
324
324 $ printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo
325 $ printf 'helloworld\n\n\n\ngoodbye\tworld \n' >foo
325
326
326 >>> five diffs showing changed whitespace <<<
327 >>> five diffs showing changed whitespace <<<
327
328
328 $ hg ndiff
329 $ hg ndiff
329 diff -r 540c40a65b78 foo
330 diff -r 540c40a65b78 foo
330 --- a/foo
331 --- a/foo
331 +++ b/foo
332 +++ b/foo
332 @@ -1,2 +1,5 @@
333 @@ -1,2 +1,5 @@
333 -hello world
334 -hello world
334 -goodbye world
335 -goodbye world
335 +helloworld
336 +helloworld
336 +
337 +
337 +
338 +
338 +
339 +
339 +goodbye world
340 +goodbye world
340
341
341 $ hg ndiff -B
342 $ hg ndiff -B
342 diff -r 540c40a65b78 foo
343 diff -r 540c40a65b78 foo
343 --- a/foo
344 --- a/foo
344 +++ b/foo
345 +++ b/foo
345 @@ -1,2 +1,5 @@
346 @@ -1,2 +1,5 @@
346 -hello world
347 -hello world
347 -goodbye world
348 -goodbye world
348 +helloworld
349 +helloworld
349 +
350 +
350 +
351 +
351 +
352 +
352 +goodbye world
353 +goodbye world
353
354
354 $ hg ndiff -b
355 $ hg ndiff -b
355 diff -r 540c40a65b78 foo
356 diff -r 540c40a65b78 foo
356 --- a/foo
357 --- a/foo
357 +++ b/foo
358 +++ b/foo
358 @@ -1,2 +1,5 @@
359 @@ -1,2 +1,5 @@
359 -hello world
360 -hello world
360 +helloworld
361 +helloworld
361 +
362 +
362 +
363 +
363 +
364 +
364 goodbye world
365 goodbye world
365
366
366 $ hg ndiff -Bb
367 $ hg ndiff -Bb
367 diff -r 540c40a65b78 foo
368 diff -r 540c40a65b78 foo
368 --- a/foo
369 --- a/foo
369 +++ b/foo
370 +++ b/foo
370 @@ -1,2 +1,5 @@
371 @@ -1,2 +1,5 @@
371 -hello world
372 -hello world
372 +helloworld
373 +helloworld
373 +
374 +
374 +
375 +
375 +
376 +
376 goodbye world
377 goodbye world
377
378
378 $ hg ndiff -w
379 $ hg ndiff -w
379 diff -r 540c40a65b78 foo
380 diff -r 540c40a65b78 foo
380 --- a/foo
381 --- a/foo
381 +++ b/foo
382 +++ b/foo
382 @@ -1,2 +1,5 @@
383 @@ -1,2 +1,5 @@
383 hello world
384 hello world
384 +
385 +
385 +
386 +
386 +
387 +
387 goodbye world
388 goodbye world
388
389
389 >>> no diffs <<<
390 >>> no diffs <<<
390
391
391 $ hg ndiff -wB
392 $ hg ndiff -wB
392
393
393
394
394 Test \r (carriage return) as used in "DOS" line endings:
395 Test \r (carriage return) as used in "DOS" line endings:
395
396
396 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
397 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
397
398
398 $ hg ndiff
399 $ hg ndiff
399 diff -r 540c40a65b78 foo
400 diff -r 540c40a65b78 foo
400 --- a/foo
401 --- a/foo
401 +++ b/foo
402 +++ b/foo
402 @@ -1,2 +1,3 @@
403 @@ -1,2 +1,3 @@
403 -hello world
404 -hello world
404 -goodbye world
405 -goodbye world
405 +hello world\r (esc)
406 +hello world\r (esc)
406 +\r (esc)
407 +\r (esc)
407 +goodbye\r (no-eol) (esc)
408 +goodbye\r (no-eol) (esc)
408 world
409 world
409
410
410 Test \r (carriage return) as used in "DOS" line endings:
411 Test \r (carriage return) as used in "DOS" line endings:
411
412
412 $ printf 'hello world \r\n\t\ngoodbye world\n' >foo
413 $ printf 'hello world \r\n\t\ngoodbye world\n' >foo
413
414
414 $ hg ndiff --ignore-space-at-eol
415 $ hg ndiff --ignore-space-at-eol
415 diff -r 540c40a65b78 foo
416 diff -r 540c40a65b78 foo
416 --- a/foo
417 --- a/foo
417 +++ b/foo
418 +++ b/foo
418 @@ -1,2 +1,3 @@
419 @@ -1,2 +1,3 @@
419 hello world
420 hello world
420 +\t (esc)
421 +\t (esc)
421 goodbye world
422 goodbye world
422
423
423 No completely blank lines to ignore:
424 No completely blank lines to ignore:
424
425
425 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
426 $ printf 'hello world\r\n\r\ngoodbye\rworld\n' >foo
426
427
427 $ hg ndiff --ignore-blank-lines
428 $ hg ndiff --ignore-blank-lines
428 diff -r 540c40a65b78 foo
429 diff -r 540c40a65b78 foo
429 --- a/foo
430 --- a/foo
430 +++ b/foo
431 +++ b/foo
431 @@ -1,2 +1,3 @@
432 @@ -1,2 +1,3 @@
432 -hello world
433 -hello world
433 -goodbye world
434 -goodbye world
434 +hello world\r (esc)
435 +hello world\r (esc)
435 +\r (esc)
436 +\r (esc)
436 +goodbye\r (no-eol) (esc)
437 +goodbye\r (no-eol) (esc)
437 world
438 world
438
439
439 Only new line noticed:
440 Only new line noticed:
440
441
441 $ hg ndiff --ignore-space-change
442 $ hg ndiff --ignore-space-change
442 diff -r 540c40a65b78 foo
443 diff -r 540c40a65b78 foo
443 --- a/foo
444 --- a/foo
444 +++ b/foo
445 +++ b/foo
445 @@ -1,2 +1,3 @@
446 @@ -1,2 +1,3 @@
446 hello world
447 hello world
447 +\r (esc)
448 +\r (esc)
448 goodbye world
449 goodbye world
449
450
450 $ hg ndiff --ignore-all-space
451 $ hg ndiff --ignore-all-space
451 diff -r 540c40a65b78 foo
452 diff -r 540c40a65b78 foo
452 --- a/foo
453 --- a/foo
453 +++ b/foo
454 +++ b/foo
454 @@ -1,2 +1,3 @@
455 @@ -1,2 +1,3 @@
455 hello world
456 hello world
456 +\r (esc)
457 +\r (esc)
457 goodbye world
458 goodbye world
458
459
459 New line not noticed when space change ignored:
460 New line not noticed when space change ignored:
460
461
461 $ hg ndiff --ignore-blank-lines --ignore-all-space
462 $ hg ndiff --ignore-blank-lines --ignore-all-space
462
463
463 Do not ignore all newlines, only blank lines
464 Do not ignore all newlines, only blank lines
464
465
465 $ printf 'hello \nworld\ngoodbye world\n' > foo
466 $ printf 'hello \nworld\ngoodbye world\n' > foo
466 $ hg ndiff --ignore-blank-lines
467 $ hg ndiff --ignore-blank-lines
467 diff -r 540c40a65b78 foo
468 diff -r 540c40a65b78 foo
468 --- a/foo
469 --- a/foo
469 +++ b/foo
470 +++ b/foo
470 @@ -1,2 +1,3 @@
471 @@ -1,2 +1,3 @@
471 -hello world
472 -hello world
472 +hello
473 +hello
473 +world
474 +world
474 goodbye world
475 goodbye world
475
476
476 Test hunk offsets adjustments with --ignore-blank-lines
477 Test hunk offsets adjustments with --ignore-blank-lines
477
478
478 $ hg revert -aC
479 $ hg revert -aC
479 reverting foo
480 reverting foo
480 $ printf '\nb\nx\nd\n' > a
481 $ printf '\nb\nx\nd\n' > a
481 $ printf 'b\ny\nd\n' > b
482 $ printf 'b\ny\nd\n' > b
482 $ hg add a b
483 $ hg add a b
483 $ hg ci -m add
484 $ hg ci -m add
484 $ hg cat -r . a > b
485 $ hg cat -r . a > b
485 $ hg cat -r . b > a
486 $ hg cat -r . b > a
486 $ hg diff -B --nodates a > ../diffa
487 $ hg diff -B --nodates a > ../diffa
487 $ cat ../diffa
488 $ cat ../diffa
488 diff -r 0e66aa54f318 a
489 diff -r 0e66aa54f318 a
489 --- a/a
490 --- a/a
490 +++ b/a
491 +++ b/a
491 @@ -1,4 +1,4 @@
492 @@ -1,4 +1,4 @@
492
493
493 b
494 b
494 -x
495 -x
495 +y
496 +y
496 d
497 d
497 $ hg diff -B --nodates b > ../diffb
498 $ hg diff -B --nodates b > ../diffb
498 $ cat ../diffb
499 $ cat ../diffb
499 diff -r 0e66aa54f318 b
500 diff -r 0e66aa54f318 b
500 --- a/b
501 --- a/b
501 +++ b/b
502 +++ b/b
502 @@ -1,3 +1,3 @@
503 @@ -1,3 +1,3 @@
503 b
504 b
504 -y
505 -y
505 +x
506 +x
506 d
507 d
507 $ hg revert -aC
508 $ hg revert -aC
508 reverting a
509 reverting a
509 reverting b
510 reverting b
510 $ hg import --no-commit ../diffa
511 $ hg import --no-commit ../diffa
511 applying ../diffa
512 applying ../diffa
512 $ hg revert -aC
513 $ hg revert -aC
513 reverting a
514 reverting a
514 $ hg import --no-commit ../diffb
515 $ hg import --no-commit ../diffb
515 applying ../diffb
516 applying ../diffb
516 $ hg revert -aC
517 $ hg revert -aC
517 reverting b
518 reverting b
@@ -1,339 +1,340 b''
1 #testcases bdiff xdiff
1 #testcases bdiff xdiff
2
2
3 #if xdiff
3 #if xdiff
4 #require xdiff
4 #require xdiff
5 $ cat >> $HGRCPATH <<EOF
5 $ cat >> $HGRCPATH <<EOF
6 > [experimental]
6 > [experimental]
7 > xdiff = true
7 > xdiff = true
8 > EOF
8 > EOF
9 #endif
9 #endif
10
10
11 $ hg init
11 $ hg init repo
12 $ cd repo
12
13
13 $ cat > a.c <<'EOF'
14 $ cat > a.c <<'EOF'
14 > /*
15 > /*
15 > * This function returns 1.
16 > * This function returns 1.
16 > */
17 > */
17 > int f() {
18 > int f() {
18 > return 1;
19 > return 1;
19 > }
20 > }
20 > /*
21 > /*
21 > * This function returns 2.
22 > * This function returns 2.
22 > */
23 > */
23 > int g() {
24 > int g() {
24 > return 2;
25 > return 2;
25 > }
26 > }
26 > /*
27 > /*
27 > * This function returns 3.
28 > * This function returns 3.
28 > */
29 > */
29 > int h() {
30 > int h() {
30 > return 3;
31 > return 3;
31 > }
32 > }
32 > EOF
33 > EOF
33
34
34 $ cat > b.c <<'EOF'
35 $ cat > b.c <<'EOF'
35 > if (x) {
36 > if (x) {
36 > do_something();
37 > do_something();
37 > }
38 > }
38 >
39 >
39 > if (y) {
40 > if (y) {
40 > do_something_else();
41 > do_something_else();
41 > }
42 > }
42 > EOF
43 > EOF
43
44
44 $ cat > c.rb <<'EOF'
45 $ cat > c.rb <<'EOF'
45 > #!ruby
46 > #!ruby
46 > ["foo", "bar", "baz"].map do |i|
47 > ["foo", "bar", "baz"].map do |i|
47 > i.upcase
48 > i.upcase
48 > end
49 > end
49 > EOF
50 > EOF
50
51
51 $ cat > d.py <<'EOF'
52 $ cat > d.py <<'EOF'
52 > try:
53 > try:
53 > import foo
54 > import foo
54 > except ImportError:
55 > except ImportError:
55 > pass
56 > pass
56 > try:
57 > try:
57 > import bar
58 > import bar
58 > except ImportError:
59 > except ImportError:
59 > pass
60 > pass
60 > EOF
61 > EOF
61
62
62 The below two files are taken from git: t/t4061-diff-indent.sh
63 The below two files are taken from git: t/t4061-diff-indent.sh
63
64
64 $ cat > spaces.txt <<'EOF'
65 $ cat > spaces.txt <<'EOF'
65 > 1
66 > 1
66 > 2
67 > 2
67 > a
68 > a
68 >
69 >
69 > b
70 > b
70 > 3
71 > 3
71 > 4
72 > 4
72 > EOF
73 > EOF
73
74
74 $ cat > functions.c <<'EOF'
75 $ cat > functions.c <<'EOF'
75 > 1
76 > 1
76 > 2
77 > 2
77 > /* function */
78 > /* function */
78 > foo() {
79 > foo() {
79 > foo
80 > foo
80 > }
81 > }
81 >
82 >
82 > 3
83 > 3
83 > 4
84 > 4
84 > EOF
85 > EOF
85
86
86 $ hg commit -m 1 -A . -q
87 $ hg commit -m 1 -A . -q
87
88
88 $ cat > a.c <<'EOF'
89 $ cat > a.c <<'EOF'
89 > /*
90 > /*
90 > * This function returns 1.
91 > * This function returns 1.
91 > */
92 > */
92 > int f() {
93 > int f() {
93 > return 1;
94 > return 1;
94 > }
95 > }
95 > /*
96 > /*
96 > * This function returns 3.
97 > * This function returns 3.
97 > */
98 > */
98 > int h() {
99 > int h() {
99 > return 3;
100 > return 3;
100 > }
101 > }
101 > EOF
102 > EOF
102
103
103 $ cat > b.c <<'EOF'
104 $ cat > b.c <<'EOF'
104 > if (x) {
105 > if (x) {
105 > do_something();
106 > do_something();
106 > }
107 > }
107 >
108 >
108 > if (y) {
109 > if (y) {
109 > do_another_thing();
110 > do_another_thing();
110 > }
111 > }
111 >
112 >
112 > if (y) {
113 > if (y) {
113 > do_something_else();
114 > do_something_else();
114 > }
115 > }
115 > EOF
116 > EOF
116
117
117 $ cat > c.rb <<'EOF'
118 $ cat > c.rb <<'EOF'
118 > #!ruby
119 > #!ruby
119 > ["foo", "bar", "baz"].map do |i|
120 > ["foo", "bar", "baz"].map do |i|
120 > i
121 > i
121 > end
122 > end
122 > ["foo", "bar", "baz"].map do |i|
123 > ["foo", "bar", "baz"].map do |i|
123 > i.upcase
124 > i.upcase
124 > end
125 > end
125 > EOF
126 > EOF
126
127
127 $ cat > d.py <<'EOF'
128 $ cat > d.py <<'EOF'
128 > try:
129 > try:
129 > import foo
130 > import foo
130 > except ImportError:
131 > except ImportError:
131 > pass
132 > pass
132 > try:
133 > try:
133 > import baz
134 > import baz
134 > except ImportError:
135 > except ImportError:
135 > pass
136 > pass
136 > try:
137 > try:
137 > import bar
138 > import bar
138 > except ImportError:
139 > except ImportError:
139 > pass
140 > pass
140 > EOF
141 > EOF
141
142
142 $ cat > spaces.txt <<'EOF'
143 $ cat > spaces.txt <<'EOF'
143 > 1
144 > 1
144 > 2
145 > 2
145 > a
146 > a
146 >
147 >
147 > b
148 > b
148 > a
149 > a
149 >
150 >
150 > b
151 > b
151 > 3
152 > 3
152 > 4
153 > 4
153 > EOF
154 > EOF
154
155
155 $ cat > functions.c <<'EOF'
156 $ cat > functions.c <<'EOF'
156 > 1
157 > 1
157 > 2
158 > 2
158 > /* function */
159 > /* function */
159 > bar() {
160 > bar() {
160 > foo
161 > foo
161 > }
162 > }
162 >
163 >
163 > /* function */
164 > /* function */
164 > foo() {
165 > foo() {
165 > foo
166 > foo
166 > }
167 > }
167 >
168 >
168 > 3
169 > 3
169 > 4
170 > 4
170 > EOF
171 > EOF
171
172
172 #if xdiff
173 #if xdiff
173 $ hg diff --git
174 $ hg diff --git
174 diff --git a/a.c b/a.c
175 diff --git a/a.c b/a.c
175 --- a/a.c
176 --- a/a.c
176 +++ b/a.c
177 +++ b/a.c
177 @@ -4,12 +4,6 @@
178 @@ -4,12 +4,6 @@
178 int f() {
179 int f() {
179 return 1;
180 return 1;
180 }
181 }
181 -/*
182 -/*
182 - * This function returns 2.
183 - * This function returns 2.
183 - */
184 - */
184 -int g() {
185 -int g() {
185 - return 2;
186 - return 2;
186 -}
187 -}
187 /*
188 /*
188 * This function returns 3.
189 * This function returns 3.
189 */
190 */
190 diff --git a/b.c b/b.c
191 diff --git a/b.c b/b.c
191 --- a/b.c
192 --- a/b.c
192 +++ b/b.c
193 +++ b/b.c
193 @@ -2,6 +2,10 @@
194 @@ -2,6 +2,10 @@
194 do_something();
195 do_something();
195 }
196 }
196
197
197 +if (y) {
198 +if (y) {
198 + do_another_thing();
199 + do_another_thing();
199 +}
200 +}
200 +
201 +
201 if (y) {
202 if (y) {
202 do_something_else();
203 do_something_else();
203 }
204 }
204 diff --git a/c.rb b/c.rb
205 diff --git a/c.rb b/c.rb
205 --- a/c.rb
206 --- a/c.rb
206 +++ b/c.rb
207 +++ b/c.rb
207 @@ -1,4 +1,7 @@
208 @@ -1,4 +1,7 @@
208 #!ruby
209 #!ruby
209 +["foo", "bar", "baz"].map do |i|
210 +["foo", "bar", "baz"].map do |i|
210 + i
211 + i
211 +end
212 +end
212 ["foo", "bar", "baz"].map do |i|
213 ["foo", "bar", "baz"].map do |i|
213 i.upcase
214 i.upcase
214 end
215 end
215 diff --git a/d.py b/d.py
216 diff --git a/d.py b/d.py
216 --- a/d.py
217 --- a/d.py
217 +++ b/d.py
218 +++ b/d.py
218 @@ -2,6 +2,10 @@
219 @@ -2,6 +2,10 @@
219 import foo
220 import foo
220 except ImportError:
221 except ImportError:
221 pass
222 pass
222 +try:
223 +try:
223 + import baz
224 + import baz
224 +except ImportError:
225 +except ImportError:
225 + pass
226 + pass
226 try:
227 try:
227 import bar
228 import bar
228 except ImportError:
229 except ImportError:
229 diff --git a/functions.c b/functions.c
230 diff --git a/functions.c b/functions.c
230 --- a/functions.c
231 --- a/functions.c
231 +++ b/functions.c
232 +++ b/functions.c
232 @@ -1,5 +1,10 @@
233 @@ -1,5 +1,10 @@
233 1
234 1
234 2
235 2
235 +/* function */
236 +/* function */
236 +bar() {
237 +bar() {
237 + foo
238 + foo
238 +}
239 +}
239 +
240 +
240 /* function */
241 /* function */
241 foo() {
242 foo() {
242 foo
243 foo
243 diff --git a/spaces.txt b/spaces.txt
244 diff --git a/spaces.txt b/spaces.txt
244 --- a/spaces.txt
245 --- a/spaces.txt
245 +++ b/spaces.txt
246 +++ b/spaces.txt
246 @@ -2,6 +2,9 @@
247 @@ -2,6 +2,9 @@
247 2
248 2
248 a
249 a
249
250
250 +b
251 +b
251 +a
252 +a
252 +
253 +
253 b
254 b
254 3
255 3
255 4
256 4
256 #else
257 #else
257 $ hg diff --git
258 $ hg diff --git
258 diff --git a/a.c b/a.c
259 diff --git a/a.c b/a.c
259 --- a/a.c
260 --- a/a.c
260 +++ b/a.c
261 +++ b/a.c
261 @@ -5,12 +5,6 @@
262 @@ -5,12 +5,6 @@
262 return 1;
263 return 1;
263 }
264 }
264 /*
265 /*
265 - * This function returns 2.
266 - * This function returns 2.
266 - */
267 - */
267 -int g() {
268 -int g() {
268 - return 2;
269 - return 2;
269 -}
270 -}
270 -/*
271 -/*
271 * This function returns 3.
272 * This function returns 3.
272 */
273 */
273 int h() {
274 int h() {
274 diff --git a/b.c b/b.c
275 diff --git a/b.c b/b.c
275 --- a/b.c
276 --- a/b.c
276 +++ b/b.c
277 +++ b/b.c
277 @@ -3,5 +3,9 @@
278 @@ -3,5 +3,9 @@
278 }
279 }
279
280
280 if (y) {
281 if (y) {
281 + do_another_thing();
282 + do_another_thing();
282 +}
283 +}
283 +
284 +
284 +if (y) {
285 +if (y) {
285 do_something_else();
286 do_something_else();
286 }
287 }
287 diff --git a/c.rb b/c.rb
288 diff --git a/c.rb b/c.rb
288 --- a/c.rb
289 --- a/c.rb
289 +++ b/c.rb
290 +++ b/c.rb
290 @@ -1,4 +1,7 @@
291 @@ -1,4 +1,7 @@
291 #!ruby
292 #!ruby
292 ["foo", "bar", "baz"].map do |i|
293 ["foo", "bar", "baz"].map do |i|
293 + i
294 + i
294 +end
295 +end
295 +["foo", "bar", "baz"].map do |i|
296 +["foo", "bar", "baz"].map do |i|
296 i.upcase
297 i.upcase
297 end
298 end
298 diff --git a/d.py b/d.py
299 diff --git a/d.py b/d.py
299 --- a/d.py
300 --- a/d.py
300 +++ b/d.py
301 +++ b/d.py
301 @@ -3,6 +3,10 @@
302 @@ -3,6 +3,10 @@
302 except ImportError:
303 except ImportError:
303 pass
304 pass
304 try:
305 try:
305 + import baz
306 + import baz
306 +except ImportError:
307 +except ImportError:
307 + pass
308 + pass
308 +try:
309 +try:
309 import bar
310 import bar
310 except ImportError:
311 except ImportError:
311 pass
312 pass
312 diff --git a/functions.c b/functions.c
313 diff --git a/functions.c b/functions.c
313 --- a/functions.c
314 --- a/functions.c
314 +++ b/functions.c
315 +++ b/functions.c
315 @@ -1,6 +1,11 @@
316 @@ -1,6 +1,11 @@
316 1
317 1
317 2
318 2
318 /* function */
319 /* function */
319 +bar() {
320 +bar() {
320 + foo
321 + foo
321 +}
322 +}
322 +
323 +
323 +/* function */
324 +/* function */
324 foo() {
325 foo() {
325 foo
326 foo
326 }
327 }
327 diff --git a/spaces.txt b/spaces.txt
328 diff --git a/spaces.txt b/spaces.txt
328 --- a/spaces.txt
329 --- a/spaces.txt
329 +++ b/spaces.txt
330 +++ b/spaces.txt
330 @@ -3,5 +3,8 @@
331 @@ -3,5 +3,8 @@
331 a
332 a
332
333
333 b
334 b
334 +a
335 +a
335 +
336 +
336 +b
337 +b
337 3
338 3
338 4
339 4
339 #endif
340 #endif
@@ -1,23 +1,24 b''
1 Test issue2761
1 Test issue2761
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4
5
5 $ touch to-be-deleted
6 $ touch to-be-deleted
6 $ hg add
7 $ hg add
7 adding to-be-deleted
8 adding to-be-deleted
8 $ hg ci -m first
9 $ hg ci -m first
9 $ echo a > to-be-deleted
10 $ echo a > to-be-deleted
10 $ hg ci -m second
11 $ hg ci -m second
11 $ rm to-be-deleted
12 $ rm to-be-deleted
12 $ hg diff -r 0
13 $ hg diff -r 0
13
14
14 Same issue, different code path
15 Same issue, different code path
15
16
16 $ hg up -C
17 $ hg up -C
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 $ touch does-not-exist-in-1
19 $ touch does-not-exist-in-1
19 $ hg add
20 $ hg add
20 adding does-not-exist-in-1
21 adding does-not-exist-in-1
21 $ hg ci -m third
22 $ hg ci -m third
22 $ rm does-not-exist-in-1
23 $ rm does-not-exist-in-1
23 $ hg diff -r 1
24 $ hg diff -r 1
@@ -1,19 +1,20 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ "$PYTHON" -c 'open("a", "wb").write(b"confuse str.splitlines\nembedded\rnewline\n")'
4 $ "$PYTHON" -c 'open("a", "wb").write(b"confuse str.splitlines\nembedded\rnewline\n")'
4 $ hg ci -Ama -d '1 0'
5 $ hg ci -Ama -d '1 0'
5 adding a
6 adding a
6
7
7 $ echo clean diff >> a
8 $ echo clean diff >> a
8 $ hg ci -mb -d '2 0'
9 $ hg ci -mb -d '2 0'
9
10
10 $ hg diff -r0 -r1
11 $ hg diff -r0 -r1
11 diff -r 107ba6f817b5 -r 310ce7989cdc a
12 diff -r 107ba6f817b5 -r 310ce7989cdc a
12 --- a/a Thu Jan 01 00:00:01 1970 +0000
13 --- a/a Thu Jan 01 00:00:01 1970 +0000
13 +++ b/a Thu Jan 01 00:00:02 1970 +0000
14 +++ b/a Thu Jan 01 00:00:02 1970 +0000
14 @@ -1,2 +1,3 @@
15 @@ -1,2 +1,3 @@
15 confuse str.splitlines
16 confuse str.splitlines
16 embedded\r (no-eol) (esc)
17 embedded\r (no-eol) (esc)
17 newline
18 newline
18 +clean diff
19 +clean diff
19
20
@@ -1,65 +1,66 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ cat > a <<EOF
4 $ cat > a <<EOF
4 > a
5 > a
5 > b
6 > b
6 > c
7 > c
7 > EOF
8 > EOF
8 $ hg ci -Am adda
9 $ hg ci -Am adda
9 adding a
10 adding a
10
11
11 $ cat > a <<EOF
12 $ cat > a <<EOF
12 > d
13 > d
13 > e
14 > e
14 > f
15 > f
15 > EOF
16 > EOF
16 $ hg ci -m moda
17 $ hg ci -m moda
17
18
18 $ hg diff --reverse -r0 -r1
19 $ hg diff --reverse -r0 -r1
19 diff -r 2855cdcfcbb7 -r 8e1805a3cf6e a
20 diff -r 2855cdcfcbb7 -r 8e1805a3cf6e a
20 --- a/a Thu Jan 01 00:00:00 1970 +0000
21 --- a/a Thu Jan 01 00:00:00 1970 +0000
21 +++ b/a Thu Jan 01 00:00:00 1970 +0000
22 +++ b/a Thu Jan 01 00:00:00 1970 +0000
22 @@ -1,3 +1,3 @@
23 @@ -1,3 +1,3 @@
23 -d
24 -d
24 -e
25 -e
25 -f
26 -f
26 +a
27 +a
27 +b
28 +b
28 +c
29 +c
29
30
30 $ cat >> a <<EOF
31 $ cat >> a <<EOF
31 > g
32 > g
32 > h
33 > h
33 > EOF
34 > EOF
34 $ hg diff --reverse --nodates
35 $ hg diff --reverse --nodates
35 diff -r 2855cdcfcbb7 a
36 diff -r 2855cdcfcbb7 a
36 --- a/a
37 --- a/a
37 +++ b/a
38 +++ b/a
38 @@ -1,5 +1,3 @@
39 @@ -1,5 +1,3 @@
39 d
40 d
40 e
41 e
41 f
42 f
42 -g
43 -g
43 -h
44 -h
44
45
45 should show removed file 'a' as being added
46 should show removed file 'a' as being added
46 $ hg revert a
47 $ hg revert a
47 $ hg rm a
48 $ hg rm a
48 $ hg diff --reverse --nodates a
49 $ hg diff --reverse --nodates a
49 diff -r 2855cdcfcbb7 a
50 diff -r 2855cdcfcbb7 a
50 --- /dev/null
51 --- /dev/null
51 +++ b/a
52 +++ b/a
52 @@ -0,0 +1,3 @@
53 @@ -0,0 +1,3 @@
53 +d
54 +d
54 +e
55 +e
55 +f
56 +f
56
57
57 should show added file 'b' as being removed
58 should show added file 'b' as being removed
58 $ echo b >> b
59 $ echo b >> b
59 $ hg add b
60 $ hg add b
60 $ hg diff --reverse --nodates b
61 $ hg diff --reverse --nodates b
61 diff -r 2855cdcfcbb7 b
62 diff -r 2855cdcfcbb7 b
62 --- a/b
63 --- a/b
63 +++ /dev/null
64 +++ /dev/null
64 @@ -1,1 +0,0 @@
65 @@ -1,1 +0,0 @@
65 -b
66 -b
@@ -1,64 +1,65 b''
1 Test temp file used with an editor has the expected suffix.
1 Test temp file used with an editor has the expected suffix.
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4
5
5 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
6 Create an editor that writes its arguments to stdout and set it to $HGEDITOR.
6
7
7 $ cat > editor.sh << EOF
8 $ cat > editor.sh << EOF
8 > echo "\$@"
9 > echo "\$@"
9 > exit 1
10 > exit 1
10 > EOF
11 > EOF
11 $ hg add editor.sh
12 $ hg add editor.sh
12 $ HGEDITOR="sh $TESTTMP/editor.sh"
13 $ HGEDITOR="sh $TESTTMP/repo/editor.sh"
13 $ export HGEDITOR
14 $ export HGEDITOR
14
15
15 Verify that the path for a commit editor has the expected suffix.
16 Verify that the path for a commit editor has the expected suffix.
16
17
17 $ hg commit
18 $ hg commit
18 *.commit.hg.txt (glob)
19 *.commit.hg.txt (glob)
19 abort: edit failed: sh exited with status 1
20 abort: edit failed: sh exited with status 1
20 [250]
21 [250]
21
22
22 Verify that the path for a histedit editor has the expected suffix.
23 Verify that the path for a histedit editor has the expected suffix.
23
24
24 $ cat >> $HGRCPATH <<EOF
25 $ cat >> $HGRCPATH <<EOF
25 > [extensions]
26 > [extensions]
26 > rebase=
27 > rebase=
27 > histedit=
28 > histedit=
28 > EOF
29 > EOF
29 $ hg commit --message 'At least one commit for histedit.'
30 $ hg commit --message 'At least one commit for histedit.'
30 $ hg histedit
31 $ hg histedit
31 *.histedit.hg.txt (glob)
32 *.histedit.hg.txt (glob)
32 abort: edit failed: sh exited with status 1
33 abort: edit failed: sh exited with status 1
33 [250]
34 [250]
34
35
35 Verify that when performing an action that has the side-effect of creating an
36 Verify that when performing an action that has the side-effect of creating an
36 editor for a diff, the file ends in .diff.
37 editor for a diff, the file ends in .diff.
37
38
38 $ echo 1 > one
39 $ echo 1 > one
39 $ echo 2 > two
40 $ echo 2 > two
40 $ hg add
41 $ hg add
41 adding one
42 adding one
42 adding two
43 adding two
43 $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
44 $ hg commit --interactive --config ui.interactive=true --config ui.interface=text << EOF
44 > y
45 > y
45 > e
46 > e
46 > q
47 > q
47 > EOF
48 > EOF
48 diff --git a/one b/one
49 diff --git a/one b/one
49 new file mode 100644
50 new file mode 100644
50 examine changes to 'one'?
51 examine changes to 'one'?
51 (enter ? for help) [Ynesfdaq?] y
52 (enter ? for help) [Ynesfdaq?] y
52
53
53 @@ -0,0 +1,1 @@
54 @@ -0,0 +1,1 @@
54 +1
55 +1
55 record change 1/2 to 'one'?
56 record change 1/2 to 'one'?
56 (enter ? for help) [Ynesfdaq?] e
57 (enter ? for help) [Ynesfdaq?] e
57
58
58 *.diff (glob)
59 *.diff (glob)
59 editor exited with exit code 1
60 editor exited with exit code 1
60 record change 1/2 to 'one'?
61 record change 1/2 to 'one'?
61 (enter ? for help) [Ynesfdaq?] q
62 (enter ? for help) [Ynesfdaq?] q
62
63
63 abort: user quit
64 abort: user quit
64 [250]
65 [250]
@@ -1,72 +1,73 b''
1 Test encode/decode filters
1 Test encode/decode filters
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ cat > .hg/hgrc <<EOF
5 $ cat > .hg/hgrc <<EOF
5 > [encode]
6 > [encode]
6 > not.gz = tr [:lower:] [:upper:]
7 > not.gz = tr [:lower:] [:upper:]
7 > *.gz = gzip -d
8 > *.gz = gzip -d
8 > [decode]
9 > [decode]
9 > not.gz = tr [:upper:] [:lower:]
10 > not.gz = tr [:upper:] [:lower:]
10 > *.gz = gzip
11 > *.gz = gzip
11 > EOF
12 > EOF
12 $ echo "this is a test" | gzip > a.gz
13 $ echo "this is a test" | gzip > a.gz
13 $ echo "this is a test" > not.gz
14 $ echo "this is a test" > not.gz
14 $ hg add *
15 $ hg add *
15 $ hg ci -m "test"
16 $ hg ci -m "test"
16
17
17 no changes
18 no changes
18
19
19 $ hg status
20 $ hg status
20 $ touch *
21 $ touch *
21
22
22 no changes
23 no changes
23
24
24 $ hg status
25 $ hg status
25
26
26 check contents in repo are encoded
27 check contents in repo are encoded
27
28
28 $ hg debugdata a.gz 0
29 $ hg debugdata a.gz 0
29 this is a test
30 this is a test
30 $ hg debugdata not.gz 0
31 $ hg debugdata not.gz 0
31 THIS IS A TEST
32 THIS IS A TEST
32
33
33 check committed content was decoded
34 check committed content was decoded
34
35
35 $ gunzip < a.gz
36 $ gunzip < a.gz
36 this is a test
37 this is a test
37 $ cat not.gz
38 $ cat not.gz
38 this is a test
39 this is a test
39 $ rm *
40 $ rm *
40 $ hg co -C
41 $ hg co -C
41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42
43
43 check decoding of our new working dir copy
44 check decoding of our new working dir copy
44
45
45 $ gunzip < a.gz
46 $ gunzip < a.gz
46 this is a test
47 this is a test
47 $ cat not.gz
48 $ cat not.gz
48 this is a test
49 this is a test
49
50
50 check hg cat operation
51 check hg cat operation
51
52
52 $ hg cat a.gz
53 $ hg cat a.gz
53 this is a test
54 this is a test
54 $ hg cat --decode a.gz | gunzip
55 $ hg cat --decode a.gz | gunzip
55 this is a test
56 this is a test
56 $ mkdir subdir
57 $ mkdir subdir
57 $ cd subdir
58 $ cd subdir
58 $ hg -R .. cat ../a.gz
59 $ hg -R .. cat ../a.gz
59 this is a test
60 this is a test
60 $ hg -R .. cat --decode ../a.gz | gunzip
61 $ hg -R .. cat --decode ../a.gz | gunzip
61 this is a test
62 this is a test
62 $ cd ..
63 $ cd ..
63
64
64 check tempfile filter
65 check tempfile filter
65
66
66 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip
67 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:gzip -c INFILE > OUTFILE' | gunzip
67 this is a test
68 this is a test
68 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"'
69 $ hg cat a.gz --decode --config 'decode.*.gz=tempfile:sh -c "exit 1"'
69 abort: command '*' failed: exited with status 1 (glob)
70 abort: command '*' failed: exited with status 1 (glob)
70 [255]
71 [255]
71
72
72 $ cd ..
73 $ cd ..
@@ -1,28 +1,29 b''
1 #require execbit
1 #require execbit
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ echo a > a
5 $ echo a > a
5 $ hg ci -Am'not executable'
6 $ hg ci -Am'not executable'
6 adding a
7 adding a
7
8
8 $ chmod +x a
9 $ chmod +x a
9 $ hg ci -m'executable'
10 $ hg ci -m'executable'
10 $ hg id
11 $ hg id
11 79abf14474dc tip
12 79abf14474dc tip
12
13
13 Make sure we notice the change of mode if the cached size == -1:
14 Make sure we notice the change of mode if the cached size == -1:
14
15
15 $ hg rm a
16 $ hg rm a
16 $ hg revert -r 0 a
17 $ hg revert -r 0 a
17 $ hg debugstate
18 $ hg debugstate
18 n 0 -1 unset a
19 n 0 -1 unset a
19 $ hg status
20 $ hg status
20 M a
21 M a
21
22
22 $ hg up 0
23 $ hg up 0
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 $ hg id
25 $ hg id
25 d69afc33ff8a
26 d69afc33ff8a
26 $ test -x a && echo executable -- bad || echo not executable -- good
27 $ test -x a && echo executable -- bad || echo not executable -- good
27 not executable -- good
28 not executable -- good
28
29
@@ -1,21 +1,22 b''
1 Issue351: mq: qrefresh can create extra revlog entry
1 Issue351: mq: qrefresh can create extra revlog entry
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5
5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 $ hg qinit
8 $ hg qinit
8
9
9 $ echo b > b
10 $ echo b > b
10 $ hg ci -A -m foo
11 $ hg ci -A -m foo
11 adding b
12 adding b
12
13
13 $ echo cc > b
14 $ echo cc > b
14 $ hg qnew -f foo.diff
15 $ hg qnew -f foo.diff
15 $ echo b > b
16 $ echo b > b
16 $ hg qrefresh
17 $ hg qrefresh
17
18
18 $ hg debugindex b
19 $ hg debugindex b
19 rev linkrev nodeid p1-nodeid p2-nodeid
20 rev linkrev nodeid p1-nodeid p2-nodeid
20 0 0 1e88685f5dde 000000000000 000000000000
21 0 0 1e88685f5dde 000000000000 000000000000
21
22
@@ -1,198 +1,199 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 Set up history and working copy
4 Set up history and working copy
4
5
5 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
6 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
6 $ hg addremove -q --similarity 0
7 $ hg addremove -q --similarity 0
7 $ hg commit -m first
8 $ hg commit -m first
8
9
9 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
10 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
10 $ hg addremove -q --similarity 0
11 $ hg addremove -q --similarity 0
11 $ hg commit -m second
12 $ hg commit -m second
12
13
13 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
14 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
14 $ hg addremove -q --similarity 0
15 $ hg addremove -q --similarity 0
15 $ hg forget *_*_*-untracked
16 $ hg forget *_*_*-untracked
16 $ rm *_*_missing-*
17 $ rm *_*_missing-*
17
18
18 Test status
19 Test status
19
20
20 $ hg st -A 'set:modified()'
21 $ hg st -A 'set:modified()'
21 M content1_content1_content3-tracked
22 M content1_content1_content3-tracked
22 M content1_content2_content1-tracked
23 M content1_content2_content1-tracked
23 M content1_content2_content3-tracked
24 M content1_content2_content3-tracked
24 M missing_content2_content3-tracked
25 M missing_content2_content3-tracked
25
26
26 $ hg st -A 'set:added()'
27 $ hg st -A 'set:added()'
27 A content1_missing_content1-tracked
28 A content1_missing_content1-tracked
28 A content1_missing_content3-tracked
29 A content1_missing_content3-tracked
29 A missing_missing_content3-tracked
30 A missing_missing_content3-tracked
30
31
31 $ hg st -A 'set:removed()'
32 $ hg st -A 'set:removed()'
32 R content1_content1_content1-untracked
33 R content1_content1_content1-untracked
33 R content1_content1_content3-untracked
34 R content1_content1_content3-untracked
34 R content1_content1_missing-untracked
35 R content1_content1_missing-untracked
35 R content1_content2_content1-untracked
36 R content1_content2_content1-untracked
36 R content1_content2_content2-untracked
37 R content1_content2_content2-untracked
37 R content1_content2_content3-untracked
38 R content1_content2_content3-untracked
38 R content1_content2_missing-untracked
39 R content1_content2_missing-untracked
39 R missing_content2_content2-untracked
40 R missing_content2_content2-untracked
40 R missing_content2_content3-untracked
41 R missing_content2_content3-untracked
41 R missing_content2_missing-untracked
42 R missing_content2_missing-untracked
42
43
43 $ hg st -A 'set:deleted()'
44 $ hg st -A 'set:deleted()'
44 ! content1_content1_missing-tracked
45 ! content1_content1_missing-tracked
45 ! content1_content2_missing-tracked
46 ! content1_content2_missing-tracked
46 ! content1_missing_missing-tracked
47 ! content1_missing_missing-tracked
47 ! missing_content2_missing-tracked
48 ! missing_content2_missing-tracked
48 ! missing_missing_missing-tracked
49 ! missing_missing_missing-tracked
49
50
50 $ hg st -A 'set:missing()'
51 $ hg st -A 'set:missing()'
51 ! content1_content1_missing-tracked
52 ! content1_content1_missing-tracked
52 ! content1_content2_missing-tracked
53 ! content1_content2_missing-tracked
53 ! content1_missing_missing-tracked
54 ! content1_missing_missing-tracked
54 ! missing_content2_missing-tracked
55 ! missing_content2_missing-tracked
55 ! missing_missing_missing-tracked
56 ! missing_missing_missing-tracked
56
57
57 $ hg st -A 'set:unknown()'
58 $ hg st -A 'set:unknown()'
58 ? content1_missing_content1-untracked
59 ? content1_missing_content1-untracked
59 ? content1_missing_content3-untracked
60 ? content1_missing_content3-untracked
60 ? missing_missing_content3-untracked
61 ? missing_missing_content3-untracked
61
62
62 $ hg st -A 'set:clean()'
63 $ hg st -A 'set:clean()'
63 C content1_content1_content1-tracked
64 C content1_content1_content1-tracked
64 C content1_content2_content2-tracked
65 C content1_content2_content2-tracked
65 C missing_content2_content2-tracked
66 C missing_content2_content2-tracked
66
67
67 Test log
68 Test log
68
69
69 $ hg log -T '{rev}\n' --stat 'set:modified()'
70 $ hg log -T '{rev}\n' --stat 'set:modified()'
70 1
71 1
71 content1_content2_content1-tracked | 2 +-
72 content1_content2_content1-tracked | 2 +-
72 content1_content2_content3-tracked | 2 +-
73 content1_content2_content3-tracked | 2 +-
73 missing_content2_content3-tracked | 1 +
74 missing_content2_content3-tracked | 1 +
74 3 files changed, 3 insertions(+), 2 deletions(-)
75 3 files changed, 3 insertions(+), 2 deletions(-)
75
76
76 0
77 0
77 content1_content1_content3-tracked | 1 +
78 content1_content1_content3-tracked | 1 +
78 content1_content2_content1-tracked | 1 +
79 content1_content2_content1-tracked | 1 +
79 content1_content2_content3-tracked | 1 +
80 content1_content2_content3-tracked | 1 +
80 3 files changed, 3 insertions(+), 0 deletions(-)
81 3 files changed, 3 insertions(+), 0 deletions(-)
81
82
82 Largefiles doesn't crash
83 Largefiles doesn't crash
83 $ hg log -T '{rev}\n' --stat 'set:modified()' --config extensions.largefiles=
84 $ hg log -T '{rev}\n' --stat 'set:modified()' --config extensions.largefiles=
84 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
85 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
85 1
86 1
86 content1_content2_content1-tracked | 2 +-
87 content1_content2_content1-tracked | 2 +-
87 content1_content2_content3-tracked | 2 +-
88 content1_content2_content3-tracked | 2 +-
88 missing_content2_content3-tracked | 1 +
89 missing_content2_content3-tracked | 1 +
89 3 files changed, 3 insertions(+), 2 deletions(-)
90 3 files changed, 3 insertions(+), 2 deletions(-)
90
91
91 0
92 0
92 content1_content1_content3-tracked | 1 +
93 content1_content1_content3-tracked | 1 +
93 content1_content2_content1-tracked | 1 +
94 content1_content2_content1-tracked | 1 +
94 content1_content2_content3-tracked | 1 +
95 content1_content2_content3-tracked | 1 +
95 3 files changed, 3 insertions(+), 0 deletions(-)
96 3 files changed, 3 insertions(+), 0 deletions(-)
96
97
97 $ hg log -T '{rev}\n' --stat 'set:added()'
98 $ hg log -T '{rev}\n' --stat 'set:added()'
98 1
99 1
99 content1_missing_content1-tracked | 1 -
100 content1_missing_content1-tracked | 1 -
100 content1_missing_content3-tracked | 1 -
101 content1_missing_content3-tracked | 1 -
101 2 files changed, 0 insertions(+), 2 deletions(-)
102 2 files changed, 0 insertions(+), 2 deletions(-)
102
103
103 0
104 0
104 content1_missing_content1-tracked | 1 +
105 content1_missing_content1-tracked | 1 +
105 content1_missing_content3-tracked | 1 +
106 content1_missing_content3-tracked | 1 +
106 2 files changed, 2 insertions(+), 0 deletions(-)
107 2 files changed, 2 insertions(+), 0 deletions(-)
107
108
108 $ hg log -T '{rev}\n' --stat 'set:removed()'
109 $ hg log -T '{rev}\n' --stat 'set:removed()'
109 1
110 1
110 content1_content2_content1-untracked | 2 +-
111 content1_content2_content1-untracked | 2 +-
111 content1_content2_content2-untracked | 2 +-
112 content1_content2_content2-untracked | 2 +-
112 content1_content2_content3-untracked | 2 +-
113 content1_content2_content3-untracked | 2 +-
113 content1_content2_missing-untracked | 2 +-
114 content1_content2_missing-untracked | 2 +-
114 missing_content2_content2-untracked | 1 +
115 missing_content2_content2-untracked | 1 +
115 missing_content2_content3-untracked | 1 +
116 missing_content2_content3-untracked | 1 +
116 missing_content2_missing-untracked | 1 +
117 missing_content2_missing-untracked | 1 +
117 7 files changed, 7 insertions(+), 4 deletions(-)
118 7 files changed, 7 insertions(+), 4 deletions(-)
118
119
119 0
120 0
120 content1_content1_content1-untracked | 1 +
121 content1_content1_content1-untracked | 1 +
121 content1_content1_content3-untracked | 1 +
122 content1_content1_content3-untracked | 1 +
122 content1_content1_missing-untracked | 1 +
123 content1_content1_missing-untracked | 1 +
123 content1_content2_content1-untracked | 1 +
124 content1_content2_content1-untracked | 1 +
124 content1_content2_content2-untracked | 1 +
125 content1_content2_content2-untracked | 1 +
125 content1_content2_content3-untracked | 1 +
126 content1_content2_content3-untracked | 1 +
126 content1_content2_missing-untracked | 1 +
127 content1_content2_missing-untracked | 1 +
127 7 files changed, 7 insertions(+), 0 deletions(-)
128 7 files changed, 7 insertions(+), 0 deletions(-)
128
129
129 $ hg log -T '{rev}\n' --stat 'set:deleted()'
130 $ hg log -T '{rev}\n' --stat 'set:deleted()'
130 1
131 1
131 content1_content2_missing-tracked | 2 +-
132 content1_content2_missing-tracked | 2 +-
132 content1_missing_missing-tracked | 1 -
133 content1_missing_missing-tracked | 1 -
133 missing_content2_missing-tracked | 1 +
134 missing_content2_missing-tracked | 1 +
134 3 files changed, 2 insertions(+), 2 deletions(-)
135 3 files changed, 2 insertions(+), 2 deletions(-)
135
136
136 0
137 0
137 content1_content1_missing-tracked | 1 +
138 content1_content1_missing-tracked | 1 +
138 content1_content2_missing-tracked | 1 +
139 content1_content2_missing-tracked | 1 +
139 content1_missing_missing-tracked | 1 +
140 content1_missing_missing-tracked | 1 +
140 3 files changed, 3 insertions(+), 0 deletions(-)
141 3 files changed, 3 insertions(+), 0 deletions(-)
141
142
142 $ hg log -T '{rev}\n' --stat 'set:unknown()'
143 $ hg log -T '{rev}\n' --stat 'set:unknown()'
143 1
144 1
144 content1_missing_content1-untracked | 1 -
145 content1_missing_content1-untracked | 1 -
145 content1_missing_content3-untracked | 1 -
146 content1_missing_content3-untracked | 1 -
146 2 files changed, 0 insertions(+), 2 deletions(-)
147 2 files changed, 0 insertions(+), 2 deletions(-)
147
148
148 0
149 0
149 content1_missing_content1-untracked | 1 +
150 content1_missing_content1-untracked | 1 +
150 content1_missing_content3-untracked | 1 +
151 content1_missing_content3-untracked | 1 +
151 2 files changed, 2 insertions(+), 0 deletions(-)
152 2 files changed, 2 insertions(+), 0 deletions(-)
152
153
153 $ hg log -T '{rev}\n' --stat 'set:clean()'
154 $ hg log -T '{rev}\n' --stat 'set:clean()'
154 1
155 1
155 content1_content2_content2-tracked | 2 +-
156 content1_content2_content2-tracked | 2 +-
156 missing_content2_content2-tracked | 1 +
157 missing_content2_content2-tracked | 1 +
157 2 files changed, 2 insertions(+), 1 deletions(-)
158 2 files changed, 2 insertions(+), 1 deletions(-)
158
159
159 0
160 0
160 content1_content1_content1-tracked | 1 +
161 content1_content1_content1-tracked | 1 +
161 content1_content2_content2-tracked | 1 +
162 content1_content2_content2-tracked | 1 +
162 2 files changed, 2 insertions(+), 0 deletions(-)
163 2 files changed, 2 insertions(+), 0 deletions(-)
163
164
164 Test revert
165 Test revert
165
166
166 $ hg revert 'set:modified()'
167 $ hg revert 'set:modified()'
167 reverting content1_content1_content3-tracked
168 reverting content1_content1_content3-tracked
168 reverting content1_content2_content1-tracked
169 reverting content1_content2_content1-tracked
169 reverting content1_content2_content3-tracked
170 reverting content1_content2_content3-tracked
170 reverting missing_content2_content3-tracked
171 reverting missing_content2_content3-tracked
171
172
172 $ hg revert 'set:added()'
173 $ hg revert 'set:added()'
173 forgetting content1_missing_content1-tracked
174 forgetting content1_missing_content1-tracked
174 forgetting content1_missing_content3-tracked
175 forgetting content1_missing_content3-tracked
175 forgetting missing_missing_content3-tracked
176 forgetting missing_missing_content3-tracked
176
177
177 $ hg revert 'set:removed()'
178 $ hg revert 'set:removed()'
178 undeleting content1_content1_content1-untracked
179 undeleting content1_content1_content1-untracked
179 undeleting content1_content1_content3-untracked
180 undeleting content1_content1_content3-untracked
180 undeleting content1_content1_missing-untracked
181 undeleting content1_content1_missing-untracked
181 undeleting content1_content2_content1-untracked
182 undeleting content1_content2_content1-untracked
182 undeleting content1_content2_content2-untracked
183 undeleting content1_content2_content2-untracked
183 undeleting content1_content2_content3-untracked
184 undeleting content1_content2_content3-untracked
184 undeleting content1_content2_missing-untracked
185 undeleting content1_content2_missing-untracked
185 undeleting missing_content2_content2-untracked
186 undeleting missing_content2_content2-untracked
186 undeleting missing_content2_content3-untracked
187 undeleting missing_content2_content3-untracked
187 undeleting missing_content2_missing-untracked
188 undeleting missing_content2_missing-untracked
188
189
189 $ hg revert 'set:deleted()'
190 $ hg revert 'set:deleted()'
190 forgetting content1_missing_missing-tracked
191 forgetting content1_missing_missing-tracked
191 forgetting missing_missing_missing-tracked
192 forgetting missing_missing_missing-tracked
192 reverting content1_content1_missing-tracked
193 reverting content1_content1_missing-tracked
193 reverting content1_content2_missing-tracked
194 reverting content1_content2_missing-tracked
194 reverting missing_content2_missing-tracked
195 reverting missing_content2_missing-tracked
195
196
196 $ hg revert 'set:unknown()'
197 $ hg revert 'set:unknown()'
197
198
198 $ hg revert 'set:clean()'
199 $ hg revert 'set:clean()'
@@ -1,615 +1,616 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo start > start
3 $ echo start > start
3 $ hg ci -Amstart
4 $ hg ci -Amstart
4 adding start
5 adding start
5
6
6 New file:
7 New file:
7
8
8 $ mkdir dir1
9 $ mkdir dir1
9 $ echo new > dir1/new
10 $ echo new > dir1/new
10 $ hg ci -Amnew
11 $ hg ci -Amnew
11 adding dir1/new
12 adding dir1/new
12 $ hg diff --git -r 0
13 $ hg diff --git -r 0
13 diff --git a/dir1/new b/dir1/new
14 diff --git a/dir1/new b/dir1/new
14 new file mode 100644
15 new file mode 100644
15 --- /dev/null
16 --- /dev/null
16 +++ b/dir1/new
17 +++ b/dir1/new
17 @@ -0,0 +1,1 @@
18 @@ -0,0 +1,1 @@
18 +new
19 +new
19
20
20 Copy:
21 Copy:
21
22
22 $ mkdir dir2
23 $ mkdir dir2
23 $ hg cp dir1/new dir1/copy
24 $ hg cp dir1/new dir1/copy
24 $ echo copy1 >> dir1/copy
25 $ echo copy1 >> dir1/copy
25 $ hg cp dir1/new dir2/copy
26 $ hg cp dir1/new dir2/copy
26 $ echo copy2 >> dir2/copy
27 $ echo copy2 >> dir2/copy
27 $ hg ci -mcopy
28 $ hg ci -mcopy
28 $ hg diff --git -r 1:tip
29 $ hg diff --git -r 1:tip
29 diff --git a/dir1/new b/dir1/copy
30 diff --git a/dir1/new b/dir1/copy
30 copy from dir1/new
31 copy from dir1/new
31 copy to dir1/copy
32 copy to dir1/copy
32 --- a/dir1/new
33 --- a/dir1/new
33 +++ b/dir1/copy
34 +++ b/dir1/copy
34 @@ -1,1 +1,2 @@
35 @@ -1,1 +1,2 @@
35 new
36 new
36 +copy1
37 +copy1
37 diff --git a/dir1/new b/dir2/copy
38 diff --git a/dir1/new b/dir2/copy
38 copy from dir1/new
39 copy from dir1/new
39 copy to dir2/copy
40 copy to dir2/copy
40 --- a/dir1/new
41 --- a/dir1/new
41 +++ b/dir2/copy
42 +++ b/dir2/copy
42 @@ -1,1 +1,2 @@
43 @@ -1,1 +1,2 @@
43 new
44 new
44 +copy2
45 +copy2
45
46
46 Cross and same-directory copies with a relative root:
47 Cross and same-directory copies with a relative root:
47
48
48 $ hg diff --git --root .. -r 1:tip
49 $ hg diff --git --root .. -r 1:tip
49 abort: .. not under root '$TESTTMP'
50 abort: .. not under root '$TESTTMP/repo'
50 [255]
51 [255]
51 $ hg diff --git --root doesnotexist -r 1:tip
52 $ hg diff --git --root doesnotexist -r 1:tip
52 $ hg diff --git --root . -r 1:tip
53 $ hg diff --git --root . -r 1:tip
53 diff --git a/dir1/new b/dir1/copy
54 diff --git a/dir1/new b/dir1/copy
54 copy from dir1/new
55 copy from dir1/new
55 copy to dir1/copy
56 copy to dir1/copy
56 --- a/dir1/new
57 --- a/dir1/new
57 +++ b/dir1/copy
58 +++ b/dir1/copy
58 @@ -1,1 +1,2 @@
59 @@ -1,1 +1,2 @@
59 new
60 new
60 +copy1
61 +copy1
61 diff --git a/dir1/new b/dir2/copy
62 diff --git a/dir1/new b/dir2/copy
62 copy from dir1/new
63 copy from dir1/new
63 copy to dir2/copy
64 copy to dir2/copy
64 --- a/dir1/new
65 --- a/dir1/new
65 +++ b/dir2/copy
66 +++ b/dir2/copy
66 @@ -1,1 +1,2 @@
67 @@ -1,1 +1,2 @@
67 new
68 new
68 +copy2
69 +copy2
69 $ hg diff --git --root dir1 -r 1:tip
70 $ hg diff --git --root dir1 -r 1:tip
70 diff --git a/new b/copy
71 diff --git a/new b/copy
71 copy from new
72 copy from new
72 copy to copy
73 copy to copy
73 --- a/new
74 --- a/new
74 +++ b/copy
75 +++ b/copy
75 @@ -1,1 +1,2 @@
76 @@ -1,1 +1,2 @@
76 new
77 new
77 +copy1
78 +copy1
78
79
79 $ hg diff --git --root dir2/ -r 1:tip
80 $ hg diff --git --root dir2/ -r 1:tip
80 diff --git a/copy b/copy
81 diff --git a/copy b/copy
81 new file mode 100644
82 new file mode 100644
82 --- /dev/null
83 --- /dev/null
83 +++ b/copy
84 +++ b/copy
84 @@ -0,0 +1,2 @@
85 @@ -0,0 +1,2 @@
85 +new
86 +new
86 +copy2
87 +copy2
87
88
88 $ hg diff --git --root dir1 -r 1:tip -I '**/copy'
89 $ hg diff --git --root dir1 -r 1:tip -I '**/copy'
89 diff --git a/new b/copy
90 diff --git a/new b/copy
90 copy from new
91 copy from new
91 copy to copy
92 copy to copy
92 --- a/new
93 --- a/new
93 +++ b/copy
94 +++ b/copy
94 @@ -1,1 +1,2 @@
95 @@ -1,1 +1,2 @@
95 new
96 new
96 +copy1
97 +copy1
97
98
98 $ hg diff --git --root dir1 -r 1:tip dir2
99 $ hg diff --git --root dir1 -r 1:tip dir2
99 warning: dir2 not inside relative root dir1
100 warning: dir2 not inside relative root dir1
100
101
101 $ hg diff --git --root dir1 -r 1:tip 'dir2/{copy}'
102 $ hg diff --git --root dir1 -r 1:tip 'dir2/{copy}'
102 warning: dir2/{copy} not inside relative root dir1
103 warning: dir2/{copy} not inside relative root dir1
103
104
104 $ cd dir1
105 $ cd dir1
105 $ hg diff --git --root .. -r 1:tip
106 $ hg diff --git --root .. -r 1:tip
106 diff --git a/dir1/new b/dir1/copy
107 diff --git a/dir1/new b/dir1/copy
107 copy from dir1/new
108 copy from dir1/new
108 copy to dir1/copy
109 copy to dir1/copy
109 --- a/dir1/new
110 --- a/dir1/new
110 +++ b/dir1/copy
111 +++ b/dir1/copy
111 @@ -1,1 +1,2 @@
112 @@ -1,1 +1,2 @@
112 new
113 new
113 +copy1
114 +copy1
114 diff --git a/dir1/new b/dir2/copy
115 diff --git a/dir1/new b/dir2/copy
115 copy from dir1/new
116 copy from dir1/new
116 copy to dir2/copy
117 copy to dir2/copy
117 --- a/dir1/new
118 --- a/dir1/new
118 +++ b/dir2/copy
119 +++ b/dir2/copy
119 @@ -1,1 +1,2 @@
120 @@ -1,1 +1,2 @@
120 new
121 new
121 +copy2
122 +copy2
122
123
123 $ hg diff --git --root ../.. -r 1:tip
124 $ hg diff --git --root ../.. -r 1:tip
124 abort: ../.. not under root '$TESTTMP'
125 abort: ../.. not under root '$TESTTMP/repo'
125 [255]
126 [255]
126 $ hg diff --git --root ../doesnotexist -r 1:tip
127 $ hg diff --git --root ../doesnotexist -r 1:tip
127 $ hg diff --git --root .. -r 1:tip
128 $ hg diff --git --root .. -r 1:tip
128 diff --git a/dir1/new b/dir1/copy
129 diff --git a/dir1/new b/dir1/copy
129 copy from dir1/new
130 copy from dir1/new
130 copy to dir1/copy
131 copy to dir1/copy
131 --- a/dir1/new
132 --- a/dir1/new
132 +++ b/dir1/copy
133 +++ b/dir1/copy
133 @@ -1,1 +1,2 @@
134 @@ -1,1 +1,2 @@
134 new
135 new
135 +copy1
136 +copy1
136 diff --git a/dir1/new b/dir2/copy
137 diff --git a/dir1/new b/dir2/copy
137 copy from dir1/new
138 copy from dir1/new
138 copy to dir2/copy
139 copy to dir2/copy
139 --- a/dir1/new
140 --- a/dir1/new
140 +++ b/dir2/copy
141 +++ b/dir2/copy
141 @@ -1,1 +1,2 @@
142 @@ -1,1 +1,2 @@
142 new
143 new
143 +copy2
144 +copy2
144
145
145 $ hg diff --git --root . -r 1:tip
146 $ hg diff --git --root . -r 1:tip
146 diff --git a/new b/copy
147 diff --git a/new b/copy
147 copy from new
148 copy from new
148 copy to copy
149 copy to copy
149 --- a/new
150 --- a/new
150 +++ b/copy
151 +++ b/copy
151 @@ -1,1 +1,2 @@
152 @@ -1,1 +1,2 @@
152 new
153 new
153 +copy1
154 +copy1
154 $ hg diff --git --root . -r 1:tip copy
155 $ hg diff --git --root . -r 1:tip copy
155 diff --git a/new b/copy
156 diff --git a/new b/copy
156 copy from new
157 copy from new
157 copy to copy
158 copy to copy
158 --- a/new
159 --- a/new
159 +++ b/copy
160 +++ b/copy
160 @@ -1,1 +1,2 @@
161 @@ -1,1 +1,2 @@
161 new
162 new
162 +copy1
163 +copy1
163 $ hg diff --git --root . -r 1:tip ../dir2
164 $ hg diff --git --root . -r 1:tip ../dir2
164 warning: ../dir2 not inside relative root .
165 warning: ../dir2 not inside relative root .
165 $ hg diff --git --root . -r 1:tip '../dir2/*'
166 $ hg diff --git --root . -r 1:tip '../dir2/*'
166 warning: ../dir2/* not inside relative root . (glob)
167 warning: ../dir2/* not inside relative root . (glob)
167 $ cd ..
168 $ cd ..
168
169
169 Rename:
170 Rename:
170
171
171 $ hg mv dir1/copy dir1/rename1
172 $ hg mv dir1/copy dir1/rename1
172 $ echo rename1 >> dir1/rename1
173 $ echo rename1 >> dir1/rename1
173 $ hg mv dir2/copy dir1/rename2
174 $ hg mv dir2/copy dir1/rename2
174 $ echo rename2 >> dir1/rename2
175 $ echo rename2 >> dir1/rename2
175 $ hg ci -mrename
176 $ hg ci -mrename
176 $ hg diff --git -r 2:tip
177 $ hg diff --git -r 2:tip
177 diff --git a/dir1/copy b/dir1/rename1
178 diff --git a/dir1/copy b/dir1/rename1
178 rename from dir1/copy
179 rename from dir1/copy
179 rename to dir1/rename1
180 rename to dir1/rename1
180 --- a/dir1/copy
181 --- a/dir1/copy
181 +++ b/dir1/rename1
182 +++ b/dir1/rename1
182 @@ -1,2 +1,3 @@
183 @@ -1,2 +1,3 @@
183 new
184 new
184 copy1
185 copy1
185 +rename1
186 +rename1
186 diff --git a/dir2/copy b/dir1/rename2
187 diff --git a/dir2/copy b/dir1/rename2
187 rename from dir2/copy
188 rename from dir2/copy
188 rename to dir1/rename2
189 rename to dir1/rename2
189 --- a/dir2/copy
190 --- a/dir2/copy
190 +++ b/dir1/rename2
191 +++ b/dir1/rename2
191 @@ -1,2 +1,3 @@
192 @@ -1,2 +1,3 @@
192 new
193 new
193 copy2
194 copy2
194 +rename2
195 +rename2
195
196
196 Cross and same-directory renames with a relative root:
197 Cross and same-directory renames with a relative root:
197
198
198 $ hg diff --root dir1 --git -r 2:tip
199 $ hg diff --root dir1 --git -r 2:tip
199 diff --git a/copy b/rename1
200 diff --git a/copy b/rename1
200 rename from copy
201 rename from copy
201 rename to rename1
202 rename to rename1
202 --- a/copy
203 --- a/copy
203 +++ b/rename1
204 +++ b/rename1
204 @@ -1,2 +1,3 @@
205 @@ -1,2 +1,3 @@
205 new
206 new
206 copy1
207 copy1
207 +rename1
208 +rename1
208 diff --git a/rename2 b/rename2
209 diff --git a/rename2 b/rename2
209 new file mode 100644
210 new file mode 100644
210 --- /dev/null
211 --- /dev/null
211 +++ b/rename2
212 +++ b/rename2
212 @@ -0,0 +1,3 @@
213 @@ -0,0 +1,3 @@
213 +new
214 +new
214 +copy2
215 +copy2
215 +rename2
216 +rename2
216
217
217 $ hg diff --root dir2 --git -r 2:tip
218 $ hg diff --root dir2 --git -r 2:tip
218 diff --git a/copy b/copy
219 diff --git a/copy b/copy
219 deleted file mode 100644
220 deleted file mode 100644
220 --- a/copy
221 --- a/copy
221 +++ /dev/null
222 +++ /dev/null
222 @@ -1,2 +0,0 @@
223 @@ -1,2 +0,0 @@
223 -new
224 -new
224 -copy2
225 -copy2
225
226
226 $ hg diff --root dir1 --git -r 2:tip -I '**/copy'
227 $ hg diff --root dir1 --git -r 2:tip -I '**/copy'
227 diff --git a/copy b/copy
228 diff --git a/copy b/copy
228 deleted file mode 100644
229 deleted file mode 100644
229 --- a/copy
230 --- a/copy
230 +++ /dev/null
231 +++ /dev/null
231 @@ -1,2 +0,0 @@
232 @@ -1,2 +0,0 @@
232 -new
233 -new
233 -copy1
234 -copy1
234
235
235 $ hg diff --root dir1 --git -r 2:tip -I '**/rename*'
236 $ hg diff --root dir1 --git -r 2:tip -I '**/rename*'
236 diff --git a/copy b/rename1
237 diff --git a/copy b/rename1
237 copy from copy
238 copy from copy
238 copy to rename1
239 copy to rename1
239 --- a/copy
240 --- a/copy
240 +++ b/rename1
241 +++ b/rename1
241 @@ -1,2 +1,3 @@
242 @@ -1,2 +1,3 @@
242 new
243 new
243 copy1
244 copy1
244 +rename1
245 +rename1
245 diff --git a/rename2 b/rename2
246 diff --git a/rename2 b/rename2
246 new file mode 100644
247 new file mode 100644
247 --- /dev/null
248 --- /dev/null
248 +++ b/rename2
249 +++ b/rename2
249 @@ -0,0 +1,3 @@
250 @@ -0,0 +1,3 @@
250 +new
251 +new
251 +copy2
252 +copy2
252 +rename2
253 +rename2
253
254
254 Delete:
255 Delete:
255
256
256 $ hg rm dir1/*
257 $ hg rm dir1/*
257 $ hg ci -mdelete
258 $ hg ci -mdelete
258 $ hg diff --git -r 3:tip
259 $ hg diff --git -r 3:tip
259 diff --git a/dir1/new b/dir1/new
260 diff --git a/dir1/new b/dir1/new
260 deleted file mode 100644
261 deleted file mode 100644
261 --- a/dir1/new
262 --- a/dir1/new
262 +++ /dev/null
263 +++ /dev/null
263 @@ -1,1 +0,0 @@
264 @@ -1,1 +0,0 @@
264 -new
265 -new
265 diff --git a/dir1/rename1 b/dir1/rename1
266 diff --git a/dir1/rename1 b/dir1/rename1
266 deleted file mode 100644
267 deleted file mode 100644
267 --- a/dir1/rename1
268 --- a/dir1/rename1
268 +++ /dev/null
269 +++ /dev/null
269 @@ -1,3 +0,0 @@
270 @@ -1,3 +0,0 @@
270 -new
271 -new
271 -copy1
272 -copy1
272 -rename1
273 -rename1
273 diff --git a/dir1/rename2 b/dir1/rename2
274 diff --git a/dir1/rename2 b/dir1/rename2
274 deleted file mode 100644
275 deleted file mode 100644
275 --- a/dir1/rename2
276 --- a/dir1/rename2
276 +++ /dev/null
277 +++ /dev/null
277 @@ -1,3 +0,0 @@
278 @@ -1,3 +0,0 @@
278 -new
279 -new
279 -copy2
280 -copy2
280 -rename2
281 -rename2
281
282
282 $ cat > src <<EOF
283 $ cat > src <<EOF
283 > 1
284 > 1
284 > 2
285 > 2
285 > 3
286 > 3
286 > 4
287 > 4
287 > 5
288 > 5
288 > EOF
289 > EOF
289 $ hg ci -Amsrc
290 $ hg ci -Amsrc
290 adding src
291 adding src
291
292
292 #if execbit
293 #if execbit
293
294
294 chmod 644:
295 chmod 644:
295
296
296 $ chmod +x src
297 $ chmod +x src
297 $ hg ci -munexec
298 $ hg ci -munexec
298 $ hg diff --git -r 5:tip
299 $ hg diff --git -r 5:tip
299 diff --git a/src b/src
300 diff --git a/src b/src
300 old mode 100644
301 old mode 100644
301 new mode 100755
302 new mode 100755
302
303
303 Rename+mod+chmod:
304 Rename+mod+chmod:
304
305
305 $ hg mv src dst
306 $ hg mv src dst
306 $ chmod -x dst
307 $ chmod -x dst
307 $ echo a >> dst
308 $ echo a >> dst
308 $ hg ci -mrenamemod
309 $ hg ci -mrenamemod
309 $ hg diff --git -r 6:tip
310 $ hg diff --git -r 6:tip
310 diff --git a/src b/dst
311 diff --git a/src b/dst
311 old mode 100755
312 old mode 100755
312 new mode 100644
313 new mode 100644
313 rename from src
314 rename from src
314 rename to dst
315 rename to dst
315 --- a/src
316 --- a/src
316 +++ b/dst
317 +++ b/dst
317 @@ -3,3 +3,4 @@
318 @@ -3,3 +3,4 @@
318 3
319 3
319 4
320 4
320 5
321 5
321 +a
322 +a
322
323
323 Nonexistent in tip+chmod:
324 Nonexistent in tip+chmod:
324
325
325 $ hg diff --git -r 5:6
326 $ hg diff --git -r 5:6
326 diff --git a/src b/src
327 diff --git a/src b/src
327 old mode 100644
328 old mode 100644
328 new mode 100755
329 new mode 100755
329
330
330 #else
331 #else
331
332
332 Dummy changes when no exec bit, mocking the execbit commit structure
333 Dummy changes when no exec bit, mocking the execbit commit structure
333
334
334 $ echo change >> src
335 $ echo change >> src
335 $ hg ci -munexec
336 $ hg ci -munexec
336 $ hg mv src dst
337 $ hg mv src dst
337 $ hg ci -mrenamemod
338 $ hg ci -mrenamemod
338
339
339 #endif
340 #endif
340
341
341 Binary diff:
342 Binary diff:
342
343
343 $ cp "$TESTDIR/binfile.bin" .
344 $ cp "$TESTDIR/binfile.bin" .
344 $ hg add binfile.bin
345 $ hg add binfile.bin
345 $ hg diff --git > b.diff
346 $ hg diff --git > b.diff
346 $ cat b.diff
347 $ cat b.diff
347 diff --git a/binfile.bin b/binfile.bin
348 diff --git a/binfile.bin b/binfile.bin
348 new file mode 100644
349 new file mode 100644
349 index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
350 index 0000000000000000000000000000000000000000..37ba3d1c6f17137d9c5f5776fa040caf5fe73ff9
350 GIT binary patch
351 GIT binary patch
351 literal 593
352 literal 593
352 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
353 zc$@)I0<QguP)<h;3K|Lk000e1NJLTq000mG000mO0ssI2kdbIM00009a7bBm000XU
353 z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd
354 z000XU0RWnu7ytkO2XskIMF-Uh9TW;VpMjwv0005-Nkl<ZD9@FWPs=e;7{<>W$NUkd
354 zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M
355 zX$nnYLt$-$V!?uy+1V%`z&Eh=ah|duER<4|QWhju3gb^nF*8iYobxWG-qqXl=2~5M
355 z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT
356 z*IoDB)sG^CfNuoBmqLTVU^<;@nwHP!1wrWd`{(mHo6VNXWtyh{alzqmsH*yYzpvLT
356 zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po
357 zLdY<T=ks|woh-`&01!ej#(xbV1f|pI*=%;d-%F*E*X#ZH`4I%6SS+$EJDE&ct=8po
357 ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<;
358 ziN#{?_j|kD%Cd|oiqds`xm@;oJ-^?NG3Gdqrs?5u*zI;{nogxsx~^|Fn^Y?Gdc6<;
358 zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V
359 zfMJ+iF1J`LMx&A2?dEwNW8ClebzPTbIh{@$hS6*`kH@1d%Lo7fA#}N1)oN7`gm$~V
359 z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W-
360 z+wDx#)OFqMcE{s!JN0-xhG8ItAjVkJwEcb`3WWlJfU2r?;Pd%dmR+q@mSri5q9_W-
360 zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U;
361 zaR2~ECX?B2w+zELozC0s*6Z~|QG^f{3I#<`?)Q7U-JZ|q5W;9Q8i_=pBuSzunx=U;
361 z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K
362 z9C)5jBoYw9^?EHyQl(M}1OlQcCX>lXB*ODN003Z&P17_@)3Pi=i0wb04<W?v-u}7K
362 zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#=
363 zXmmQA+wDgE!qR9o8jr`%=ab_&uh(l?R=r;Tjiqon91I2-hIu?57~@*4h7h9uORK#=
363 fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4
364 fQItJW-{SoTm)8|5##k|m00000NkvXXu0mjf{mKw4
364
365
365
366
366 Import binary diff:
367 Import binary diff:
367
368
368 $ hg revert binfile.bin
369 $ hg revert binfile.bin
369 $ rm binfile.bin
370 $ rm binfile.bin
370 $ hg import -mfoo b.diff
371 $ hg import -mfoo b.diff
371 applying b.diff
372 applying b.diff
372 $ cmp binfile.bin "$TESTDIR/binfile.bin"
373 $ cmp binfile.bin "$TESTDIR/binfile.bin"
373
374
374 Rename binary file:
375 Rename binary file:
375
376
376 $ hg mv binfile.bin renamed.bin
377 $ hg mv binfile.bin renamed.bin
377 $ hg diff --git
378 $ hg diff --git
378 diff --git a/binfile.bin b/renamed.bin
379 diff --git a/binfile.bin b/renamed.bin
379 rename from binfile.bin
380 rename from binfile.bin
380 rename to renamed.bin
381 rename to renamed.bin
381
382
382 Diff across many revisions:
383 Diff across many revisions:
383
384
384 $ hg mv dst dst2
385 $ hg mv dst dst2
385 $ hg ci -m 'mv dst dst2'
386 $ hg ci -m 'mv dst dst2'
386
387
387 $ echo >> start
388 $ echo >> start
388 $ hg ci -m 'change start'
389 $ hg ci -m 'change start'
389
390
390 $ hg revert -r -2 start
391 $ hg revert -r -2 start
391 $ hg mv dst2 dst3
392 $ hg mv dst2 dst3
392 $ hg ci -m 'mv dst2 dst3; revert start'
393 $ hg ci -m 'mv dst2 dst3; revert start'
393
394
394 $ hg diff --git -r 9:11
395 $ hg diff --git -r 9:11
395 diff --git a/dst2 b/dst3
396 diff --git a/dst2 b/dst3
396 rename from dst2
397 rename from dst2
397 rename to dst3
398 rename to dst3
398
399
399 Reversed:
400 Reversed:
400
401
401 $ hg diff --git -r 11:9
402 $ hg diff --git -r 11:9
402 diff --git a/dst3 b/dst2
403 diff --git a/dst3 b/dst2
403 rename from dst3
404 rename from dst3
404 rename to dst2
405 rename to dst2
405
406
406
407
407 $ echo a >> foo
408 $ echo a >> foo
408 $ hg add foo
409 $ hg add foo
409 $ hg ci -m 'add foo'
410 $ hg ci -m 'add foo'
410 $ echo b >> foo
411 $ echo b >> foo
411 $ hg ci -m 'change foo'
412 $ hg ci -m 'change foo'
412 $ hg mv foo bar
413 $ hg mv foo bar
413 $ hg ci -m 'mv foo bar'
414 $ hg ci -m 'mv foo bar'
414 $ echo c >> bar
415 $ echo c >> bar
415 $ hg ci -m 'change bar'
416 $ hg ci -m 'change bar'
416
417
417 File created before r1 and renamed before r2:
418 File created before r1 and renamed before r2:
418
419
419 $ hg diff --git -r -3:-1
420 $ hg diff --git -r -3:-1
420 diff --git a/foo b/bar
421 diff --git a/foo b/bar
421 rename from foo
422 rename from foo
422 rename to bar
423 rename to bar
423 --- a/foo
424 --- a/foo
424 +++ b/bar
425 +++ b/bar
425 @@ -1,2 +1,3 @@
426 @@ -1,2 +1,3 @@
426 a
427 a
427 b
428 b
428 +c
429 +c
429
430
430 Reversed:
431 Reversed:
431
432
432 $ hg diff --git -r -1:-3
433 $ hg diff --git -r -1:-3
433 diff --git a/bar b/foo
434 diff --git a/bar b/foo
434 rename from bar
435 rename from bar
435 rename to foo
436 rename to foo
436 --- a/bar
437 --- a/bar
437 +++ b/foo
438 +++ b/foo
438 @@ -1,3 +1,2 @@
439 @@ -1,3 +1,2 @@
439 a
440 a
440 b
441 b
441 -c
442 -c
442
443
443 File created in r1 and renamed before r2:
444 File created in r1 and renamed before r2:
444
445
445 $ hg diff --git -r -4:-1
446 $ hg diff --git -r -4:-1
446 diff --git a/foo b/bar
447 diff --git a/foo b/bar
447 rename from foo
448 rename from foo
448 rename to bar
449 rename to bar
449 --- a/foo
450 --- a/foo
450 +++ b/bar
451 +++ b/bar
451 @@ -1,1 +1,3 @@
452 @@ -1,1 +1,3 @@
452 a
453 a
453 +b
454 +b
454 +c
455 +c
455
456
456 Reversed:
457 Reversed:
457
458
458 $ hg diff --git -r -1:-4
459 $ hg diff --git -r -1:-4
459 diff --git a/bar b/foo
460 diff --git a/bar b/foo
460 rename from bar
461 rename from bar
461 rename to foo
462 rename to foo
462 --- a/bar
463 --- a/bar
463 +++ b/foo
464 +++ b/foo
464 @@ -1,3 +1,1 @@
465 @@ -1,3 +1,1 @@
465 a
466 a
466 -b
467 -b
467 -c
468 -c
468
469
469 File created after r1 and renamed before r2:
470 File created after r1 and renamed before r2:
470
471
471 $ hg diff --git -r -5:-1
472 $ hg diff --git -r -5:-1
472 diff --git a/bar b/bar
473 diff --git a/bar b/bar
473 new file mode 100644
474 new file mode 100644
474 --- /dev/null
475 --- /dev/null
475 +++ b/bar
476 +++ b/bar
476 @@ -0,0 +1,3 @@
477 @@ -0,0 +1,3 @@
477 +a
478 +a
478 +b
479 +b
479 +c
480 +c
480
481
481 Reversed:
482 Reversed:
482
483
483 $ hg diff --git -r -1:-5
484 $ hg diff --git -r -1:-5
484 diff --git a/bar b/bar
485 diff --git a/bar b/bar
485 deleted file mode 100644
486 deleted file mode 100644
486 --- a/bar
487 --- a/bar
487 +++ /dev/null
488 +++ /dev/null
488 @@ -1,3 +0,0 @@
489 @@ -1,3 +0,0 @@
489 -a
490 -a
490 -b
491 -b
491 -c
492 -c
492
493
493
494
494 Comparing with the working dir:
495 Comparing with the working dir:
495
496
496 $ echo >> start
497 $ echo >> start
497 $ hg ci -m 'change start again'
498 $ hg ci -m 'change start again'
498
499
499 $ echo > created
500 $ echo > created
500 $ hg add created
501 $ hg add created
501 $ hg ci -m 'add created'
502 $ hg ci -m 'add created'
502
503
503 $ hg mv created created2
504 $ hg mv created created2
504 $ hg ci -m 'mv created created2'
505 $ hg ci -m 'mv created created2'
505
506
506 $ hg mv created2 created3
507 $ hg mv created2 created3
507
508
508 There's a copy in the working dir:
509 There's a copy in the working dir:
509
510
510 $ hg diff --git
511 $ hg diff --git
511 diff --git a/created2 b/created3
512 diff --git a/created2 b/created3
512 rename from created2
513 rename from created2
513 rename to created3
514 rename to created3
514
515
515 There's another copy between the original rev and the wd:
516 There's another copy between the original rev and the wd:
516
517
517 $ hg diff --git -r -2
518 $ hg diff --git -r -2
518 diff --git a/created b/created3
519 diff --git a/created b/created3
519 rename from created
520 rename from created
520 rename to created3
521 rename to created3
521
522
522 The source of the copy was created after the original rev:
523 The source of the copy was created after the original rev:
523
524
524 $ hg diff --git -r -3
525 $ hg diff --git -r -3
525 diff --git a/created3 b/created3
526 diff --git a/created3 b/created3
526 new file mode 100644
527 new file mode 100644
527 --- /dev/null
528 --- /dev/null
528 +++ b/created3
529 +++ b/created3
529 @@ -0,0 +1,1 @@
530 @@ -0,0 +1,1 @@
530 +
531 +
531 $ hg ci -m 'mv created2 created3'
532 $ hg ci -m 'mv created2 created3'
532
533
533
534
534 $ echo > brand-new
535 $ echo > brand-new
535 $ hg add brand-new
536 $ hg add brand-new
536 $ hg ci -m 'add brand-new'
537 $ hg ci -m 'add brand-new'
537 $ hg mv brand-new brand-new2
538 $ hg mv brand-new brand-new2
538
539
539 Created in parent of wd; renamed in the wd:
540 Created in parent of wd; renamed in the wd:
540
541
541 $ hg diff --git
542 $ hg diff --git
542 diff --git a/brand-new b/brand-new2
543 diff --git a/brand-new b/brand-new2
543 rename from brand-new
544 rename from brand-new
544 rename to brand-new2
545 rename to brand-new2
545
546
546 Created between r1 and parent of wd; renamed in the wd:
547 Created between r1 and parent of wd; renamed in the wd:
547
548
548 $ hg diff --git -r -2
549 $ hg diff --git -r -2
549 diff --git a/brand-new2 b/brand-new2
550 diff --git a/brand-new2 b/brand-new2
550 new file mode 100644
551 new file mode 100644
551 --- /dev/null
552 --- /dev/null
552 +++ b/brand-new2
553 +++ b/brand-new2
553 @@ -0,0 +1,1 @@
554 @@ -0,0 +1,1 @@
554 +
555 +
555 $ hg ci -m 'mv brand-new brand-new2'
556 $ hg ci -m 'mv brand-new brand-new2'
556
557
557 One file is copied to many destinations and removed:
558 One file is copied to many destinations and removed:
558
559
559 $ hg cp brand-new2 brand-new3
560 $ hg cp brand-new2 brand-new3
560 $ hg mv brand-new2 brand-new3-2
561 $ hg mv brand-new2 brand-new3-2
561 $ hg ci -m 'multiple renames/copies'
562 $ hg ci -m 'multiple renames/copies'
562 $ hg diff --git -r -2 -r -1
563 $ hg diff --git -r -2 -r -1
563 diff --git a/brand-new2 b/brand-new3
564 diff --git a/brand-new2 b/brand-new3
564 rename from brand-new2
565 rename from brand-new2
565 rename to brand-new3
566 rename to brand-new3
566 diff --git a/brand-new2 b/brand-new3-2
567 diff --git a/brand-new2 b/brand-new3-2
567 copy from brand-new2
568 copy from brand-new2
568 copy to brand-new3-2
569 copy to brand-new3-2
569
570
570 Reversed:
571 Reversed:
571
572
572 $ hg diff --git -r -1 -r -2
573 $ hg diff --git -r -1 -r -2
573 diff --git a/brand-new3-2 b/brand-new2
574 diff --git a/brand-new3-2 b/brand-new2
574 rename from brand-new3-2
575 rename from brand-new3-2
575 rename to brand-new2
576 rename to brand-new2
576 diff --git a/brand-new3 b/brand-new3
577 diff --git a/brand-new3 b/brand-new3
577 deleted file mode 100644
578 deleted file mode 100644
578 --- a/brand-new3
579 --- a/brand-new3
579 +++ /dev/null
580 +++ /dev/null
580 @@ -1,1 +0,0 @@
581 @@ -1,1 +0,0 @@
581 -
582 -
582
583
583 There should be a trailing TAB if there are spaces in the file name:
584 There should be a trailing TAB if there are spaces in the file name:
584
585
585 $ echo foo > 'with spaces'
586 $ echo foo > 'with spaces'
586 $ hg add 'with spaces'
587 $ hg add 'with spaces'
587 $ hg diff --git
588 $ hg diff --git
588 diff --git a/with spaces b/with spaces
589 diff --git a/with spaces b/with spaces
589 new file mode 100644
590 new file mode 100644
590 --- /dev/null
591 --- /dev/null
591 +++ b/with spaces
592 +++ b/with spaces
592 @@ -0,0 +1,1 @@
593 @@ -0,0 +1,1 @@
593 +foo
594 +foo
594 $ hg ci -m 'add filename with spaces'
595 $ hg ci -m 'add filename with spaces'
595
596
596 Additions should be properly marked even in the middle of a merge
597 Additions should be properly marked even in the middle of a merge
597
598
598 $ hg up -r -2
599 $ hg up -r -2
599 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
600 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
600 $ echo "New File" >> inmerge
601 $ echo "New File" >> inmerge
601 $ hg add inmerge
602 $ hg add inmerge
602 $ hg ci -m "file in merge"
603 $ hg ci -m "file in merge"
603 created new head
604 created new head
604 $ hg up 23
605 $ hg up 23
605 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
606 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
606 $ hg merge
607 $ hg merge
607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 (branch merge, don't forget to commit)
609 (branch merge, don't forget to commit)
609 $ hg diff -g
610 $ hg diff -g
610 diff --git a/inmerge b/inmerge
611 diff --git a/inmerge b/inmerge
611 new file mode 100644
612 new file mode 100644
612 --- /dev/null
613 --- /dev/null
613 +++ b/inmerge
614 +++ b/inmerge
614 @@ -0,0 +1,1 @@
615 @@ -0,0 +1,1 @@
615 +New File
616 +New File
@@ -1,26 +1,27 b''
1 https://bz.mercurial-scm.org/1089
1 https://bz.mercurial-scm.org/1089
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ mkdir a
5 $ mkdir a
5 $ echo a > a/b
6 $ echo a > a/b
6 $ hg ci -Am m
7 $ hg ci -Am m
7 adding a/b
8 adding a/b
8
9
9 $ hg rm a
10 $ hg rm a
10 removing a/b
11 removing a/b
11 $ hg ci -m m a
12 $ hg ci -m m a
12
13
13 $ mkdir a b
14 $ mkdir a b
14 $ echo a > a/b
15 $ echo a > a/b
15 $ hg ci -Am m
16 $ hg ci -Am m
16 adding a/b
17 adding a/b
17
18
18 $ hg rm a
19 $ hg rm a
19 removing a/b
20 removing a/b
20 $ cd b
21 $ cd b
21
22
22 Relative delete:
23 Relative delete:
23
24
24 $ hg ci -m m ../a
25 $ hg ci -m m ../a
25
26
26 $ cd ..
27 $ cd ..
@@ -1,96 +1,97 b''
1 https://bz.mercurial-scm.org/1175
1 https://bz.mercurial-scm.org/1175
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ touch a
5 $ touch a
5 $ hg ci -Am0
6 $ hg ci -Am0
6 adding a
7 adding a
7
8
8 $ hg mv a a1
9 $ hg mv a a1
9 $ hg ci -m1
10 $ hg ci -m1
10
11
11 $ hg co 0
12 $ hg co 0
12 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
13
14
14 $ hg mv a a2
15 $ hg mv a a2
15 $ hg up
16 $ hg up
16 note: possible conflict - a was renamed multiple times to:
17 note: possible conflict - a was renamed multiple times to:
17 a1
18 a1
18 a2
19 a2
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20
21
21 $ hg ci -m2
22 $ hg ci -m2
22
23
23 $ touch a
24 $ touch a
24 $ hg ci -Am3
25 $ hg ci -Am3
25 adding a
26 adding a
26
27
27 $ hg mv a b
28 $ hg mv a b
28 $ hg ci -Am4 a
29 $ hg ci -Am4 a
29
30
30 $ hg ci --debug --traceback -Am5 b
31 $ hg ci --debug --traceback -Am5 b
31 committing files:
32 committing files:
32 b
33 b
33 warning: can't find ancestor for 'b' copied from 'a'!
34 warning: can't find ancestor for 'b' copied from 'a'!
34 committing manifest
35 committing manifest
35 committing changelog
36 committing changelog
36 updating the branch cache
37 updating the branch cache
37 committed changeset 5:83a687e8a97c80992ba385bbfd766be181bfb1d1
38 committed changeset 5:83a687e8a97c80992ba385bbfd766be181bfb1d1
38
39
39 $ hg verify
40 $ hg verify
40 checking changesets
41 checking changesets
41 checking manifests
42 checking manifests
42 crosschecking files in changesets and manifests
43 crosschecking files in changesets and manifests
43 checking files
44 checking files
44 checked 6 changesets with 4 changes to 4 files
45 checked 6 changesets with 4 changes to 4 files
45
46
46 $ hg export --git tip
47 $ hg export --git tip
47 # HG changeset patch
48 # HG changeset patch
48 # User test
49 # User test
49 # Date 0 0
50 # Date 0 0
50 # Thu Jan 01 00:00:00 1970 +0000
51 # Thu Jan 01 00:00:00 1970 +0000
51 # Node ID 83a687e8a97c80992ba385bbfd766be181bfb1d1
52 # Node ID 83a687e8a97c80992ba385bbfd766be181bfb1d1
52 # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f
53 # Parent 1d1625283f71954f21d14c3d44d0ad3c019c597f
53 5
54 5
54
55
55 diff --git a/b b/b
56 diff --git a/b b/b
56 new file mode 100644
57 new file mode 100644
57
58
58 https://bz.mercurial-scm.org/show_bug.cgi?id=4476
59 https://bz.mercurial-scm.org/show_bug.cgi?id=4476
59
60
60 $ hg init foo
61 $ hg init foo
61 $ cd foo
62 $ cd foo
62 $ touch a && hg ci -Aqm a
63 $ touch a && hg ci -Aqm a
63 $ hg mv a b
64 $ hg mv a b
64 $ echo b1 >> b
65 $ echo b1 >> b
65 $ hg ci -Aqm b1
66 $ hg ci -Aqm b1
66 $ hg up 0
67 $ hg up 0
67 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 $ hg mv a b
69 $ hg mv a b
69 $ echo b2 >> b
70 $ echo b2 >> b
70 $ hg ci -Aqm b2
71 $ hg ci -Aqm b2
71 $ hg graft 1
72 $ hg graft 1
72 grafting 1:5974126fad84 "b1"
73 grafting 1:5974126fad84 "b1"
73 merging b
74 merging b
74 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
75 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
75 abort: unresolved conflicts, can't continue
76 abort: unresolved conflicts, can't continue
76 (use 'hg resolve' and 'hg graft --continue')
77 (use 'hg resolve' and 'hg graft --continue')
77 [1]
78 [1]
78 $ echo a > b
79 $ echo a > b
79 $ echo b3 >> b
80 $ echo b3 >> b
80 $ hg resolve --mark b
81 $ hg resolve --mark b
81 (no more unresolved files)
82 (no more unresolved files)
82 continue: hg graft --continue
83 continue: hg graft --continue
83 $ hg graft --continue
84 $ hg graft --continue
84 grafting 1:5974126fad84 "b1"
85 grafting 1:5974126fad84 "b1"
85 $ hg log -f b -T 'changeset: {rev}:{node|short}\nsummary: {desc}\n\n'
86 $ hg log -f b -T 'changeset: {rev}:{node|short}\nsummary: {desc}\n\n'
86 changeset: 3:376d30ccffc0
87 changeset: 3:376d30ccffc0
87 summary: b1
88 summary: b1
88
89
89 changeset: 2:416baaa2e5e4
90 changeset: 2:416baaa2e5e4
90 summary: b2
91 summary: b2
91
92
92 changeset: 0:3903775176ed
93 changeset: 0:3903775176ed
93 summary: a
94 summary: a
94
95
95
96
96
97
@@ -1,23 +1,24 b''
1 #require symlink
1 #require symlink
2
2
3 https://bz.mercurial-scm.org/1438
3 https://bz.mercurial-scm.org/1438
4
4
5 $ hg init
5 $ hg init repo
6 $ cd repo
6
7
7 $ ln -s foo link
8 $ ln -s foo link
8 $ hg add link
9 $ hg add link
9 $ hg ci -mbad link
10 $ hg ci -mbad link
10 $ hg rm link
11 $ hg rm link
11 $ hg ci -mok
12 $ hg ci -mok
12 $ hg diff -g -r 0:1 > bad.patch
13 $ hg diff -g -r 0:1 > bad.patch
13
14
14 $ hg up 0
15 $ hg up 0
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16
17
17 $ hg import --no-commit bad.patch
18 $ hg import --no-commit bad.patch
18 applying bad.patch
19 applying bad.patch
19
20
20 $ hg status
21 $ hg status
21 R link
22 R link
22 ? bad.patch
23 ? bad.patch
23
24
@@ -1,52 +1,53 b''
1 https://bz.mercurial-scm.org/522
1 https://bz.mercurial-scm.org/522
2
2
3 In the merge below, the file "foo" has the same contents in both
3 In the merge below, the file "foo" has the same contents in both
4 parents, but if we look at the file-level history, we'll notice that
4 parents, but if we look at the file-level history, we'll notice that
5 the version in p1 is an ancestor of the version in p2. This test makes
5 the version in p1 is an ancestor of the version in p2. This test makes
6 sure that we'll use the version from p2 in the manifest of the merge
6 sure that we'll use the version from p2 in the manifest of the merge
7 revision.
7 revision.
8
8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10
11
11 $ echo foo > foo
12 $ echo foo > foo
12 $ hg ci -qAm 'add foo'
13 $ hg ci -qAm 'add foo'
13
14
14 $ echo bar >> foo
15 $ echo bar >> foo
15 $ hg ci -m 'change foo'
16 $ hg ci -m 'change foo'
16
17
17 $ hg backout -r tip -m 'backout changed foo'
18 $ hg backout -r tip -m 'backout changed foo'
18 reverting foo
19 reverting foo
19 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
20 changeset 2:4d9e78aaceee backs out changeset 1:b515023e500e
20
21
21 $ hg up -C 0
22 $ hg up -C 0
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23
24
24 $ touch bar
25 $ touch bar
25 $ hg ci -qAm 'add bar'
26 $ hg ci -qAm 'add bar'
26
27
27 $ hg merge --debug
28 $ hg merge --debug
28 resolving manifests
29 resolving manifests
29 branchmerge: True, force: False, partial: False
30 branchmerge: True, force: False, partial: False
30 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
31 ancestor: bbd179dfa0a7, local: 71766447bdbb+, remote: 4d9e78aaceee
31 foo: remote is newer -> g
32 foo: remote is newer -> g
32 getting foo
33 getting foo
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 (branch merge, don't forget to commit)
35 (branch merge, don't forget to commit)
35
36
36 $ hg debugstate | grep foo
37 $ hg debugstate | grep foo
37 m 0 -2 unset foo
38 m 0 -2 unset foo
38
39
39 $ hg st -A foo
40 $ hg st -A foo
40 M foo
41 M foo
41
42
42 $ hg ci -m 'merge'
43 $ hg ci -m 'merge'
43
44
44 $ hg manifest --debug | grep foo
45 $ hg manifest --debug | grep foo
45 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
46 c6fc755d7e68f49f880599da29f15add41f42f5a 644 foo
46
47
47 $ hg debugindex foo
48 $ hg debugindex foo
48 rev linkrev nodeid p1-nodeid p2-nodeid
49 rev linkrev nodeid p1-nodeid p2-nodeid
49 0 0 2ed2a3912a0b 000000000000 000000000000
50 0 0 2ed2a3912a0b 000000000000 000000000000
50 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
51 1 1 6f4310b00b9a 2ed2a3912a0b 000000000000
51 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
52 2 2 c6fc755d7e68 6f4310b00b9a 000000000000
52
53
@@ -1,34 +1,35 b''
1 https://bz.mercurial-scm.org/612
1 https://bz.mercurial-scm.org/612
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ mkdir src
5 $ mkdir src
5 $ echo a > src/a.c
6 $ echo a > src/a.c
6 $ hg ci -Ama
7 $ hg ci -Ama
7 adding src/a.c
8 adding src/a.c
8
9
9 $ hg mv src source
10 $ hg mv src source
10 moving src/a.c to source/a.c
11 moving src/a.c to source/a.c
11
12
12 $ hg ci -Ammove
13 $ hg ci -Ammove
13
14
14 $ hg co -C 0
15 $ hg co -C 0
15 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
16 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
16
17
17 $ echo new > src/a.c
18 $ echo new > src/a.c
18 $ echo compiled > src/a.o
19 $ echo compiled > src/a.o
19 $ hg ci -mupdate
20 $ hg ci -mupdate
20 created new head
21 created new head
21
22
22 $ hg status
23 $ hg status
23 ? src/a.o
24 ? src/a.o
24
25
25 $ hg merge
26 $ hg merge
26 merging src/a.c and source/a.c to source/a.c
27 merging src/a.c and source/a.c to source/a.c
27 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 (branch merge, don't forget to commit)
29 (branch merge, don't forget to commit)
29
30
30 $ hg status
31 $ hg status
31 M source/a.c
32 M source/a.c
32 R src/a.c
33 R src/a.c
33 ? src/a.o
34 ? src/a.o
34
35
@@ -1,36 +1,37 b''
1 https://bz.mercurial-scm.org/619
1 https://bz.mercurial-scm.org/619
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ echo a > a
5 $ echo a > a
5 $ hg ci -Ama
6 $ hg ci -Ama
6 adding a
7 adding a
7
8
8 $ echo b > b
9 $ echo b > b
9 $ hg branch b
10 $ hg branch b
10 marked working directory as branch b
11 marked working directory as branch b
11 (branches are permanent and global, did you want a bookmark?)
12 (branches are permanent and global, did you want a bookmark?)
12 $ hg ci -Amb
13 $ hg ci -Amb
13 adding b
14 adding b
14
15
15 $ hg co -C 0
16 $ hg co -C 0
16 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17
18
18 Fast-forward:
19 Fast-forward:
19
20
20 $ hg merge b
21 $ hg merge b
21 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 (branch merge, don't forget to commit)
23 (branch merge, don't forget to commit)
23 $ hg ci -Ammerge
24 $ hg ci -Ammerge
24
25
25 Bogus fast-forward should fail:
26 Bogus fast-forward should fail:
26
27
27 $ hg merge b
28 $ hg merge b
28 abort: merging with a working directory ancestor has no effect
29 abort: merging with a working directory ancestor has no effect
29 [255]
30 [255]
30
31
31 Even with strange revset (issue4465)
32 Even with strange revset (issue4465)
32
33
33 $ hg merge ::.
34 $ hg merge ::.
34 abort: merging with a working directory ancestor has no effect
35 abort: merging with a working directory ancestor has no effect
35 [255]
36 [255]
36
37
@@ -1,99 +1,100 b''
1 https://bz.mercurial-scm.org/672
1 https://bz.mercurial-scm.org/672
2
2
3 # 0-2-4
3 # 0-2-4
4 # \ \ \
4 # \ \ \
5 # 1-3-5
5 # 1-3-5
6 #
6 #
7 # rename in #1, content change in #4.
7 # rename in #1, content change in #4.
8
8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10
11
11 $ touch 1
12 $ touch 1
12 $ touch 2
13 $ touch 2
13 $ hg commit -Am init # 0
14 $ hg commit -Am init # 0
14 adding 1
15 adding 1
15 adding 2
16 adding 2
16
17
17 $ hg rename 1 1a
18 $ hg rename 1 1a
18 $ hg commit -m rename # 1
19 $ hg commit -m rename # 1
19
20
20 $ hg co -C 0
21 $ hg co -C 0
21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22
23
23 $ echo unrelated >> 2
24 $ echo unrelated >> 2
24 $ hg ci -m unrelated1 # 2
25 $ hg ci -m unrelated1 # 2
25 created new head
26 created new head
26
27
27 $ hg merge --debug 1
28 $ hg merge --debug 1
28 unmatched files in other:
29 unmatched files in other:
29 1a
30 1a
30 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 on remote side:
32 on remote side:
32 src: '1' -> dst: '1a'
33 src: '1' -> dst: '1a'
33 checking for directory renames
34 checking for directory renames
34 resolving manifests
35 resolving manifests
35 branchmerge: True, force: False, partial: False
36 branchmerge: True, force: False, partial: False
36 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 1: other deleted -> r
38 1: other deleted -> r
38 removing 1
39 removing 1
39 1a: remote created -> g
40 1a: remote created -> g
40 getting 1a
41 getting 1a
41 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
42 (branch merge, don't forget to commit)
43 (branch merge, don't forget to commit)
43
44
44 $ hg ci -m merge1 # 3
45 $ hg ci -m merge1 # 3
45
46
46 $ hg co -C 2
47 $ hg co -C 2
47 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
48 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
48
49
49 $ echo hello >> 1
50 $ echo hello >> 1
50 $ hg ci -m unrelated2 # 4
51 $ hg ci -m unrelated2 # 4
51 created new head
52 created new head
52
53
53 $ hg co -C 3
54 $ hg co -C 3
54 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
55
56
56 $ hg merge -y --debug 4
57 $ hg merge -y --debug 4
57 unmatched files in local:
58 unmatched files in local:
58 1a
59 1a
59 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
60 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
60 on local side:
61 on local side:
61 src: '1' -> dst: '1a' *
62 src: '1' -> dst: '1a' *
62 checking for directory renames
63 checking for directory renames
63 resolving manifests
64 resolving manifests
64 branchmerge: True, force: False, partial: False
65 branchmerge: True, force: False, partial: False
65 ancestor: c64f439569a9, local: f4a9cff3cd0b+, remote: 746e9549ea96
66 ancestor: c64f439569a9, local: f4a9cff3cd0b+, remote: 746e9549ea96
66 starting 4 threads for background file closing (?)
67 starting 4 threads for background file closing (?)
67 preserving 1a for resolve of 1a
68 preserving 1a for resolve of 1a
68 1a: local copied/moved from 1 -> m
69 1a: local copied/moved from 1 -> m
69 picked tool ':merge' for 1a (binary False symlink False changedelete False)
70 picked tool ':merge' for 1a (binary False symlink False changedelete False)
70 merging 1a and 1 to 1a
71 merging 1a and 1 to 1a
71 my 1a@f4a9cff3cd0b+ other 1@746e9549ea96 ancestor 1@c64f439569a9
72 my 1a@f4a9cff3cd0b+ other 1@746e9549ea96 ancestor 1@c64f439569a9
72 premerge successful
73 premerge successful
73 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
74 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
74 (branch merge, don't forget to commit)
75 (branch merge, don't forget to commit)
75
76
76 $ hg co -C 4
77 $ hg co -C 4
77 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78
79
79 $ hg merge -y --debug 3
80 $ hg merge -y --debug 3
80 unmatched files in other:
81 unmatched files in other:
81 1a
82 1a
82 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
83 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
83 on remote side:
84 on remote side:
84 src: '1' -> dst: '1a' *
85 src: '1' -> dst: '1a' *
85 checking for directory renames
86 checking for directory renames
86 resolving manifests
87 resolving manifests
87 branchmerge: True, force: False, partial: False
88 branchmerge: True, force: False, partial: False
88 ancestor: c64f439569a9, local: 746e9549ea96+, remote: f4a9cff3cd0b
89 ancestor: c64f439569a9, local: 746e9549ea96+, remote: f4a9cff3cd0b
89 starting 4 threads for background file closing (?)
90 starting 4 threads for background file closing (?)
90 preserving 1 for resolve of 1a
91 preserving 1 for resolve of 1a
91 removing 1
92 removing 1
92 1a: remote moved from 1 -> m
93 1a: remote moved from 1 -> m
93 picked tool ':merge' for 1a (binary False symlink False changedelete False)
94 picked tool ':merge' for 1a (binary False symlink False changedelete False)
94 merging 1 and 1a to 1a
95 merging 1 and 1a to 1a
95 my 1a@746e9549ea96+ other 1a@f4a9cff3cd0b ancestor 1@c64f439569a9
96 my 1a@746e9549ea96+ other 1a@f4a9cff3cd0b ancestor 1@c64f439569a9
96 premerge successful
97 premerge successful
97 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
98 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
98 (branch merge, don't forget to commit)
99 (branch merge, don't forget to commit)
99
100
@@ -1,39 +1,40 b''
1 https://bz.mercurial-scm.org/842
1 https://bz.mercurial-scm.org/842
2
2
3 $ hg init
3 $ hg init repo
4 $ cd repo
4 $ echo foo > a
5 $ echo foo > a
5 $ hg ci -Ama
6 $ hg ci -Ama
6 adding a
7 adding a
7
8
8 $ hg up -r0000
9 $ hg up -r0000
9 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10
11
11 $ echo bar > a
12 $ echo bar > a
12
13
13 Should issue new head warning:
14 Should issue new head warning:
14
15
15 $ hg ci -Amb
16 $ hg ci -Amb
16 adding a
17 adding a
17 created new head
18 created new head
18
19
19 $ hg up -r0000
20 $ hg up -r0000
20 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
21
22
22 $ echo stuffy > a
23 $ echo stuffy > a
23
24
24 Should not issue new head warning:
25 Should not issue new head warning:
25
26
26 $ hg ci -q -Amc
27 $ hg ci -q -Amc
27
28
28 $ hg up -r0000
29 $ hg up -r0000
29 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
30 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
30
31
31 $ echo crap > a
32 $ echo crap > a
32 $ hg branch testing
33 $ hg branch testing
33 marked working directory as branch testing
34 marked working directory as branch testing
34 (branches are permanent and global, did you want a bookmark?)
35 (branches are permanent and global, did you want a bookmark?)
35
36
36 Should not issue warning:
37 Should not issue warning:
37
38
38 $ hg ci -q -Amd
39 $ hg ci -q -Amd
39
40
@@ -1,60 +1,61 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo a > a
3 $ echo a > a
3 $ hg ci -Am0
4 $ hg ci -Am0
4 adding a
5 adding a
5
6
6 $ hg -q clone . foo
7 $ hg -q clone . foo
7
8
8 $ touch .hg/store/journal
9 $ touch .hg/store/journal
9
10
10 $ echo foo > a
11 $ echo foo > a
11 $ hg ci -Am0
12 $ hg ci -Am0
12 abort: abandoned transaction found
13 abort: abandoned transaction found
13 (run 'hg recover' to clean up transaction)
14 (run 'hg recover' to clean up transaction)
14 [255]
15 [255]
15
16
16 $ hg recover
17 $ hg recover
17 rolling back interrupted transaction
18 rolling back interrupted transaction
18 (verify step skipped, run `hg verify` to check your repository content)
19 (verify step skipped, run `hg verify` to check your repository content)
19
20
20 recover, explicit verify
21 recover, explicit verify
21
22
22 $ touch .hg/store/journal
23 $ touch .hg/store/journal
23 $ hg ci -Am0
24 $ hg ci -Am0
24 abort: abandoned transaction found
25 abort: abandoned transaction found
25 (run 'hg recover' to clean up transaction)
26 (run 'hg recover' to clean up transaction)
26 [255]
27 [255]
27 $ hg recover --verify
28 $ hg recover --verify
28 rolling back interrupted transaction
29 rolling back interrupted transaction
29 checking changesets
30 checking changesets
30 checking manifests
31 checking manifests
31 crosschecking files in changesets and manifests
32 crosschecking files in changesets and manifests
32 checking files
33 checking files
33 checked 1 changesets with 1 changes to 1 files
34 checked 1 changesets with 1 changes to 1 files
34
35
35 recover, no verify
36 recover, no verify
36
37
37 $ touch .hg/store/journal
38 $ touch .hg/store/journal
38 $ hg ci -Am0
39 $ hg ci -Am0
39 abort: abandoned transaction found
40 abort: abandoned transaction found
40 (run 'hg recover' to clean up transaction)
41 (run 'hg recover' to clean up transaction)
41 [255]
42 [255]
42 $ hg recover --no-verify
43 $ hg recover --no-verify
43 rolling back interrupted transaction
44 rolling back interrupted transaction
44 (verify step skipped, run `hg verify` to check your repository content)
45 (verify step skipped, run `hg verify` to check your repository content)
45
46
46
47
47 Check that zero-size journals are correctly aborted:
48 Check that zero-size journals are correctly aborted:
48
49
49 #if unix-permissions no-root
50 #if unix-permissions no-root
50 $ hg bundle -qa repo.hg
51 $ hg bundle -qa repo.hg
51 $ chmod -w foo/.hg/store/00changelog.i
52 $ chmod -w foo/.hg/store/00changelog.i
52
53
53 $ hg -R foo unbundle repo.hg
54 $ hg -R foo unbundle repo.hg
54 adding changesets
55 adding changesets
55 abort: Permission denied: '$TESTTMP/foo/.hg/store/.00changelog.i-*' (glob)
56 abort: Permission denied: '$TESTTMP/repo/foo/.hg/store/.00changelog.i-*' (glob)
56 [255]
57 [255]
57
58
58 $ if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi
59 $ if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi
59 #endif
60 #endif
60
61
@@ -1,49 +1,50 b''
1 Tests that the exit code is as expected when ui.detailed-exit-code is *not*
1 Tests that the exit code is as expected when ui.detailed-exit-code is *not*
2 enabled.
2 enabled.
3
3
4 $ cat >> $HGRCPATH << EOF
4 $ cat >> $HGRCPATH << EOF
5 > [ui]
5 > [ui]
6 > detailed-exit-code=no
6 > detailed-exit-code=no
7 > EOF
7 > EOF
8
8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10 $ echo a > a
11 $ echo a > a
11 Expect exit code 0 on success
12 Expect exit code 0 on success
12 $ hg ci -Aqm initial
13 $ hg ci -Aqm initial
13
14
14 $ hg co nonexistent
15 $ hg co nonexistent
15 abort: unknown revision 'nonexistent'
16 abort: unknown revision 'nonexistent'
16 [255]
17 [255]
17
18
18 $ hg co 'none()'
19 $ hg co 'none()'
19 abort: empty revision set
20 abort: empty revision set
20 [255]
21 [255]
21
22
22 $ hg co 'invalid('
23 $ hg co 'invalid('
23 hg: parse error at 8: not a prefix: end
24 hg: parse error at 8: not a prefix: end
24 (invalid(
25 (invalid(
25 ^ here)
26 ^ here)
26 [255]
27 [255]
27
28
28 $ hg co 'invalid('
29 $ hg co 'invalid('
29 hg: parse error at 8: not a prefix: end
30 hg: parse error at 8: not a prefix: end
30 (invalid(
31 (invalid(
31 ^ here)
32 ^ here)
32 [255]
33 [255]
33
34
34 $ hg continue
35 $ hg continue
35 abort: no operation in progress
36 abort: no operation in progress
36 [255]
37 [255]
37
38
38 $ hg st --config a=b
39 $ hg st --config a=b
39 abort: malformed --config option: 'a=b' (use --config section.name=value)
40 abort: malformed --config option: 'a=b' (use --config section.name=value)
40 [255]
41 [255]
41
42
42 $ echo b > a
43 $ echo b > a
43 $ hg ci -m second
44 $ hg ci -m second
44 $ echo c > a
45 $ echo c > a
45 $ hg ci -m third
46 $ hg ci -m third
46 $ hg --config extensions.rebase= rebase -r . -d 0 -q
47 $ hg --config extensions.rebase= rebase -r . -d 0 -q
47 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
48 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
48 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
49 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
49 [1]
50 [1]
@@ -1,1153 +1,1154 b''
1 $ cat >> $HGRCPATH << EOF
1 $ cat >> $HGRCPATH << EOF
2 > [diff]
2 > [diff]
3 > git = true
3 > git = true
4 > EOF
4 > EOF
5
5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 $ cat > foo << EOF
8 $ cat > foo << EOF
8 > 0
9 > 0
9 > 1
10 > 1
10 > 2
11 > 2
11 > 3
12 > 3
12 > 4
13 > 4
13 > EOF
14 > EOF
14 $ hg ci -Am init
15 $ hg ci -Am init
15 adding foo
16 adding foo
16 $ cat > foo << EOF
17 $ cat > foo << EOF
17 > 0
18 > 0
18 > 0
19 > 0
19 > 0
20 > 0
20 > 0
21 > 0
21 > 1
22 > 1
22 > 2
23 > 2
23 > 3
24 > 3
24 > 4
25 > 4
25 > EOF
26 > EOF
26 $ hg ci -m 'more 0'
27 $ hg ci -m 'more 0'
27 $ sed 's/2/2+/' foo > foo.new
28 $ sed 's/2/2+/' foo > foo.new
28 $ mv foo.new foo
29 $ mv foo.new foo
29 $ cat > bar << EOF
30 $ cat > bar << EOF
30 > a
31 > a
31 > b
32 > b
32 > c
33 > c
33 > d
34 > d
34 > e
35 > e
35 > EOF
36 > EOF
36 $ hg add bar
37 $ hg add bar
37 $ hg ci -Am "2 -> 2+; added bar"
38 $ hg ci -Am "2 -> 2+; added bar"
38 $ cat >> foo << EOF
39 $ cat >> foo << EOF
39 > 5
40 > 5
40 > 6
41 > 6
41 > 7
42 > 7
42 > 8
43 > 8
43 > 9
44 > 9
44 > 10
45 > 10
45 > 11
46 > 11
46 > EOF
47 > EOF
47 $ hg ci -m "to 11"
48 $ hg ci -m "to 11"
48
49
49 Add some changes with two diff hunks
50 Add some changes with two diff hunks
50
51
51 $ sed 's/^1$/ 1/' foo > foo.new
52 $ sed 's/^1$/ 1/' foo > foo.new
52 $ mv foo.new foo
53 $ mv foo.new foo
53 $ sed 's/^11$/11+/' foo > foo.new
54 $ sed 's/^11$/11+/' foo > foo.new
54 $ mv foo.new foo
55 $ mv foo.new foo
55 $ hg ci -m '11 -> 11+; leading space before "1"'
56 $ hg ci -m '11 -> 11+; leading space before "1"'
56 (make sure there are two hunks in "foo")
57 (make sure there are two hunks in "foo")
57 $ hg diff -c .
58 $ hg diff -c .
58 diff --git a/foo b/foo
59 diff --git a/foo b/foo
59 --- a/foo
60 --- a/foo
60 +++ b/foo
61 +++ b/foo
61 @@ -2,7 +2,7 @@
62 @@ -2,7 +2,7 @@
62 0
63 0
63 0
64 0
64 0
65 0
65 -1
66 -1
66 + 1
67 + 1
67 2+
68 2+
68 3
69 3
69 4
70 4
70 @@ -12,4 +12,4 @@
71 @@ -12,4 +12,4 @@
71 8
72 8
72 9
73 9
73 10
74 10
74 -11
75 -11
75 +11+
76 +11+
76 $ sed 's/3/3+/' foo > foo.new
77 $ sed 's/3/3+/' foo > foo.new
77 $ mv foo.new foo
78 $ mv foo.new foo
78 $ sed 's/^11+$/11-/' foo > foo.new
79 $ sed 's/^11+$/11-/' foo > foo.new
79 $ mv foo.new foo
80 $ mv foo.new foo
80 $ sed 's/a/a+/' bar > bar.new
81 $ sed 's/a/a+/' bar > bar.new
81 $ mv bar.new bar
82 $ mv bar.new bar
82 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 $ hg ci -m 'foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+'
83 (make sure there are two hunks in "foo")
84 (make sure there are two hunks in "foo")
84 $ hg diff -c . foo
85 $ hg diff -c . foo
85 diff --git a/foo b/foo
86 diff --git a/foo b/foo
86 --- a/foo
87 --- a/foo
87 +++ b/foo
88 +++ b/foo
88 @@ -4,7 +4,7 @@
89 @@ -4,7 +4,7 @@
89 0
90 0
90 1
91 1
91 2+
92 2+
92 -3
93 -3
93 +3+
94 +3+
94 4
95 4
95 5
96 5
96 6
97 6
97 @@ -12,4 +12,4 @@
98 @@ -12,4 +12,4 @@
98 8
99 8
99 9
100 9
100 10
101 10
101 -11+
102 -11+
102 +11-
103 +11-
103
104
104 $ hg log -f -L foo,5:7 -p
105 $ hg log -f -L foo,5:7 -p
105 changeset: 5:cfdf972b3971
106 changeset: 5:cfdf972b3971
106 tag: tip
107 tag: tip
107 user: test
108 user: test
108 date: Thu Jan 01 00:00:00 1970 +0000
109 date: Thu Jan 01 00:00:00 1970 +0000
109 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
110
111
111 diff --git a/foo b/foo
112 diff --git a/foo b/foo
112 --- a/foo
113 --- a/foo
113 +++ b/foo
114 +++ b/foo
114 @@ -4,7 +4,7 @@
115 @@ -4,7 +4,7 @@
115 0
116 0
116 1
117 1
117 2+
118 2+
118 -3
119 -3
119 +3+
120 +3+
120 4
121 4
121 5
122 5
122 6
123 6
123
124
124 changeset: 4:eaec41c1a0c9
125 changeset: 4:eaec41c1a0c9
125 user: test
126 user: test
126 date: Thu Jan 01 00:00:00 1970 +0000
127 date: Thu Jan 01 00:00:00 1970 +0000
127 summary: 11 -> 11+; leading space before "1"
128 summary: 11 -> 11+; leading space before "1"
128
129
129 diff --git a/foo b/foo
130 diff --git a/foo b/foo
130 --- a/foo
131 --- a/foo
131 +++ b/foo
132 +++ b/foo
132 @@ -2,7 +2,7 @@
133 @@ -2,7 +2,7 @@
133 0
134 0
134 0
135 0
135 0
136 0
136 -1
137 -1
137 + 1
138 + 1
138 2+
139 2+
139 3
140 3
140 4
141 4
141
142
142 changeset: 2:63a884426fd0
143 changeset: 2:63a884426fd0
143 user: test
144 user: test
144 date: Thu Jan 01 00:00:00 1970 +0000
145 date: Thu Jan 01 00:00:00 1970 +0000
145 summary: 2 -> 2+; added bar
146 summary: 2 -> 2+; added bar
146
147
147 diff --git a/foo b/foo
148 diff --git a/foo b/foo
148 --- a/foo
149 --- a/foo
149 +++ b/foo
150 +++ b/foo
150 @@ -3,6 +3,6 @@
151 @@ -3,6 +3,6 @@
151 0
152 0
152 0
153 0
153 1
154 1
154 -2
155 -2
155 +2+
156 +2+
156 3
157 3
157 4
158 4
158
159
159 changeset: 0:5ae1f82b9a00
160 changeset: 0:5ae1f82b9a00
160 user: test
161 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
162 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: init
163 summary: init
163
164
164 diff --git a/foo b/foo
165 diff --git a/foo b/foo
165 new file mode 100644
166 new file mode 100644
166 --- /dev/null
167 --- /dev/null
167 +++ b/foo
168 +++ b/foo
168 @@ -0,0 +1,5 @@
169 @@ -0,0 +1,5 @@
169 +0
170 +0
170 +1
171 +1
171 +2
172 +2
172 +3
173 +3
173 +4
174 +4
174
175
175 $ hg log -f --graph -L foo,5:7 -p
176 $ hg log -f --graph -L foo,5:7 -p
176 @ changeset: 5:cfdf972b3971
177 @ changeset: 5:cfdf972b3971
177 | tag: tip
178 | tag: tip
178 | user: test
179 | user: test
179 | date: Thu Jan 01 00:00:00 1970 +0000
180 | date: Thu Jan 01 00:00:00 1970 +0000
180 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 | summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
181 |
182 |
182 | diff --git a/foo b/foo
183 | diff --git a/foo b/foo
183 | --- a/foo
184 | --- a/foo
184 | +++ b/foo
185 | +++ b/foo
185 | @@ -4,7 +4,7 @@
186 | @@ -4,7 +4,7 @@
186 | 0
187 | 0
187 | 1
188 | 1
188 | 2+
189 | 2+
189 | -3
190 | -3
190 | +3+
191 | +3+
191 | 4
192 | 4
192 | 5
193 | 5
193 | 6
194 | 6
194 |
195 |
195 o changeset: 4:eaec41c1a0c9
196 o changeset: 4:eaec41c1a0c9
196 : user: test
197 : user: test
197 : date: Thu Jan 01 00:00:00 1970 +0000
198 : date: Thu Jan 01 00:00:00 1970 +0000
198 : summary: 11 -> 11+; leading space before "1"
199 : summary: 11 -> 11+; leading space before "1"
199 :
200 :
200 : diff --git a/foo b/foo
201 : diff --git a/foo b/foo
201 : --- a/foo
202 : --- a/foo
202 : +++ b/foo
203 : +++ b/foo
203 : @@ -2,7 +2,7 @@
204 : @@ -2,7 +2,7 @@
204 : 0
205 : 0
205 : 0
206 : 0
206 : 0
207 : 0
207 : -1
208 : -1
208 : + 1
209 : + 1
209 : 2+
210 : 2+
210 : 3
211 : 3
211 : 4
212 : 4
212 :
213 :
213 o changeset: 2:63a884426fd0
214 o changeset: 2:63a884426fd0
214 : user: test
215 : user: test
215 : date: Thu Jan 01 00:00:00 1970 +0000
216 : date: Thu Jan 01 00:00:00 1970 +0000
216 : summary: 2 -> 2+; added bar
217 : summary: 2 -> 2+; added bar
217 :
218 :
218 : diff --git a/foo b/foo
219 : diff --git a/foo b/foo
219 : --- a/foo
220 : --- a/foo
220 : +++ b/foo
221 : +++ b/foo
221 : @@ -3,6 +3,6 @@
222 : @@ -3,6 +3,6 @@
222 : 0
223 : 0
223 : 0
224 : 0
224 : 1
225 : 1
225 : -2
226 : -2
226 : +2+
227 : +2+
227 : 3
228 : 3
228 : 4
229 : 4
229 :
230 :
230 o changeset: 0:5ae1f82b9a00
231 o changeset: 0:5ae1f82b9a00
231 user: test
232 user: test
232 date: Thu Jan 01 00:00:00 1970 +0000
233 date: Thu Jan 01 00:00:00 1970 +0000
233 summary: init
234 summary: init
234
235
235 diff --git a/foo b/foo
236 diff --git a/foo b/foo
236 new file mode 100644
237 new file mode 100644
237 --- /dev/null
238 --- /dev/null
238 +++ b/foo
239 +++ b/foo
239 @@ -0,0 +1,5 @@
240 @@ -0,0 +1,5 @@
240 +0
241 +0
241 +1
242 +1
242 +2
243 +2
243 +3
244 +3
244 +4
245 +4
245
246
246
247
247 With --template.
248 With --template.
248
249
249 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 $ hg log -f -L foo,5:7 -T '{rev}:{node|short} {desc|firstline}\n'
250 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 5:cfdf972b3971 foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
251 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 4:eaec41c1a0c9 11 -> 11+; leading space before "1"
252 2:63a884426fd0 2 -> 2+; added bar
253 2:63a884426fd0 2 -> 2+; added bar
253 0:5ae1f82b9a00 init
254 0:5ae1f82b9a00 init
254 $ hg log -f -L foo,5:7 -T json
255 $ hg log -f -L foo,5:7 -T json
255 [
256 [
256 {
257 {
257 "bookmarks": [],
258 "bookmarks": [],
258 "branch": "default",
259 "branch": "default",
259 "date": [0, 0],
260 "date": [0, 0],
260 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 "desc": "foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+",
261 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 "node": "cfdf972b3971a2a59638bf9583c0debbffee5404",
262 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 "parents": ["eaec41c1a0c9ad0a5e999611d0149d171beffb8c"],
263 "phase": "draft",
264 "phase": "draft",
264 "rev": 5,
265 "rev": 5,
265 "tags": ["tip"],
266 "tags": ["tip"],
266 "user": "test"
267 "user": "test"
267 },
268 },
268 {
269 {
269 "bookmarks": [],
270 "bookmarks": [],
270 "branch": "default",
271 "branch": "default",
271 "date": [0, 0],
272 "date": [0, 0],
272 "desc": "11 -> 11+; leading space before \"1\"",
273 "desc": "11 -> 11+; leading space before \"1\"",
273 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 "node": "eaec41c1a0c9ad0a5e999611d0149d171beffb8c",
274 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 "parents": ["730a61fbaecf426c17c2c66bc42d195b5d5b0ba8"],
275 "phase": "draft",
276 "phase": "draft",
276 "rev": 4,
277 "rev": 4,
277 "tags": [],
278 "tags": [],
278 "user": "test"
279 "user": "test"
279 },
280 },
280 {
281 {
281 "bookmarks": [],
282 "bookmarks": [],
282 "branch": "default",
283 "branch": "default",
283 "date": [0, 0],
284 "date": [0, 0],
284 "desc": "2 -> 2+; added bar",
285 "desc": "2 -> 2+; added bar",
285 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 "node": "63a884426fd0b277fcd55895bbb2f230434576eb",
286 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 "parents": ["29a1e7c6b80024f63f310a2d71de979e9d2996d7"],
287 "phase": "draft",
288 "phase": "draft",
288 "rev": 2,
289 "rev": 2,
289 "tags": [],
290 "tags": [],
290 "user": "test"
291 "user": "test"
291 },
292 },
292 {
293 {
293 "bookmarks": [],
294 "bookmarks": [],
294 "branch": "default",
295 "branch": "default",
295 "date": [0, 0],
296 "date": [0, 0],
296 "desc": "init",
297 "desc": "init",
297 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 "node": "5ae1f82b9a000ff1e0967d0dac1c58b9d796e1b4",
298 "parents": ["0000000000000000000000000000000000000000"],
299 "parents": ["0000000000000000000000000000000000000000"],
299 "phase": "draft",
300 "phase": "draft",
300 "rev": 0,
301 "rev": 0,
301 "tags": [],
302 "tags": [],
302 "user": "test"
303 "user": "test"
303 }
304 }
304 ]
305 ]
305
306
306 With some white-space diff option, respective revisions are skipped.
307 With some white-space diff option, respective revisions are skipped.
307
308
308 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 $ hg log -f -L foo,5:7 -p --config diff.ignorews=true
309 changeset: 5:cfdf972b3971
310 changeset: 5:cfdf972b3971
310 tag: tip
311 tag: tip
311 user: test
312 user: test
312 date: Thu Jan 01 00:00:00 1970 +0000
313 date: Thu Jan 01 00:00:00 1970 +0000
313 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
314
315
315 diff --git a/foo b/foo
316 diff --git a/foo b/foo
316 --- a/foo
317 --- a/foo
317 +++ b/foo
318 +++ b/foo
318 @@ -4,7 +4,7 @@
319 @@ -4,7 +4,7 @@
319 0
320 0
320 1
321 1
321 2+
322 2+
322 -3
323 -3
323 +3+
324 +3+
324 4
325 4
325 5
326 5
326 6
327 6
327
328
328 changeset: 2:63a884426fd0
329 changeset: 2:63a884426fd0
329 user: test
330 user: test
330 date: Thu Jan 01 00:00:00 1970 +0000
331 date: Thu Jan 01 00:00:00 1970 +0000
331 summary: 2 -> 2+; added bar
332 summary: 2 -> 2+; added bar
332
333
333 diff --git a/foo b/foo
334 diff --git a/foo b/foo
334 --- a/foo
335 --- a/foo
335 +++ b/foo
336 +++ b/foo
336 @@ -3,6 +3,6 @@
337 @@ -3,6 +3,6 @@
337 0
338 0
338 0
339 0
339 1
340 1
340 -2
341 -2
341 +2+
342 +2+
342 3
343 3
343 4
344 4
344
345
345 changeset: 0:5ae1f82b9a00
346 changeset: 0:5ae1f82b9a00
346 user: test
347 user: test
347 date: Thu Jan 01 00:00:00 1970 +0000
348 date: Thu Jan 01 00:00:00 1970 +0000
348 summary: init
349 summary: init
349
350
350 diff --git a/foo b/foo
351 diff --git a/foo b/foo
351 new file mode 100644
352 new file mode 100644
352 --- /dev/null
353 --- /dev/null
353 +++ b/foo
354 +++ b/foo
354 @@ -0,0 +1,5 @@
355 @@ -0,0 +1,5 @@
355 +0
356 +0
356 +1
357 +1
357 +2
358 +2
358 +3
359 +3
359 +4
360 +4
360
361
361
362
362 Regular file patterns are not allowed.
363 Regular file patterns are not allowed.
363
364
364 $ hg log -f -L foo,5:7 -p bar
365 $ hg log -f -L foo,5:7 -p bar
365 abort: FILE arguments are not compatible with --line-range option
366 abort: FILE arguments are not compatible with --line-range option
366 [10]
367 [10]
367
368
368 Option --rev acts as a restriction.
369 Option --rev acts as a restriction.
369
370
370 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 $ hg log -f -L foo,5:7 -p -r 'desc(2)'
371 changeset: 2:63a884426fd0
372 changeset: 2:63a884426fd0
372 user: test
373 user: test
373 date: Thu Jan 01 00:00:00 1970 +0000
374 date: Thu Jan 01 00:00:00 1970 +0000
374 summary: 2 -> 2+; added bar
375 summary: 2 -> 2+; added bar
375
376
376 diff --git a/foo b/foo
377 diff --git a/foo b/foo
377 --- a/foo
378 --- a/foo
378 +++ b/foo
379 +++ b/foo
379 @@ -3,6 +3,6 @@
380 @@ -3,6 +3,6 @@
380 0
381 0
381 0
382 0
382 1
383 1
383 -2
384 -2
384 +2+
385 +2+
385 3
386 3
386 4
387 4
387
388
388 changeset: 0:5ae1f82b9a00
389 changeset: 0:5ae1f82b9a00
389 user: test
390 user: test
390 date: Thu Jan 01 00:00:00 1970 +0000
391 date: Thu Jan 01 00:00:00 1970 +0000
391 summary: init
392 summary: init
392
393
393 diff --git a/foo b/foo
394 diff --git a/foo b/foo
394 new file mode 100644
395 new file mode 100644
395 --- /dev/null
396 --- /dev/null
396 +++ b/foo
397 +++ b/foo
397 @@ -0,0 +1,5 @@
398 @@ -0,0 +1,5 @@
398 +0
399 +0
399 +1
400 +1
400 +2
401 +2
401 +3
402 +3
402 +4
403 +4
403
404
404
405
405 With several -L patterns, changes touching any files in their respective line
406 With several -L patterns, changes touching any files in their respective line
406 range are show.
407 range are show.
407
408
408 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 $ hg log -f -L foo,5:7 -L bar,1:2 -p
409 changeset: 5:cfdf972b3971
410 changeset: 5:cfdf972b3971
410 tag: tip
411 tag: tip
411 user: test
412 user: test
412 date: Thu Jan 01 00:00:00 1970 +0000
413 date: Thu Jan 01 00:00:00 1970 +0000
413 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
414
415
415 diff --git a/bar b/bar
416 diff --git a/bar b/bar
416 --- a/bar
417 --- a/bar
417 +++ b/bar
418 +++ b/bar
418 @@ -1,4 +1,4 @@
419 @@ -1,4 +1,4 @@
419 -a
420 -a
420 +a+
421 +a+
421 b
422 b
422 c
423 c
423 d
424 d
424 diff --git a/foo b/foo
425 diff --git a/foo b/foo
425 --- a/foo
426 --- a/foo
426 +++ b/foo
427 +++ b/foo
427 @@ -4,7 +4,7 @@
428 @@ -4,7 +4,7 @@
428 0
429 0
429 1
430 1
430 2+
431 2+
431 -3
432 -3
432 +3+
433 +3+
433 4
434 4
434 5
435 5
435 6
436 6
436
437
437 changeset: 4:eaec41c1a0c9
438 changeset: 4:eaec41c1a0c9
438 user: test
439 user: test
439 date: Thu Jan 01 00:00:00 1970 +0000
440 date: Thu Jan 01 00:00:00 1970 +0000
440 summary: 11 -> 11+; leading space before "1"
441 summary: 11 -> 11+; leading space before "1"
441
442
442 diff --git a/foo b/foo
443 diff --git a/foo b/foo
443 --- a/foo
444 --- a/foo
444 +++ b/foo
445 +++ b/foo
445 @@ -2,7 +2,7 @@
446 @@ -2,7 +2,7 @@
446 0
447 0
447 0
448 0
448 0
449 0
449 -1
450 -1
450 + 1
451 + 1
451 2+
452 2+
452 3
453 3
453 4
454 4
454
455
455 changeset: 2:63a884426fd0
456 changeset: 2:63a884426fd0
456 user: test
457 user: test
457 date: Thu Jan 01 00:00:00 1970 +0000
458 date: Thu Jan 01 00:00:00 1970 +0000
458 summary: 2 -> 2+; added bar
459 summary: 2 -> 2+; added bar
459
460
460 diff --git a/bar b/bar
461 diff --git a/bar b/bar
461 new file mode 100644
462 new file mode 100644
462 --- /dev/null
463 --- /dev/null
463 +++ b/bar
464 +++ b/bar
464 @@ -0,0 +1,5 @@
465 @@ -0,0 +1,5 @@
465 +a
466 +a
466 +b
467 +b
467 +c
468 +c
468 +d
469 +d
469 +e
470 +e
470 diff --git a/foo b/foo
471 diff --git a/foo b/foo
471 --- a/foo
472 --- a/foo
472 +++ b/foo
473 +++ b/foo
473 @@ -3,6 +3,6 @@
474 @@ -3,6 +3,6 @@
474 0
475 0
475 0
476 0
476 1
477 1
477 -2
478 -2
478 +2+
479 +2+
479 3
480 3
480 4
481 4
481
482
482 changeset: 0:5ae1f82b9a00
483 changeset: 0:5ae1f82b9a00
483 user: test
484 user: test
484 date: Thu Jan 01 00:00:00 1970 +0000
485 date: Thu Jan 01 00:00:00 1970 +0000
485 summary: init
486 summary: init
486
487
487 diff --git a/foo b/foo
488 diff --git a/foo b/foo
488 new file mode 100644
489 new file mode 100644
489 --- /dev/null
490 --- /dev/null
490 +++ b/foo
491 +++ b/foo
491 @@ -0,0 +1,5 @@
492 @@ -0,0 +1,5 @@
492 +0
493 +0
493 +1
494 +1
494 +2
495 +2
495 +3
496 +3
496 +4
497 +4
497
498
498
499
499 Multiple -L options with the same file yields changes touching any of
500 Multiple -L options with the same file yields changes touching any of
500 specified line ranges.
501 specified line ranges.
501
502
502 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 $ hg log -f -L foo,5:7 -L foo,14:15 -p
503 changeset: 5:cfdf972b3971
504 changeset: 5:cfdf972b3971
504 tag: tip
505 tag: tip
505 user: test
506 user: test
506 date: Thu Jan 01 00:00:00 1970 +0000
507 date: Thu Jan 01 00:00:00 1970 +0000
507 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
508
509
509 diff --git a/foo b/foo
510 diff --git a/foo b/foo
510 --- a/foo
511 --- a/foo
511 +++ b/foo
512 +++ b/foo
512 @@ -4,7 +4,7 @@
513 @@ -4,7 +4,7 @@
513 0
514 0
514 1
515 1
515 2+
516 2+
516 -3
517 -3
517 +3+
518 +3+
518 4
519 4
519 5
520 5
520 6
521 6
521 @@ -12,4 +12,4 @@
522 @@ -12,4 +12,4 @@
522 8
523 8
523 9
524 9
524 10
525 10
525 -11+
526 -11+
526 +11-
527 +11-
527
528
528 changeset: 4:eaec41c1a0c9
529 changeset: 4:eaec41c1a0c9
529 user: test
530 user: test
530 date: Thu Jan 01 00:00:00 1970 +0000
531 date: Thu Jan 01 00:00:00 1970 +0000
531 summary: 11 -> 11+; leading space before "1"
532 summary: 11 -> 11+; leading space before "1"
532
533
533 diff --git a/foo b/foo
534 diff --git a/foo b/foo
534 --- a/foo
535 --- a/foo
535 +++ b/foo
536 +++ b/foo
536 @@ -2,7 +2,7 @@
537 @@ -2,7 +2,7 @@
537 0
538 0
538 0
539 0
539 0
540 0
540 -1
541 -1
541 + 1
542 + 1
542 2+
543 2+
543 3
544 3
544 4
545 4
545 @@ -12,4 +12,4 @@
546 @@ -12,4 +12,4 @@
546 8
547 8
547 9
548 9
548 10
549 10
549 -11
550 -11
550 +11+
551 +11+
551
552
552 changeset: 3:730a61fbaecf
553 changeset: 3:730a61fbaecf
553 user: test
554 user: test
554 date: Thu Jan 01 00:00:00 1970 +0000
555 date: Thu Jan 01 00:00:00 1970 +0000
555 summary: to 11
556 summary: to 11
556
557
557 diff --git a/foo b/foo
558 diff --git a/foo b/foo
558 --- a/foo
559 --- a/foo
559 +++ b/foo
560 +++ b/foo
560 @@ -6,3 +6,10 @@
561 @@ -6,3 +6,10 @@
561 2+
562 2+
562 3
563 3
563 4
564 4
564 +5
565 +5
565 +6
566 +6
566 +7
567 +7
567 +8
568 +8
568 +9
569 +9
569 +10
570 +10
570 +11
571 +11
571
572
572 changeset: 2:63a884426fd0
573 changeset: 2:63a884426fd0
573 user: test
574 user: test
574 date: Thu Jan 01 00:00:00 1970 +0000
575 date: Thu Jan 01 00:00:00 1970 +0000
575 summary: 2 -> 2+; added bar
576 summary: 2 -> 2+; added bar
576
577
577 diff --git a/foo b/foo
578 diff --git a/foo b/foo
578 --- a/foo
579 --- a/foo
579 +++ b/foo
580 +++ b/foo
580 @@ -3,6 +3,6 @@
581 @@ -3,6 +3,6 @@
581 0
582 0
582 0
583 0
583 1
584 1
584 -2
585 -2
585 +2+
586 +2+
586 3
587 3
587 4
588 4
588
589
589 changeset: 0:5ae1f82b9a00
590 changeset: 0:5ae1f82b9a00
590 user: test
591 user: test
591 date: Thu Jan 01 00:00:00 1970 +0000
592 date: Thu Jan 01 00:00:00 1970 +0000
592 summary: init
593 summary: init
593
594
594 diff --git a/foo b/foo
595 diff --git a/foo b/foo
595 new file mode 100644
596 new file mode 100644
596 --- /dev/null
597 --- /dev/null
597 +++ b/foo
598 +++ b/foo
598 @@ -0,0 +1,5 @@
599 @@ -0,0 +1,5 @@
599 +0
600 +0
600 +1
601 +1
601 +2
602 +2
602 +3
603 +3
603 +4
604 +4
604
605
605
606
606 A file with a comma in its name.
607 A file with a comma in its name.
607
608
608 $ cat > ba,z << EOF
609 $ cat > ba,z << EOF
609 > q
610 > q
610 > w
611 > w
611 > e
612 > e
612 > r
613 > r
613 > t
614 > t
614 > y
615 > y
615 > EOF
616 > EOF
616 $ hg ci -Am 'querty'
617 $ hg ci -Am 'querty'
617 adding ba,z
618 adding ba,z
618 $ cat >> ba,z << EOF
619 $ cat >> ba,z << EOF
619 > u
620 > u
620 > i
621 > i
621 > o
622 > o
622 > p
623 > p
623 > EOF
624 > EOF
624 $ hg ci -m 'more keys'
625 $ hg ci -m 'more keys'
625 $ cat > ba,z << EOF
626 $ cat > ba,z << EOF
626 > a
627 > a
627 > z
628 > z
628 > e
629 > e
629 > r
630 > r
630 > t
631 > t
631 > y
632 > y
632 > u
633 > u
633 > i
634 > i
634 > o
635 > o
635 > p
636 > p
636 > EOF
637 > EOF
637 $ hg ci -m 'azerty'
638 $ hg ci -m 'azerty'
638 $ hg log -f -L ba,z,1:2 -p
639 $ hg log -f -L ba,z,1:2 -p
639 changeset: 8:52373265138b
640 changeset: 8:52373265138b
640 tag: tip
641 tag: tip
641 user: test
642 user: test
642 date: Thu Jan 01 00:00:00 1970 +0000
643 date: Thu Jan 01 00:00:00 1970 +0000
643 summary: azerty
644 summary: azerty
644
645
645 diff --git a/ba,z b/ba,z
646 diff --git a/ba,z b/ba,z
646 --- a/ba,z
647 --- a/ba,z
647 +++ b/ba,z
648 +++ b/ba,z
648 @@ -1,5 +1,5 @@
649 @@ -1,5 +1,5 @@
649 -q
650 -q
650 -w
651 -w
651 +a
652 +a
652 +z
653 +z
653 e
654 e
654 r
655 r
655 t
656 t
656
657
657 changeset: 6:96ba8850f316
658 changeset: 6:96ba8850f316
658 user: test
659 user: test
659 date: Thu Jan 01 00:00:00 1970 +0000
660 date: Thu Jan 01 00:00:00 1970 +0000
660 summary: querty
661 summary: querty
661
662
662 diff --git a/ba,z b/ba,z
663 diff --git a/ba,z b/ba,z
663 new file mode 100644
664 new file mode 100644
664 --- /dev/null
665 --- /dev/null
665 +++ b/ba,z
666 +++ b/ba,z
666 @@ -0,0 +1,6 @@
667 @@ -0,0 +1,6 @@
667 +q
668 +q
668 +w
669 +w
669 +e
670 +e
670 +r
671 +r
671 +t
672 +t
672 +y
673 +y
673
674
674
675
675 Exact prefix kinds work in -L options.
676 Exact prefix kinds work in -L options.
676
677
677 $ mkdir dir
678 $ mkdir dir
678 $ cd dir
679 $ cd dir
679 $ hg log -f -L path:foo,5:7 -p
680 $ hg log -f -L path:foo,5:7 -p
680 changeset: 5:cfdf972b3971
681 changeset: 5:cfdf972b3971
681 user: test
682 user: test
682 date: Thu Jan 01 00:00:00 1970 +0000
683 date: Thu Jan 01 00:00:00 1970 +0000
683 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
684
685
685 diff --git a/foo b/foo
686 diff --git a/foo b/foo
686 --- a/foo
687 --- a/foo
687 +++ b/foo
688 +++ b/foo
688 @@ -4,7 +4,7 @@
689 @@ -4,7 +4,7 @@
689 0
690 0
690 1
691 1
691 2+
692 2+
692 -3
693 -3
693 +3+
694 +3+
694 4
695 4
695 5
696 5
696 6
697 6
697
698
698 changeset: 4:eaec41c1a0c9
699 changeset: 4:eaec41c1a0c9
699 user: test
700 user: test
700 date: Thu Jan 01 00:00:00 1970 +0000
701 date: Thu Jan 01 00:00:00 1970 +0000
701 summary: 11 -> 11+; leading space before "1"
702 summary: 11 -> 11+; leading space before "1"
702
703
703 diff --git a/foo b/foo
704 diff --git a/foo b/foo
704 --- a/foo
705 --- a/foo
705 +++ b/foo
706 +++ b/foo
706 @@ -2,7 +2,7 @@
707 @@ -2,7 +2,7 @@
707 0
708 0
708 0
709 0
709 0
710 0
710 -1
711 -1
711 + 1
712 + 1
712 2+
713 2+
713 3
714 3
714 4
715 4
715
716
716 changeset: 2:63a884426fd0
717 changeset: 2:63a884426fd0
717 user: test
718 user: test
718 date: Thu Jan 01 00:00:00 1970 +0000
719 date: Thu Jan 01 00:00:00 1970 +0000
719 summary: 2 -> 2+; added bar
720 summary: 2 -> 2+; added bar
720
721
721 diff --git a/foo b/foo
722 diff --git a/foo b/foo
722 --- a/foo
723 --- a/foo
723 +++ b/foo
724 +++ b/foo
724 @@ -3,6 +3,6 @@
725 @@ -3,6 +3,6 @@
725 0
726 0
726 0
727 0
727 1
728 1
728 -2
729 -2
729 +2+
730 +2+
730 3
731 3
731 4
732 4
732
733
733 changeset: 0:5ae1f82b9a00
734 changeset: 0:5ae1f82b9a00
734 user: test
735 user: test
735 date: Thu Jan 01 00:00:00 1970 +0000
736 date: Thu Jan 01 00:00:00 1970 +0000
736 summary: init
737 summary: init
737
738
738 diff --git a/foo b/foo
739 diff --git a/foo b/foo
739 new file mode 100644
740 new file mode 100644
740 --- /dev/null
741 --- /dev/null
741 +++ b/foo
742 +++ b/foo
742 @@ -0,0 +1,5 @@
743 @@ -0,0 +1,5 @@
743 +0
744 +0
744 +1
745 +1
745 +2
746 +2
746 +3
747 +3
747 +4
748 +4
748
749
749
750
750 Renames are followed.
751 Renames are followed.
751
752
752 $ hg mv ../foo baz
753 $ hg mv ../foo baz
753 $ sed 's/1/1+/' baz > baz.new
754 $ sed 's/1/1+/' baz > baz.new
754 $ mv baz.new baz
755 $ mv baz.new baz
755 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 $ hg ci -m 'foo -> dir/baz; 1-1+'
756 $ hg diff -c .
757 $ hg diff -c .
757 diff --git a/foo b/dir/baz
758 diff --git a/foo b/dir/baz
758 rename from foo
759 rename from foo
759 rename to dir/baz
760 rename to dir/baz
760 --- a/foo
761 --- a/foo
761 +++ b/dir/baz
762 +++ b/dir/baz
762 @@ -2,7 +2,7 @@
763 @@ -2,7 +2,7 @@
763 0
764 0
764 0
765 0
765 0
766 0
766 - 1
767 - 1
767 + 1+
768 + 1+
768 2+
769 2+
769 3+
770 3+
770 4
771 4
771 @@ -11,5 +11,5 @@
772 @@ -11,5 +11,5 @@
772 7
773 7
773 8
774 8
774 9
775 9
775 -10
776 -10
776 -11-
777 -11-
777 +1+0
778 +1+0
778 +1+1-
779 +1+1-
779 $ hg log -f -L relpath:baz,5:7 -p
780 $ hg log -f -L relpath:baz,5:7 -p
780 changeset: 9:6af29c3a778f
781 changeset: 9:6af29c3a778f
781 tag: tip
782 tag: tip
782 user: test
783 user: test
783 date: Thu Jan 01 00:00:00 1970 +0000
784 date: Thu Jan 01 00:00:00 1970 +0000
784 summary: foo -> dir/baz; 1-1+
785 summary: foo -> dir/baz; 1-1+
785
786
786 diff --git a/foo b/dir/baz
787 diff --git a/foo b/dir/baz
787 copy from foo
788 copy from foo
788 copy to dir/baz
789 copy to dir/baz
789 --- a/foo
790 --- a/foo
790 +++ b/dir/baz
791 +++ b/dir/baz
791 @@ -2,7 +2,7 @@
792 @@ -2,7 +2,7 @@
792 0
793 0
793 0
794 0
794 0
795 0
795 - 1
796 - 1
796 + 1+
797 + 1+
797 2+
798 2+
798 3+
799 3+
799 4
800 4
800
801
801 changeset: 5:cfdf972b3971
802 changeset: 5:cfdf972b3971
802 user: test
803 user: test
803 date: Thu Jan 01 00:00:00 1970 +0000
804 date: Thu Jan 01 00:00:00 1970 +0000
804 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
805
806
806 diff --git a/foo b/foo
807 diff --git a/foo b/foo
807 --- a/foo
808 --- a/foo
808 +++ b/foo
809 +++ b/foo
809 @@ -4,7 +4,7 @@
810 @@ -4,7 +4,7 @@
810 0
811 0
811 1
812 1
812 2+
813 2+
813 -3
814 -3
814 +3+
815 +3+
815 4
816 4
816 5
817 5
817 6
818 6
818
819
819 changeset: 4:eaec41c1a0c9
820 changeset: 4:eaec41c1a0c9
820 user: test
821 user: test
821 date: Thu Jan 01 00:00:00 1970 +0000
822 date: Thu Jan 01 00:00:00 1970 +0000
822 summary: 11 -> 11+; leading space before "1"
823 summary: 11 -> 11+; leading space before "1"
823
824
824 diff --git a/foo b/foo
825 diff --git a/foo b/foo
825 --- a/foo
826 --- a/foo
826 +++ b/foo
827 +++ b/foo
827 @@ -2,7 +2,7 @@
828 @@ -2,7 +2,7 @@
828 0
829 0
829 0
830 0
830 0
831 0
831 -1
832 -1
832 + 1
833 + 1
833 2+
834 2+
834 3
835 3
835 4
836 4
836
837
837 changeset: 2:63a884426fd0
838 changeset: 2:63a884426fd0
838 user: test
839 user: test
839 date: Thu Jan 01 00:00:00 1970 +0000
840 date: Thu Jan 01 00:00:00 1970 +0000
840 summary: 2 -> 2+; added bar
841 summary: 2 -> 2+; added bar
841
842
842 diff --git a/foo b/foo
843 diff --git a/foo b/foo
843 --- a/foo
844 --- a/foo
844 +++ b/foo
845 +++ b/foo
845 @@ -3,6 +3,6 @@
846 @@ -3,6 +3,6 @@
846 0
847 0
847 0
848 0
848 1
849 1
849 -2
850 -2
850 +2+
851 +2+
851 3
852 3
852 4
853 4
853
854
854 changeset: 0:5ae1f82b9a00
855 changeset: 0:5ae1f82b9a00
855 user: test
856 user: test
856 date: Thu Jan 01 00:00:00 1970 +0000
857 date: Thu Jan 01 00:00:00 1970 +0000
857 summary: init
858 summary: init
858
859
859 diff --git a/foo b/foo
860 diff --git a/foo b/foo
860 new file mode 100644
861 new file mode 100644
861 --- /dev/null
862 --- /dev/null
862 +++ b/foo
863 +++ b/foo
863 @@ -0,0 +1,5 @@
864 @@ -0,0 +1,5 @@
864 +0
865 +0
865 +1
866 +1
866 +2
867 +2
867 +3
868 +3
868 +4
869 +4
869
870
870
871
871 Uncommitted changes with a rename
872 Uncommitted changes with a rename
872
873
873 $ hg mv baz bazn
874 $ hg mv baz bazn
874 $ hg log -f -L bazn,5:7
875 $ hg log -f -L bazn,5:7
875 changeset: 9:6af29c3a778f
876 changeset: 9:6af29c3a778f
876 tag: tip
877 tag: tip
877 user: test
878 user: test
878 date: Thu Jan 01 00:00:00 1970 +0000
879 date: Thu Jan 01 00:00:00 1970 +0000
879 summary: foo -> dir/baz; 1-1+
880 summary: foo -> dir/baz; 1-1+
880
881
881 changeset: 5:cfdf972b3971
882 changeset: 5:cfdf972b3971
882 user: test
883 user: test
883 date: Thu Jan 01 00:00:00 1970 +0000
884 date: Thu Jan 01 00:00:00 1970 +0000
884 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
885 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
885
886
886 changeset: 4:eaec41c1a0c9
887 changeset: 4:eaec41c1a0c9
887 user: test
888 user: test
888 date: Thu Jan 01 00:00:00 1970 +0000
889 date: Thu Jan 01 00:00:00 1970 +0000
889 summary: 11 -> 11+; leading space before "1"
890 summary: 11 -> 11+; leading space before "1"
890
891
891 changeset: 2:63a884426fd0
892 changeset: 2:63a884426fd0
892 user: test
893 user: test
893 date: Thu Jan 01 00:00:00 1970 +0000
894 date: Thu Jan 01 00:00:00 1970 +0000
894 summary: 2 -> 2+; added bar
895 summary: 2 -> 2+; added bar
895
896
896 changeset: 0:5ae1f82b9a00
897 changeset: 0:5ae1f82b9a00
897 user: test
898 user: test
898 date: Thu Jan 01 00:00:00 1970 +0000
899 date: Thu Jan 01 00:00:00 1970 +0000
899 summary: init
900 summary: init
900
901
901
902
902 Uncommitted changes in requested line range
903 Uncommitted changes in requested line range
903
904
904 $ sed 's/2/ /' bazn > bazn.new
905 $ sed 's/2/ /' bazn > bazn.new
905 $ mv bazn.new bazn
906 $ mv bazn.new bazn
906 $ hg diff
907 $ hg diff
907 diff --git a/dir/baz b/dir/bazn
908 diff --git a/dir/baz b/dir/bazn
908 rename from dir/baz
909 rename from dir/baz
909 rename to dir/bazn
910 rename to dir/bazn
910 --- a/dir/baz
911 --- a/dir/baz
911 +++ b/dir/bazn
912 +++ b/dir/bazn
912 @@ -3,7 +3,7 @@
913 @@ -3,7 +3,7 @@
913 0
914 0
914 0
915 0
915 1+
916 1+
916 -2+
917 -2+
917 + +
918 + +
918 3+
919 3+
919 4
920 4
920 5
921 5
921 $ hg log -f -L bazn,5:7
922 $ hg log -f -L bazn,5:7
922 changeset: 9:6af29c3a778f
923 changeset: 9:6af29c3a778f
923 tag: tip
924 tag: tip
924 user: test
925 user: test
925 date: Thu Jan 01 00:00:00 1970 +0000
926 date: Thu Jan 01 00:00:00 1970 +0000
926 summary: foo -> dir/baz; 1-1+
927 summary: foo -> dir/baz; 1-1+
927
928
928 changeset: 5:cfdf972b3971
929 changeset: 5:cfdf972b3971
929 user: test
930 user: test
930 date: Thu Jan 01 00:00:00 1970 +0000
931 date: Thu Jan 01 00:00:00 1970 +0000
931 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
932 summary: foo: 3 -> 3+ and 11+ -> 11-; bar: a -> a+
932
933
933 changeset: 4:eaec41c1a0c9
934 changeset: 4:eaec41c1a0c9
934 user: test
935 user: test
935 date: Thu Jan 01 00:00:00 1970 +0000
936 date: Thu Jan 01 00:00:00 1970 +0000
936 summary: 11 -> 11+; leading space before "1"
937 summary: 11 -> 11+; leading space before "1"
937
938
938 changeset: 2:63a884426fd0
939 changeset: 2:63a884426fd0
939 user: test
940 user: test
940 date: Thu Jan 01 00:00:00 1970 +0000
941 date: Thu Jan 01 00:00:00 1970 +0000
941 summary: 2 -> 2+; added bar
942 summary: 2 -> 2+; added bar
942
943
943 changeset: 0:5ae1f82b9a00
944 changeset: 0:5ae1f82b9a00
944 user: test
945 user: test
945 date: Thu Jan 01 00:00:00 1970 +0000
946 date: Thu Jan 01 00:00:00 1970 +0000
946 summary: init
947 summary: init
947
948
948
949
949 Uncommitted changes in line-range + wdir()
950 Uncommitted changes in line-range + wdir()
950
951
951 $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p
952 $ hg log -r 'wdir()' -f -L bazn,5:7 --limit 2 -p
952 changeset: 2147483647:ffffffffffff
953 changeset: 2147483647:ffffffffffff
953 parent: 9:6af29c3a778f
954 parent: 9:6af29c3a778f
954 user: test
955 user: test
955 date: Thu Jan 01 00:00:00 1970 +0000
956 date: Thu Jan 01 00:00:00 1970 +0000
956
957
957 diff --git a/dir/baz b/dir/bazn
958 diff --git a/dir/baz b/dir/bazn
958 copy from dir/baz
959 copy from dir/baz
959 copy to dir/bazn
960 copy to dir/bazn
960 --- a/dir/baz
961 --- a/dir/baz
961 +++ b/dir/bazn
962 +++ b/dir/bazn
962 @@ -3,7 +3,7 @@
963 @@ -3,7 +3,7 @@
963 0
964 0
964 0
965 0
965 1+
966 1+
966 -2+
967 -2+
967 + +
968 + +
968 3+
969 3+
969 4
970 4
970 5
971 5
971
972
972 changeset: 9:6af29c3a778f
973 changeset: 9:6af29c3a778f
973 tag: tip
974 tag: tip
974 user: test
975 user: test
975 date: Thu Jan 01 00:00:00 1970 +0000
976 date: Thu Jan 01 00:00:00 1970 +0000
976 summary: foo -> dir/baz; 1-1+
977 summary: foo -> dir/baz; 1-1+
977
978
978 diff --git a/foo b/dir/baz
979 diff --git a/foo b/dir/baz
979 copy from foo
980 copy from foo
980 copy to dir/baz
981 copy to dir/baz
981 --- a/foo
982 --- a/foo
982 +++ b/dir/baz
983 +++ b/dir/baz
983 @@ -2,7 +2,7 @@
984 @@ -2,7 +2,7 @@
984 0
985 0
985 0
986 0
986 0
987 0
987 - 1
988 - 1
988 + 1+
989 + 1+
989 2+
990 2+
990 3+
991 3+
991 4
992 4
992
993
993
994
994 $ hg revert -a -C -q
995 $ hg revert -a -C -q
995
996
996 Copies.
997 Copies.
997
998
998 $ hg copy baz bbaz
999 $ hg copy baz bbaz
999 $ sed 's/6/6+/' bbaz > bbaz.new
1000 $ sed 's/6/6+/' bbaz > bbaz.new
1000 $ mv bbaz.new bbaz
1001 $ mv bbaz.new bbaz
1001 $ hg commit -m 'cp baz bbaz; 6-6+'
1002 $ hg commit -m 'cp baz bbaz; 6-6+'
1002 $ hg diff -c .
1003 $ hg diff -c .
1003 diff --git a/dir/baz b/dir/bbaz
1004 diff --git a/dir/baz b/dir/bbaz
1004 copy from dir/baz
1005 copy from dir/baz
1005 copy to dir/bbaz
1006 copy to dir/bbaz
1006 --- a/dir/baz
1007 --- a/dir/baz
1007 +++ b/dir/bbaz
1008 +++ b/dir/bbaz
1008 @@ -7,7 +7,7 @@
1009 @@ -7,7 +7,7 @@
1009 3+
1010 3+
1010 4
1011 4
1011 5
1012 5
1012 -6
1013 -6
1013 +6+
1014 +6+
1014 7
1015 7
1015 8
1016 8
1016 9
1017 9
1017 $ hg log --copies -f -L bbaz,10:11 -p
1018 $ hg log --copies -f -L bbaz,10:11 -p
1018 changeset: 10:91a3d3b6c546
1019 changeset: 10:91a3d3b6c546
1019 tag: tip
1020 tag: tip
1020 user: test
1021 user: test
1021 date: Thu Jan 01 00:00:00 1970 +0000
1022 date: Thu Jan 01 00:00:00 1970 +0000
1022 summary: cp baz bbaz; 6-6+
1023 summary: cp baz bbaz; 6-6+
1023
1024
1024 diff --git a/dir/baz b/dir/bbaz
1025 diff --git a/dir/baz b/dir/bbaz
1025 copy from dir/baz
1026 copy from dir/baz
1026 copy to dir/bbaz
1027 copy to dir/bbaz
1027 --- a/dir/baz
1028 --- a/dir/baz
1028 +++ b/dir/bbaz
1029 +++ b/dir/bbaz
1029 @@ -7,7 +7,7 @@
1030 @@ -7,7 +7,7 @@
1030 3+
1031 3+
1031 4
1032 4
1032 5
1033 5
1033 -6
1034 -6
1034 +6+
1035 +6+
1035 7
1036 7
1036 8
1037 8
1037 9
1038 9
1038
1039
1039 changeset: 3:730a61fbaecf
1040 changeset: 3:730a61fbaecf
1040 user: test
1041 user: test
1041 date: Thu Jan 01 00:00:00 1970 +0000
1042 date: Thu Jan 01 00:00:00 1970 +0000
1042 summary: to 11
1043 summary: to 11
1043
1044
1044 diff --git a/foo b/foo
1045 diff --git a/foo b/foo
1045 --- a/foo
1046 --- a/foo
1046 +++ b/foo
1047 +++ b/foo
1047 @@ -6,3 +6,10 @@
1048 @@ -6,3 +6,10 @@
1048 2+
1049 2+
1049 3
1050 3
1050 4
1051 4
1051 +5
1052 +5
1052 +6
1053 +6
1053 +7
1054 +7
1054 +8
1055 +8
1055 +9
1056 +9
1056 +10
1057 +10
1057 +11
1058 +11
1058
1059
1059 $ hg log -f -L bbaz,10:11 -p
1060 $ hg log -f -L bbaz,10:11 -p
1060 changeset: 10:91a3d3b6c546
1061 changeset: 10:91a3d3b6c546
1061 tag: tip
1062 tag: tip
1062 user: test
1063 user: test
1063 date: Thu Jan 01 00:00:00 1970 +0000
1064 date: Thu Jan 01 00:00:00 1970 +0000
1064 summary: cp baz bbaz; 6-6+
1065 summary: cp baz bbaz; 6-6+
1065
1066
1066 diff --git a/dir/baz b/dir/bbaz
1067 diff --git a/dir/baz b/dir/bbaz
1067 copy from dir/baz
1068 copy from dir/baz
1068 copy to dir/bbaz
1069 copy to dir/bbaz
1069 --- a/dir/baz
1070 --- a/dir/baz
1070 +++ b/dir/bbaz
1071 +++ b/dir/bbaz
1071 @@ -7,7 +7,7 @@
1072 @@ -7,7 +7,7 @@
1072 3+
1073 3+
1073 4
1074 4
1074 5
1075 5
1075 -6
1076 -6
1076 +6+
1077 +6+
1077 7
1078 7
1078 8
1079 8
1079 9
1080 9
1080
1081
1081 changeset: 3:730a61fbaecf
1082 changeset: 3:730a61fbaecf
1082 user: test
1083 user: test
1083 date: Thu Jan 01 00:00:00 1970 +0000
1084 date: Thu Jan 01 00:00:00 1970 +0000
1084 summary: to 11
1085 summary: to 11
1085
1086
1086 diff --git a/foo b/foo
1087 diff --git a/foo b/foo
1087 --- a/foo
1088 --- a/foo
1088 +++ b/foo
1089 +++ b/foo
1089 @@ -6,3 +6,10 @@
1090 @@ -6,3 +6,10 @@
1090 2+
1091 2+
1091 3
1092 3
1092 4
1093 4
1093 +5
1094 +5
1094 +6
1095 +6
1095 +7
1096 +7
1096 +8
1097 +8
1097 +9
1098 +9
1098 +10
1099 +10
1099 +11
1100 +11
1100
1101
1101
1102
1102 Binary files work but without diff hunks filtering.
1103 Binary files work but without diff hunks filtering.
1103 (Checking w/ and w/o diff.git option.)
1104 (Checking w/ and w/o diff.git option.)
1104
1105
1105 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
1106 >>> open('binary', 'wb').write(b'this\nis\na\nbinary\0') and None
1106 $ hg add binary
1107 $ hg add binary
1107 $ hg ci -m 'add a binary file' --quiet
1108 $ hg ci -m 'add a binary file' --quiet
1108 $ hg log -f -L binary,1:2 -p
1109 $ hg log -f -L binary,1:2 -p
1109 changeset: 11:dc865b608edf
1110 changeset: 11:dc865b608edf
1110 tag: tip
1111 tag: tip
1111 user: test
1112 user: test
1112 date: Thu Jan 01 00:00:00 1970 +0000
1113 date: Thu Jan 01 00:00:00 1970 +0000
1113 summary: add a binary file
1114 summary: add a binary file
1114
1115
1115 diff --git a/dir/binary b/dir/binary
1116 diff --git a/dir/binary b/dir/binary
1116 new file mode 100644
1117 new file mode 100644
1117 index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
1118 index 0000000000000000000000000000000000000000..c2e1fbed209fe919b3f189a6a31950e9adf61e45
1118 GIT binary patch
1119 GIT binary patch
1119 literal 17
1120 literal 17
1120 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
1121 Wc$_QA$SmdpqC~Ew%)G>+N(KNlNClYy
1121
1122
1122
1123
1123 $ hg log -f -L binary,1:2 -p --config diff.git=false
1124 $ hg log -f -L binary,1:2 -p --config diff.git=false
1124 changeset: 11:dc865b608edf
1125 changeset: 11:dc865b608edf
1125 tag: tip
1126 tag: tip
1126 user: test
1127 user: test
1127 date: Thu Jan 01 00:00:00 1970 +0000
1128 date: Thu Jan 01 00:00:00 1970 +0000
1128 summary: add a binary file
1129 summary: add a binary file
1129
1130
1130 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
1131 diff -r 91a3d3b6c546 -r dc865b608edf dir/binary
1131 Binary file dir/binary has changed
1132 Binary file dir/binary has changed
1132
1133
1133
1134
1134 Option --follow is required.
1135 Option --follow is required.
1135
1136
1136 $ hg log -L foo,5:7
1137 $ hg log -L foo,5:7
1137 abort: --line-range requires --follow
1138 abort: --line-range requires --follow
1138 [10]
1139 [10]
1139
1140
1140 Non-exact pattern kinds are not allowed.
1141 Non-exact pattern kinds are not allowed.
1141
1142
1142 $ cd ..
1143 $ cd ..
1143 $ hg log -f -L glob:*a*,1:2
1144 $ hg log -f -L glob:*a*,1:2
1144 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1145 hg: parse error: line range pattern 'glob:*a*' must match exactly one file
1145 [10]
1146 [10]
1146
1147
1147 We get an error for removed files.
1148 We get an error for removed files.
1148
1149
1149 $ hg rm dir/baz
1150 $ hg rm dir/baz
1150 $ hg ci -m 'remove baz' --quiet
1151 $ hg ci -m 'remove baz' --quiet
1151 $ hg log -f -L dir/baz,5:7 -p
1152 $ hg log -f -L dir/baz,5:7 -p
1152 abort: cannot follow file not in parent revision: "dir/baz"
1153 abort: cannot follow file not in parent revision: "dir/baz"
1153 [20]
1154 [20]
@@ -1,190 +1,191 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo a > a
3 $ echo a > a
3 $ hg commit -A -ma
4 $ hg commit -A -ma
4 adding a
5 adding a
5
6
6 $ echo b >> a
7 $ echo b >> a
7 $ hg commit -mb
8 $ hg commit -mb
8
9
9 $ echo c >> a
10 $ echo c >> a
10 $ hg commit -mc
11 $ hg commit -mc
11
12
12 $ hg up 1
13 $ hg up 1
13 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
14 $ echo d >> a
15 $ echo d >> a
15 $ hg commit -md
16 $ hg commit -md
16 created new head
17 created new head
17
18
18 $ hg up 1
19 $ hg up 1
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ echo e >> a
21 $ echo e >> a
21 $ hg commit -me
22 $ hg commit -me
22 created new head
23 created new head
23
24
24 $ hg up 1
25 $ hg up 1
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26
27
27 Should fail because not at a head:
28 Should fail because not at a head:
28
29
29 $ hg merge
30 $ hg merge
30 abort: working directory not at a head revision
31 abort: working directory not at a head revision
31 (use 'hg update' or merge with an explicit revision)
32 (use 'hg update' or merge with an explicit revision)
32 [255]
33 [255]
33
34
34 $ hg up
35 $ hg up
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 updated to "f25cbe84d8b3: e"
37 updated to "f25cbe84d8b3: e"
37 2 other heads for branch "default"
38 2 other heads for branch "default"
38
39
39 Should fail because > 2 heads:
40 Should fail because > 2 heads:
40
41
41 $ HGMERGE=internal:other; export HGMERGE
42 $ HGMERGE=internal:other; export HGMERGE
42 $ hg merge
43 $ hg merge
43 abort: branch 'default' has 3 heads - please merge with an explicit rev
44 abort: branch 'default' has 3 heads - please merge with an explicit rev
44 (run 'hg heads .' to see heads, specify rev with -r)
45 (run 'hg heads .' to see heads, specify rev with -r)
45 [255]
46 [255]
46
47
47 Should succeed (we're specifying commands.merge.require-rev=True just to test
48 Should succeed (we're specifying commands.merge.require-rev=True just to test
48 that it allows merge to succeed if we specify a revision):
49 that it allows merge to succeed if we specify a revision):
49
50
50 $ hg merge 2 --config commands.merge.require-rev=True
51 $ hg merge 2 --config commands.merge.require-rev=True
51 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
52 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
52 (branch merge, don't forget to commit)
53 (branch merge, don't forget to commit)
53 $ hg id -Tjson
54 $ hg id -Tjson
54 [
55 [
55 {
56 {
56 "bookmarks": [],
57 "bookmarks": [],
57 "branch": "default",
58 "branch": "default",
58 "dirty": "+",
59 "dirty": "+",
59 "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+",
60 "id": "f25cbe84d8b320e298e7703f18a25a3959518c23+2d95304fed5d89bc9d70b2a0d02f0d567469c3ab+",
60 "node": "ffffffffffffffffffffffffffffffffffffffff",
61 "node": "ffffffffffffffffffffffffffffffffffffffff",
61 "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"],
62 "parents": ["f25cbe84d8b320e298e7703f18a25a3959518c23", "2d95304fed5d89bc9d70b2a0d02f0d567469c3ab"],
62 "tags": ["tip"]
63 "tags": ["tip"]
63 }
64 }
64 ]
65 ]
65 $ hg commit -mm1
66 $ hg commit -mm1
66
67
67 Should fail because we didn't specify a revision (even though it would have
68 Should fail because we didn't specify a revision (even though it would have
68 succeeded without this):
69 succeeded without this):
69
70
70 $ hg merge --config commands.merge.require-rev=True
71 $ hg merge --config commands.merge.require-rev=True
71 abort: configuration requires specifying revision to merge with
72 abort: configuration requires specifying revision to merge with
72 [10]
73 [10]
73
74
74 Should succeed - 2 heads:
75 Should succeed - 2 heads:
75
76
76 $ hg merge -P
77 $ hg merge -P
77 changeset: 3:ea9ff125ff88
78 changeset: 3:ea9ff125ff88
78 parent: 1:1846eede8b68
79 parent: 1:1846eede8b68
79 user: test
80 user: test
80 date: Thu Jan 01 00:00:00 1970 +0000
81 date: Thu Jan 01 00:00:00 1970 +0000
81 summary: d
82 summary: d
82
83
83 $ hg merge
84 $ hg merge
84 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 (branch merge, don't forget to commit)
86 (branch merge, don't forget to commit)
86 $ hg commit -mm2
87 $ hg commit -mm2
87
88
88 $ hg id -r 1 -Tjson
89 $ hg id -r 1 -Tjson
89 [
90 [
90 {
91 {
91 "bookmarks": [],
92 "bookmarks": [],
92 "branch": "default",
93 "branch": "default",
93 "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
94 "id": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
94 "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
95 "node": "1846eede8b6886d8cc8a88c96a687b7fe8f3b9d1",
95 "tags": []
96 "tags": []
96 }
97 }
97 ]
98 ]
98
99
99 Should fail because we didn't specify a revision (even though it would have
100 Should fail because we didn't specify a revision (even though it would have
100 failed without this due to being on tip, but this check comes first):
101 failed without this due to being on tip, but this check comes first):
101
102
102 $ hg merge --config commands.merge.require-rev=True
103 $ hg merge --config commands.merge.require-rev=True
103 abort: configuration requires specifying revision to merge with
104 abort: configuration requires specifying revision to merge with
104 [10]
105 [10]
105
106
106 Should fail because at tip:
107 Should fail because at tip:
107
108
108 $ hg merge
109 $ hg merge
109 abort: nothing to merge
110 abort: nothing to merge
110 [255]
111 [255]
111
112
112 $ hg up 0
113 $ hg up 0
113 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114
115
115 Should fail because there is only one head:
116 Should fail because there is only one head:
116
117
117 $ hg merge
118 $ hg merge
118 abort: nothing to merge
119 abort: nothing to merge
119 (use 'hg update' instead)
120 (use 'hg update' instead)
120 [255]
121 [255]
121
122
122 $ hg up 3
123 $ hg up 3
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
124
125
125 $ echo f >> a
126 $ echo f >> a
126 $ hg branch foobranch
127 $ hg branch foobranch
127 marked working directory as branch foobranch
128 marked working directory as branch foobranch
128 (branches are permanent and global, did you want a bookmark?)
129 (branches are permanent and global, did you want a bookmark?)
129 $ hg commit -mf
130 $ hg commit -mf
130
131
131 Should fail because merge with other branch:
132 Should fail because merge with other branch:
132
133
133 $ hg merge
134 $ hg merge
134 abort: branch 'foobranch' has one head - please merge with an explicit rev
135 abort: branch 'foobranch' has one head - please merge with an explicit rev
135 (run 'hg heads' to see all heads, specify rev with -r)
136 (run 'hg heads' to see all heads, specify rev with -r)
136 [255]
137 [255]
137
138
138
139
139 Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
140 Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
140 are not ancestors of 7, regardless of where their common ancestors are.
141 are not ancestors of 7, regardless of where their common ancestors are.
141
142
142 Merge preview not affected by common ancestor:
143 Merge preview not affected by common ancestor:
143
144
144 $ hg up -q 7
145 $ hg up -q 7
145 $ hg merge -q -P 6
146 $ hg merge -q -P 6
146 2:2d95304fed5d
147 2:2d95304fed5d
147 4:f25cbe84d8b3
148 4:f25cbe84d8b3
148 5:a431fabd6039
149 5:a431fabd6039
149 6:e88e33f3bf62
150 6:e88e33f3bf62
150
151
151 Test experimental destination revset
152 Test experimental destination revset
152
153
153 $ hg log -r '_destmerge()'
154 $ hg log -r '_destmerge()'
154 abort: branch 'foobranch' has one head - please merge with an explicit rev
155 abort: branch 'foobranch' has one head - please merge with an explicit rev
155 (run 'hg heads' to see all heads, specify rev with -r)
156 (run 'hg heads' to see all heads, specify rev with -r)
156 [255]
157 [255]
157
158
158 (on a branch with a two heads)
159 (on a branch with a two heads)
159
160
160 $ hg up 5
161 $ hg up 5
161 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
162 $ echo f >> a
163 $ echo f >> a
163 $ hg commit -mf
164 $ hg commit -mf
164 created new head
165 created new head
165 $ hg log -r '_destmerge()'
166 $ hg log -r '_destmerge()'
166 changeset: 6:e88e33f3bf62
167 changeset: 6:e88e33f3bf62
167 parent: 5:a431fabd6039
168 parent: 5:a431fabd6039
168 parent: 3:ea9ff125ff88
169 parent: 3:ea9ff125ff88
169 user: test
170 user: test
170 date: Thu Jan 01 00:00:00 1970 +0000
171 date: Thu Jan 01 00:00:00 1970 +0000
171 summary: m2
172 summary: m2
172
173
173
174
174 (from the other head)
175 (from the other head)
175
176
176 $ hg log -r '_destmerge(e88e33f3bf62)'
177 $ hg log -r '_destmerge(e88e33f3bf62)'
177 changeset: 8:b613918999e2
178 changeset: 8:b613918999e2
178 tag: tip
179 tag: tip
179 parent: 5:a431fabd6039
180 parent: 5:a431fabd6039
180 user: test
181 user: test
181 date: Thu Jan 01 00:00:00 1970 +0000
182 date: Thu Jan 01 00:00:00 1970 +0000
182 summary: f
183 summary: f
183
184
184
185
185 (from unrelated branch)
186 (from unrelated branch)
186
187
187 $ hg log -r '_destmerge(foobranch)'
188 $ hg log -r '_destmerge(foobranch)'
188 abort: branch 'foobranch' has one head - please merge with an explicit rev
189 abort: branch 'foobranch' has one head - please merge with an explicit rev
189 (run 'hg heads' to see all heads, specify rev with -r)
190 (run 'hg heads' to see all heads, specify rev with -r)
190 [255]
191 [255]
@@ -1,141 +1,142 b''
1 Make sure that the internal merge tools (internal:fail, internal:local,
1 Make sure that the internal merge tools (internal:fail, internal:local,
2 internal:union and internal:other) are used when matched by a
2 internal:union and internal:other) are used when matched by a
3 merge-pattern in hgrc
3 merge-pattern in hgrc
4
4
5 Make sure HGMERGE doesn't interfere with the test:
5 Make sure HGMERGE doesn't interfere with the test:
6
6
7 $ unset HGMERGE
7 $ unset HGMERGE
8
8
9 $ hg init
9 $ hg init repo
10 $ cd repo
10
11
11 Initial file contents:
12 Initial file contents:
12
13
13 $ echo "line 1" > f
14 $ echo "line 1" > f
14 $ echo "line 2" >> f
15 $ echo "line 2" >> f
15 $ echo "line 3" >> f
16 $ echo "line 3" >> f
16 $ hg ci -Am "revision 0"
17 $ hg ci -Am "revision 0"
17 adding f
18 adding f
18
19
19 $ cat f
20 $ cat f
20 line 1
21 line 1
21 line 2
22 line 2
22 line 3
23 line 3
23
24
24 Branch 1: editing line 1:
25 Branch 1: editing line 1:
25
26
26 $ sed 's/line 1/first line/' f > f.new
27 $ sed 's/line 1/first line/' f > f.new
27 $ mv f.new f
28 $ mv f.new f
28 $ hg ci -Am "edited first line"
29 $ hg ci -Am "edited first line"
29
30
30 Branch 2: editing line 3:
31 Branch 2: editing line 3:
31
32
32 $ hg update 0
33 $ hg update 0
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ sed 's/line 3/third line/' f > f.new
35 $ sed 's/line 3/third line/' f > f.new
35 $ mv f.new f
36 $ mv f.new f
36 $ hg ci -Am "edited third line"
37 $ hg ci -Am "edited third line"
37 created new head
38 created new head
38
39
39 Merge using internal:fail tool:
40 Merge using internal:fail tool:
40
41
41 $ echo "[merge-patterns]" > .hg/hgrc
42 $ echo "[merge-patterns]" > .hg/hgrc
42 $ echo "* = internal:fail" >> .hg/hgrc
43 $ echo "* = internal:fail" >> .hg/hgrc
43
44
44 $ hg merge
45 $ hg merge
45 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
46 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
46 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
47 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
47 [1]
48 [1]
48
49
49 $ cat f
50 $ cat f
50 line 1
51 line 1
51 line 2
52 line 2
52 third line
53 third line
53
54
54 $ hg stat
55 $ hg stat
55 M f
56 M f
56
57
57 Merge using internal:local tool:
58 Merge using internal:local tool:
58
59
59 $ hg update -C 2
60 $ hg update -C 2
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
62 $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
62 $ mv .hg/hgrc.new .hg/hgrc
63 $ mv .hg/hgrc.new .hg/hgrc
63
64
64 $ hg merge
65 $ hg merge
65 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
66 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
66 (branch merge, don't forget to commit)
67 (branch merge, don't forget to commit)
67
68
68 $ cat f
69 $ cat f
69 line 1
70 line 1
70 line 2
71 line 2
71 third line
72 third line
72
73
73 $ hg stat
74 $ hg stat
74 M f
75 M f
75
76
76 Merge using internal:other tool:
77 Merge using internal:other tool:
77
78
78 $ hg update -C 2
79 $ hg update -C 2
79 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
81 $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
81 $ mv .hg/hgrc.new .hg/hgrc
82 $ mv .hg/hgrc.new .hg/hgrc
82
83
83 $ hg merge
84 $ hg merge
84 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
85 (branch merge, don't forget to commit)
86 (branch merge, don't forget to commit)
86
87
87 $ cat f
88 $ cat f
88 first line
89 first line
89 line 2
90 line 2
90 line 3
91 line 3
91
92
92 $ hg stat
93 $ hg stat
93 M f
94 M f
94
95
95 Merge using default tool:
96 Merge using default tool:
96
97
97 $ hg update -C 2
98 $ hg update -C 2
98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 $ rm .hg/hgrc
100 $ rm .hg/hgrc
100
101
101 $ hg merge
102 $ hg merge
102 merging f
103 merging f
103 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
104 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
104 (branch merge, don't forget to commit)
105 (branch merge, don't forget to commit)
105
106
106 $ cat f
107 $ cat f
107 first line
108 first line
108 line 2
109 line 2
109 third line
110 third line
110
111
111 $ hg stat
112 $ hg stat
112 M f
113 M f
113
114
114 Merge using internal:union tool:
115 Merge using internal:union tool:
115
116
116 $ hg update -C 2
117 $ hg update -C 2
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118
119
119 $ echo "line 4a" >>f
120 $ echo "line 4a" >>f
120 $ hg ci -Am "Adding fourth line (commit 4)"
121 $ hg ci -Am "Adding fourth line (commit 4)"
121 $ hg update 2
122 $ hg update 2
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
123
124
124 $ echo "line 4b" >>f
125 $ echo "line 4b" >>f
125 $ hg ci -Am "Adding fourth line v2 (commit 5)"
126 $ hg ci -Am "Adding fourth line v2 (commit 5)"
126 created new head
127 created new head
127
128
128 $ echo "[merge-patterns]" > .hg/hgrc
129 $ echo "[merge-patterns]" > .hg/hgrc
129 $ echo "* = internal:union" >> .hg/hgrc
130 $ echo "* = internal:union" >> .hg/hgrc
130
131
131 $ hg merge 3
132 $ hg merge 3
132 merging f
133 merging f
133 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
134 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
134 (branch merge, don't forget to commit)
135 (branch merge, don't forget to commit)
135
136
136 $ cat f
137 $ cat f
137 line 1
138 line 1
138 line 2
139 line 2
139 third line
140 third line
140 line 4b
141 line 4b
141 line 4a
142 line 4a
@@ -1,151 +1,152 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 Revision 0:
4 Revision 0:
4
5
5 $ echo "unchanged" > unchanged
6 $ echo "unchanged" > unchanged
6 $ echo "remove me" > remove
7 $ echo "remove me" > remove
7 $ echo "copy me" > copy
8 $ echo "copy me" > copy
8 $ echo "move me" > move
9 $ echo "move me" > move
9 $ for i in 1 2 3 4 5 6 7 8 9; do
10 $ for i in 1 2 3 4 5 6 7 8 9; do
10 > echo "merge ok $i" >> zzz1_merge_ok
11 > echo "merge ok $i" >> zzz1_merge_ok
11 > done
12 > done
12 $ echo "merge bad" > zzz2_merge_bad
13 $ echo "merge bad" > zzz2_merge_bad
13 $ hg ci -Am "revision 0"
14 $ hg ci -Am "revision 0"
14 adding copy
15 adding copy
15 adding move
16 adding move
16 adding remove
17 adding remove
17 adding unchanged
18 adding unchanged
18 adding zzz1_merge_ok
19 adding zzz1_merge_ok
19 adding zzz2_merge_bad
20 adding zzz2_merge_bad
20
21
21 Revision 1:
22 Revision 1:
22
23
23 $ hg rm remove
24 $ hg rm remove
24 $ hg mv move moved
25 $ hg mv move moved
25 $ hg cp copy copied
26 $ hg cp copy copied
26 $ echo "added" > added
27 $ echo "added" > added
27 $ hg add added
28 $ hg add added
28 $ echo "new first line" > zzz1_merge_ok
29 $ echo "new first line" > zzz1_merge_ok
29 $ hg cat zzz1_merge_ok >> zzz1_merge_ok
30 $ hg cat zzz1_merge_ok >> zzz1_merge_ok
30 $ echo "new last line" >> zzz2_merge_bad
31 $ echo "new last line" >> zzz2_merge_bad
31 $ hg ci -m "revision 1"
32 $ hg ci -m "revision 1"
32
33
33 Local changes to revision 0:
34 Local changes to revision 0:
34
35
35 $ hg co 0
36 $ hg co 0
36 4 files updated, 0 files merged, 3 files removed, 0 files unresolved
37 4 files updated, 0 files merged, 3 files removed, 0 files unresolved
37 $ echo "new last line" >> zzz1_merge_ok
38 $ echo "new last line" >> zzz1_merge_ok
38 $ echo "another last line" >> zzz2_merge_bad
39 $ echo "another last line" >> zzz2_merge_bad
39
40
40 $ hg diff --nodates | grep "^[+-][^<>]"
41 $ hg diff --nodates | grep "^[+-][^<>]"
41 --- a/zzz1_merge_ok
42 --- a/zzz1_merge_ok
42 +++ b/zzz1_merge_ok
43 +++ b/zzz1_merge_ok
43 +new last line
44 +new last line
44 --- a/zzz2_merge_bad
45 --- a/zzz2_merge_bad
45 +++ b/zzz2_merge_bad
46 +++ b/zzz2_merge_bad
46 +another last line
47 +another last line
47
48
48 $ hg st
49 $ hg st
49 M zzz1_merge_ok
50 M zzz1_merge_ok
50 M zzz2_merge_bad
51 M zzz2_merge_bad
51
52
52 Local merge with bad merge tool:
53 Local merge with bad merge tool:
53
54
54 $ HGMERGE=false hg co
55 $ HGMERGE=false hg co
55 merging zzz1_merge_ok
56 merging zzz1_merge_ok
56 merging zzz2_merge_bad
57 merging zzz2_merge_bad
57 merging zzz2_merge_bad failed!
58 merging zzz2_merge_bad failed!
58 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
59 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
59 use 'hg resolve' to retry unresolved file merges
60 use 'hg resolve' to retry unresolved file merges
60 [1]
61 [1]
61
62
62 $ hg resolve -m
63 $ hg resolve -m
63 (no more unresolved files)
64 (no more unresolved files)
64
65
65 $ hg co 0
66 $ hg co 0
66 merging zzz1_merge_ok
67 merging zzz1_merge_ok
67 merging zzz2_merge_bad
68 merging zzz2_merge_bad
68 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
69 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
69 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
70 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
70 use 'hg resolve' to retry unresolved file merges
71 use 'hg resolve' to retry unresolved file merges
71 [1]
72 [1]
72
73
73 $ hg diff --nodates | grep "^[+-][^<>]"
74 $ hg diff --nodates | grep "^[+-][^<>]"
74 --- a/zzz1_merge_ok
75 --- a/zzz1_merge_ok
75 +++ b/zzz1_merge_ok
76 +++ b/zzz1_merge_ok
76 +new last line
77 +new last line
77 --- a/zzz2_merge_bad
78 --- a/zzz2_merge_bad
78 +++ b/zzz2_merge_bad
79 +++ b/zzz2_merge_bad
79 +another last line
80 +another last line
80 +=======
81 +=======
81
82
82 $ hg st
83 $ hg st
83 M zzz1_merge_ok
84 M zzz1_merge_ok
84 M zzz2_merge_bad
85 M zzz2_merge_bad
85 ? zzz2_merge_bad.orig
86 ? zzz2_merge_bad.orig
86
87
87 Local merge with conflicts:
88 Local merge with conflicts:
88
89
89 $ hg resolve -m
90 $ hg resolve -m
90 (no more unresolved files)
91 (no more unresolved files)
91
92
92 $ hg co
93 $ hg co
93 merging zzz1_merge_ok
94 merging zzz1_merge_ok
94 merging zzz2_merge_bad
95 merging zzz2_merge_bad
95 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
96 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
96 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
97 3 files updated, 1 files merged, 2 files removed, 1 files unresolved
97 use 'hg resolve' to retry unresolved file merges
98 use 'hg resolve' to retry unresolved file merges
98 [1]
99 [1]
99
100
100 $ hg resolve -m
101 $ hg resolve -m
101 (no more unresolved files)
102 (no more unresolved files)
102
103
103 $ hg co 0 --config 'ui.origbackuppath=.hg/origbackups'
104 $ hg co 0 --config 'ui.origbackuppath=.hg/origbackups'
104 merging zzz1_merge_ok
105 merging zzz1_merge_ok
105 merging zzz2_merge_bad
106 merging zzz2_merge_bad
106 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
107 warning: conflicts while merging zzz2_merge_bad! (edit, then use 'hg resolve --mark')
107 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
108 2 files updated, 1 files merged, 3 files removed, 1 files unresolved
108 use 'hg resolve' to retry unresolved file merges
109 use 'hg resolve' to retry unresolved file merges
109 [1]
110 [1]
110
111
111 Are orig files from the last commit where we want them?
112 Are orig files from the last commit where we want them?
112 $ ls .hg/origbackups
113 $ ls .hg/origbackups
113 zzz2_merge_bad
114 zzz2_merge_bad
114
115
115 $ hg diff --nodates | grep "^[+-][^<>]"
116 $ hg diff --nodates | grep "^[+-][^<>]"
116 --- a/zzz1_merge_ok
117 --- a/zzz1_merge_ok
117 +++ b/zzz1_merge_ok
118 +++ b/zzz1_merge_ok
118 +new last line
119 +new last line
119 --- a/zzz2_merge_bad
120 --- a/zzz2_merge_bad
120 +++ b/zzz2_merge_bad
121 +++ b/zzz2_merge_bad
121 +another last line
122 +another last line
122 +=======
123 +=======
123 +=======
124 +=======
124 +new last line
125 +new last line
125 +=======
126 +=======
126
127
127 $ hg st
128 $ hg st
128 M zzz1_merge_ok
129 M zzz1_merge_ok
129 M zzz2_merge_bad
130 M zzz2_merge_bad
130 ? zzz2_merge_bad.orig
131 ? zzz2_merge_bad.orig
131
132
132 Local merge without conflicts:
133 Local merge without conflicts:
133
134
134 $ hg revert zzz2_merge_bad
135 $ hg revert zzz2_merge_bad
135
136
136 $ hg resolve -m
137 $ hg resolve -m
137 (no more unresolved files)
138 (no more unresolved files)
138
139
139 $ hg co
140 $ hg co
140 merging zzz1_merge_ok
141 merging zzz1_merge_ok
141 4 files updated, 1 files merged, 2 files removed, 0 files unresolved
142 4 files updated, 1 files merged, 2 files removed, 0 files unresolved
142
143
143 $ hg diff --nodates | grep "^[+-][^<>]"
144 $ hg diff --nodates | grep "^[+-][^<>]"
144 --- a/zzz1_merge_ok
145 --- a/zzz1_merge_ok
145 +++ b/zzz1_merge_ok
146 +++ b/zzz1_merge_ok
146 +new last line
147 +new last line
147
148
148 $ hg st
149 $ hg st
149 M zzz1_merge_ok
150 M zzz1_merge_ok
150 ? zzz2_merge_bad.orig
151 ? zzz2_merge_bad.orig
151
152
@@ -1,116 +1,117 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo foo > foo
4 $ echo foo > foo
4 $ echo bar > bar
5 $ echo bar > bar
5 $ hg ci -qAm 'add foo bar'
6 $ hg ci -qAm 'add foo bar'
6
7
7 $ echo foo2 >> foo
8 $ echo foo2 >> foo
8 $ echo bleh > bar
9 $ echo bleh > bar
9 $ hg ci -m 'change foo bar'
10 $ hg ci -m 'change foo bar'
10
11
11 $ hg up -qC 0
12 $ hg up -qC 0
12 $ hg mv foo foo1
13 $ hg mv foo foo1
13 $ echo foo1 > foo1
14 $ echo foo1 > foo1
14 $ hg cat foo >> foo1
15 $ hg cat foo >> foo1
15 $ hg ci -m 'mv foo foo1'
16 $ hg ci -m 'mv foo foo1'
16 created new head
17 created new head
17
18
18 $ hg merge
19 $ hg merge
19 merging foo1 and foo to foo1
20 merging foo1 and foo to foo1
20 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
21 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
21 (branch merge, don't forget to commit)
22 (branch merge, don't forget to commit)
22
23
23 $ hg debugstate --no-dates
24 $ hg debugstate --no-dates
24 m 0 -2 unset bar
25 m 0 -2 unset bar
25 m 0 -2 unset foo1
26 m 0 -2 unset foo1
26 copy: foo -> foo1
27 copy: foo -> foo1
27
28
28 $ hg st -q
29 $ hg st -q
29 M bar
30 M bar
30 M foo1
31 M foo1
31
32
32
33
33 Removing foo1 and bar:
34 Removing foo1 and bar:
34
35
35 $ cp foo1 F
36 $ cp foo1 F
36 $ cp bar B
37 $ cp bar B
37 $ hg rm -f foo1 bar
38 $ hg rm -f foo1 bar
38
39
39 $ hg debugstate --no-dates
40 $ hg debugstate --no-dates
40 r 0 -1 set bar
41 r 0 -1 set bar
41 r 0 -1 set foo1
42 r 0 -1 set foo1
42 copy: foo -> foo1
43 copy: foo -> foo1
43
44
44 $ hg st -qC
45 $ hg st -qC
45 R bar
46 R bar
46 R foo1
47 R foo1
47
48
48
49
49 Re-adding foo1 and bar:
50 Re-adding foo1 and bar:
50
51
51 $ cp F foo1
52 $ cp F foo1
52 $ cp B bar
53 $ cp B bar
53 $ hg add -v foo1 bar
54 $ hg add -v foo1 bar
54 adding bar
55 adding bar
55 adding foo1
56 adding foo1
56
57
57 $ hg debugstate --no-dates
58 $ hg debugstate --no-dates
58 m 0 -2 unset bar
59 m 0 -2 unset bar
59 m 0 -2 unset foo1
60 m 0 -2 unset foo1
60 copy: foo -> foo1
61 copy: foo -> foo1
61
62
62 $ hg st -qC
63 $ hg st -qC
63 M bar
64 M bar
64 M foo1
65 M foo1
65 foo
66 foo
66
67
67
68
68 Reverting foo1 and bar:
69 Reverting foo1 and bar:
69
70
70 $ hg revert -vr . foo1 bar
71 $ hg revert -vr . foo1 bar
71 saving current version of bar as bar.orig
72 saving current version of bar as bar.orig
72 saving current version of foo1 as foo1.orig
73 saving current version of foo1 as foo1.orig
73 reverting bar
74 reverting bar
74 reverting foo1
75 reverting foo1
75
76
76 $ hg debugstate --no-dates
77 $ hg debugstate --no-dates
77 m 0 -2 unset bar
78 m 0 -2 unset bar
78 m 0 -2 unset foo1
79 m 0 -2 unset foo1
79 copy: foo -> foo1
80 copy: foo -> foo1
80
81
81 $ hg st -qC
82 $ hg st -qC
82 M bar
83 M bar
83 M foo1
84 M foo1
84 foo
85 foo
85
86
86 $ hg diff
87 $ hg diff
87
88
88 Merge should not overwrite local file that is untracked after remove
89 Merge should not overwrite local file that is untracked after remove
89
90
90 $ rm *
91 $ rm *
91 $ hg up -qC
92 $ hg up -qC
92 $ hg rm bar
93 $ hg rm bar
93 $ hg ci -m 'remove bar'
94 $ hg ci -m 'remove bar'
94 $ echo 'memories of buried pirate treasure' > bar
95 $ echo 'memories of buried pirate treasure' > bar
95 $ hg merge
96 $ hg merge
96 bar: untracked file differs
97 bar: untracked file differs
97 abort: untracked files in working directory differ from files in requested revision
98 abort: untracked files in working directory differ from files in requested revision
98 [20]
99 [20]
99 $ cat bar
100 $ cat bar
100 memories of buried pirate treasure
101 memories of buried pirate treasure
101
102
102 Those who use force will lose
103 Those who use force will lose
103
104
104 $ hg merge -f
105 $ hg merge -f
105 file 'bar' was deleted in local [working copy] but was modified in other [merge rev].
106 file 'bar' was deleted in local [working copy] but was modified in other [merge rev].
106 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
107 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
107 What do you want to do? u
108 What do you want to do? u
108 merging foo1 and foo to foo1
109 merging foo1 and foo to foo1
109 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
110 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
110 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
111 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
111 [1]
112 [1]
112 $ cat bar
113 $ cat bar
113 bleh
114 bleh
114 $ hg st
115 $ hg st
115 M bar
116 M bar
116 M foo1
117 M foo1
@@ -1,74 +1,75 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo "added file1" > file1
4 $ echo "added file1" > file1
4 $ echo "added file2" > file2
5 $ echo "added file2" > file2
5 $ hg add file1 file2
6 $ hg add file1 file2
6 $ hg commit -m "added file1 and file2"
7 $ hg commit -m "added file1 and file2"
7
8
8 $ echo "changed file1" >> file1
9 $ echo "changed file1" >> file1
9 $ hg commit -m "changed file1"
10 $ hg commit -m "changed file1"
10
11
11 $ hg -q log
12 $ hg -q log
12 1:08a16e8e4408
13 1:08a16e8e4408
13 0:d29c767a4b52
14 0:d29c767a4b52
14 $ hg id
15 $ hg id
15 08a16e8e4408 tip
16 08a16e8e4408 tip
16
17
17 $ hg update -C 0
18 $ hg update -C 0
18 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 $ hg id
20 $ hg id
20 d29c767a4b52
21 d29c767a4b52
21 $ echo "changed file1" >> file1
22 $ echo "changed file1" >> file1
22 $ hg id
23 $ hg id
23 d29c767a4b52+
24 d29c767a4b52+
24
25
25 $ hg revert --all
26 $ hg revert --all
26 reverting file1
27 reverting file1
27 $ hg diff
28 $ hg diff
28 $ hg status
29 $ hg status
29 ? file1.orig
30 ? file1.orig
30 $ hg id
31 $ hg id
31 d29c767a4b52
32 d29c767a4b52
32
33
33 $ hg update
34 $ hg update
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 $ hg diff
36 $ hg diff
36 $ hg status
37 $ hg status
37 ? file1.orig
38 ? file1.orig
38 $ hg id
39 $ hg id
39 08a16e8e4408 tip
40 08a16e8e4408 tip
40
41
41 $ hg update -C 0
42 $ hg update -C 0
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ echo "changed file1" >> file1
44 $ echo "changed file1" >> file1
44
45
45 $ hg update
46 $ hg update
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ hg diff
48 $ hg diff
48 $ hg status
49 $ hg status
49 ? file1.orig
50 ? file1.orig
50 $ hg id
51 $ hg id
51 08a16e8e4408 tip
52 08a16e8e4408 tip
52
53
53 $ hg revert --all
54 $ hg revert --all
54 $ hg diff
55 $ hg diff
55 $ hg status
56 $ hg status
56 ? file1.orig
57 ? file1.orig
57 $ hg id
58 $ hg id
58 08a16e8e4408 tip
59 08a16e8e4408 tip
59
60
60 $ hg revert -r tip --all
61 $ hg revert -r tip --all
61 $ hg diff
62 $ hg diff
62 $ hg status
63 $ hg status
63 ? file1.orig
64 ? file1.orig
64 $ hg id
65 $ hg id
65 08a16e8e4408 tip
66 08a16e8e4408 tip
66
67
67 $ hg update -C
68 $ hg update -C
68 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 $ hg diff
70 $ hg diff
70 $ hg status
71 $ hg status
71 ? file1.orig
72 ? file1.orig
72 $ hg id
73 $ hg id
73 08a16e8e4408 tip
74 08a16e8e4408 tip
74
75
@@ -1,93 +1,94 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo "added file1" > file1
4 $ echo "added file1" > file1
4 $ echo "another line of text" >> file1
5 $ echo "another line of text" >> file1
5 $ echo "added file2" > file2
6 $ echo "added file2" > file2
6 $ hg add file1 file2
7 $ hg add file1 file2
7 $ hg commit -m "added file1 and file2"
8 $ hg commit -m "added file1 and file2"
8
9
9 $ echo "changed file1" >> file1
10 $ echo "changed file1" >> file1
10 $ hg commit -m "changed file1"
11 $ hg commit -m "changed file1"
11
12
12 $ hg -q log
13 $ hg -q log
13 1:dfab7f3c2efb
14 1:dfab7f3c2efb
14 0:c3fa057dd86f
15 0:c3fa057dd86f
15 $ hg id
16 $ hg id
16 dfab7f3c2efb tip
17 dfab7f3c2efb tip
17
18
18 $ hg update -C 0
19 $ hg update -C 0
19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ hg id
21 $ hg id
21 c3fa057dd86f
22 c3fa057dd86f
22
23
23 $ echo "changed file1" >> file1
24 $ echo "changed file1" >> file1
24 $ hg id
25 $ hg id
25 c3fa057dd86f+
26 c3fa057dd86f+
26
27
27 $ hg revert --no-backup --all
28 $ hg revert --no-backup --all
28 reverting file1
29 reverting file1
29 $ hg diff
30 $ hg diff
30 $ hg status
31 $ hg status
31 $ hg id
32 $ hg id
32 c3fa057dd86f
33 c3fa057dd86f
33
34
34 $ hg update
35 $ hg update
35 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
36 $ hg diff
37 $ hg diff
37 $ hg status
38 $ hg status
38 $ hg id
39 $ hg id
39 dfab7f3c2efb tip
40 dfab7f3c2efb tip
40
41
41 $ hg update -C 0
42 $ hg update -C 0
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ echo "changed file1 different" >> file1
44 $ echo "changed file1 different" >> file1
44
45
45 $ hg update
46 $ hg update
46 merging file1
47 merging file1
47 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
48 warning: conflicts while merging file1! (edit, then use 'hg resolve --mark')
48 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
49 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
49 use 'hg resolve' to retry unresolved file merges
50 use 'hg resolve' to retry unresolved file merges
50 [1]
51 [1]
51
52
52 $ hg diff --nodates
53 $ hg diff --nodates
53 diff -r dfab7f3c2efb file1
54 diff -r dfab7f3c2efb file1
54 --- a/file1
55 --- a/file1
55 +++ b/file1
56 +++ b/file1
56 @@ -1,3 +1,7 @@
57 @@ -1,3 +1,7 @@
57 added file1
58 added file1
58 another line of text
59 another line of text
59 +<<<<<<< working copy: c3fa057dd86f - test: added file1 and file2
60 +<<<<<<< working copy: c3fa057dd86f - test: added file1 and file2
60 +changed file1 different
61 +changed file1 different
61 +=======
62 +=======
62 changed file1
63 changed file1
63 +>>>>>>> destination: dfab7f3c2efb - test: changed file1
64 +>>>>>>> destination: dfab7f3c2efb - test: changed file1
64
65
65 $ hg status
66 $ hg status
66 M file1
67 M file1
67 ? file1.orig
68 ? file1.orig
68 $ hg id
69 $ hg id
69 dfab7f3c2efb+ tip
70 dfab7f3c2efb+ tip
70
71
71 $ hg revert --no-backup --all
72 $ hg revert --no-backup --all
72 reverting file1
73 reverting file1
73 $ hg diff
74 $ hg diff
74 $ hg status
75 $ hg status
75 ? file1.orig
76 ? file1.orig
76 $ hg id
77 $ hg id
77 dfab7f3c2efb tip
78 dfab7f3c2efb tip
78
79
79 $ hg revert -r tip --no-backup --all
80 $ hg revert -r tip --no-backup --all
80 $ hg diff
81 $ hg diff
81 $ hg status
82 $ hg status
82 ? file1.orig
83 ? file1.orig
83 $ hg id
84 $ hg id
84 dfab7f3c2efb tip
85 dfab7f3c2efb tip
85
86
86 $ hg update -C
87 $ hg update -C
87 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 $ hg diff
89 $ hg diff
89 $ hg status
90 $ hg status
90 ? file1.orig
91 ? file1.orig
91 $ hg id
92 $ hg id
92 dfab7f3c2efb tip
93 dfab7f3c2efb tip
93
94
@@ -1,148 +1,149 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo a > a
4 $ echo a > a
4 $ hg ci -qAm 'add a'
5 $ hg ci -qAm 'add a'
5
6
6 $ hg init subrepo
7 $ hg init subrepo
7 $ echo 'subrepo = http://example.net/libfoo' > .hgsub
8 $ echo 'subrepo = http://example.net/libfoo' > .hgsub
8 $ hg ci -qAm 'added subrepo'
9 $ hg ci -qAm 'added subrepo'
9
10
10 $ hg up -qC 0
11 $ hg up -qC 0
11 $ echo ax > a
12 $ echo ax > a
12 $ hg ci -m 'changed a'
13 $ hg ci -m 'changed a'
13 created new head
14 created new head
14
15
15 $ hg up -qC 1
16 $ hg up -qC 1
16 $ cd subrepo
17 $ cd subrepo
17 $ echo b > b
18 $ echo b > b
18 $ hg add b
19 $ hg add b
19 $ cd ..
20 $ cd ..
20
21
21 Should fail, since there are added files to subrepo:
22 Should fail, since there are added files to subrepo:
22
23
23 $ hg merge
24 $ hg merge
24 abort: uncommitted changes in subrepository "subrepo"
25 abort: uncommitted changes in subrepository "subrepo"
25 [255]
26 [255]
26
27
27 Deleted files trigger a '+' marker in top level repos. Deleted files are also
28 Deleted files trigger a '+' marker in top level repos. Deleted files are also
28 noticed by `update --check` in the top level repo.
29 noticed by `update --check` in the top level repo.
29
30
30 $ hg ci -Sqm 'add b'
31 $ hg ci -Sqm 'add b'
31 $ echo change > subrepo/b
32 $ echo change > subrepo/b
32
33
33 $ hg ci -Sm 'change b'
34 $ hg ci -Sm 'change b'
34 committing subrepository subrepo
35 committing subrepository subrepo
35
36
36 $ rm a
37 $ rm a
37 $ hg id
38 $ hg id
38 9bfe45a197d7+ tip
39 9bfe45a197d7+ tip
39 $ hg sum
40 $ hg sum
40 parent: 4:9bfe45a197d7 tip
41 parent: 4:9bfe45a197d7 tip
41 change b
42 change b
42 branch: default
43 branch: default
43 commit: 1 deleted (clean)
44 commit: 1 deleted (clean)
44 update: 1 new changesets, 2 branch heads (merge)
45 update: 1 new changesets, 2 branch heads (merge)
45 phases: 5 draft
46 phases: 5 draft
46
47
47 $ hg up --check -r '.^'
48 $ hg up --check -r '.^'
48 abort: uncommitted changes
49 abort: uncommitted changes
49 [20]
50 [20]
50 $ hg st -S
51 $ hg st -S
51 ! a
52 ! a
52 $ hg up -Cq .
53 $ hg up -Cq .
53
54
54 Test that dirty is consistent through subrepos
55 Test that dirty is consistent through subrepos
55
56
56 $ rm subrepo/b
57 $ rm subrepo/b
57
58
58 A deleted subrepo file is flagged as dirty, like the top level repo
59 A deleted subrepo file is flagged as dirty, like the top level repo
59
60
60 $ hg id --config extensions.blackbox= --config blackbox.dirty=True \
61 $ hg id --config extensions.blackbox= --config blackbox.dirty=True \
61 > --config blackbox.track='command commandfinish'
62 > --config blackbox.track='command commandfinish'
62 9bfe45a197d7+ tip
63 9bfe45a197d7+ tip
63 $ cat .hg/blackbox.log
64 $ cat .hg/blackbox.log
64 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> serve --no-profile --cmdserver chgunix * (glob) (chg !)
65 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> serve --no-profile --cmdserver chgunix * (glob) (chg !)
65 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* (glob)
66 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* (glob)
66 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob)
67 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob)
67
68
68 TODO: a deleted file should be listed as such, like the top level repo
69 TODO: a deleted file should be listed as such, like the top level repo
69
70
70 $ hg sum
71 $ hg sum
71 parent: 4:9bfe45a197d7 tip
72 parent: 4:9bfe45a197d7 tip
72 change b
73 change b
73 branch: default
74 branch: default
74 commit: (clean)
75 commit: (clean)
75 update: 1 new changesets, 2 branch heads (merge)
76 update: 1 new changesets, 2 branch heads (merge)
76 phases: 5 draft
77 phases: 5 draft
77
78
78 Modified subrepo files are noticed by `update --check` and `summary`
79 Modified subrepo files are noticed by `update --check` and `summary`
79
80
80 $ echo mod > subrepo/b
81 $ echo mod > subrepo/b
81 $ hg st -S
82 $ hg st -S
82 M subrepo/b
83 M subrepo/b
83
84
84 $ hg up -r '.^' --check
85 $ hg up -r '.^' --check
85 abort: uncommitted changes in subrepository "subrepo"
86 abort: uncommitted changes in subrepository "subrepo"
86 [255]
87 [255]
87
88
88 $ hg sum
89 $ hg sum
89 parent: 4:9bfe45a197d7 tip
90 parent: 4:9bfe45a197d7 tip
90 change b
91 change b
91 branch: default
92 branch: default
92 commit: 1 subrepos
93 commit: 1 subrepos
93 update: 1 new changesets, 2 branch heads (merge)
94 update: 1 new changesets, 2 branch heads (merge)
94 phases: 5 draft
95 phases: 5 draft
95
96
96 TODO: why is -R needed here? If it's because the subrepo is treated as a
97 TODO: why is -R needed here? If it's because the subrepo is treated as a
97 discrete unit, then this should probably warn or something.
98 discrete unit, then this should probably warn or something.
98 $ hg revert -R subrepo --no-backup subrepo/b -r .
99 $ hg revert -R subrepo --no-backup subrepo/b -r .
99
100
100 $ rm subrepo/b
101 $ rm subrepo/b
101 $ hg st -S
102 $ hg st -S
102 ! subrepo/b
103 ! subrepo/b
103
104
104 `hg update --check` notices a subrepo with a missing file, like it notices a
105 `hg update --check` notices a subrepo with a missing file, like it notices a
105 missing file in the top level repo.
106 missing file in the top level repo.
106
107
107 $ hg up -r '.^' --check
108 $ hg up -r '.^' --check
108 abort: uncommitted changes in subrepository "subrepo"
109 abort: uncommitted changes in subrepository "subrepo"
109 [255]
110 [255]
110
111
111 $ hg up -r '.^' --config ui.interactive=True << EOF
112 $ hg up -r '.^' --config ui.interactive=True << EOF
112 > d
113 > d
113 > EOF
114 > EOF
114 file 'b' was deleted in local [working copy] but was modified in other [destination].
115 file 'b' was deleted in local [working copy] but was modified in other [destination].
115 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
116 You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
116 What do you want to do? d
117 What do you want to do? d
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118
119
119 XXX: There's a difference between wdir() and '.', so there should be a status.
120 XXX: There's a difference between wdir() and '.', so there should be a status.
120 `hg files -S` from the top is also missing 'subrepo/b'. The files should be
121 `hg files -S` from the top is also missing 'subrepo/b'. The files should be
121 seen as deleted (and, maybe even missing? in which case `hg files` should list
122 seen as deleted (and, maybe even missing? in which case `hg files` should list
122 it)
123 it)
123
124
124 $ hg st -S
125 $ hg st -S
125 R subrepo/b (missing-correct-output !)
126 R subrepo/b (missing-correct-output !)
126 $ hg st -R subrepo
127 $ hg st -R subrepo
127 R subrepo/b (missing-correct-output !)
128 R subrepo/b (missing-correct-output !)
128
129
129 (note: return [1] because no files "match" since the list is empty)
130 (note: return [1] because no files "match" since the list is empty)
130
131
131 $ hg files -R subrepo
132 $ hg files -R subrepo
132 [1]
133 [1]
133 $ hg files -R subrepo -r '.'
134 $ hg files -R subrepo -r '.'
134 subrepo/b
135 subrepo/b
135
136
136 $ hg bookmark -r tip @other
137 $ hg bookmark -r tip @other
137 $ echo xyz > subrepo/c
138 $ echo xyz > subrepo/c
138 $ hg ci -SAm 'add c'
139 $ hg ci -SAm 'add c'
139 adding subrepo/c
140 adding subrepo/c
140 committing subrepository subrepo
141 committing subrepository subrepo
141 created new head
142 created new head
142 $ rm subrepo/c
143 $ rm subrepo/c
143
144
144 Merge sees deleted subrepo files as an uncommitted change
145 Merge sees deleted subrepo files as an uncommitted change
145
146
146 $ hg merge @other
147 $ hg merge @other
147 abort: uncommitted changes in subrepository "subrepo"
148 abort: uncommitted changes in subrepository "subrepo"
148 [255]
149 [255]
@@ -1,59 +1,60 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo This is file a1 > a
3 $ echo This is file a1 > a
3 $ hg add a
4 $ hg add a
4 $ hg commit -m "commit #0"
5 $ hg commit -m "commit #0"
5 $ echo This is file b1 > b
6 $ echo This is file b1 > b
6 $ hg add b
7 $ hg add b
7 $ hg commit -m "commit #1"
8 $ hg commit -m "commit #1"
8 $ hg update 0
9 $ hg update 0
9 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
10 $ echo This is file c1 > c
11 $ echo This is file c1 > c
11 $ hg add c
12 $ hg add c
12 $ hg commit -m "commit #2"
13 $ hg commit -m "commit #2"
13 created new head
14 created new head
14 $ hg merge 1
15 $ hg merge 1
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 (branch merge, don't forget to commit)
17 (branch merge, don't forget to commit)
17 $ rm b
18 $ rm b
18 $ echo This is file c22 > c
19 $ echo This is file c22 > c
19
20
20 Test hg behaves when committing with a missing file added by a merge
21 Test hg behaves when committing with a missing file added by a merge
21
22
22 $ hg commit -m "commit #3"
23 $ hg commit -m "commit #3"
23 abort: cannot commit merge with missing files
24 abort: cannot commit merge with missing files
24 [255]
25 [255]
25
26
26
27
27 Test conflict*() revsets
28 Test conflict*() revsets
28
29
29 # Bad usage
30 # Bad usage
30 $ hg log -r 'conflictlocal(foo)'
31 $ hg log -r 'conflictlocal(foo)'
31 hg: parse error: conflictlocal takes no arguments
32 hg: parse error: conflictlocal takes no arguments
32 [10]
33 [10]
33 $ hg log -r 'conflictother(foo)'
34 $ hg log -r 'conflictother(foo)'
34 hg: parse error: conflictother takes no arguments
35 hg: parse error: conflictother takes no arguments
35 [10]
36 [10]
36 $ hg co -C .
37 $ hg co -C .
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 # No merge parents when not merging
39 # No merge parents when not merging
39 $ hg log -r 'conflictlocal() + conflictother()'
40 $ hg log -r 'conflictlocal() + conflictother()'
40 # No merge parents when there is no conflict
41 # No merge parents when there is no conflict
41 $ hg merge 1
42 $ hg merge 1
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 (branch merge, don't forget to commit)
44 (branch merge, don't forget to commit)
44 $ hg log -r 'conflictlocal() + conflictother()'
45 $ hg log -r 'conflictlocal() + conflictother()'
45 $ hg co -C .
46 $ hg co -C .
46 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 $ echo conflict > b
48 $ echo conflict > b
48 $ hg ci -Aqm 'conflicting change to b'
49 $ hg ci -Aqm 'conflicting change to b'
49 $ hg merge 1
50 $ hg merge 1
50 merging b
51 merging b
51 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
52 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
52 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
53 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
53 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
54 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
54 [1]
55 [1]
55 # Shows merge parents when there is a conflict
56 # Shows merge parents when there is a conflict
56 $ hg log -r 'conflictlocal()' -T '{rev} {desc}\n'
57 $ hg log -r 'conflictlocal()' -T '{rev} {desc}\n'
57 3 conflicting change to b
58 3 conflicting change to b
58 $ hg log -r 'conflictother()' -T '{rev} {desc}\n'
59 $ hg log -r 'conflictother()' -T '{rev} {desc}\n'
59 1 commit #1
60 1 commit #1
@@ -1,36 +1,37 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ echo This is file a1 > a
3 $ echo This is file a1 > a
3 $ echo This is file b1 > b
4 $ echo This is file b1 > b
4 $ hg add a b
5 $ hg add a b
5 $ hg commit -m "commit #0"
6 $ hg commit -m "commit #0"
6 $ echo This is file b22 > b
7 $ echo This is file b22 > b
7 $ hg commit -m "comment #1"
8 $ hg commit -m "comment #1"
8 $ hg update 0
9 $ hg update 0
9 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 $ rm b
11 $ rm b
11 $ hg commit -A -m "comment #2"
12 $ hg commit -A -m "comment #2"
12 removing b
13 removing b
13 created new head
14 created new head
14 $ hg update 1
15 $ hg update 1
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 $ rm b
17 $ rm b
17 $ hg update -c 2
18 $ hg update -c 2
18 abort: uncommitted changes
19 abort: uncommitted changes
19 [20]
20 [20]
20 $ hg revert b
21 $ hg revert b
21 $ hg update -c 2
22 $ hg update -c 2
22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 $ mv a c
24 $ mv a c
24
25
25 Should abort:
26 Should abort:
26
27
27 $ hg update 1
28 $ hg update 1
28 abort: uncommitted changes
29 abort: uncommitted changes
29 (commit or update --clean to discard changes)
30 (commit or update --clean to discard changes)
30 [255]
31 [255]
31 $ mv c a
32 $ mv c a
32
33
33 Should succeed:
34 Should succeed:
34
35
35 $ hg update 1
36 $ hg update 1
36 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,593 +1,594 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3
3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5 $ hg qinit
6 $ hg qinit
6
7
7 $ echo x > x
8 $ echo x > x
8 $ hg ci -Ama
9 $ hg ci -Ama
9 adding x
10 adding x
10
11
11 $ hg qnew a.patch
12 $ hg qnew a.patch
12 $ echo a > a
13 $ echo a > a
13 $ hg add a
14 $ hg add a
14 $ hg qrefresh
15 $ hg qrefresh
15
16
16 $ hg qnew b.patch
17 $ hg qnew b.patch
17 $ echo b > b
18 $ echo b > b
18 $ hg add b
19 $ hg add b
19 $ hg qrefresh
20 $ hg qrefresh
20
21
21 $ hg qnew c.patch
22 $ hg qnew c.patch
22 $ echo c > c
23 $ echo c > c
23 $ hg add c
24 $ hg add c
24 $ hg qrefresh
25 $ hg qrefresh
25
26
26 $ hg qpop -a
27 $ hg qpop -a
27 popping c.patch
28 popping c.patch
28 popping b.patch
29 popping b.patch
29 popping a.patch
30 popping a.patch
30 patch queue now empty
31 patch queue now empty
31
32
32
33
33 should fail
34 should fail
34
35
35 $ hg qguard does-not-exist.patch +bleh
36 $ hg qguard does-not-exist.patch +bleh
36 abort: no patch named does-not-exist.patch
37 abort: no patch named does-not-exist.patch
37 [255]
38 [255]
38
39
39
40
40 should fail
41 should fail
41
42
42 $ hg qguard +fail
43 $ hg qguard +fail
43 abort: no patches applied
44 abort: no patches applied
44 [255]
45 [255]
45
46
46 $ hg qpush
47 $ hg qpush
47 applying a.patch
48 applying a.patch
48 now at: a.patch
49 now at: a.patch
49
50
50 should guard a.patch
51 should guard a.patch
51
52
52 $ hg qguard +a
53 $ hg qguard +a
53
54
54 should print +a
55 should print +a
55
56
56 $ hg qguard
57 $ hg qguard
57 a.patch: +a
58 a.patch: +a
58 $ hg qpop
59 $ hg qpop
59 popping a.patch
60 popping a.patch
60 patch queue now empty
61 patch queue now empty
61
62
62
63
63 should fail
64 should fail
64
65
65 $ hg qpush a.patch
66 $ hg qpush a.patch
66 cannot push 'a.patch' - guarded by '+a'
67 cannot push 'a.patch' - guarded by '+a'
67 [1]
68 [1]
68
69
69 $ hg qguard a.patch
70 $ hg qguard a.patch
70 a.patch: +a
71 a.patch: +a
71
72
72 should push b.patch
73 should push b.patch
73
74
74 $ hg qpush
75 $ hg qpush
75 applying b.patch
76 applying b.patch
76 now at: b.patch
77 now at: b.patch
77
78
78 $ hg qpop
79 $ hg qpop
79 popping b.patch
80 popping b.patch
80 patch queue now empty
81 patch queue now empty
81
82
82 test selection of an empty guard
83 test selection of an empty guard
83
84
84 $ hg qselect ""
85 $ hg qselect ""
85 abort: guard cannot be an empty string
86 abort: guard cannot be an empty string
86 [255]
87 [255]
87 $ hg qselect a
88 $ hg qselect a
88 number of unguarded, unapplied patches has changed from 2 to 3
89 number of unguarded, unapplied patches has changed from 2 to 3
89
90
90 should push a.patch
91 should push a.patch
91
92
92 $ hg qpush
93 $ hg qpush
93 applying a.patch
94 applying a.patch
94 now at: a.patch
95 now at: a.patch
95
96
96 $ hg qguard -- c.patch -a
97 $ hg qguard -- c.patch -a
97
98
98 should print -a
99 should print -a
99
100
100 $ hg qguard c.patch
101 $ hg qguard c.patch
101 c.patch: -a
102 c.patch: -a
102
103
103
104
104 should skip c.patch
105 should skip c.patch
105
106
106 $ hg qpush -a
107 $ hg qpush -a
107 applying b.patch
108 applying b.patch
108 skipping c.patch - guarded by '-a'
109 skipping c.patch - guarded by '-a'
109 now at: b.patch
110 now at: b.patch
110 $ hg qnext
111 $ hg qnext
111 all patches applied
112 all patches applied
112 [1]
113 [1]
113
114
114 should display b.patch
115 should display b.patch
115
116
116 $ hg qtop
117 $ hg qtop
117 b.patch
118 b.patch
118
119
119 $ hg qguard -n c.patch
120 $ hg qguard -n c.patch
120
121
121 should push c.patch
122 should push c.patch
122
123
123 $ hg qpush -a
124 $ hg qpush -a
124 applying c.patch
125 applying c.patch
125 now at: c.patch
126 now at: c.patch
126
127
127 $ hg qpop -a
128 $ hg qpop -a
128 popping c.patch
129 popping c.patch
129 popping b.patch
130 popping b.patch
130 popping a.patch
131 popping a.patch
131 patch queue now empty
132 patch queue now empty
132 $ hg qselect -n
133 $ hg qselect -n
133 guards deactivated
134 guards deactivated
134 number of unguarded, unapplied patches has changed from 3 to 2
135 number of unguarded, unapplied patches has changed from 3 to 2
135
136
136 should push all
137 should push all
137
138
138 $ hg qpush -a
139 $ hg qpush -a
139 applying b.patch
140 applying b.patch
140 applying c.patch
141 applying c.patch
141 now at: c.patch
142 now at: c.patch
142
143
143 $ hg qpop -a
144 $ hg qpop -a
144 popping c.patch
145 popping c.patch
145 popping b.patch
146 popping b.patch
146 patch queue now empty
147 patch queue now empty
147 $ hg qguard a.patch +1
148 $ hg qguard a.patch +1
148 $ hg qguard b.patch +2
149 $ hg qguard b.patch +2
149 $ hg qselect 1
150 $ hg qselect 1
150 number of unguarded, unapplied patches has changed from 1 to 2
151 number of unguarded, unapplied patches has changed from 1 to 2
151
152
152 should push a.patch, not b.patch
153 should push a.patch, not b.patch
153
154
154 $ hg qpush
155 $ hg qpush
155 applying a.patch
156 applying a.patch
156 now at: a.patch
157 now at: a.patch
157 $ hg qpush
158 $ hg qpush
158 applying c.patch
159 applying c.patch
159 now at: c.patch
160 now at: c.patch
160 $ hg qpop -a
161 $ hg qpop -a
161 popping c.patch
162 popping c.patch
162 popping a.patch
163 popping a.patch
163 patch queue now empty
164 patch queue now empty
164
165
165 $ hg qselect 2
166 $ hg qselect 2
166
167
167 should push b.patch
168 should push b.patch
168
169
169 $ hg qpush
170 $ hg qpush
170 applying b.patch
171 applying b.patch
171 now at: b.patch
172 now at: b.patch
172 $ hg qpush -a
173 $ hg qpush -a
173 applying c.patch
174 applying c.patch
174 now at: c.patch
175 now at: c.patch
175 $ hg qprev
176 $ hg qprev
176 b.patch
177 b.patch
177
178
178 Used to be an issue with holes in the patch sequence
179 Used to be an issue with holes in the patch sequence
179 So, put one hole on the base and ask for topmost patch.
180 So, put one hole on the base and ask for topmost patch.
180
181
181 $ hg qtop
182 $ hg qtop
182 c.patch
183 c.patch
183 $ hg qpop -a
184 $ hg qpop -a
184 popping c.patch
185 popping c.patch
185 popping b.patch
186 popping b.patch
186 patch queue now empty
187 patch queue now empty
187
188
188 $ hg qselect 1 2
189 $ hg qselect 1 2
189 number of unguarded, unapplied patches has changed from 2 to 3
190 number of unguarded, unapplied patches has changed from 2 to 3
190
191
191 should push a.patch, b.patch
192 should push a.patch, b.patch
192
193
193 $ hg qpush
194 $ hg qpush
194 applying a.patch
195 applying a.patch
195 now at: a.patch
196 now at: a.patch
196 $ hg qpush
197 $ hg qpush
197 applying b.patch
198 applying b.patch
198 now at: b.patch
199 now at: b.patch
199 $ hg qpop -a
200 $ hg qpop -a
200 popping b.patch
201 popping b.patch
201 popping a.patch
202 popping a.patch
202 patch queue now empty
203 patch queue now empty
203
204
204 $ hg qguard -- a.patch +1 +2 -3
205 $ hg qguard -- a.patch +1 +2 -3
205 $ hg qselect 1 2 3
206 $ hg qselect 1 2 3
206 number of unguarded, unapplied patches has changed from 3 to 2
207 number of unguarded, unapplied patches has changed from 3 to 2
207
208
208
209
209 list patches and guards
210 list patches and guards
210
211
211 $ hg qguard -l
212 $ hg qguard -l
212 a.patch: +1 +2 -3
213 a.patch: +1 +2 -3
213 b.patch: +2
214 b.patch: +2
214 c.patch: unguarded
215 c.patch: unguarded
215
216
216 have at least one patch applied to test coloring
217 have at least one patch applied to test coloring
217
218
218 $ hg qpush
219 $ hg qpush
219 applying b.patch
220 applying b.patch
220 now at: b.patch
221 now at: b.patch
221
222
222 list patches and guards with color
223 list patches and guards with color
223
224
224 $ hg --config extensions.color= qguard --config color.mode=ansi \
225 $ hg --config extensions.color= qguard --config color.mode=ansi \
225 > -l --color=always
226 > -l --color=always
226 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
227 \x1b[0;30;1ma.patch\x1b[0m: \x1b[0;33m+1\x1b[0m \x1b[0;33m+2\x1b[0m \x1b[0;31m-3\x1b[0m (esc)
227 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
228 \x1b[0;34;1;4mb.patch\x1b[0m: \x1b[0;33m+2\x1b[0m (esc)
228 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
229 \x1b[0;30;1mc.patch\x1b[0m: \x1b[0;32munguarded\x1b[0m (esc)
229
230
230 should pop b.patch
231 should pop b.patch
231
232
232 $ hg qpop
233 $ hg qpop
233 popping b.patch
234 popping b.patch
234 patch queue now empty
235 patch queue now empty
235
236
236 list series
237 list series
237
238
238 $ hg qseries -v
239 $ hg qseries -v
239 0 G a.patch
240 0 G a.patch
240 1 U b.patch
241 1 U b.patch
241 2 U c.patch
242 2 U c.patch
242
243
243 list guards
244 list guards
244
245
245 $ hg qselect
246 $ hg qselect
246 1
247 1
247 2
248 2
248 3
249 3
249
250
250 should push b.patch
251 should push b.patch
251
252
252 $ hg qpush
253 $ hg qpush
253 applying b.patch
254 applying b.patch
254 now at: b.patch
255 now at: b.patch
255
256
256 $ hg qpush -a
257 $ hg qpush -a
257 applying c.patch
258 applying c.patch
258 now at: c.patch
259 now at: c.patch
259 $ hg qselect -n --reapply -v
260 $ hg qselect -n --reapply -v
260 guards deactivated
261 guards deactivated
261 popping guarded patches
262 popping guarded patches
262 popping c.patch
263 popping c.patch
263 popping b.patch
264 popping b.patch
264 patch queue now empty
265 patch queue now empty
265 reapplying unguarded patches
266 reapplying unguarded patches
266 skipping a.patch - guarded by '+1' '+2'
267 skipping a.patch - guarded by '+1' '+2'
267 skipping b.patch - guarded by '+2'
268 skipping b.patch - guarded by '+2'
268 skipping a.patch - guarded by '+1' '+2'
269 skipping a.patch - guarded by '+1' '+2'
269 skipping b.patch - guarded by '+2'
270 skipping b.patch - guarded by '+2'
270 applying c.patch
271 applying c.patch
271 patching file c
272 patching file c
272 adding c
273 adding c
273 committing files:
274 committing files:
274 c
275 c
275 committing manifest
276 committing manifest
276 committing changelog
277 committing changelog
277 now at: c.patch
278 now at: c.patch
278
279
279 guards in series file: +1 +2 -3
280 guards in series file: +1 +2 -3
280
281
281 $ hg qselect -s
282 $ hg qselect -s
282 +1
283 +1
283 +2
284 +2
284 -3
285 -3
285
286
286 should show c.patch
287 should show c.patch
287
288
288 $ hg qapplied
289 $ hg qapplied
289 c.patch
290 c.patch
290
291
291 $ hg qrename a.patch new.patch
292 $ hg qrename a.patch new.patch
292
293
293 should show :
294 should show :
294
295
295
296
296 new.patch: +1 +2 -3
297 new.patch: +1 +2 -3
297
298
298
299
299 b.patch: +2
300 b.patch: +2
300
301
301
302
302 c.patch: unguarded
303 c.patch: unguarded
303
304
304 $ hg qguard -l
305 $ hg qguard -l
305 new.patch: +1 +2 -3
306 new.patch: +1 +2 -3
306 b.patch: +2
307 b.patch: +2
307 c.patch: unguarded
308 c.patch: unguarded
308
309
309 $ hg qnew d.patch
310 $ hg qnew d.patch
310 $ hg qpop
311 $ hg qpop
311 popping d.patch
312 popping d.patch
312 now at: c.patch
313 now at: c.patch
313
314
314 should show new.patch and b.patch as Guarded, c.patch as Applied
315 should show new.patch and b.patch as Guarded, c.patch as Applied
315
316
316
317
317 and d.patch as Unapplied
318 and d.patch as Unapplied
318
319
319 $ hg qseries -v
320 $ hg qseries -v
320 0 G new.patch
321 0 G new.patch
321 1 G b.patch
322 1 G b.patch
322 2 A c.patch
323 2 A c.patch
323 3 U d.patch
324 3 U d.patch
324
325
325 qseries again, but with color
326 qseries again, but with color
326
327
327 $ hg --config extensions.color= --config color.mode=ansi qseries -v --color=always
328 $ hg --config extensions.color= --config color.mode=ansi qseries -v --color=always
328 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
329 0 G \x1b[0;30;1mnew.patch\x1b[0m (esc)
329 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
330 1 G \x1b[0;30;1mb.patch\x1b[0m (esc)
330 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
331 2 A \x1b[0;34;1;4mc.patch\x1b[0m (esc)
331 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
332 3 U \x1b[0;30;1md.patch\x1b[0m (esc)
332
333
333 $ hg qguard d.patch +2
334 $ hg qguard d.patch +2
334
335
335 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
336 new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
336
337
337 $ hg qseries -v
338 $ hg qseries -v
338 0 G new.patch
339 0 G new.patch
339 1 G b.patch
340 1 G b.patch
340 2 A c.patch
341 2 A c.patch
341 3 G d.patch
342 3 G d.patch
342
343
343 $ qappunappv()
344 $ qappunappv()
344 > {
345 > {
345 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
346 > for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
346 > echo % hg $command
347 > echo % hg $command
347 > hg $command
348 > hg $command
348 > done
349 > done
349 > }
350 > }
350
351
351 $ hg qpop -a
352 $ hg qpop -a
352 popping c.patch
353 popping c.patch
353 patch queue now empty
354 patch queue now empty
354 $ hg qguard -l
355 $ hg qguard -l
355 new.patch: +1 +2 -3
356 new.patch: +1 +2 -3
356 b.patch: +2
357 b.patch: +2
357 c.patch: unguarded
358 c.patch: unguarded
358 d.patch: +2
359 d.patch: +2
359 $ qappunappv
360 $ qappunappv
360 % hg qapplied
361 % hg qapplied
361 % hg qapplied -v
362 % hg qapplied -v
362 % hg qunapplied
363 % hg qunapplied
363 c.patch
364 c.patch
364 % hg qunapplied -v
365 % hg qunapplied -v
365 0 G new.patch
366 0 G new.patch
366 1 G b.patch
367 1 G b.patch
367 2 U c.patch
368 2 U c.patch
368 3 G d.patch
369 3 G d.patch
369 $ hg qselect 1
370 $ hg qselect 1
370 number of unguarded, unapplied patches has changed from 1 to 2
371 number of unguarded, unapplied patches has changed from 1 to 2
371 $ qappunappv
372 $ qappunappv
372 % hg qapplied
373 % hg qapplied
373 % hg qapplied -v
374 % hg qapplied -v
374 % hg qunapplied
375 % hg qunapplied
375 new.patch
376 new.patch
376 c.patch
377 c.patch
377 % hg qunapplied -v
378 % hg qunapplied -v
378 0 U new.patch
379 0 U new.patch
379 1 G b.patch
380 1 G b.patch
380 2 U c.patch
381 2 U c.patch
381 3 G d.patch
382 3 G d.patch
382 $ hg qpush -a
383 $ hg qpush -a
383 applying new.patch
384 applying new.patch
384 skipping b.patch - guarded by '+2'
385 skipping b.patch - guarded by '+2'
385 applying c.patch
386 applying c.patch
386 skipping d.patch - guarded by '+2'
387 skipping d.patch - guarded by '+2'
387 now at: c.patch
388 now at: c.patch
388 $ qappunappv
389 $ qappunappv
389 % hg qapplied
390 % hg qapplied
390 new.patch
391 new.patch
391 c.patch
392 c.patch
392 % hg qapplied -v
393 % hg qapplied -v
393 0 A new.patch
394 0 A new.patch
394 1 G b.patch
395 1 G b.patch
395 2 A c.patch
396 2 A c.patch
396 % hg qunapplied
397 % hg qunapplied
397 % hg qunapplied -v
398 % hg qunapplied -v
398 3 G d.patch
399 3 G d.patch
399 $ hg qselect 2
400 $ hg qselect 2
400 number of unguarded, unapplied patches has changed from 0 to 1
401 number of unguarded, unapplied patches has changed from 0 to 1
401 $ qappunappv
402 $ qappunappv
402 % hg qapplied
403 % hg qapplied
403 new.patch
404 new.patch
404 c.patch
405 c.patch
405 % hg qapplied -v
406 % hg qapplied -v
406 0 A new.patch
407 0 A new.patch
407 1 U b.patch
408 1 U b.patch
408 2 A c.patch
409 2 A c.patch
409 % hg qunapplied
410 % hg qunapplied
410 d.patch
411 d.patch
411 % hg qunapplied -v
412 % hg qunapplied -v
412 3 U d.patch
413 3 U d.patch
413
414
414 $ for patch in `hg qseries`; do
415 $ for patch in `hg qseries`; do
415 > echo % hg qapplied $patch
416 > echo % hg qapplied $patch
416 > hg qapplied $patch
417 > hg qapplied $patch
417 > echo % hg qunapplied $patch
418 > echo % hg qunapplied $patch
418 > hg qunapplied $patch
419 > hg qunapplied $patch
419 > done
420 > done
420 % hg qapplied new.patch
421 % hg qapplied new.patch
421 new.patch
422 new.patch
422 % hg qunapplied new.patch
423 % hg qunapplied new.patch
423 b.patch
424 b.patch
424 d.patch
425 d.patch
425 % hg qapplied b.patch
426 % hg qapplied b.patch
426 new.patch
427 new.patch
427 % hg qunapplied b.patch
428 % hg qunapplied b.patch
428 d.patch
429 d.patch
429 % hg qapplied c.patch
430 % hg qapplied c.patch
430 new.patch
431 new.patch
431 c.patch
432 c.patch
432 % hg qunapplied c.patch
433 % hg qunapplied c.patch
433 d.patch
434 d.patch
434 % hg qapplied d.patch
435 % hg qapplied d.patch
435 new.patch
436 new.patch
436 c.patch
437 c.patch
437 % hg qunapplied d.patch
438 % hg qunapplied d.patch
438
439
439
440
440 hg qseries -m: only b.patch should be shown
441 hg qseries -m: only b.patch should be shown
441 the guards file was not ignored in the past
442 the guards file was not ignored in the past
442
443
443 $ hg qdelete -k b.patch
444 $ hg qdelete -k b.patch
444 $ hg qseries -m
445 $ hg qseries -m
445 b.patch
446 b.patch
446
447
447 hg qseries -m with color
448 hg qseries -m with color
448
449
449 $ hg --config extensions.color= --config color.mode=ansi qseries -m --color=always
450 $ hg --config extensions.color= --config color.mode=ansi qseries -m --color=always
450 \x1b[0;31;1mb.patch\x1b[0m (esc)
451 \x1b[0;31;1mb.patch\x1b[0m (esc)
451
452
452
453
453 excercise corner cases in "qselect --reapply"
454 excercise corner cases in "qselect --reapply"
454
455
455 $ hg qpop -a
456 $ hg qpop -a
456 popping c.patch
457 popping c.patch
457 popping new.patch
458 popping new.patch
458 patch queue now empty
459 patch queue now empty
459 $ hg qguard -- new.patch -not-new
460 $ hg qguard -- new.patch -not-new
460 $ hg qguard -- c.patch -not-c
461 $ hg qguard -- c.patch -not-c
461 $ hg qguard -- d.patch -not-d
462 $ hg qguard -- d.patch -not-d
462 $ hg qpush -a
463 $ hg qpush -a
463 applying new.patch
464 applying new.patch
464 applying c.patch
465 applying c.patch
465 applying d.patch
466 applying d.patch
466 patch d.patch is empty
467 patch d.patch is empty
467 now at: d.patch
468 now at: d.patch
468 $ hg qguard -l
469 $ hg qguard -l
469 new.patch: -not-new
470 new.patch: -not-new
470 c.patch: -not-c
471 c.patch: -not-c
471 d.patch: -not-d
472 d.patch: -not-d
472 $ hg qselect --reapply not-d
473 $ hg qselect --reapply not-d
473 popping guarded patches
474 popping guarded patches
474 popping d.patch
475 popping d.patch
475 now at: c.patch
476 now at: c.patch
476 reapplying unguarded patches
477 reapplying unguarded patches
477 cannot push 'd.patch' - guarded by '-not-d'
478 cannot push 'd.patch' - guarded by '-not-d'
478 $ hg qser -v
479 $ hg qser -v
479 0 A new.patch
480 0 A new.patch
480 1 A c.patch
481 1 A c.patch
481 2 G d.patch
482 2 G d.patch
482 $ hg qselect --reapply -n
483 $ hg qselect --reapply -n
483 guards deactivated
484 guards deactivated
484 $ hg qpush
485 $ hg qpush
485 applying d.patch
486 applying d.patch
486 patch d.patch is empty
487 patch d.patch is empty
487 now at: d.patch
488 now at: d.patch
488 $ hg qser -v
489 $ hg qser -v
489 0 A new.patch
490 0 A new.patch
490 1 A c.patch
491 1 A c.patch
491 2 A d.patch
492 2 A d.patch
492 $ hg qselect --reapply not-c
493 $ hg qselect --reapply not-c
493 popping guarded patches
494 popping guarded patches
494 popping d.patch
495 popping d.patch
495 popping c.patch
496 popping c.patch
496 now at: new.patch
497 now at: new.patch
497 reapplying unguarded patches
498 reapplying unguarded patches
498 applying d.patch
499 applying d.patch
499 patch d.patch is empty
500 patch d.patch is empty
500 now at: d.patch
501 now at: d.patch
501 $ hg qser -v
502 $ hg qser -v
502 0 A new.patch
503 0 A new.patch
503 1 G c.patch
504 1 G c.patch
504 2 A d.patch
505 2 A d.patch
505 $ hg qselect --reapply not-new
506 $ hg qselect --reapply not-new
506 popping guarded patches
507 popping guarded patches
507 popping d.patch
508 popping d.patch
508 popping new.patch
509 popping new.patch
509 patch queue now empty
510 patch queue now empty
510 reapplying unguarded patches
511 reapplying unguarded patches
511 applying c.patch
512 applying c.patch
512 applying d.patch
513 applying d.patch
513 patch d.patch is empty
514 patch d.patch is empty
514 now at: d.patch
515 now at: d.patch
515 $ hg qser -v
516 $ hg qser -v
516 0 G new.patch
517 0 G new.patch
517 1 A c.patch
518 1 A c.patch
518 2 A d.patch
519 2 A d.patch
519
520
520 test that qselect shows "number of guarded, applied patches" correctly
521 test that qselect shows "number of guarded, applied patches" correctly
521
522
522 $ hg qimport -q -e b.patch
523 $ hg qimport -q -e b.patch
523 adding b.patch to series file
524 adding b.patch to series file
524 $ hg qguard -- b.patch -not-b
525 $ hg qguard -- b.patch -not-b
525 $ hg qpop -a -q
526 $ hg qpop -a -q
526 patch queue now empty
527 patch queue now empty
527 $ hg qunapplied -v
528 $ hg qunapplied -v
528 0 G new.patch
529 0 G new.patch
529 1 U c.patch
530 1 U c.patch
530 2 U d.patch
531 2 U d.patch
531 3 U b.patch
532 3 U b.patch
532 $ hg qselect not-new not-c
533 $ hg qselect not-new not-c
533 number of unguarded, unapplied patches has changed from 3 to 2
534 number of unguarded, unapplied patches has changed from 3 to 2
534 $ hg qpush -q -a
535 $ hg qpush -q -a
535 patch d.patch is empty
536 patch d.patch is empty
536 now at: b.patch
537 now at: b.patch
537
538
538 $ hg qapplied -v
539 $ hg qapplied -v
539 0 G new.patch
540 0 G new.patch
540 1 G c.patch
541 1 G c.patch
541 2 A d.patch
542 2 A d.patch
542 3 A b.patch
543 3 A b.patch
543 $ hg qselect --none
544 $ hg qselect --none
544 guards deactivated
545 guards deactivated
545 $ hg qselect not-new not-c not-d
546 $ hg qselect not-new not-c not-d
546 number of guarded, applied patches has changed from 0 to 1
547 number of guarded, applied patches has changed from 0 to 1
547
548
548 test that "qselect --reapply" reapplies patches successfully when the
549 test that "qselect --reapply" reapplies patches successfully when the
549 already applied patch becomes unguarded and it follows the already
550 already applied patch becomes unguarded and it follows the already
550 guarded (= not yet applied) one.
551 guarded (= not yet applied) one.
551
552
552 $ hg qpop -q -a
553 $ hg qpop -q -a
553 patch queue now empty
554 patch queue now empty
554 $ hg qselect not-new not-c
555 $ hg qselect not-new not-c
555 number of unguarded, unapplied patches has changed from 1 to 2
556 number of unguarded, unapplied patches has changed from 1 to 2
556 $ hg qpush -q -a
557 $ hg qpush -q -a
557 patch d.patch is empty
558 patch d.patch is empty
558 now at: b.patch
559 now at: b.patch
559 $ hg qapplied -v
560 $ hg qapplied -v
560 0 G new.patch
561 0 G new.patch
561 1 G c.patch
562 1 G c.patch
562 2 A d.patch
563 2 A d.patch
563 3 A b.patch
564 3 A b.patch
564 $ hg qselect -q --reapply not-c not-b
565 $ hg qselect -q --reapply not-c not-b
565 now at: d.patch
566 now at: d.patch
566 cannot push 'b.patch' - guarded by '-not-b'
567 cannot push 'b.patch' - guarded by '-not-b'
567 $ hg qseries -v
568 $ hg qseries -v
568 0 U new.patch
569 0 U new.patch
569 1 G c.patch
570 1 G c.patch
570 2 A d.patch
571 2 A d.patch
571 3 G b.patch
572 3 G b.patch
572
573
573 test that "qselect --reapply" checks applied patches correctly when no
574 test that "qselect --reapply" checks applied patches correctly when no
574 applied patches becomes guarded but some of unapplied ones become
575 applied patches becomes guarded but some of unapplied ones become
575 unguarded.
576 unguarded.
576
577
577 $ hg qpop -q -a
578 $ hg qpop -q -a
578 patch queue now empty
579 patch queue now empty
579 $ hg qselect not-new not-c not-d
580 $ hg qselect not-new not-c not-d
580 number of unguarded, unapplied patches has changed from 2 to 1
581 number of unguarded, unapplied patches has changed from 2 to 1
581 $ hg qpush -q -a
582 $ hg qpush -q -a
582 now at: b.patch
583 now at: b.patch
583 $ hg qapplied -v
584 $ hg qapplied -v
584 0 G new.patch
585 0 G new.patch
585 1 G c.patch
586 1 G c.patch
586 2 G d.patch
587 2 G d.patch
587 3 A b.patch
588 3 A b.patch
588 $ hg qselect -q --reapply not-new not-c
589 $ hg qselect -q --reapply not-new not-c
589 $ hg qseries -v
590 $ hg qseries -v
590 0 G new.patch
591 0 G new.patch
591 1 G c.patch
592 1 G c.patch
592 2 U d.patch
593 2 U d.patch
593 3 A b.patch
594 3 A b.patch
@@ -1,15 +1,16 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3
3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5
6
6 $ echo 'base' > base
7 $ echo 'base' > base
7 $ hg ci -Ambase
8 $ hg ci -Ambase
8 adding base
9 adding base
9
10
10 $ hg qnew -mmqbase mqbase
11 $ hg qnew -mmqbase mqbase
11
12
12 $ hg qsave
13 $ hg qsave
13 $ hg qrestore 2
14 $ hg qrestore 2
14 restoring status: hg patches saved state
15 restoring status: hg patches saved state
15
16
@@ -1,112 +1,113 b''
1 #require symlink
1 #require symlink
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
4 $ echo "mq=" >> $HGRCPATH
5
5
6 $ hg init
6 $ hg init repo
7 $ cd repo
7 $ hg qinit
8 $ hg qinit
8 $ hg qnew base.patch
9 $ hg qnew base.patch
9 $ echo aaa > a
10 $ echo aaa > a
10 $ echo bbb > b
11 $ echo bbb > b
11 $ echo ccc > c
12 $ echo ccc > c
12 $ hg add a b c
13 $ hg add a b c
13 $ hg qrefresh
14 $ hg qrefresh
14 $ readlink.py a
15 $ readlink.py a
15 a -> a not a symlink
16 a -> a not a symlink
16
17
17
18
18 test replacing a file with a symlink
19 test replacing a file with a symlink
19
20
20 $ hg qnew symlink.patch
21 $ hg qnew symlink.patch
21 $ rm a
22 $ rm a
22 $ ln -s b a
23 $ ln -s b a
23 $ hg qrefresh --git
24 $ hg qrefresh --git
24 $ readlink.py a
25 $ readlink.py a
25 a -> b
26 a -> b
26
27
27 $ hg qpop
28 $ hg qpop
28 popping symlink.patch
29 popping symlink.patch
29 now at: base.patch
30 now at: base.patch
30 $ hg qpush
31 $ hg qpush
31 applying symlink.patch
32 applying symlink.patch
32 now at: symlink.patch
33 now at: symlink.patch
33 $ readlink.py a
34 $ readlink.py a
34 a -> b
35 a -> b
35
36
36
37
37 test updating a symlink
38 test updating a symlink
38
39
39 $ rm a
40 $ rm a
40 $ ln -s c a
41 $ ln -s c a
41 $ hg qnew --git -f updatelink
42 $ hg qnew --git -f updatelink
42 $ readlink.py a
43 $ readlink.py a
43 a -> c
44 a -> c
44 $ hg qpop
45 $ hg qpop
45 popping updatelink
46 popping updatelink
46 now at: symlink.patch
47 now at: symlink.patch
47 $ hg qpush --debug
48 $ hg qpush --debug
48 applying updatelink
49 applying updatelink
49 patching file a
50 patching file a
50 committing files:
51 committing files:
51 a
52 a
52 committing manifest
53 committing manifest
53 committing changelog
54 committing changelog
54 updating the branch cache
55 updating the branch cache
55 now at: updatelink
56 now at: updatelink
56 $ readlink.py a
57 $ readlink.py a
57 a -> c
58 a -> c
58 $ hg st
59 $ hg st
59
60
60
61
61 test replacing a symlink with a file
62 test replacing a symlink with a file
62
63
63 $ ln -s c s
64 $ ln -s c s
64 $ hg add s
65 $ hg add s
65 $ hg qnew --git -f addlink
66 $ hg qnew --git -f addlink
66 $ rm s
67 $ rm s
67 $ echo sss > s
68 $ echo sss > s
68 $ hg qnew --git -f replacelinkwithfile
69 $ hg qnew --git -f replacelinkwithfile
69 $ hg qpop
70 $ hg qpop
70 popping replacelinkwithfile
71 popping replacelinkwithfile
71 now at: addlink
72 now at: addlink
72 $ hg qpush
73 $ hg qpush
73 applying replacelinkwithfile
74 applying replacelinkwithfile
74 now at: replacelinkwithfile
75 now at: replacelinkwithfile
75 $ cat s
76 $ cat s
76 sss
77 sss
77 $ hg st
78 $ hg st
78
79
79
80
80 test symlink removal
81 test symlink removal
81
82
82 $ hg qnew removesl.patch
83 $ hg qnew removesl.patch
83 $ hg rm a
84 $ hg rm a
84 $ hg qrefresh --git
85 $ hg qrefresh --git
85 $ hg qpop
86 $ hg qpop
86 popping removesl.patch
87 popping removesl.patch
87 now at: replacelinkwithfile
88 now at: replacelinkwithfile
88 $ hg qpush
89 $ hg qpush
89 applying removesl.patch
90 applying removesl.patch
90 now at: removesl.patch
91 now at: removesl.patch
91 $ hg st -c
92 $ hg st -c
92 C b
93 C b
93 C c
94 C c
94 C s
95 C s
95
96
96 replace broken symlink with another broken symlink
97 replace broken symlink with another broken symlink
97
98
98 $ ln -s linka linka
99 $ ln -s linka linka
99 $ hg add linka
100 $ hg add linka
100 $ hg qnew link
101 $ hg qnew link
101 $ hg mv linka linkb
102 $ hg mv linka linkb
102 $ rm linkb
103 $ rm linkb
103 $ ln -s linkb linkb
104 $ ln -s linkb linkb
104 $ hg qnew movelink
105 $ hg qnew movelink
105 $ hg qpop
106 $ hg qpop
106 popping movelink
107 popping movelink
107 now at: link
108 now at: link
108 $ hg qpush
109 $ hg qpush
109 applying movelink
110 applying movelink
110 now at: movelink
111 now at: movelink
111 $ readlink.py linkb
112 $ readlink.py linkb
112 linkb -> linkb
113 linkb -> linkb
@@ -1,532 +1,527 b''
1 $ hg init a
1 $ hg init a
2 $ hg clone a b
2 $ hg clone a b
3 updating to branch default
3 updating to branch default
4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
5 $ cd a
5 $ cd a
6
6
7 with no paths:
7 with no paths:
8
8
9 $ hg paths
9 $ hg paths
10 $ hg paths unknown
10 $ hg paths unknown
11 not found!
11 not found!
12 [1]
12 [1]
13 $ hg paths -Tjson
13 $ hg paths -Tjson
14 [
14 [
15 ]
15 ]
16
16
17 with paths:
17 with paths:
18
18
19 $ echo '[paths]' >> .hg/hgrc
19 $ echo '[paths]' >> .hg/hgrc
20 $ echo 'dupe = ../b#tip' >> .hg/hgrc
20 $ echo 'dupe = ../b#tip' >> .hg/hgrc
21 $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
21 $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
22 $ hg in dupe
22 $ hg in dupe
23 comparing with $TESTTMP/b
23 comparing with $TESTTMP/b
24 no changes found
24 no changes found
25 [1]
25 [1]
26 $ cd ..
26 $ cd ..
27 $ hg -R a in dupe
27 $ hg -R a in dupe
28 comparing with $TESTTMP/b
28 comparing with $TESTTMP/b
29 no changes found
29 no changes found
30 [1]
30 [1]
31 $ cd a
31 $ cd a
32 $ hg paths
32 $ hg paths
33 dupe = $TESTTMP/b#tip
33 dupe = $TESTTMP/b#tip
34 expand = $TESTTMP/a/$SOMETHING/bar
34 expand = $TESTTMP/a/$SOMETHING/bar
35 $ SOMETHING=foo hg paths
35 $ SOMETHING=foo hg paths
36 dupe = $TESTTMP/b#tip
36 dupe = $TESTTMP/b#tip
37 expand = $TESTTMP/a/foo/bar
37 expand = $TESTTMP/a/foo/bar
38 #if msys
38 #if msys
39 $ SOMETHING=//foo hg paths
39 $ SOMETHING=//foo hg paths
40 dupe = $TESTTMP/b#tip
40 dupe = $TESTTMP/b#tip
41 expand = /foo/bar
41 expand = /foo/bar
42 #else
42 #else
43 $ SOMETHING=/foo hg paths
43 $ SOMETHING=/foo hg paths
44 dupe = $TESTTMP/b#tip
44 dupe = $TESTTMP/b#tip
45 expand = /foo/bar
45 expand = /foo/bar
46 #endif
46 #endif
47 $ hg paths -q
47 $ hg paths -q
48 dupe
48 dupe
49 expand
49 expand
50 $ hg paths dupe
50 $ hg paths dupe
51 $TESTTMP/b#tip
51 $TESTTMP/b#tip
52 $ hg paths -q dupe
52 $ hg paths -q dupe
53 $ hg paths unknown
53 $ hg paths unknown
54 not found!
54 not found!
55 [1]
55 [1]
56 $ hg paths -q unknown
56 $ hg paths -q unknown
57 [1]
57 [1]
58
58
59 formatter output with paths:
59 formatter output with paths:
60
60
61 $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc
61 $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc
62 $ hg paths -Tjson | sed 's|\\\\|\\|g'
62 $ hg paths -Tjson | sed 's|\\\\|\\|g'
63 [
63 [
64 {
64 {
65 "name": "dupe",
65 "name": "dupe",
66 "pushurl": "https://example.com/dupe",
66 "pushurl": "https://example.com/dupe",
67 "url": "$TESTTMP/b#tip"
67 "url": "$TESTTMP/b#tip"
68 },
68 },
69 {
69 {
70 "name": "expand",
70 "name": "expand",
71 "url": "$TESTTMP/a/$SOMETHING/bar"
71 "url": "$TESTTMP/a/$SOMETHING/bar"
72 }
72 }
73 ]
73 ]
74 $ hg paths -Tjson dupe | sed 's|\\\\|\\|g'
74 $ hg paths -Tjson dupe | sed 's|\\\\|\\|g'
75 [
75 [
76 {
76 {
77 "name": "dupe",
77 "name": "dupe",
78 "pushurl": "https://example.com/dupe",
78 "pushurl": "https://example.com/dupe",
79 "url": "$TESTTMP/b#tip"
79 "url": "$TESTTMP/b#tip"
80 }
80 }
81 ]
81 ]
82 $ hg paths -Tjson -q unknown
82 $ hg paths -Tjson -q unknown
83 [
83 [
84 ]
84 ]
85 [1]
85 [1]
86
86
87 log template:
87 log template:
88
88
89 (behaves as a {name: path-string} dict by default)
89 (behaves as a {name: path-string} dict by default)
90
90
91 $ hg log -rnull -T '{peerurls}\n'
91 $ hg log -rnull -T '{peerurls}\n'
92 dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar
92 dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar
93 $ hg log -rnull -T '{join(peerurls, "\n")}\n'
93 $ hg log -rnull -T '{join(peerurls, "\n")}\n'
94 dupe=$TESTTMP/b#tip
94 dupe=$TESTTMP/b#tip
95 expand=$TESTTMP/a/$SOMETHING/bar
95 expand=$TESTTMP/a/$SOMETHING/bar
96 $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}'
96 $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}'
97 dupe: $TESTTMP/b#tip
97 dupe: $TESTTMP/b#tip
98 expand: $TESTTMP/a/$SOMETHING/bar
98 expand: $TESTTMP/a/$SOMETHING/bar
99 $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
99 $ hg log -rnull -T '{get(peerurls, "dupe")}\n'
100 $TESTTMP/b#tip
100 $TESTTMP/b#tip
101 #if windows
101 #if windows
102 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
102 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
103 [{"pushurl": "https://example.com/dupe", "url": "$STR_REPR_TESTTMP\\b#tip"}]
103 [{"pushurl": "https://example.com/dupe", "url": "$STR_REPR_TESTTMP\\b#tip"}]
104 [{"url": "$STR_REPR_TESTTMP\\a\\$SOMETHING\\bar"}]
104 [{"url": "$STR_REPR_TESTTMP\\a\\$SOMETHING\\bar"}]
105 #else
105 #else
106 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
106 $ hg log -rnull -T '{peerurls % "{urls|json}\n"}'
107 [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}]
107 [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}]
108 [{"url": "$TESTTMP/a/$SOMETHING/bar"}]
108 [{"url": "$TESTTMP/a/$SOMETHING/bar"}]
109 #endif
109 #endif
110
110
111 (sub options can be populated by map/dot operation)
111 (sub options can be populated by map/dot operation)
112
112
113 $ hg log -rnull \
113 $ hg log -rnull \
114 > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
114 > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}'
115 url: $TESTTMP/b#tip
115 url: $TESTTMP/b#tip
116 pushurl: https://example.com/dupe
116 pushurl: https://example.com/dupe
117 $ hg log -rnull -T '{peerurls.dupe.pushurl}\n'
117 $ hg log -rnull -T '{peerurls.dupe.pushurl}\n'
118 https://example.com/dupe
118 https://example.com/dupe
119
119
120 (in JSON, it's a dict of urls)
120 (in JSON, it's a dict of urls)
121
121
122 $ hg log -rnull -T '{peerurls|json}\n' | sed 's|\\\\|/|g'
122 $ hg log -rnull -T '{peerurls|json}\n' | sed 's|\\\\|/|g'
123 {"dupe": "$TESTTMP/b#tip", "expand": "$TESTTMP/a/$SOMETHING/bar"}
123 {"dupe": "$TESTTMP/b#tip", "expand": "$TESTTMP/a/$SOMETHING/bar"}
124
124
125 password should be masked in plain output, but not in machine-readable/template
125 password should be masked in plain output, but not in machine-readable/template
126 output:
126 output:
127
127
128 $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc
128 $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc
129 $ hg paths insecure
129 $ hg paths insecure
130 http://foo:***@example.com/
130 http://foo:***@example.com/
131 $ hg paths -Tjson insecure
131 $ hg paths -Tjson insecure
132 [
132 [
133 {
133 {
134 "name": "insecure",
134 "name": "insecure",
135 "url": "http://foo:insecure@example.com/"
135 "url": "http://foo:insecure@example.com/"
136 }
136 }
137 ]
137 ]
138 $ hg log -rnull -T '{get(peerurls, "insecure")}\n'
138 $ hg log -rnull -T '{get(peerurls, "insecure")}\n'
139 http://foo:insecure@example.com/
139 http://foo:insecure@example.com/
140
140
141 zeroconf wraps ui.configitems(), which shouldn't crash at least:
141 zeroconf wraps ui.configitems(), which shouldn't crash at least:
142
142
143 XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason,
143 XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason,
144 we accept the bad output for now as this is the last thing in the way of
144 we accept the bad output for now as this is the last thing in the way of
145 testing the pyoxidizer build.
145 testing the pyoxidizer build.
146
146
147 #if no-pyoxidizer
147 #if no-pyoxidizer
148 $ hg paths --config extensions.zeroconf=
148 $ hg paths --config extensions.zeroconf=
149 dupe = $TESTTMP/b#tip
149 dupe = $TESTTMP/b#tip
150 dupe:pushurl = https://example.com/dupe
150 dupe:pushurl = https://example.com/dupe
151 expand = $TESTTMP/a/$SOMETHING/bar
151 expand = $TESTTMP/a/$SOMETHING/bar
152 insecure = http://foo:***@example.com/
152 insecure = http://foo:***@example.com/
153 #else
153 #else
154 $ hg paths --config extensions.zeroconf=
154 $ hg paths --config extensions.zeroconf=
155 abort: An invalid argument was supplied (known-bad-output !)
155 abort: An invalid argument was supplied (known-bad-output !)
156 [255]
156 [255]
157 #endif
157 #endif
158
158
159
159
160 $ cd ..
160 $ cd ..
161
161
162 sub-options for an undeclared path are ignored
162 sub-options for an undeclared path are ignored
163
163
164 $ hg init suboptions
164 $ hg init suboptions
165 $ cd suboptions
165 $ cd suboptions
166
166
167 $ cat > .hg/hgrc << EOF
167 $ cat > .hg/hgrc << EOF
168 > [paths]
168 > [paths]
169 > path0 = https://example.com/path0
169 > path0 = https://example.com/path0
170 > path1:pushurl = https://example.com/path1
170 > path1:pushurl = https://example.com/path1
171 > EOF
171 > EOF
172 $ hg paths
172 $ hg paths
173 path0 = https://example.com/path0
173 path0 = https://example.com/path0
174
174
175 unknown sub-options aren't displayed
175 unknown sub-options aren't displayed
176
176
177 $ cat > .hg/hgrc << EOF
177 $ cat > .hg/hgrc << EOF
178 > [paths]
178 > [paths]
179 > path0 = https://example.com/path0
179 > path0 = https://example.com/path0
180 > path0:foo = https://example.com/path1
180 > path0:foo = https://example.com/path1
181 > EOF
181 > EOF
182
182
183 $ hg paths
183 $ hg paths
184 path0 = https://example.com/path0
184 path0 = https://example.com/path0
185
185
186 :pushurl must be a URL
186 :pushurl must be a URL
187
187
188 $ cat > .hg/hgrc << EOF
188 $ cat > .hg/hgrc << EOF
189 > [paths]
189 > [paths]
190 > default = /path/to/nothing
190 > default = /path/to/nothing
191 > default:pushurl = /not/a/url
191 > default:pushurl = /not/a/url
192 > EOF
192 > EOF
193
193
194 $ hg paths
194 $ hg paths
195 (paths.default:pushurl not a URL; ignoring: "/not/a/url")
195 (paths.default:pushurl not a URL; ignoring: "/not/a/url")
196 default = /path/to/nothing
196 default = /path/to/nothing
197
197
198 #fragment is not allowed in :pushurl
198 #fragment is not allowed in :pushurl
199
199
200 $ cat > .hg/hgrc << EOF
200 $ cat > .hg/hgrc << EOF
201 > [paths]
201 > [paths]
202 > default = https://example.com/repo
202 > default = https://example.com/repo
203 > invalid = https://example.com/repo
203 > invalid = https://example.com/repo
204 > invalid:pushurl = https://example.com/repo#branch
204 > invalid:pushurl = https://example.com/repo#branch
205 > EOF
205 > EOF
206
206
207 $ hg paths
207 $ hg paths
208 ("#fragment" in paths.invalid:pushurl not supported; ignoring)
208 ("#fragment" in paths.invalid:pushurl not supported; ignoring)
209 default = https://example.com/repo
209 default = https://example.com/repo
210 invalid = https://example.com/repo
210 invalid = https://example.com/repo
211 invalid:pushurl = https://example.com/repo
211 invalid:pushurl = https://example.com/repo
212
212
213 $ cd ..
213 $ cd ..
214
214
215 'file:' disables [paths] entries for clone destination
215 'file:' disables [paths] entries for clone destination
216
216
217 $ cat >> $HGRCPATH <<EOF
217 $ cat >> $HGRCPATH <<EOF
218 > [paths]
218 > [paths]
219 > gpath1 = http://hg.example.com
219 > gpath1 = http://hg.example.com
220 > EOF
220 > EOF
221
221
222 $ hg clone a gpath1
222 $ hg clone a gpath1
223 abort: cannot create new http repository
223 abort: cannot create new http repository
224 [255]
224 [255]
225
225
226 $ hg clone a file:gpath1
226 $ hg clone a file:gpath1
227 updating to branch default
227 updating to branch default
228 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 $ cd gpath1
229 $ cd gpath1
230 $ hg -q id
230 $ hg -q id
231 000000000000
231 000000000000
232
232
233 $ cd ..
233 $ cd ..
234
234
235 Testing path referencing other paths
235 Testing path referencing other paths
236 ====================================
236 ====================================
237
237
238 basic setup
238 basic setup
239 -----------
239 -----------
240
240
241 $ ls -1
242 a
243 b
244 gpath1
245 suboptions
246 $ hg init chained_path
241 $ hg init chained_path
247 $ cd chained_path
242 $ cd chained_path
248 $ cat << EOF > .hg/hgrc
243 $ cat << EOF > .hg/hgrc
249 > [paths]
244 > [paths]
250 > default=../a
245 > default=../a
251 > other_default=path://default
246 > other_default=path://default
252 > path_with_branch=../branchy#foo
247 > path_with_branch=../branchy#foo
253 > other_branch=path://path_with_branch
248 > other_branch=path://path_with_branch
254 > other_branched=path://path_with_branch#default
249 > other_branched=path://path_with_branch#default
255 > pushdest=../push-dest
250 > pushdest=../push-dest
256 > pushdest:pushrev=default
251 > pushdest:pushrev=default
257 > pushdest2=path://pushdest
252 > pushdest2=path://pushdest
258 > pushdest-overwrite=path://pushdest
253 > pushdest-overwrite=path://pushdest
259 > pushdest-overwrite:pushrev=foo
254 > pushdest-overwrite:pushrev=foo
260 > EOF
255 > EOF
261
256
262 $ hg init ../branchy
257 $ hg init ../branchy
263 $ hg init ../push-dest
258 $ hg init ../push-dest
264 $ hg debugbuilddag -R ../branchy '.:base+3<base@foo+5'
259 $ hg debugbuilddag -R ../branchy '.:base+3<base@foo+5'
265 $ hg log -G -T '{branch}\n' -R ../branchy
260 $ hg log -G -T '{branch}\n' -R ../branchy
266 o foo
261 o foo
267 |
262 |
268 o foo
263 o foo
269 |
264 |
270 o foo
265 o foo
271 |
266 |
272 o foo
267 o foo
273 |
268 |
274 o foo
269 o foo
275 |
270 |
276 | o default
271 | o default
277 | |
272 | |
278 | o default
273 | o default
279 | |
274 | |
280 | o default
275 | o default
281 |/
276 |/
282 o default
277 o default
283
278
284
279
285 $ hg paths
280 $ hg paths
286 default = $TESTTMP/a
281 default = $TESTTMP/a
287 gpath1 = http://hg.example.com/
282 gpath1 = http://hg.example.com/
288 other_branch = $TESTTMP/branchy#foo
283 other_branch = $TESTTMP/branchy#foo
289 other_branched = $TESTTMP/branchy#default
284 other_branched = $TESTTMP/branchy#default
290 other_default = $TESTTMP/a
285 other_default = $TESTTMP/a
291 path_with_branch = $TESTTMP/branchy#foo
286 path_with_branch = $TESTTMP/branchy#foo
292 pushdest = $TESTTMP/push-dest
287 pushdest = $TESTTMP/push-dest
293 pushdest:pushrev = default
288 pushdest:pushrev = default
294 pushdest-overwrite = $TESTTMP/push-dest
289 pushdest-overwrite = $TESTTMP/push-dest
295 pushdest-overwrite:pushrev = foo
290 pushdest-overwrite:pushrev = foo
296 pushdest2 = $TESTTMP/push-dest
291 pushdest2 = $TESTTMP/push-dest
297 pushdest2:pushrev = default
292 pushdest2:pushrev = default
298
293
299 test basic chaining
294 test basic chaining
300 -------------------
295 -------------------
301
296
302 $ hg path other_default
297 $ hg path other_default
303 $TESTTMP/a
298 $TESTTMP/a
304 $ hg pull default
299 $ hg pull default
305 pulling from $TESTTMP/a
300 pulling from $TESTTMP/a
306 no changes found
301 no changes found
307 $ hg pull other_default
302 $ hg pull other_default
308 pulling from $TESTTMP/a
303 pulling from $TESTTMP/a
309 no changes found
304 no changes found
310
305
311 test inheritance of the #fragment part
306 test inheritance of the #fragment part
312 --------------------------------------
307 --------------------------------------
313
308
314 $ hg pull path_with_branch
309 $ hg pull path_with_branch
315 pulling from $TESTTMP/branchy
310 pulling from $TESTTMP/branchy
316 adding changesets
311 adding changesets
317 adding manifests
312 adding manifests
318 adding file changes
313 adding file changes
319 added 6 changesets with 0 changes to 0 files
314 added 6 changesets with 0 changes to 0 files
320 new changesets 1ea73414a91b:bcebb50b77de
315 new changesets 1ea73414a91b:bcebb50b77de
321 (run 'hg update' to get a working copy)
316 (run 'hg update' to get a working copy)
322 $ hg pull other_branch
317 $ hg pull other_branch
323 pulling from $TESTTMP/branchy
318 pulling from $TESTTMP/branchy
324 no changes found
319 no changes found
325 $ hg pull other_branched
320 $ hg pull other_branched
326 pulling from $TESTTMP/branchy
321 pulling from $TESTTMP/branchy
327 searching for changes
322 searching for changes
328 adding changesets
323 adding changesets
329 adding manifests
324 adding manifests
330 adding file changes
325 adding file changes
331 added 3 changesets with 0 changes to 0 files (+1 heads)
326 added 3 changesets with 0 changes to 0 files (+1 heads)
332 new changesets 66f7d451a68b:2dc09a01254d
327 new changesets 66f7d451a68b:2dc09a01254d
333 (run 'hg heads' to see heads)
328 (run 'hg heads' to see heads)
334
329
335 test inheritance of the suboptions
330 test inheritance of the suboptions
336 ----------------------------------
331 ----------------------------------
337
332
338 $ hg push pushdest
333 $ hg push pushdest
339 pushing to $TESTTMP/push-dest
334 pushing to $TESTTMP/push-dest
340 searching for changes
335 searching for changes
341 adding changesets
336 adding changesets
342 adding manifests
337 adding manifests
343 adding file changes
338 adding file changes
344 added 4 changesets with 0 changes to 0 files
339 added 4 changesets with 0 changes to 0 files
345 $ hg push pushdest2
340 $ hg push pushdest2
346 pushing to $TESTTMP/push-dest
341 pushing to $TESTTMP/push-dest
347 searching for changes
342 searching for changes
348 no changes found
343 no changes found
349 [1]
344 [1]
350 $ hg push pushdest-overwrite --new-branch
345 $ hg push pushdest-overwrite --new-branch
351 pushing to $TESTTMP/push-dest
346 pushing to $TESTTMP/push-dest
352 searching for changes
347 searching for changes
353 adding changesets
348 adding changesets
354 adding manifests
349 adding manifests
355 adding file changes
350 adding file changes
356 added 5 changesets with 0 changes to 0 files (+1 heads)
351 added 5 changesets with 0 changes to 0 files (+1 heads)
357
352
358 Test chaining path:// definition
353 Test chaining path:// definition
359 --------------------------------
354 --------------------------------
360
355
361 This is currently unsupported, but feel free to implement the necessary
356 This is currently unsupported, but feel free to implement the necessary
362 dependency detection.
357 dependency detection.
363
358
364 $ cat << EOF >> .hg/hgrc
359 $ cat << EOF >> .hg/hgrc
365 > chain_path=path://other_default
360 > chain_path=path://other_default
366 > EOF
361 > EOF
367
362
368 $ hg id
363 $ hg id
369 000000000000
364 000000000000
370 $ hg path
365 $ hg path
371 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
366 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
372 [255]
367 [255]
373 $ hg pull chain_path
368 $ hg pull chain_path
374 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
369 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
375 [255]
370 [255]
376
371
377 Doing an actual circle should always be an issue
372 Doing an actual circle should always be an issue
378
373
379 $ cat << EOF >> .hg/hgrc
374 $ cat << EOF >> .hg/hgrc
380 > rock=path://cissors
375 > rock=path://cissors
381 > cissors=path://paper
376 > cissors=path://paper
382 > paper=://rock
377 > paper=://rock
383 > EOF
378 > EOF
384
379
385 $ hg id
380 $ hg id
386 000000000000
381 000000000000
387 $ hg path
382 $ hg path
388 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
383 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
389 [255]
384 [255]
390 $ hg pull chain_path
385 $ hg pull chain_path
391 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
386 abort: cannot use `path://other_default`, "other_default" is also defined as a `path://`
392 [255]
387 [255]
393
388
394 Test basic error cases
389 Test basic error cases
395 ----------------------
390 ----------------------
396
391
397 $ cat << EOF > .hg/hgrc
392 $ cat << EOF > .hg/hgrc
398 > [paths]
393 > [paths]
399 > error-missing=path://unknown
394 > error-missing=path://unknown
400 > EOF
395 > EOF
401 $ hg path
396 $ hg path
402 abort: cannot use `path://unknown`, "unknown" is not a known path
397 abort: cannot use `path://unknown`, "unknown" is not a known path
403 [255]
398 [255]
404 $ hg pull error-missing
399 $ hg pull error-missing
405 abort: cannot use `path://unknown`, "unknown" is not a known path
400 abort: cannot use `path://unknown`, "unknown" is not a known path
406 [255]
401 [255]
407
402
408 Test path pointing to multiple urls
403 Test path pointing to multiple urls
409 ===================================
404 ===================================
410
405
411 Simple cases
406 Simple cases
412 ------------
407 ------------
413 - one layer
408 - one layer
414 - one list
409 - one list
415 - no special option
410 - no special option
416
411
417 $ cat << EOF > .hg/hgrc
412 $ cat << EOF > .hg/hgrc
418 > [paths]
413 > [paths]
419 > one-path=foo
414 > one-path=foo
420 > multiple-path=foo,bar,baz,https://example.org/
415 > multiple-path=foo,bar,baz,https://example.org/
421 > multiple-path:multi-urls=yes
416 > multiple-path:multi-urls=yes
422 > EOF
417 > EOF
423 $ hg path
418 $ hg path
424 gpath1 = http://hg.example.com/
419 gpath1 = http://hg.example.com/
425 multiple-path = $TESTTMP/chained_path/foo
420 multiple-path = $TESTTMP/chained_path/foo
426 multiple-path:multi-urls = yes
421 multiple-path:multi-urls = yes
427 multiple-path = $TESTTMP/chained_path/bar
422 multiple-path = $TESTTMP/chained_path/bar
428 multiple-path:multi-urls = yes
423 multiple-path:multi-urls = yes
429 multiple-path = $TESTTMP/chained_path/baz
424 multiple-path = $TESTTMP/chained_path/baz
430 multiple-path:multi-urls = yes
425 multiple-path:multi-urls = yes
431 multiple-path = https://example.org/
426 multiple-path = https://example.org/
432 multiple-path:multi-urls = yes
427 multiple-path:multi-urls = yes
433 one-path = $TESTTMP/chained_path/foo
428 one-path = $TESTTMP/chained_path/foo
434
429
435 Reference to a list
430 Reference to a list
436 -------------------
431 -------------------
437
432
438 $ cat << EOF >> .hg/hgrc
433 $ cat << EOF >> .hg/hgrc
439 > ref-to-multi=path://multiple-path
434 > ref-to-multi=path://multiple-path
440 > EOF
435 > EOF
441 $ hg path | grep ref-to-multi
436 $ hg path | grep ref-to-multi
442 ref-to-multi = $TESTTMP/chained_path/foo
437 ref-to-multi = $TESTTMP/chained_path/foo
443 ref-to-multi:multi-urls = yes
438 ref-to-multi:multi-urls = yes
444 ref-to-multi = $TESTTMP/chained_path/bar
439 ref-to-multi = $TESTTMP/chained_path/bar
445 ref-to-multi:multi-urls = yes
440 ref-to-multi:multi-urls = yes
446 ref-to-multi = $TESTTMP/chained_path/baz
441 ref-to-multi = $TESTTMP/chained_path/baz
447 ref-to-multi:multi-urls = yes
442 ref-to-multi:multi-urls = yes
448 ref-to-multi = https://example.org/
443 ref-to-multi = https://example.org/
449 ref-to-multi:multi-urls = yes
444 ref-to-multi:multi-urls = yes
450
445
451 List with a reference
446 List with a reference
452 ---------------------
447 ---------------------
453
448
454 $ cat << EOF >> .hg/hgrc
449 $ cat << EOF >> .hg/hgrc
455 > multi-with-ref=path://one-path, ssh://babar@savannah/celeste-ville
450 > multi-with-ref=path://one-path, ssh://babar@savannah/celeste-ville
456 > multi-with-ref:multi-urls=yes
451 > multi-with-ref:multi-urls=yes
457 > EOF
452 > EOF
458 $ hg path | grep multi-with-ref
453 $ hg path | grep multi-with-ref
459 multi-with-ref = $TESTTMP/chained_path/foo
454 multi-with-ref = $TESTTMP/chained_path/foo
460 multi-with-ref:multi-urls = yes
455 multi-with-ref:multi-urls = yes
461 multi-with-ref = ssh://babar@savannah/celeste-ville
456 multi-with-ref = ssh://babar@savannah/celeste-ville
462 multi-with-ref:multi-urls = yes
457 multi-with-ref:multi-urls = yes
463
458
464 List with a reference to a list
459 List with a reference to a list
465 -------------------------------
460 -------------------------------
466
461
467 $ cat << EOF >> .hg/hgrc
462 $ cat << EOF >> .hg/hgrc
468 > multi-to-multi-ref = path://multiple-path, ssh://celeste@savannah/celeste-ville
463 > multi-to-multi-ref = path://multiple-path, ssh://celeste@savannah/celeste-ville
469 > multi-to-multi-ref:multi-urls = yes
464 > multi-to-multi-ref:multi-urls = yes
470 > EOF
465 > EOF
471 $ hg path | grep multi-to-multi-ref
466 $ hg path | grep multi-to-multi-ref
472 multi-to-multi-ref = $TESTTMP/chained_path/foo
467 multi-to-multi-ref = $TESTTMP/chained_path/foo
473 multi-to-multi-ref:multi-urls = yes
468 multi-to-multi-ref:multi-urls = yes
474 multi-to-multi-ref = $TESTTMP/chained_path/bar
469 multi-to-multi-ref = $TESTTMP/chained_path/bar
475 multi-to-multi-ref:multi-urls = yes
470 multi-to-multi-ref:multi-urls = yes
476 multi-to-multi-ref = $TESTTMP/chained_path/baz
471 multi-to-multi-ref = $TESTTMP/chained_path/baz
477 multi-to-multi-ref:multi-urls = yes
472 multi-to-multi-ref:multi-urls = yes
478 multi-to-multi-ref = https://example.org/
473 multi-to-multi-ref = https://example.org/
479 multi-to-multi-ref:multi-urls = yes
474 multi-to-multi-ref:multi-urls = yes
480 multi-to-multi-ref = ssh://celeste@savannah/celeste-ville
475 multi-to-multi-ref = ssh://celeste@savannah/celeste-ville
481 multi-to-multi-ref:multi-urls = yes
476 multi-to-multi-ref:multi-urls = yes
482
477
483 individual suboptions are inherited
478 individual suboptions are inherited
484 -----------------------------------
479 -----------------------------------
485
480
486 $ cat << EOF >> .hg/hgrc
481 $ cat << EOF >> .hg/hgrc
487 > with-pushurl = foo
482 > with-pushurl = foo
488 > with-pushurl:pushurl = http://foo.bar/
483 > with-pushurl:pushurl = http://foo.bar/
489 > with-pushrev = bar
484 > with-pushrev = bar
490 > with-pushrev:pushrev = draft()
485 > with-pushrev:pushrev = draft()
491 > with-both = toto
486 > with-both = toto
492 > with-both:pushurl = http://ta.ta
487 > with-both:pushurl = http://ta.ta
493 > with-both:pushrev = secret()
488 > with-both:pushrev = secret()
494 > ref-all-no-opts = path://with-pushurl, path://with-pushrev, path://with-both
489 > ref-all-no-opts = path://with-pushurl, path://with-pushrev, path://with-both
495 > ref-all-no-opts:multi-urls = yes
490 > ref-all-no-opts:multi-urls = yes
496 > with-overwrite = path://with-pushurl, path://with-pushrev, path://with-both
491 > with-overwrite = path://with-pushurl, path://with-pushrev, path://with-both
497 > with-overwrite:multi-urls = yes
492 > with-overwrite:multi-urls = yes
498 > with-overwrite:pushrev = public()
493 > with-overwrite:pushrev = public()
499 > EOF
494 > EOF
500 $ hg path | grep with-pushurl
495 $ hg path | grep with-pushurl
501 with-pushurl = $TESTTMP/chained_path/foo
496 with-pushurl = $TESTTMP/chained_path/foo
502 with-pushurl:pushurl = http://foo.bar/
497 with-pushurl:pushurl = http://foo.bar/
503 $ hg path | grep with-pushrev
498 $ hg path | grep with-pushrev
504 with-pushrev = $TESTTMP/chained_path/bar
499 with-pushrev = $TESTTMP/chained_path/bar
505 with-pushrev:pushrev = draft()
500 with-pushrev:pushrev = draft()
506 $ hg path | grep with-both
501 $ hg path | grep with-both
507 with-both = $TESTTMP/chained_path/toto
502 with-both = $TESTTMP/chained_path/toto
508 with-both:pushrev = secret()
503 with-both:pushrev = secret()
509 with-both:pushurl = http://ta.ta/
504 with-both:pushurl = http://ta.ta/
510 $ hg path | grep ref-all-no-opts
505 $ hg path | grep ref-all-no-opts
511 ref-all-no-opts = $TESTTMP/chained_path/foo
506 ref-all-no-opts = $TESTTMP/chained_path/foo
512 ref-all-no-opts:multi-urls = yes
507 ref-all-no-opts:multi-urls = yes
513 ref-all-no-opts:pushurl = http://foo.bar/
508 ref-all-no-opts:pushurl = http://foo.bar/
514 ref-all-no-opts = $TESTTMP/chained_path/bar
509 ref-all-no-opts = $TESTTMP/chained_path/bar
515 ref-all-no-opts:multi-urls = yes
510 ref-all-no-opts:multi-urls = yes
516 ref-all-no-opts:pushrev = draft()
511 ref-all-no-opts:pushrev = draft()
517 ref-all-no-opts = $TESTTMP/chained_path/toto
512 ref-all-no-opts = $TESTTMP/chained_path/toto
518 ref-all-no-opts:multi-urls = yes
513 ref-all-no-opts:multi-urls = yes
519 ref-all-no-opts:pushrev = secret()
514 ref-all-no-opts:pushrev = secret()
520 ref-all-no-opts:pushurl = http://ta.ta/
515 ref-all-no-opts:pushurl = http://ta.ta/
521 $ hg path | grep with-overwrite
516 $ hg path | grep with-overwrite
522 with-overwrite = $TESTTMP/chained_path/foo
517 with-overwrite = $TESTTMP/chained_path/foo
523 with-overwrite:multi-urls = yes
518 with-overwrite:multi-urls = yes
524 with-overwrite:pushrev = public()
519 with-overwrite:pushrev = public()
525 with-overwrite:pushurl = http://foo.bar/
520 with-overwrite:pushurl = http://foo.bar/
526 with-overwrite = $TESTTMP/chained_path/bar
521 with-overwrite = $TESTTMP/chained_path/bar
527 with-overwrite:multi-urls = yes
522 with-overwrite:multi-urls = yes
528 with-overwrite:pushrev = public()
523 with-overwrite:pushrev = public()
529 with-overwrite = $TESTTMP/chained_path/toto
524 with-overwrite = $TESTTMP/chained_path/toto
530 with-overwrite:multi-urls = yes
525 with-overwrite:multi-urls = yes
531 with-overwrite:pushrev = public()
526 with-overwrite:pushrev = public()
532 with-overwrite:pushurl = http://ta.ta/
527 with-overwrite:pushurl = http://ta.ta/
@@ -1,236 +1,237 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo "[merge]" >> .hg/hgrc
4 $ echo "[merge]" >> .hg/hgrc
4 $ echo "followcopies = 1" >> .hg/hgrc
5 $ echo "followcopies = 1" >> .hg/hgrc
5
6
6 $ echo foo > a
7 $ echo foo > a
7 $ echo foo > a2
8 $ echo foo > a2
8 $ hg add a a2
9 $ hg add a a2
9 $ hg ci -m "start"
10 $ hg ci -m "start"
10
11
11 $ hg mv a b
12 $ hg mv a b
12 $ hg mv a2 b2
13 $ hg mv a2 b2
13 $ hg ci -m "rename"
14 $ hg ci -m "rename"
14
15
15 $ hg co 0
16 $ hg co 0
16 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
17 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
17
18
18 $ echo blahblah > a
19 $ echo blahblah > a
19 $ echo blahblah > a2
20 $ echo blahblah > a2
20 $ hg mv a2 c2
21 $ hg mv a2 c2
21 $ hg ci -m "modify"
22 $ hg ci -m "modify"
22 created new head
23 created new head
23
24
24 $ hg merge -y --debug
25 $ hg merge -y --debug
25 unmatched files in local:
26 unmatched files in local:
26 c2
27 c2
27 unmatched files in other:
28 unmatched files in other:
28 b
29 b
29 b2
30 b2
30 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 on local side:
32 on local side:
32 src: 'a2' -> dst: 'c2' !
33 src: 'a2' -> dst: 'c2' !
33 on remote side:
34 on remote side:
34 src: 'a' -> dst: 'b' *
35 src: 'a' -> dst: 'b' *
35 src: 'a2' -> dst: 'b2' !
36 src: 'a2' -> dst: 'b2' !
36 checking for directory renames
37 checking for directory renames
37 resolving manifests
38 resolving manifests
38 branchmerge: True, force: False, partial: False
39 branchmerge: True, force: False, partial: False
39 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
40 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
40 note: possible conflict - a2 was renamed multiple times to:
41 note: possible conflict - a2 was renamed multiple times to:
41 b2
42 b2
42 c2
43 c2
43 b2: remote created -> g
44 b2: remote created -> g
44 getting b2
45 getting b2
45 preserving a for resolve of b
46 preserving a for resolve of b
46 removing a
47 removing a
47 b: remote moved from a -> m
48 b: remote moved from a -> m
48 picked tool ':merge' for b (binary False symlink False changedelete False)
49 picked tool ':merge' for b (binary False symlink False changedelete False)
49 merging a and b to b
50 merging a and b to b
50 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
51 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
51 premerge successful
52 premerge successful
52 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
53 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
53 (branch merge, don't forget to commit)
54 (branch merge, don't forget to commit)
54
55
55 $ hg status -AC
56 $ hg status -AC
56 M b
57 M b
57 a
58 a
58 M b2
59 M b2
59 R a
60 R a
60 C c2
61 C c2
61
62
62 $ cat b
63 $ cat b
63 blahblah
64 blahblah
64
65
65 $ hg ci -m "merge"
66 $ hg ci -m "merge"
66
67
67 $ hg debugindex b
68 $ hg debugindex b
68 rev linkrev nodeid p1-nodeid p2-nodeid
69 rev linkrev nodeid p1-nodeid p2-nodeid
69 0 1 57eacc201a7f 000000000000 000000000000
70 0 1 57eacc201a7f 000000000000 000000000000
70 1 3 4727ba907962 000000000000 57eacc201a7f
71 1 3 4727ba907962 000000000000 57eacc201a7f
71
72
72 $ hg debugrename b
73 $ hg debugrename b
73 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
74 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
74
75
75 This used to trigger a "divergent renames" warning, despite no renames
76 This used to trigger a "divergent renames" warning, despite no renames
76
77
77 $ hg cp b b3
78 $ hg cp b b3
78 $ hg cp b b4
79 $ hg cp b b4
79 $ hg ci -A -m 'copy b twice'
80 $ hg ci -A -m 'copy b twice'
80 $ hg up '.^'
81 $ hg up '.^'
81 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
82 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
82 $ hg up
83 $ hg up
83 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
84 $ hg rm b3 b4
85 $ hg rm b3 b4
85 $ hg ci -m 'clean up a bit of our mess'
86 $ hg ci -m 'clean up a bit of our mess'
86
87
87 We'd rather not warn on divergent renames done in the same changeset (issue2113)
88 We'd rather not warn on divergent renames done in the same changeset (issue2113)
88
89
89 $ hg cp b b3
90 $ hg cp b b3
90 $ hg mv b b4
91 $ hg mv b b4
91 $ hg ci -A -m 'divergent renames in same changeset'
92 $ hg ci -A -m 'divergent renames in same changeset'
92 $ hg up '.^'
93 $ hg up '.^'
93 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
94 $ hg up
95 $ hg up
95 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
96 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
96
97
97 Check for issue2642
98 Check for issue2642
98
99
99 $ hg init t
100 $ hg init t
100 $ cd t
101 $ cd t
101
102
102 $ echo c0 > f1
103 $ echo c0 > f1
103 $ hg ci -Aqm0
104 $ hg ci -Aqm0
104
105
105 $ hg up null -q
106 $ hg up null -q
106 $ echo c1 > f1 # backport
107 $ echo c1 > f1 # backport
107 $ hg ci -Aqm1
108 $ hg ci -Aqm1
108 $ hg mv f1 f2
109 $ hg mv f1 f2
109 $ hg ci -qm2
110 $ hg ci -qm2
110
111
111 $ hg up 0 -q
112 $ hg up 0 -q
112 $ hg merge 1 -q --tool internal:local
113 $ hg merge 1 -q --tool internal:local
113 $ hg ci -qm3
114 $ hg ci -qm3
114
115
115 $ hg merge 2
116 $ hg merge 2
116 merging f1 and f2 to f2
117 merging f1 and f2 to f2
117 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
118 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
118 (branch merge, don't forget to commit)
119 (branch merge, don't forget to commit)
119
120
120 $ cat f2
121 $ cat f2
121 c0
122 c0
122
123
123 $ cd ..
124 $ cd ..
124
125
125 Check for issue2089
126 Check for issue2089
126
127
127 $ hg init repo2089
128 $ hg init repo2089
128 $ cd repo2089
129 $ cd repo2089
129
130
130 $ echo c0 > f1
131 $ echo c0 > f1
131 $ hg ci -Aqm0
132 $ hg ci -Aqm0
132
133
133 $ hg up null -q
134 $ hg up null -q
134 $ echo c1 > f1
135 $ echo c1 > f1
135 $ hg ci -Aqm1
136 $ hg ci -Aqm1
136
137
137 $ hg up 0 -q
138 $ hg up 0 -q
138 $ hg merge 1 -q --tool internal:local
139 $ hg merge 1 -q --tool internal:local
139 $ echo c2 > f1
140 $ echo c2 > f1
140 $ hg ci -qm2
141 $ hg ci -qm2
141
142
142 $ hg up 1 -q
143 $ hg up 1 -q
143 $ hg mv f1 f2
144 $ hg mv f1 f2
144 $ hg ci -Aqm3
145 $ hg ci -Aqm3
145
146
146 $ hg up 2 -q
147 $ hg up 2 -q
147 $ hg merge 3
148 $ hg merge 3
148 merging f1 and f2 to f2
149 merging f1 and f2 to f2
149 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
150 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
150 (branch merge, don't forget to commit)
151 (branch merge, don't forget to commit)
151
152
152 $ cat f2
153 $ cat f2
153 c2
154 c2
154
155
155 $ cd ..
156 $ cd ..
156
157
157 Check for issue3074
158 Check for issue3074
158
159
159 $ hg init repo3074
160 $ hg init repo3074
160 $ cd repo3074
161 $ cd repo3074
161 $ echo foo > file
162 $ echo foo > file
162 $ hg add file
163 $ hg add file
163 $ hg commit -m "added file"
164 $ hg commit -m "added file"
164 $ hg mv file newfile
165 $ hg mv file newfile
165 $ hg commit -m "renamed file"
166 $ hg commit -m "renamed file"
166 $ hg update 0
167 $ hg update 0
167 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
168 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
168 $ hg rm file
169 $ hg rm file
169 $ hg commit -m "deleted file"
170 $ hg commit -m "deleted file"
170 created new head
171 created new head
171 $ hg merge --debug
172 $ hg merge --debug
172 unmatched files in other:
173 unmatched files in other:
173 newfile
174 newfile
174 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
175 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
175 on remote side:
176 on remote side:
176 src: 'file' -> dst: 'newfile' %
177 src: 'file' -> dst: 'newfile' %
177 checking for directory renames
178 checking for directory renames
178 resolving manifests
179 resolving manifests
179 branchmerge: True, force: False, partial: False
180 branchmerge: True, force: False, partial: False
180 ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
181 ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
181 note: possible conflict - file was deleted and renamed to:
182 note: possible conflict - file was deleted and renamed to:
182 newfile
183 newfile
183 newfile: remote created -> g
184 newfile: remote created -> g
184 getting newfile
185 getting newfile
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 (branch merge, don't forget to commit)
187 (branch merge, don't forget to commit)
187 $ hg status
188 $ hg status
188 M newfile
189 M newfile
189 $ cd ..
190 $ cd ..
190
191
191 Create x and y, then modify y and rename x to z on one side of merge, and
192 Create x and y, then modify y and rename x to z on one side of merge, and
192 modify x and rename y to z on the other side.
193 modify x and rename y to z on the other side.
193 $ hg init conflicting-target
194 $ hg init conflicting-target
194 $ cd conflicting-target
195 $ cd conflicting-target
195 $ echo x > x
196 $ echo x > x
196 $ echo y > y
197 $ echo y > y
197 $ hg ci -Aqm 'add x and y'
198 $ hg ci -Aqm 'add x and y'
198 $ hg mv x z
199 $ hg mv x z
199 $ echo foo >> y
200 $ echo foo >> y
200 $ hg ci -qm 'modify y, rename x to z'
201 $ hg ci -qm 'modify y, rename x to z'
201 $ hg co -q 0
202 $ hg co -q 0
202 $ hg mv y z
203 $ hg mv y z
203 $ echo foo >> x
204 $ echo foo >> x
204 $ hg ci -qm 'modify x, rename y to z'
205 $ hg ci -qm 'modify x, rename y to z'
205 # We should probably tell the user about the conflicting rename sources.
206 # We should probably tell the user about the conflicting rename sources.
206 # Depending on which side they pick, we should take that rename and get
207 # Depending on which side they pick, we should take that rename and get
207 # the changes to the source from the other side. The unchanged file should
208 # the changes to the source from the other side. The unchanged file should
208 # remain.
209 # remain.
209 $ hg merge --debug 1 -t :merge3
210 $ hg merge --debug 1 -t :merge3
210 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
211 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
211 on local side:
212 on local side:
212 src: 'y' -> dst: 'z' *
213 src: 'y' -> dst: 'z' *
213 on remote side:
214 on remote side:
214 src: 'x' -> dst: 'z' *
215 src: 'x' -> dst: 'z' *
215 checking for directory renames
216 checking for directory renames
216 resolving manifests
217 resolving manifests
217 branchmerge: True, force: False, partial: False
218 branchmerge: True, force: False, partial: False
218 ancestor: 5151c134577e, local: 07fcbc9a74ed+, remote: f21419739508
219 ancestor: 5151c134577e, local: 07fcbc9a74ed+, remote: f21419739508
219 starting 4 threads for background file closing (?)
220 starting 4 threads for background file closing (?)
220 preserving z for resolve of z
221 preserving z for resolve of z
221 z: both renamed from y -> m
222 z: both renamed from y -> m
222 picked tool ':merge3' for z (binary False symlink False changedelete False)
223 picked tool ':merge3' for z (binary False symlink False changedelete False)
223 merging z
224 merging z
224 my z@07fcbc9a74ed+ other z@f21419739508 ancestor y@5151c134577e
225 my z@07fcbc9a74ed+ other z@f21419739508 ancestor y@5151c134577e
225 premerge successful
226 premerge successful
226 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
227 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
227 (branch merge, don't forget to commit)
228 (branch merge, don't forget to commit)
228 $ ls
229 $ ls
229 x
230 x
230 z
231 z
231 $ cat x
232 $ cat x
232 x
233 x
233 foo
234 foo
234 # 'z' should have had the added 'foo' line
235 # 'z' should have had the added 'foo' line
235 $ cat z
236 $ cat z
236 x
237 x
@@ -1,696 +1,697 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ mkdir d1 d1/d11 d2
3 $ mkdir d1 d1/d11 d2
3 $ echo d1/a > d1/a
4 $ echo d1/a > d1/a
4 $ echo d1/ba > d1/ba
5 $ echo d1/ba > d1/ba
5 $ echo d1/a1 > d1/d11/a1
6 $ echo d1/a1 > d1/d11/a1
6 $ echo d1/b > d1/b
7 $ echo d1/b > d1/b
7 $ echo d2/b > d2/b
8 $ echo d2/b > d2/b
8 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 $ hg commit -m "1"
10 $ hg commit -m "1"
10
11
11 rename a single file
12 rename a single file
12
13
13 $ hg rename d1/d11/a1 d2/c
14 $ hg rename d1/d11/a1 d2/c
14 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
15 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
15 abort: filename contains 'con', which is reserved on Windows: d1/con.xml
16 abort: filename contains 'con', which is reserved on Windows: d1/con.xml
16 [10]
17 [10]
17 $ hg sum
18 $ hg sum
18 parent: 0:9b4b6e7b2c26 tip
19 parent: 0:9b4b6e7b2c26 tip
19 1
20 1
20 branch: default
21 branch: default
21 commit: 1 renamed
22 commit: 1 renamed
22 update: (current)
23 update: (current)
23 phases: 1 draft
24 phases: 1 draft
24 $ hg status -C
25 $ hg status -C
25 A d2/c
26 A d2/c
26 d1/d11/a1
27 d1/d11/a1
27 R d1/d11/a1
28 R d1/d11/a1
28 $ hg update -C
29 $ hg update -C
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 $ rm d2/c
31 $ rm d2/c
31
32
32 rename a single file using absolute paths
33 rename a single file using absolute paths
33
34
34 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
35 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
35 $ hg status -C
36 $ hg status -C
36 A d2/c
37 A d2/c
37 d1/d11/a1
38 d1/d11/a1
38 R d1/d11/a1
39 R d1/d11/a1
39 $ hg update -C
40 $ hg update -C
40 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 $ rm d2/c
42 $ rm d2/c
42
43
43 rename --after a single file
44 rename --after a single file
44
45
45 $ mv d1/d11/a1 d2/c
46 $ mv d1/d11/a1 d2/c
46 $ hg rename --after d1/d11/a1 d2/c
47 $ hg rename --after d1/d11/a1 d2/c
47 $ hg status -C
48 $ hg status -C
48 A d2/c
49 A d2/c
49 d1/d11/a1
50 d1/d11/a1
50 R d1/d11/a1
51 R d1/d11/a1
51 $ hg update -C
52 $ hg update -C
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 $ rm d2/c
54 $ rm d2/c
54
55
55 rename --after a single file when src and tgt already tracked
56 rename --after a single file when src and tgt already tracked
56
57
57 $ mv d1/d11/a1 d2/c
58 $ mv d1/d11/a1 d2/c
58 $ hg addrem -s 0
59 $ hg addrem -s 0
59 removing d1/d11/a1
60 removing d1/d11/a1
60 adding d2/c
61 adding d2/c
61 $ hg rename --after d1/d11/a1 d2/c
62 $ hg rename --after d1/d11/a1 d2/c
62 $ hg status -C
63 $ hg status -C
63 A d2/c
64 A d2/c
64 d1/d11/a1
65 d1/d11/a1
65 R d1/d11/a1
66 R d1/d11/a1
66 $ hg update -C
67 $ hg update -C
67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 $ rm d2/c
69 $ rm d2/c
69
70
70 rename --after a single file to a nonexistent target filename
71 rename --after a single file to a nonexistent target filename
71
72
72 $ hg rename --after d1/a dummy
73 $ hg rename --after d1/a dummy
73 d1/a: not recording move - dummy does not exist
74 d1/a: not recording move - dummy does not exist
74 [1]
75 [1]
75
76
76 move a single file to an existing directory
77 move a single file to an existing directory
77
78
78 $ hg rename d1/d11/a1 d2
79 $ hg rename d1/d11/a1 d2
79 $ hg status -C
80 $ hg status -C
80 A d2/a1
81 A d2/a1
81 d1/d11/a1
82 d1/d11/a1
82 R d1/d11/a1
83 R d1/d11/a1
83 $ hg update -C
84 $ hg update -C
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 $ rm d2/a1
86 $ rm d2/a1
86
87
87 move --after a single file to an existing directory
88 move --after a single file to an existing directory
88
89
89 $ mv d1/d11/a1 d2
90 $ mv d1/d11/a1 d2
90 $ hg rename --after d1/d11/a1 d2
91 $ hg rename --after d1/d11/a1 d2
91 $ hg status -C
92 $ hg status -C
92 A d2/a1
93 A d2/a1
93 d1/d11/a1
94 d1/d11/a1
94 R d1/d11/a1
95 R d1/d11/a1
95 $ hg update -C
96 $ hg update -C
96 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
97 $ rm d2/a1
98 $ rm d2/a1
98
99
99 rename a file using a relative path
100 rename a file using a relative path
100
101
101 $ (cd d1/d11; hg rename ../../d2/b e)
102 $ (cd d1/d11; hg rename ../../d2/b e)
102 $ hg status -C
103 $ hg status -C
103 A d1/d11/e
104 A d1/d11/e
104 d2/b
105 d2/b
105 R d2/b
106 R d2/b
106 $ hg update -C
107 $ hg update -C
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 $ rm d1/d11/e
109 $ rm d1/d11/e
109
110
110 rename --after a file using a relative path
111 rename --after a file using a relative path
111
112
112 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
113 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
113 $ hg status -C
114 $ hg status -C
114 A d1/d11/e
115 A d1/d11/e
115 d2/b
116 d2/b
116 R d2/b
117 R d2/b
117 $ hg update -C
118 $ hg update -C
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 $ rm d1/d11/e
120 $ rm d1/d11/e
120
121
121 rename directory d1 as d3
122 rename directory d1 as d3
122
123
123 $ hg rename d1/ d3
124 $ hg rename d1/ d3
124 moving d1/a to d3/a
125 moving d1/a to d3/a
125 moving d1/b to d3/b
126 moving d1/b to d3/b
126 moving d1/ba to d3/ba
127 moving d1/ba to d3/ba
127 moving d1/d11/a1 to d3/d11/a1
128 moving d1/d11/a1 to d3/d11/a1
128 $ hg status -C
129 $ hg status -C
129 A d3/a
130 A d3/a
130 d1/a
131 d1/a
131 A d3/b
132 A d3/b
132 d1/b
133 d1/b
133 A d3/ba
134 A d3/ba
134 d1/ba
135 d1/ba
135 A d3/d11/a1
136 A d3/d11/a1
136 d1/d11/a1
137 d1/d11/a1
137 R d1/a
138 R d1/a
138 R d1/b
139 R d1/b
139 R d1/ba
140 R d1/ba
140 R d1/d11/a1
141 R d1/d11/a1
141 $ hg update -C
142 $ hg update -C
142 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 $ rm -rf d3
144 $ rm -rf d3
144
145
145 rename --after directory d1 as d3
146 rename --after directory d1 as d3
146
147
147 $ mv d1 d3
148 $ mv d1 d3
148 $ hg rename --after d1 d3
149 $ hg rename --after d1 d3
149 moving d1/a to d3/a
150 moving d1/a to d3/a
150 moving d1/b to d3/b
151 moving d1/b to d3/b
151 moving d1/ba to d3/ba
152 moving d1/ba to d3/ba
152 moving d1/d11/a1 to d3/d11/a1
153 moving d1/d11/a1 to d3/d11/a1
153 $ hg status -C
154 $ hg status -C
154 A d3/a
155 A d3/a
155 d1/a
156 d1/a
156 A d3/b
157 A d3/b
157 d1/b
158 d1/b
158 A d3/ba
159 A d3/ba
159 d1/ba
160 d1/ba
160 A d3/d11/a1
161 A d3/d11/a1
161 d1/d11/a1
162 d1/d11/a1
162 R d1/a
163 R d1/a
163 R d1/b
164 R d1/b
164 R d1/ba
165 R d1/ba
165 R d1/d11/a1
166 R d1/d11/a1
166 $ hg update -C
167 $ hg update -C
167 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 $ rm -rf d3
169 $ rm -rf d3
169
170
170 move a directory using a relative path
171 move a directory using a relative path
171
172
172 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
173 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
173 moving ../d1/d11/a1 to d3/d11/a1
174 moving ../d1/d11/a1 to d3/d11/a1
174 $ hg status -C
175 $ hg status -C
175 A d2/d3/d11/a1
176 A d2/d3/d11/a1
176 d1/d11/a1
177 d1/d11/a1
177 R d1/d11/a1
178 R d1/d11/a1
178 $ hg update -C
179 $ hg update -C
179 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 $ rm -rf d2/d3
181 $ rm -rf d2/d3
181
182
182 move --after a directory using a relative path
183 move --after a directory using a relative path
183
184
184 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
185 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
185 moving ../d1/d11/a1 to d3/d11/a1
186 moving ../d1/d11/a1 to d3/d11/a1
186 $ hg status -C
187 $ hg status -C
187 A d2/d3/d11/a1
188 A d2/d3/d11/a1
188 d1/d11/a1
189 d1/d11/a1
189 R d1/d11/a1
190 R d1/d11/a1
190 $ hg update -C
191 $ hg update -C
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 $ rm -rf d2/d3
193 $ rm -rf d2/d3
193
194
194 move directory d1/d11 to an existing directory d2 (removes empty d1)
195 move directory d1/d11 to an existing directory d2 (removes empty d1)
195
196
196 $ hg rename d1/d11/ d2
197 $ hg rename d1/d11/ d2
197 moving d1/d11/a1 to d2/d11/a1
198 moving d1/d11/a1 to d2/d11/a1
198 $ hg status -C
199 $ hg status -C
199 A d2/d11/a1
200 A d2/d11/a1
200 d1/d11/a1
201 d1/d11/a1
201 R d1/d11/a1
202 R d1/d11/a1
202 $ hg update -C
203 $ hg update -C
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
204 $ rm -rf d2/d11
205 $ rm -rf d2/d11
205
206
206 move directories d1 and d2 to a new directory d3
207 move directories d1 and d2 to a new directory d3
207
208
208 $ mkdir d3
209 $ mkdir d3
209 $ hg rename d1 d2 d3
210 $ hg rename d1 d2 d3
210 moving d1/a to d3/d1/a
211 moving d1/a to d3/d1/a
211 moving d1/b to d3/d1/b
212 moving d1/b to d3/d1/b
212 moving d1/ba to d3/d1/ba
213 moving d1/ba to d3/d1/ba
213 moving d1/d11/a1 to d3/d1/d11/a1
214 moving d1/d11/a1 to d3/d1/d11/a1
214 moving d2/b to d3/d2/b
215 moving d2/b to d3/d2/b
215 $ hg status -C
216 $ hg status -C
216 A d3/d1/a
217 A d3/d1/a
217 d1/a
218 d1/a
218 A d3/d1/b
219 A d3/d1/b
219 d1/b
220 d1/b
220 A d3/d1/ba
221 A d3/d1/ba
221 d1/ba
222 d1/ba
222 A d3/d1/d11/a1
223 A d3/d1/d11/a1
223 d1/d11/a1
224 d1/d11/a1
224 A d3/d2/b
225 A d3/d2/b
225 d2/b
226 d2/b
226 R d1/a
227 R d1/a
227 R d1/b
228 R d1/b
228 R d1/ba
229 R d1/ba
229 R d1/d11/a1
230 R d1/d11/a1
230 R d2/b
231 R d2/b
231 $ hg update -C
232 $ hg update -C
232 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 $ rm -rf d3
234 $ rm -rf d3
234
235
235 move --after directories d1 and d2 to a new directory d3
236 move --after directories d1 and d2 to a new directory d3
236
237
237 $ mkdir d3
238 $ mkdir d3
238 $ mv d1 d2 d3
239 $ mv d1 d2 d3
239 $ hg rename --after d1 d2 d3
240 $ hg rename --after d1 d2 d3
240 moving d1/a to d3/d1/a
241 moving d1/a to d3/d1/a
241 moving d1/b to d3/d1/b
242 moving d1/b to d3/d1/b
242 moving d1/ba to d3/d1/ba
243 moving d1/ba to d3/d1/ba
243 moving d1/d11/a1 to d3/d1/d11/a1
244 moving d1/d11/a1 to d3/d1/d11/a1
244 moving d2/b to d3/d2/b
245 moving d2/b to d3/d2/b
245 $ hg status -C
246 $ hg status -C
246 A d3/d1/a
247 A d3/d1/a
247 d1/a
248 d1/a
248 A d3/d1/b
249 A d3/d1/b
249 d1/b
250 d1/b
250 A d3/d1/ba
251 A d3/d1/ba
251 d1/ba
252 d1/ba
252 A d3/d1/d11/a1
253 A d3/d1/d11/a1
253 d1/d11/a1
254 d1/d11/a1
254 A d3/d2/b
255 A d3/d2/b
255 d2/b
256 d2/b
256 R d1/a
257 R d1/a
257 R d1/b
258 R d1/b
258 R d1/ba
259 R d1/ba
259 R d1/d11/a1
260 R d1/d11/a1
260 R d2/b
261 R d2/b
261 $ hg update -C
262 $ hg update -C
262 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
263 $ rm -rf d3
264 $ rm -rf d3
264
265
265 move everything under directory d1 to existing directory d2, do not
266 move everything under directory d1 to existing directory d2, do not
266 overwrite existing files (d2/b)
267 overwrite existing files (d2/b)
267
268
268 $ hg rename d1/* d2
269 $ hg rename d1/* d2
269 d2/b: not overwriting - file already committed
270 d2/b: not overwriting - file already committed
270 ('hg rename --force' to replace the file by recording a rename)
271 ('hg rename --force' to replace the file by recording a rename)
271 moving d1/d11/a1 to d2/d11/a1
272 moving d1/d11/a1 to d2/d11/a1
272 [1]
273 [1]
273 $ hg status -C
274 $ hg status -C
274 A d2/a
275 A d2/a
275 d1/a
276 d1/a
276 A d2/ba
277 A d2/ba
277 d1/ba
278 d1/ba
278 A d2/d11/a1
279 A d2/d11/a1
279 d1/d11/a1
280 d1/d11/a1
280 R d1/a
281 R d1/a
281 R d1/ba
282 R d1/ba
282 R d1/d11/a1
283 R d1/d11/a1
283 $ diff -u d1/b d2/b
284 $ diff -u d1/b d2/b
284 --- d1/b * (glob)
285 --- d1/b * (glob)
285 +++ d2/b * (glob)
286 +++ d2/b * (glob)
286 @@ * (glob)
287 @@ * (glob)
287 -d1/b
288 -d1/b
288 +d2/b
289 +d2/b
289 [1]
290 [1]
290 $ hg update -C
291 $ hg update -C
291 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 $ rm d2/a d2/ba d2/d11/a1
293 $ rm d2/a d2/ba d2/d11/a1
293
294
294 attempt to move one file into a non-existent directory
295 attempt to move one file into a non-existent directory
295
296
296 $ hg rename d1/a dx/
297 $ hg rename d1/a dx/
297 abort: destination dx/ is not a directory
298 abort: destination dx/ is not a directory
298 [10]
299 [10]
299 $ hg status -C
300 $ hg status -C
300 $ hg update -C
301 $ hg update -C
301 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
302 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
302
303
303 attempt to move potentially more than one file into a non-existent directory
304 attempt to move potentially more than one file into a non-existent directory
304
305
305 $ hg rename 'glob:d1/**' dx
306 $ hg rename 'glob:d1/**' dx
306 abort: with multiple sources, destination must be an existing directory
307 abort: with multiple sources, destination must be an existing directory
307 [10]
308 [10]
308
309
309 move every file under d1 to d2/d21
310 move every file under d1 to d2/d21
310
311
311 $ mkdir d2/d21
312 $ mkdir d2/d21
312 $ hg rename 'glob:d1/**' d2/d21
313 $ hg rename 'glob:d1/**' d2/d21
313 moving d1/a to d2/d21/a
314 moving d1/a to d2/d21/a
314 moving d1/b to d2/d21/b
315 moving d1/b to d2/d21/b
315 moving d1/ba to d2/d21/ba
316 moving d1/ba to d2/d21/ba
316 moving d1/d11/a1 to d2/d21/a1
317 moving d1/d11/a1 to d2/d21/a1
317 $ hg status -C
318 $ hg status -C
318 A d2/d21/a
319 A d2/d21/a
319 d1/a
320 d1/a
320 A d2/d21/a1
321 A d2/d21/a1
321 d1/d11/a1
322 d1/d11/a1
322 A d2/d21/b
323 A d2/d21/b
323 d1/b
324 d1/b
324 A d2/d21/ba
325 A d2/d21/ba
325 d1/ba
326 d1/ba
326 R d1/a
327 R d1/a
327 R d1/b
328 R d1/b
328 R d1/ba
329 R d1/ba
329 R d1/d11/a1
330 R d1/d11/a1
330 $ hg update -C
331 $ hg update -C
331 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 $ rm -rf d2/d21
333 $ rm -rf d2/d21
333
334
334 move --after some files under d1 to d2/d21
335 move --after some files under d1 to d2/d21
335
336
336 $ mkdir d2/d21
337 $ mkdir d2/d21
337 $ mv d1/a d1/d11/a1 d2/d21
338 $ mv d1/a d1/d11/a1 d2/d21
338 $ hg rename --after 'glob:d1/**' d2/d21
339 $ hg rename --after 'glob:d1/**' d2/d21
339 moving d1/a to d2/d21/a
340 moving d1/a to d2/d21/a
340 d1/b: not recording move - d2/d21/b does not exist
341 d1/b: not recording move - d2/d21/b does not exist
341 d1/ba: not recording move - d2/d21/ba does not exist
342 d1/ba: not recording move - d2/d21/ba does not exist
342 moving d1/d11/a1 to d2/d21/a1
343 moving d1/d11/a1 to d2/d21/a1
343 [1]
344 [1]
344 $ hg status -C
345 $ hg status -C
345 A d2/d21/a
346 A d2/d21/a
346 d1/a
347 d1/a
347 A d2/d21/a1
348 A d2/d21/a1
348 d1/d11/a1
349 d1/d11/a1
349 R d1/a
350 R d1/a
350 R d1/d11/a1
351 R d1/d11/a1
351 $ hg update -C
352 $ hg update -C
352 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
353 $ rm -rf d2/d21
354 $ rm -rf d2/d21
354
355
355 move every file under d1 starting with an 'a' to d2/d21 (regexp)
356 move every file under d1 starting with an 'a' to d2/d21 (regexp)
356
357
357 $ mkdir d2/d21
358 $ mkdir d2/d21
358 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
359 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
359 moving d1/a to d2/d21/a
360 moving d1/a to d2/d21/a
360 moving d1/d11/a1 to d2/d21/a1
361 moving d1/d11/a1 to d2/d21/a1
361 $ hg status -C
362 $ hg status -C
362 A d2/d21/a
363 A d2/d21/a
363 d1/a
364 d1/a
364 A d2/d21/a1
365 A d2/d21/a1
365 d1/d11/a1
366 d1/d11/a1
366 R d1/a
367 R d1/a
367 R d1/d11/a1
368 R d1/d11/a1
368 $ hg update -C
369 $ hg update -C
369 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 $ rm -rf d2/d21
371 $ rm -rf d2/d21
371
372
372 attempt to overwrite an existing file
373 attempt to overwrite an existing file
373
374
374 $ echo "ca" > d1/ca
375 $ echo "ca" > d1/ca
375 $ hg rename d1/ba d1/ca
376 $ hg rename d1/ba d1/ca
376 d1/ca: not overwriting - file exists
377 d1/ca: not overwriting - file exists
377 ('hg rename --after' to record the rename)
378 ('hg rename --after' to record the rename)
378 [1]
379 [1]
379 $ hg status -C
380 $ hg status -C
380 ? d1/ca
381 ? d1/ca
381 $ hg update -C
382 $ hg update -C
382 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
383
384
384 forced overwrite of an existing file
385 forced overwrite of an existing file
385
386
386 $ echo "ca" > d1/ca
387 $ echo "ca" > d1/ca
387 $ hg rename --force d1/ba d1/ca
388 $ hg rename --force d1/ba d1/ca
388 $ hg status -C
389 $ hg status -C
389 A d1/ca
390 A d1/ca
390 d1/ba
391 d1/ba
391 R d1/ba
392 R d1/ba
392 $ hg update -C
393 $ hg update -C
393 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 $ rm d1/ca
395 $ rm d1/ca
395
396
396 attempt to overwrite an existing broken symlink
397 attempt to overwrite an existing broken symlink
397
398
398 #if symlink
399 #if symlink
399 $ ln -s ba d1/ca
400 $ ln -s ba d1/ca
400 $ hg rename --traceback d1/ba d1/ca
401 $ hg rename --traceback d1/ba d1/ca
401 d1/ca: not overwriting - file exists
402 d1/ca: not overwriting - file exists
402 ('hg rename --after' to record the rename)
403 ('hg rename --after' to record the rename)
403 [1]
404 [1]
404 $ hg status -C
405 $ hg status -C
405 ? d1/ca
406 ? d1/ca
406 $ hg update -C
407 $ hg update -C
407 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
408 $ rm d1/ca
409 $ rm d1/ca
409
410
410 replace a symlink with a file
411 replace a symlink with a file
411
412
412 $ ln -s ba d1/ca
413 $ ln -s ba d1/ca
413 $ hg rename --force d1/ba d1/ca
414 $ hg rename --force d1/ba d1/ca
414 $ hg status -C
415 $ hg status -C
415 A d1/ca
416 A d1/ca
416 d1/ba
417 d1/ba
417 R d1/ba
418 R d1/ba
418 $ hg update -C
419 $ hg update -C
419 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
420 $ rm d1/ca
421 $ rm d1/ca
421 #endif
422 #endif
422
423
423 do not copy more than one source file to the same destination file
424 do not copy more than one source file to the same destination file
424
425
425 $ mkdir d3
426 $ mkdir d3
426 $ hg rename d1/* d2/* d3
427 $ hg rename d1/* d2/* d3
427 moving d1/d11/a1 to d3/d11/a1
428 moving d1/d11/a1 to d3/d11/a1
428 d3/b: not overwriting - d2/b collides with d1/b
429 d3/b: not overwriting - d2/b collides with d1/b
429 [1]
430 [1]
430 $ hg status -C
431 $ hg status -C
431 A d3/a
432 A d3/a
432 d1/a
433 d1/a
433 A d3/b
434 A d3/b
434 d1/b
435 d1/b
435 A d3/ba
436 A d3/ba
436 d1/ba
437 d1/ba
437 A d3/d11/a1
438 A d3/d11/a1
438 d1/d11/a1
439 d1/d11/a1
439 R d1/a
440 R d1/a
440 R d1/b
441 R d1/b
441 R d1/ba
442 R d1/ba
442 R d1/d11/a1
443 R d1/d11/a1
443 $ hg update -C
444 $ hg update -C
444 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 $ rm -rf d3
446 $ rm -rf d3
446
447
447 move a whole subtree with "hg rename ."
448 move a whole subtree with "hg rename ."
448
449
449 $ mkdir d3
450 $ mkdir d3
450 $ (cd d1; hg rename . ../d3)
451 $ (cd d1; hg rename . ../d3)
451 moving a to ../d3/d1/a
452 moving a to ../d3/d1/a
452 moving b to ../d3/d1/b
453 moving b to ../d3/d1/b
453 moving ba to ../d3/d1/ba
454 moving ba to ../d3/d1/ba
454 moving d11/a1 to ../d3/d1/d11/a1
455 moving d11/a1 to ../d3/d1/d11/a1
455 $ hg status -C
456 $ hg status -C
456 A d3/d1/a
457 A d3/d1/a
457 d1/a
458 d1/a
458 A d3/d1/b
459 A d3/d1/b
459 d1/b
460 d1/b
460 A d3/d1/ba
461 A d3/d1/ba
461 d1/ba
462 d1/ba
462 A d3/d1/d11/a1
463 A d3/d1/d11/a1
463 d1/d11/a1
464 d1/d11/a1
464 R d1/a
465 R d1/a
465 R d1/b
466 R d1/b
466 R d1/ba
467 R d1/ba
467 R d1/d11/a1
468 R d1/d11/a1
468 $ hg update -C
469 $ hg update -C
469 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
470 $ rm -rf d3
471 $ rm -rf d3
471
472
472 move a whole subtree with "hg rename --after ."
473 move a whole subtree with "hg rename --after ."
473
474
474 $ mkdir d3
475 $ mkdir d3
475 $ mv d1/* d3
476 $ mv d1/* d3
476 $ (cd d1; hg rename --after . ../d3)
477 $ (cd d1; hg rename --after . ../d3)
477 moving a to ../d3/a
478 moving a to ../d3/a
478 moving b to ../d3/b
479 moving b to ../d3/b
479 moving ba to ../d3/ba
480 moving ba to ../d3/ba
480 moving d11/a1 to ../d3/d11/a1
481 moving d11/a1 to ../d3/d11/a1
481 $ hg status -C
482 $ hg status -C
482 A d3/a
483 A d3/a
483 d1/a
484 d1/a
484 A d3/b
485 A d3/b
485 d1/b
486 d1/b
486 A d3/ba
487 A d3/ba
487 d1/ba
488 d1/ba
488 A d3/d11/a1
489 A d3/d11/a1
489 d1/d11/a1
490 d1/d11/a1
490 R d1/a
491 R d1/a
491 R d1/b
492 R d1/b
492 R d1/ba
493 R d1/ba
493 R d1/d11/a1
494 R d1/d11/a1
494 $ hg update -C
495 $ hg update -C
495 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
496 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
496 $ rm -rf d3
497 $ rm -rf d3
497
498
498 move the parent tree with "hg rename .."
499 move the parent tree with "hg rename .."
499
500
500 $ (cd d1/d11; hg rename .. ../../d3)
501 $ (cd d1/d11; hg rename .. ../../d3)
501 moving ../a to ../../d3/a
502 moving ../a to ../../d3/a
502 moving ../b to ../../d3/b
503 moving ../b to ../../d3/b
503 moving ../ba to ../../d3/ba
504 moving ../ba to ../../d3/ba
504 moving a1 to ../../d3/d11/a1
505 moving a1 to ../../d3/d11/a1
505 $ hg status -C
506 $ hg status -C
506 A d3/a
507 A d3/a
507 d1/a
508 d1/a
508 A d3/b
509 A d3/b
509 d1/b
510 d1/b
510 A d3/ba
511 A d3/ba
511 d1/ba
512 d1/ba
512 A d3/d11/a1
513 A d3/d11/a1
513 d1/d11/a1
514 d1/d11/a1
514 R d1/a
515 R d1/a
515 R d1/b
516 R d1/b
516 R d1/ba
517 R d1/ba
517 R d1/d11/a1
518 R d1/d11/a1
518 $ hg update -C
519 $ hg update -C
519 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
520 $ rm -rf d3
521 $ rm -rf d3
521
522
522 skip removed files
523 skip removed files
523
524
524 $ hg remove d1/b
525 $ hg remove d1/b
525 $ hg rename d1 d3
526 $ hg rename d1 d3
526 moving d1/a to d3/a
527 moving d1/a to d3/a
527 moving d1/ba to d3/ba
528 moving d1/ba to d3/ba
528 moving d1/d11/a1 to d3/d11/a1
529 moving d1/d11/a1 to d3/d11/a1
529 $ hg status -C
530 $ hg status -C
530 A d3/a
531 A d3/a
531 d1/a
532 d1/a
532 A d3/ba
533 A d3/ba
533 d1/ba
534 d1/ba
534 A d3/d11/a1
535 A d3/d11/a1
535 d1/d11/a1
536 d1/d11/a1
536 R d1/a
537 R d1/a
537 R d1/b
538 R d1/b
538 R d1/ba
539 R d1/ba
539 R d1/d11/a1
540 R d1/d11/a1
540 $ hg update -C
541 $ hg update -C
541 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
542 $ rm -rf d3
543 $ rm -rf d3
543
544
544 transitive rename
545 transitive rename
545
546
546 $ hg rename d1/b d1/bb
547 $ hg rename d1/b d1/bb
547 $ hg rename d1/bb d1/bc
548 $ hg rename d1/bb d1/bc
548 $ hg status -C
549 $ hg status -C
549 A d1/bc
550 A d1/bc
550 d1/b
551 d1/b
551 R d1/b
552 R d1/b
552 $ hg update -C
553 $ hg update -C
553 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
554 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
554 $ rm d1/bc
555 $ rm d1/bc
555
556
556 transitive rename --after
557 transitive rename --after
557
558
558 $ hg rename d1/b d1/bb
559 $ hg rename d1/b d1/bb
559 $ mv d1/bb d1/bc
560 $ mv d1/bb d1/bc
560 $ hg rename --after d1/bb d1/bc
561 $ hg rename --after d1/bb d1/bc
561 $ hg status -C
562 $ hg status -C
562 A d1/bc
563 A d1/bc
563 d1/b
564 d1/b
564 R d1/b
565 R d1/b
565 $ hg update -C
566 $ hg update -C
566 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
567 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
567 $ rm d1/bc
568 $ rm d1/bc
568
569
569 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
570 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
570 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
571 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
571 $ hg rename d1/b d1/bb
572 $ hg rename d1/b d1/bb
572 $ echo "some stuff added to d1/bb" >> d1/bb
573 $ echo "some stuff added to d1/bb" >> d1/bb
573 $ hg rename d1/bb d1/b
574 $ hg rename d1/bb d1/b
574 $ hg status -C
575 $ hg status -C
575 M d1/b
576 M d1/b
576 $ hg update -C
577 $ hg update -C
577 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578
579
579 overwriting with renames (issue1959)
580 overwriting with renames (issue1959)
580
581
581 $ hg rename d1/a d1/c
582 $ hg rename d1/a d1/c
582 $ hg rename d1/b d1/a
583 $ hg rename d1/b d1/a
583 $ hg status -C
584 $ hg status -C
584 M d1/a
585 M d1/a
585 d1/b
586 d1/b
586 A d1/c
587 A d1/c
587 d1/a
588 d1/a
588 R d1/b
589 R d1/b
589 $ hg diff --git
590 $ hg diff --git
590 diff --git a/d1/a b/d1/a
591 diff --git a/d1/a b/d1/a
591 --- a/d1/a
592 --- a/d1/a
592 +++ b/d1/a
593 +++ b/d1/a
593 @@ -1,1 +1,1 @@
594 @@ -1,1 +1,1 @@
594 -d1/a
595 -d1/a
595 +d1/b
596 +d1/b
596 diff --git a/d1/b b/d1/b
597 diff --git a/d1/b b/d1/b
597 deleted file mode 100644
598 deleted file mode 100644
598 --- a/d1/b
599 --- a/d1/b
599 +++ /dev/null
600 +++ /dev/null
600 @@ -1,1 +0,0 @@
601 @@ -1,1 +0,0 @@
601 -d1/b
602 -d1/b
602 diff --git a/d1/a b/d1/c
603 diff --git a/d1/a b/d1/c
603 copy from d1/a
604 copy from d1/a
604 copy to d1/c
605 copy to d1/c
605 $ hg update -C
606 $ hg update -C
606 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget'
608 $ rm d1/c # The file was marked as added, so 'hg update' action was 'forget'
608
609
609 check illegal path components
610 check illegal path components
610
611
611 $ hg rename d1/d11/a1 .hg/foo
612 $ hg rename d1/d11/a1 .hg/foo
612 abort: path contains illegal component: .hg/foo
613 abort: path contains illegal component: .hg/foo
613 [10]
614 [10]
614 $ hg status -C
615 $ hg status -C
615 $ hg rename d1/d11/a1 ../foo
616 $ hg rename d1/d11/a1 ../foo
616 abort: ../foo not under root '$TESTTMP'
617 abort: ../foo not under root '$TESTTMP/repo'
617 [255]
618 [255]
618 $ hg status -C
619 $ hg status -C
619
620
620 $ mv d1/d11/a1 .hg/foo
621 $ mv d1/d11/a1 .hg/foo
621 $ hg rename --after d1/d11/a1 .hg/foo
622 $ hg rename --after d1/d11/a1 .hg/foo
622 abort: path contains illegal component: .hg/foo
623 abort: path contains illegal component: .hg/foo
623 [10]
624 [10]
624 $ hg status -C
625 $ hg status -C
625 ! d1/d11/a1
626 ! d1/d11/a1
626 $ hg update -C
627 $ hg update -C
627 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
628 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
628 $ rm .hg/foo
629 $ rm .hg/foo
629
630
630 $ hg rename d1/d11/a1 .hg
631 $ hg rename d1/d11/a1 .hg
631 abort: path contains illegal component: .hg/a1
632 abort: path contains illegal component: .hg/a1
632 [10]
633 [10]
633 $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
634 $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
634 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
635 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
635 abort: path contains illegal component: .hg/a1
636 abort: path contains illegal component: .hg/a1
636 [10]
637 [10]
637 $ hg status -C
638 $ hg status -C
638 $ hg rename d1/d11/a1 ..
639 $ hg rename d1/d11/a1 ..
639 abort: ../a1 not under root '$TESTTMP'
640 abort: ../a1 not under root '$TESTTMP/repo'
640 [255]
641 [255]
641 $ hg --config extensions.largefiles= rename d1/d11/a1 ..
642 $ hg --config extensions.largefiles= rename d1/d11/a1 ..
642 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
643 The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
643 abort: ../a1 not under root '$TESTTMP'
644 abort: ../a1 not under root '$TESTTMP/repo'
644 [255]
645 [255]
645 $ hg status -C
646 $ hg status -C
646
647
647 $ mv d1/d11/a1 .hg
648 $ mv d1/d11/a1 .hg
648 $ hg rename --after d1/d11/a1 .hg
649 $ hg rename --after d1/d11/a1 .hg
649 abort: path contains illegal component: .hg/a1
650 abort: path contains illegal component: .hg/a1
650 [10]
651 [10]
651 $ hg status -C
652 $ hg status -C
652 ! d1/d11/a1
653 ! d1/d11/a1
653 $ hg update -C
654 $ hg update -C
654 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
655 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
655 $ rm .hg/a1
656 $ rm .hg/a1
656
657
657 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
658 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
658 abort: path contains illegal component: .hg/foo
659 abort: path contains illegal component: .hg/foo
659 [10]
660 [10]
660 $ hg status -C
661 $ hg status -C
661 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
662 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
662 abort: ../../../foo not under root '$TESTTMP'
663 abort: ../../../foo not under root '$TESTTMP/repo'
663 [255]
664 [255]
664 $ hg status -C
665 $ hg status -C
665
666
666 check that stat information such as mtime is preserved on rename - it's unclear
667 check that stat information such as mtime is preserved on rename - it's unclear
667 whether the `touch` and `stat` commands are portable, so we mimic them using
668 whether the `touch` and `stat` commands are portable, so we mimic them using
668 python. Not all platforms support precision of even one-second granularity, so
669 python. Not all platforms support precision of even one-second granularity, so
669 we allow a rather generous fudge factor here; 1234567890 is 2009, and the
670 we allow a rather generous fudge factor here; 1234567890 is 2009, and the
670 primary thing we care about is that it's not the machine's current time;
671 primary thing we care about is that it's not the machine's current time;
671 hopefully it's really unlikely for a machine to have such a broken clock that
672 hopefully it's really unlikely for a machine to have such a broken clock that
672 this test fails. :)
673 this test fails. :)
673
674
674 $ mkdir mtime
675 $ mkdir mtime
675 Create the file (as empty), then update its mtime and atime to be 1234567890.
676 Create the file (as empty), then update its mtime and atime to be 1234567890.
676 >>> import os
677 >>> import os
677 >>> filename = "mtime/f"
678 >>> filename = "mtime/f"
678 >>> mtime = 1234567890
679 >>> mtime = 1234567890
679 >>> open(filename, "w").close()
680 >>> open(filename, "w").close()
680 >>> os.utime(filename, (mtime, mtime))
681 >>> os.utime(filename, (mtime, mtime))
681 $ hg ci -qAm 'add mtime dir'
682 $ hg ci -qAm 'add mtime dir'
682 "hg cp" does not preserve the mtime, so it should be newer than the 2009
683 "hg cp" does not preserve the mtime, so it should be newer than the 2009
683 timestamp.
684 timestamp.
684 $ hg cp -q mtime mtime_cp
685 $ hg cp -q mtime mtime_cp
685 >>> import os
686 >>> import os
686 >>> filename = "mtime_cp/f"
687 >>> filename = "mtime_cp/f"
687 >>> print(os.stat(filename).st_mtime < 1234567999)
688 >>> print(os.stat(filename).st_mtime < 1234567999)
688 False
689 False
689 "hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp
690 "hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp
690 (modulo some fudge factor due to not every system supporting 1s-level
691 (modulo some fudge factor due to not every system supporting 1s-level
691 precision).
692 precision).
692 $ hg mv -q mtime mtime_mv
693 $ hg mv -q mtime mtime_mv
693 >>> import os
694 >>> import os
694 >>> filename = "mtime_mv/f"
695 >>> filename = "mtime_mv/f"
695 >>> print(os.stat(filename).st_mtime < 1234567999)
696 >>> print(os.stat(filename).st_mtime < 1234567999)
696 True
697 True
@@ -1,30 +1,31 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ touch unknown
3 $ touch unknown
3
4
4 $ touch a
5 $ touch a
5 $ hg add a
6 $ hg add a
6 $ hg ci -m "1"
7 $ hg ci -m "1"
7
8
8 $ touch b
9 $ touch b
9 $ hg add b
10 $ hg add b
10 $ hg ci -m "2"
11 $ hg ci -m "2"
11
12
12 Should show unknown
13 Should show unknown
13
14
14 $ hg status
15 $ hg status
15 ? unknown
16 ? unknown
16 $ hg revert -r 0 --all
17 $ hg revert -r 0 --all
17 removing b
18 removing b
18
19
19 Should show unknown and b removed
20 Should show unknown and b removed
20
21
21 $ hg status
22 $ hg status
22 R b
23 R b
23 ? unknown
24 ? unknown
24
25
25 Should show a and unknown
26 Should show a and unknown
26
27
27 $ ls -A
28 $ ls -A
28 .hg
29 .hg
29 a
30 a
30 unknown
31 unknown
@@ -1,158 +1,159 b''
1 Tests of 'hg status --rev <rev>' to make sure status between <rev> and '.' get
1 Tests of 'hg status --rev <rev>' to make sure status between <rev> and '.' get
2 combined correctly with the dirstate status.
2 combined correctly with the dirstate status.
3
3
4 $ hg init
4 $ hg init repo
5 $ cd repo
5
6
6 First commit
7 First commit
7
8
8 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
9 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
9 $ hg addremove --similarity 0
10 $ hg addremove --similarity 0
10 adding content1_content1_content1-tracked
11 adding content1_content1_content1-tracked
11 adding content1_content1_content1-untracked
12 adding content1_content1_content1-untracked
12 adding content1_content1_content3-tracked
13 adding content1_content1_content3-tracked
13 adding content1_content1_content3-untracked
14 adding content1_content1_content3-untracked
14 adding content1_content1_missing-tracked
15 adding content1_content1_missing-tracked
15 adding content1_content1_missing-untracked
16 adding content1_content1_missing-untracked
16 adding content1_content2_content1-tracked
17 adding content1_content2_content1-tracked
17 adding content1_content2_content1-untracked
18 adding content1_content2_content1-untracked
18 adding content1_content2_content2-tracked
19 adding content1_content2_content2-tracked
19 adding content1_content2_content2-untracked
20 adding content1_content2_content2-untracked
20 adding content1_content2_content3-tracked
21 adding content1_content2_content3-tracked
21 adding content1_content2_content3-untracked
22 adding content1_content2_content3-untracked
22 adding content1_content2_missing-tracked
23 adding content1_content2_missing-tracked
23 adding content1_content2_missing-untracked
24 adding content1_content2_missing-untracked
24 adding content1_missing_content1-tracked
25 adding content1_missing_content1-tracked
25 adding content1_missing_content1-untracked
26 adding content1_missing_content1-untracked
26 adding content1_missing_content3-tracked
27 adding content1_missing_content3-tracked
27 adding content1_missing_content3-untracked
28 adding content1_missing_content3-untracked
28 adding content1_missing_missing-tracked
29 adding content1_missing_missing-tracked
29 adding content1_missing_missing-untracked
30 adding content1_missing_missing-untracked
30 $ hg commit -m first
31 $ hg commit -m first
31
32
32 Second commit
33 Second commit
33
34
34 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
35 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
35 $ hg addremove --similarity 0
36 $ hg addremove --similarity 0
36 removing content1_missing_content1-tracked
37 removing content1_missing_content1-tracked
37 removing content1_missing_content1-untracked
38 removing content1_missing_content1-untracked
38 removing content1_missing_content3-tracked
39 removing content1_missing_content3-tracked
39 removing content1_missing_content3-untracked
40 removing content1_missing_content3-untracked
40 removing content1_missing_missing-tracked
41 removing content1_missing_missing-tracked
41 removing content1_missing_missing-untracked
42 removing content1_missing_missing-untracked
42 adding missing_content2_content2-tracked
43 adding missing_content2_content2-tracked
43 adding missing_content2_content2-untracked
44 adding missing_content2_content2-untracked
44 adding missing_content2_content3-tracked
45 adding missing_content2_content3-tracked
45 adding missing_content2_content3-untracked
46 adding missing_content2_content3-untracked
46 adding missing_content2_missing-tracked
47 adding missing_content2_missing-tracked
47 adding missing_content2_missing-untracked
48 adding missing_content2_missing-untracked
48 $ hg commit -m second
49 $ hg commit -m second
49
50
50 Working copy
51 Working copy
51
52
52 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
53 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
53 $ hg addremove --similarity 0
54 $ hg addremove --similarity 0
54 adding content1_missing_content1-tracked
55 adding content1_missing_content1-tracked
55 adding content1_missing_content1-untracked
56 adding content1_missing_content1-untracked
56 adding content1_missing_content3-tracked
57 adding content1_missing_content3-tracked
57 adding content1_missing_content3-untracked
58 adding content1_missing_content3-untracked
58 adding content1_missing_missing-tracked
59 adding content1_missing_missing-tracked
59 adding content1_missing_missing-untracked
60 adding content1_missing_missing-untracked
60 adding missing_missing_content3-tracked
61 adding missing_missing_content3-tracked
61 adding missing_missing_content3-untracked
62 adding missing_missing_content3-untracked
62 adding missing_missing_missing-tracked
63 adding missing_missing_missing-tracked
63 adding missing_missing_missing-untracked
64 adding missing_missing_missing-untracked
64 $ hg forget *_*_*-untracked
65 $ hg forget *_*_*-untracked
65 $ rm *_*_missing-*
66 $ rm *_*_missing-*
66
67
67 Status compared to parent of the working copy, i.e. the dirstate status
68 Status compared to parent of the working copy, i.e. the dirstate status
68
69
69 $ hg status -A --rev 1 'glob:missing_content2_content3-tracked'
70 $ hg status -A --rev 1 'glob:missing_content2_content3-tracked'
70 M missing_content2_content3-tracked
71 M missing_content2_content3-tracked
71 $ hg status -A --rev 1 'glob:missing_content2_content2-tracked'
72 $ hg status -A --rev 1 'glob:missing_content2_content2-tracked'
72 C missing_content2_content2-tracked
73 C missing_content2_content2-tracked
73 $ hg status -A --rev 1 'glob:missing_missing_content3-tracked'
74 $ hg status -A --rev 1 'glob:missing_missing_content3-tracked'
74 A missing_missing_content3-tracked
75 A missing_missing_content3-tracked
75 $ hg status -A --rev 1 'glob:missing_missing_content3-untracked'
76 $ hg status -A --rev 1 'glob:missing_missing_content3-untracked'
76 ? missing_missing_content3-untracked
77 ? missing_missing_content3-untracked
77 $ hg status -A --rev 1 'glob:missing_content2_*-untracked'
78 $ hg status -A --rev 1 'glob:missing_content2_*-untracked'
78 R missing_content2_content2-untracked
79 R missing_content2_content2-untracked
79 R missing_content2_content3-untracked
80 R missing_content2_content3-untracked
80 R missing_content2_missing-untracked
81 R missing_content2_missing-untracked
81 $ hg status -A --rev 1 'glob:missing_*_missing-tracked'
82 $ hg status -A --rev 1 'glob:missing_*_missing-tracked'
82 ! missing_content2_missing-tracked
83 ! missing_content2_missing-tracked
83 ! missing_missing_missing-tracked
84 ! missing_missing_missing-tracked
84
85
85 $ hg status -A --rev 1 'glob:missing_missing_missing-untracked'
86 $ hg status -A --rev 1 'glob:missing_missing_missing-untracked'
86 missing_missing_missing-untracked: $ENOENT$
87 missing_missing_missing-untracked: $ENOENT$
87
88
88 Status between first and second commit. Should ignore dirstate status.
89 Status between first and second commit. Should ignore dirstate status.
89
90
90 $ hg status -A --rev 0:1 'glob:content1_content2_*'
91 $ hg status -A --rev 0:1 'glob:content1_content2_*'
91 M content1_content2_content1-tracked
92 M content1_content2_content1-tracked
92 M content1_content2_content1-untracked
93 M content1_content2_content1-untracked
93 M content1_content2_content2-tracked
94 M content1_content2_content2-tracked
94 M content1_content2_content2-untracked
95 M content1_content2_content2-untracked
95 M content1_content2_content3-tracked
96 M content1_content2_content3-tracked
96 M content1_content2_content3-untracked
97 M content1_content2_content3-untracked
97 M content1_content2_missing-tracked
98 M content1_content2_missing-tracked
98 M content1_content2_missing-untracked
99 M content1_content2_missing-untracked
99 $ hg status -A --rev 0:1 'glob:content1_content1_*'
100 $ hg status -A --rev 0:1 'glob:content1_content1_*'
100 C content1_content1_content1-tracked
101 C content1_content1_content1-tracked
101 C content1_content1_content1-untracked
102 C content1_content1_content1-untracked
102 C content1_content1_content3-tracked
103 C content1_content1_content3-tracked
103 C content1_content1_content3-untracked
104 C content1_content1_content3-untracked
104 C content1_content1_missing-tracked
105 C content1_content1_missing-tracked
105 C content1_content1_missing-untracked
106 C content1_content1_missing-untracked
106 $ hg status -A --rev 0:1 'glob:missing_content2_*'
107 $ hg status -A --rev 0:1 'glob:missing_content2_*'
107 A missing_content2_content2-tracked
108 A missing_content2_content2-tracked
108 A missing_content2_content2-untracked
109 A missing_content2_content2-untracked
109 A missing_content2_content3-tracked
110 A missing_content2_content3-tracked
110 A missing_content2_content3-untracked
111 A missing_content2_content3-untracked
111 A missing_content2_missing-tracked
112 A missing_content2_missing-tracked
112 A missing_content2_missing-untracked
113 A missing_content2_missing-untracked
113 $ hg status -A --rev 0:1 'glob:content1_missing_*'
114 $ hg status -A --rev 0:1 'glob:content1_missing_*'
114 R content1_missing_content1-tracked
115 R content1_missing_content1-tracked
115 R content1_missing_content1-untracked
116 R content1_missing_content1-untracked
116 R content1_missing_content3-tracked
117 R content1_missing_content3-tracked
117 R content1_missing_content3-untracked
118 R content1_missing_content3-untracked
118 R content1_missing_missing-tracked
119 R content1_missing_missing-tracked
119 R content1_missing_missing-untracked
120 R content1_missing_missing-untracked
120 $ hg status -A --rev 0:1 'glob:missing_missing_*'
121 $ hg status -A --rev 0:1 'glob:missing_missing_*'
121
122
122 Status compared to one revision back, checking that the dirstate status
123 Status compared to one revision back, checking that the dirstate status
123 is correctly combined with the inter-revision status
124 is correctly combined with the inter-revision status
124
125
125 $ hg status -A --rev 0 'glob:content1_*_content[23]-tracked'
126 $ hg status -A --rev 0 'glob:content1_*_content[23]-tracked'
126 M content1_content1_content3-tracked
127 M content1_content1_content3-tracked
127 M content1_content2_content2-tracked
128 M content1_content2_content2-tracked
128 M content1_content2_content3-tracked
129 M content1_content2_content3-tracked
129 M content1_missing_content3-tracked
130 M content1_missing_content3-tracked
130 $ hg status -A --rev 0 'glob:content1_*_content1-tracked'
131 $ hg status -A --rev 0 'glob:content1_*_content1-tracked'
131 C content1_content1_content1-tracked
132 C content1_content1_content1-tracked
132 C content1_content2_content1-tracked
133 C content1_content2_content1-tracked
133 C content1_missing_content1-tracked
134 C content1_missing_content1-tracked
134 $ hg status -A --rev 0 'glob:missing_*_content?-tracked'
135 $ hg status -A --rev 0 'glob:missing_*_content?-tracked'
135 A missing_content2_content2-tracked
136 A missing_content2_content2-tracked
136 A missing_content2_content3-tracked
137 A missing_content2_content3-tracked
137 A missing_missing_content3-tracked
138 A missing_missing_content3-tracked
138 BROKEN: missing_content2_content[23]-untracked exist, so should be listed
139 BROKEN: missing_content2_content[23]-untracked exist, so should be listed
139 $ hg status -A --rev 0 'glob:missing_*_content?-untracked'
140 $ hg status -A --rev 0 'glob:missing_*_content?-untracked'
140 ? missing_missing_content3-untracked
141 ? missing_missing_content3-untracked
141 $ hg status -A --rev 0 'glob:content1_*_*-untracked'
142 $ hg status -A --rev 0 'glob:content1_*_*-untracked'
142 R content1_content1_content1-untracked
143 R content1_content1_content1-untracked
143 R content1_content1_content3-untracked
144 R content1_content1_content3-untracked
144 R content1_content1_missing-untracked
145 R content1_content1_missing-untracked
145 R content1_content2_content1-untracked
146 R content1_content2_content1-untracked
146 R content1_content2_content2-untracked
147 R content1_content2_content2-untracked
147 R content1_content2_content3-untracked
148 R content1_content2_content3-untracked
148 R content1_content2_missing-untracked
149 R content1_content2_missing-untracked
149 R content1_missing_content1-untracked
150 R content1_missing_content1-untracked
150 R content1_missing_content3-untracked
151 R content1_missing_content3-untracked
151 R content1_missing_missing-untracked
152 R content1_missing_missing-untracked
152 $ hg status -A --rev 0 'glob:*_*_missing-tracked'
153 $ hg status -A --rev 0 'glob:*_*_missing-tracked'
153 ! content1_content1_missing-tracked
154 ! content1_content1_missing-tracked
154 ! content1_content2_missing-tracked
155 ! content1_content2_missing-tracked
155 ! content1_missing_missing-tracked
156 ! content1_missing_missing-tracked
156 ! missing_content2_missing-tracked
157 ! missing_content2_missing-tracked
157 ! missing_missing_missing-tracked
158 ! missing_missing_missing-tracked
158 $ hg status -A --rev 0 'glob:missing_*_missing-untracked'
159 $ hg status -A --rev 0 'glob:missing_*_missing-untracked'
@@ -1,26 +1,27 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ echo a > a
4 $ echo a > a
4 $ hg ci -Ama
5 $ hg ci -Ama
5 adding a
6 adding a
6
7
7 $ hg an a
8 $ hg an a
8 0: a
9 0: a
9
10
10 $ hg --config ui.strict=False an a
11 $ hg --config ui.strict=False an a
11 0: a
12 0: a
12
13
13 $ echo "[ui]" >> $HGRCPATH
14 $ echo "[ui]" >> $HGRCPATH
14 $ echo "strict=True" >> $HGRCPATH
15 $ echo "strict=True" >> $HGRCPATH
15
16
16 $ hg an a
17 $ hg an a
17 hg: unknown command 'an'
18 hg: unknown command 'an'
18 (use 'hg help' for a list of commands)
19 (use 'hg help' for a list of commands)
19 [10]
20 [10]
20 $ hg annotate a
21 $ hg annotate a
21 0: a
22 0: a
22
23
23 should succeed - up is an alias, not an abbreviation
24 should succeed - up is an alias, not an abbreviation
24
25
25 $ hg up
26 $ hg up
26 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -1,85 +1,86 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2
3
3 $ touch a
4 $ touch a
4 $ hg add a
5 $ hg add a
5 $ hg commit -m "Added a"
6 $ hg commit -m "Added a"
6
7
7 $ touch main
8 $ touch main
8 $ hg add main
9 $ hg add main
9 $ hg commit -m "Added main"
10 $ hg commit -m "Added main"
10 $ hg checkout 0
11 $ hg checkout 0
11 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
12
13
13 'main' should be gone:
14 'main' should be gone:
14
15
15 $ ls -A
16 $ ls -A
16 .hg
17 .hg
17 a
18 a
18
19
19 $ touch side1
20 $ touch side1
20 $ hg add side1
21 $ hg add side1
21 $ hg commit -m "Added side1"
22 $ hg commit -m "Added side1"
22 created new head
23 created new head
23 $ touch side2
24 $ touch side2
24 $ hg add side2
25 $ hg add side2
25 $ hg commit -m "Added side2"
26 $ hg commit -m "Added side2"
26
27
27 $ hg log
28 $ hg log
28 changeset: 3:91ebc10ed028
29 changeset: 3:91ebc10ed028
29 tag: tip
30 tag: tip
30 user: test
31 user: test
31 date: Thu Jan 01 00:00:00 1970 +0000
32 date: Thu Jan 01 00:00:00 1970 +0000
32 summary: Added side2
33 summary: Added side2
33
34
34 changeset: 2:b932d7dbb1e1
35 changeset: 2:b932d7dbb1e1
35 parent: 0:c2eda428b523
36 parent: 0:c2eda428b523
36 user: test
37 user: test
37 date: Thu Jan 01 00:00:00 1970 +0000
38 date: Thu Jan 01 00:00:00 1970 +0000
38 summary: Added side1
39 summary: Added side1
39
40
40 changeset: 1:71a760306caf
41 changeset: 1:71a760306caf
41 user: test
42 user: test
42 date: Thu Jan 01 00:00:00 1970 +0000
43 date: Thu Jan 01 00:00:00 1970 +0000
43 summary: Added main
44 summary: Added main
44
45
45 changeset: 0:c2eda428b523
46 changeset: 0:c2eda428b523
46 user: test
47 user: test
47 date: Thu Jan 01 00:00:00 1970 +0000
48 date: Thu Jan 01 00:00:00 1970 +0000
48 summary: Added a
49 summary: Added a
49
50
50
51
51 $ hg heads
52 $ hg heads
52 changeset: 3:91ebc10ed028
53 changeset: 3:91ebc10ed028
53 tag: tip
54 tag: tip
54 user: test
55 user: test
55 date: Thu Jan 01 00:00:00 1970 +0000
56 date: Thu Jan 01 00:00:00 1970 +0000
56 summary: Added side2
57 summary: Added side2
57
58
58 changeset: 1:71a760306caf
59 changeset: 1:71a760306caf
59 user: test
60 user: test
60 date: Thu Jan 01 00:00:00 1970 +0000
61 date: Thu Jan 01 00:00:00 1970 +0000
61 summary: Added main
62 summary: Added main
62
63
63 $ ls -A
64 $ ls -A
64 .hg
65 .hg
65 a
66 a
66 side1
67 side1
67 side2
68 side2
68
69
69 $ hg update --debug -C 1
70 $ hg update --debug -C 1
70 resolving manifests
71 resolving manifests
71 branchmerge: False, force: True, partial: False
72 branchmerge: False, force: True, partial: False
72 ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
73 ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
73 side1: other deleted -> r
74 side1: other deleted -> r
74 removing side1
75 removing side1
75 side2: other deleted -> r
76 side2: other deleted -> r
76 removing side2
77 removing side2
77 main: remote created -> g
78 main: remote created -> g
78 getting main
79 getting main
79 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
80 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
80
81
81 $ ls -A
82 $ ls -A
82 .hg
83 .hg
83 a
84 a
84 main
85 main
85
86
@@ -1,27 +1,28 b''
1 $ hg init
1 $ hg init repo
2 $ cd repo
2 $ touch a
3 $ touch a
3
4
4 $ unset HGUSER
5 $ unset HGUSER
5 $ echo "[ui]" >> .hg/hgrc
6 $ echo "[ui]" >> .hg/hgrc
6 $ echo "username= foo" >> .hg/hgrc
7 $ echo "username= foo" >> .hg/hgrc
7 $ echo " bar1" >> .hg/hgrc
8 $ echo " bar1" >> .hg/hgrc
8
9
9 $ hg ci -Am m
10 $ hg ci -Am m
10 adding a
11 adding a
11 abort: username 'foo\nbar1' contains a newline
12 abort: username 'foo\nbar1' contains a newline
12
13
13 [255]
14 [255]
14 $ rm .hg/hgrc
15 $ rm .hg/hgrc
15
16
16 $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
17 $ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
17 adding a
18 adding a
18 abort: username 'foo\nbar2' contains a newline
19 abort: username 'foo\nbar2' contains a newline
19
20
20 [255]
21 [255]
21 $ hg ci -Am m -u "`(echo foo; echo bar3)`"
22 $ hg ci -Am m -u "`(echo foo; echo bar3)`"
22 adding a
23 adding a
23 transaction abort!
24 transaction abort!
24 rollback completed
25 rollback completed
25 abort: username 'foo\nbar3' contains a newline
26 abort: username 'foo\nbar3' contains a newline
26 [50]
27 [50]
27
28
General Comments 0
You need to be logged in to leave comments. Login now