##// END OF EJS Templates
spelling: nonexistent
timeless@mozdev.org -
r17492:973c2b0b default
parent child Browse files
Show More
@@ -1,216 +1,216 b''
1
1
2 $ mkdir part1
2 $ mkdir part1
3 $ cd part1
3 $ cd part1
4
4
5 $ hg init
5 $ hg init
6 $ echo a > a
6 $ echo a > a
7 $ hg add a
7 $ hg add a
8 $ hg commit -m "1"
8 $ hg commit -m "1"
9 $ hg status
9 $ hg status
10 $ hg copy a b
10 $ hg copy a b
11 $ hg --config ui.portablefilenames=abort copy a con.xml
11 $ hg --config ui.portablefilenames=abort copy a con.xml
12 abort: filename contains 'con', which is reserved on Windows: 'con.xml'
12 abort: filename contains 'con', which is reserved on Windows: 'con.xml'
13 [255]
13 [255]
14 $ hg status
14 $ hg status
15 A b
15 A b
16 $ hg sum
16 $ hg sum
17 parent: 0:c19d34741b0a tip
17 parent: 0:c19d34741b0a tip
18 1
18 1
19 branch: default
19 branch: default
20 commit: 1 copied
20 commit: 1 copied
21 update: (current)
21 update: (current)
22 $ hg --debug commit -m "2"
22 $ hg --debug commit -m "2"
23 b
23 b
24 b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
24 b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
25 committed changeset 1:93580a2c28a50a56f63526fb305067e6fbf739c4
25 committed changeset 1:93580a2c28a50a56f63526fb305067e6fbf739c4
26
26
27 we should see two history entries
27 we should see two history entries
28
28
29 $ hg history -v
29 $ hg history -v
30 changeset: 1:93580a2c28a5
30 changeset: 1:93580a2c28a5
31 tag: tip
31 tag: tip
32 user: test
32 user: test
33 date: Thu Jan 01 00:00:00 1970 +0000
33 date: Thu Jan 01 00:00:00 1970 +0000
34 files: b
34 files: b
35 description:
35 description:
36 2
36 2
37
37
38
38
39 changeset: 0:c19d34741b0a
39 changeset: 0:c19d34741b0a
40 user: test
40 user: test
41 date: Thu Jan 01 00:00:00 1970 +0000
41 date: Thu Jan 01 00:00:00 1970 +0000
42 files: a
42 files: a
43 description:
43 description:
44 1
44 1
45
45
46
46
47
47
48 we should see one log entry for a
48 we should see one log entry for a
49
49
50 $ hg log a
50 $ hg log a
51 changeset: 0:c19d34741b0a
51 changeset: 0:c19d34741b0a
52 user: test
52 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: 1
54 summary: 1
55
55
56
56
57 this should show a revision linked to changeset 0
57 this should show a revision linked to changeset 0
58
58
59 $ hg debugindex a
59 $ hg debugindex a
60 rev offset length ..... linkrev nodeid p1 p2 (re)
60 rev offset length ..... linkrev nodeid p1 p2 (re)
61 0 0 3 ..... 0 b789fdd96dc2 000000000000 000000000000 (re)
61 0 0 3 ..... 0 b789fdd96dc2 000000000000 000000000000 (re)
62
62
63 we should see one log entry for b
63 we should see one log entry for b
64
64
65 $ hg log b
65 $ hg log b
66 changeset: 1:93580a2c28a5
66 changeset: 1:93580a2c28a5
67 tag: tip
67 tag: tip
68 user: test
68 user: test
69 date: Thu Jan 01 00:00:00 1970 +0000
69 date: Thu Jan 01 00:00:00 1970 +0000
70 summary: 2
70 summary: 2
71
71
72
72
73 this should show a revision linked to changeset 1
73 this should show a revision linked to changeset 1
74
74
75 $ hg debugindex b
75 $ hg debugindex b
76 rev offset length ..... linkrev nodeid p1 p2 (re)
76 rev offset length ..... linkrev nodeid p1 p2 (re)
77 0 0 65 ..... 1 37d9b5d994ea 000000000000 000000000000 (re)
77 0 0 65 ..... 1 37d9b5d994ea 000000000000 000000000000 (re)
78
78
79 this should show the rename information in the metadata
79 this should show the rename information in the metadata
80
80
81 $ hg debugdata b 0 | head -3 | tail -2
81 $ hg debugdata b 0 | head -3 | tail -2
82 copy: a
82 copy: a
83 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
83 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
84
84
85 $ "$TESTDIR/md5sum.py" .hg/store/data/b.i
85 $ "$TESTDIR/md5sum.py" .hg/store/data/b.i
86 4999f120a3b88713bbefddd195cf5133 .hg/store/data/b.i
86 4999f120a3b88713bbefddd195cf5133 .hg/store/data/b.i
87 $ hg cat b > bsum
87 $ hg cat b > bsum
88 $ "$TESTDIR/md5sum.py" bsum
88 $ "$TESTDIR/md5sum.py" bsum
89 60b725f10c9c85c70d97880dfe8191b3 bsum
89 60b725f10c9c85c70d97880dfe8191b3 bsum
90 $ hg cat a > asum
90 $ hg cat a > asum
91 $ "$TESTDIR/md5sum.py" asum
91 $ "$TESTDIR/md5sum.py" asum
92 60b725f10c9c85c70d97880dfe8191b3 asum
92 60b725f10c9c85c70d97880dfe8191b3 asum
93 $ hg verify
93 $ hg verify
94 checking changesets
94 checking changesets
95 checking manifests
95 checking manifests
96 crosschecking files in changesets and manifests
96 crosschecking files in changesets and manifests
97 checking files
97 checking files
98 2 files, 2 changesets, 2 total revisions
98 2 files, 2 changesets, 2 total revisions
99
99
100 $ cd ..
100 $ cd ..
101
101
102
102
103 $ mkdir part2
103 $ mkdir part2
104 $ cd part2
104 $ cd part2
105
105
106 $ hg init
106 $ hg init
107 $ echo foo > foo
107 $ echo foo > foo
108 should fail - foo is not managed
108 should fail - foo is not managed
109 $ hg mv foo bar
109 $ hg mv foo bar
110 foo: not copying - file is not managed
110 foo: not copying - file is not managed
111 abort: no files to copy
111 abort: no files to copy
112 [255]
112 [255]
113 $ hg st -A
113 $ hg st -A
114 ? foo
114 ? foo
115 $ hg add foo
115 $ hg add foo
116 dry-run; print a warning that this is not a real copy; foo is added
116 dry-run; print a warning that this is not a real copy; foo is added
117 $ hg mv --dry-run foo bar
117 $ hg mv --dry-run foo bar
118 foo has not been committed yet, so no copy data will be stored for bar.
118 foo has not been committed yet, so no copy data will be stored for bar.
119 $ hg st -A
119 $ hg st -A
120 A foo
120 A foo
121 should print a warning that this is not a real copy; bar is added
121 should print a warning that this is not a real copy; bar is added
122 $ hg mv foo bar
122 $ hg mv foo bar
123 foo has not been committed yet, so no copy data will be stored for bar.
123 foo has not been committed yet, so no copy data will be stored for bar.
124 $ hg st -A
124 $ hg st -A
125 A bar
125 A bar
126 should print a warning that this is not a real copy; foo is added
126 should print a warning that this is not a real copy; foo is added
127 $ hg cp bar foo
127 $ hg cp bar foo
128 bar has not been committed yet, so no copy data will be stored for foo.
128 bar has not been committed yet, so no copy data will be stored for foo.
129 $ hg rm -f bar
129 $ hg rm -f bar
130 $ rm bar
130 $ rm bar
131 $ hg st -A
131 $ hg st -A
132 A foo
132 A foo
133 $ hg commit -m1
133 $ hg commit -m1
134
134
135 moving a missing file
135 moving a missing file
136 $ rm foo
136 $ rm foo
137 $ hg mv foo foo3
137 $ hg mv foo foo3
138 foo: deleted in working copy
138 foo: deleted in working copy
139 foo3 does not exist!
139 foo3 does not exist!
140 $ hg up -qC .
140 $ hg up -qC .
141
141
142 copy --after to a nonexistant target filename
142 copy --after to a nonexistent target filename
143 $ hg cp -A foo dummy
143 $ hg cp -A foo dummy
144 foo: not recording copy - dummy does not exist
144 foo: not recording copy - dummy does not exist
145
145
146 dry-run; should show that foo is clean
146 dry-run; should show that foo is clean
147 $ hg copy --dry-run foo bar
147 $ hg copy --dry-run foo bar
148 $ hg st -A
148 $ hg st -A
149 C foo
149 C foo
150 should show copy
150 should show copy
151 $ hg copy foo bar
151 $ hg copy foo bar
152 $ hg st -C
152 $ hg st -C
153 A bar
153 A bar
154 foo
154 foo
155
155
156 shouldn't show copy
156 shouldn't show copy
157 $ hg commit -m2
157 $ hg commit -m2
158 $ hg st -C
158 $ hg st -C
159
159
160 should match
160 should match
161 $ hg debugindex foo
161 $ hg debugindex foo
162 rev offset length ..... linkrev nodeid p1 p2 (re)
162 rev offset length ..... linkrev nodeid p1 p2 (re)
163 0 0 5 ..... 0 2ed2a3912a0b 000000000000 000000000000 (re)
163 0 0 5 ..... 0 2ed2a3912a0b 000000000000 000000000000 (re)
164 $ hg debugrename bar
164 $ hg debugrename bar
165 bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
165 bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
166
166
167 $ echo bleah > foo
167 $ echo bleah > foo
168 $ echo quux > bar
168 $ echo quux > bar
169 $ hg commit -m3
169 $ hg commit -m3
170
170
171 should not be renamed
171 should not be renamed
172 $ hg debugrename bar
172 $ hg debugrename bar
173 bar not renamed
173 bar not renamed
174
174
175 $ hg copy -f foo bar
175 $ hg copy -f foo bar
176 should show copy
176 should show copy
177 $ hg st -C
177 $ hg st -C
178 M bar
178 M bar
179 foo
179 foo
180 $ hg commit -m3
180 $ hg commit -m3
181
181
182 should show no parents for tip
182 should show no parents for tip
183 $ hg debugindex bar
183 $ hg debugindex bar
184 rev offset length ..... linkrev nodeid p1 p2 (re)
184 rev offset length ..... linkrev nodeid p1 p2 (re)
185 0 0 69 ..... 1 7711d36246cc 000000000000 000000000000 (re)
185 0 0 69 ..... 1 7711d36246cc 000000000000 000000000000 (re)
186 1 69 6 ..... 2 bdf70a2b8d03 7711d36246cc 000000000000 (re)
186 1 69 6 ..... 2 bdf70a2b8d03 7711d36246cc 000000000000 (re)
187 2 75 81 ..... 3 b2558327ea8d 000000000000 000000000000 (re)
187 2 75 81 ..... 3 b2558327ea8d 000000000000 000000000000 (re)
188 should match
188 should match
189 $ hg debugindex foo
189 $ hg debugindex foo
190 rev offset length ..... linkrev nodeid p1 p2 (re)
190 rev offset length ..... linkrev nodeid p1 p2 (re)
191 0 0 5 ..... 0 2ed2a3912a0b 000000000000 000000000000 (re)
191 0 0 5 ..... 0 2ed2a3912a0b 000000000000 000000000000 (re)
192 1 5 7 ..... 2 dd12c926cf16 2ed2a3912a0b 000000000000 (re)
192 1 5 7 ..... 2 dd12c926cf16 2ed2a3912a0b 000000000000 (re)
193 $ hg debugrename bar
193 $ hg debugrename bar
194 bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
194 bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
195
195
196 should show no copies
196 should show no copies
197 $ hg st -C
197 $ hg st -C
198
198
199 copy --after on an added file
199 copy --after on an added file
200 $ cp bar baz
200 $ cp bar baz
201 $ hg add baz
201 $ hg add baz
202 $ hg cp -A bar baz
202 $ hg cp -A bar baz
203 $ hg st -C
203 $ hg st -C
204 A baz
204 A baz
205 bar
205 bar
206
206
207 foo was clean:
207 foo was clean:
208 $ hg st -AC foo
208 $ hg st -AC foo
209 C foo
209 C foo
210 but it's considered modified after a copy --after --force
210 but it's considered modified after a copy --after --force
211 $ hg copy -Af bar foo
211 $ hg copy -Af bar foo
212 $ hg st -AC foo
212 $ hg st -AC foo
213 M foo
213 M foo
214 bar
214 bar
215
215
216 $ cd ..
216 $ cd ..
@@ -1,644 +1,644 b''
1 commit hooks can see env vars
1 commit hooks can see env vars
2
2
3 $ hg init a
3 $ hg init a
4 $ cd a
4 $ cd a
5 $ cat > .hg/hgrc <<EOF
5 $ cat > .hg/hgrc <<EOF
6 > [hooks]
6 > [hooks]
7 > commit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit"
7 > commit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit"
8 > commit.b = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit.b"
8 > commit.b = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit.b"
9 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" precommit"
9 > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" precommit"
10 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxncommit"
10 > pretxncommit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxncommit"
11 > pretxncommit.tip = hg -q tip
11 > pretxncommit.tip = hg -q tip
12 > pre-identify = python "$TESTDIR/printenv.py" pre-identify 1
12 > pre-identify = python "$TESTDIR/printenv.py" pre-identify 1
13 > pre-cat = python "$TESTDIR/printenv.py" pre-cat
13 > pre-cat = python "$TESTDIR/printenv.py" pre-cat
14 > post-cat = python "$TESTDIR/printenv.py" post-cat
14 > post-cat = python "$TESTDIR/printenv.py" post-cat
15 > EOF
15 > EOF
16 $ echo a > a
16 $ echo a > a
17 $ hg add a
17 $ hg add a
18 $ hg commit -m a
18 $ hg commit -m a
19 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
19 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
20 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
20 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
21 0:cb9a9f314b8b
21 0:cb9a9f314b8b
22 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
22 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
23 commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
23 commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
24
24
25 $ hg clone . ../b
25 $ hg clone . ../b
26 updating to branch default
26 updating to branch default
27 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
28 $ cd ../b
28 $ cd ../b
29
29
30 changegroup hooks can see env vars
30 changegroup hooks can see env vars
31
31
32 $ cat > .hg/hgrc <<EOF
32 $ cat > .hg/hgrc <<EOF
33 > [hooks]
33 > [hooks]
34 > prechangegroup = python "$TESTDIR/printenv.py" prechangegroup
34 > prechangegroup = python "$TESTDIR/printenv.py" prechangegroup
35 > changegroup = python "$TESTDIR/printenv.py" changegroup
35 > changegroup = python "$TESTDIR/printenv.py" changegroup
36 > incoming = python "$TESTDIR/printenv.py" incoming
36 > incoming = python "$TESTDIR/printenv.py" incoming
37 > EOF
37 > EOF
38
38
39 pretxncommit and commit hooks can see both parents of merge
39 pretxncommit and commit hooks can see both parents of merge
40
40
41 $ cd ../a
41 $ cd ../a
42 $ echo b >> a
42 $ echo b >> a
43 $ hg commit -m a1 -d "1 0"
43 $ hg commit -m a1 -d "1 0"
44 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
44 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
45 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
45 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
46 1:ab228980c14d
46 1:ab228980c14d
47 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
47 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
48 commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
48 commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
49 $ hg update -C 0
49 $ hg update -C 0
50 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
51 $ echo b > b
51 $ echo b > b
52 $ hg add b
52 $ hg add b
53 $ hg commit -m b -d '1 0'
53 $ hg commit -m b -d '1 0'
54 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
54 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
55 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
55 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
56 2:ee9deb46ab31
56 2:ee9deb46ab31
57 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
57 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
58 commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
58 commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
59 created new head
59 created new head
60 $ hg merge 1
60 $ hg merge 1
61 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
62 (branch merge, don't forget to commit)
62 (branch merge, don't forget to commit)
63 $ hg commit -m merge -d '2 0'
63 $ hg commit -m merge -d '2 0'
64 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
64 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
65 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
65 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
66 3:07f3376c1e65
66 3:07f3376c1e65
67 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
67 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
68 commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
68 commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
69
69
70 test generic hooks
70 test generic hooks
71
71
72 $ hg id
72 $ hg id
73 pre-identify hook: HG_ARGS=id HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[]
73 pre-identify hook: HG_ARGS=id HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None} HG_PATS=[]
74 warning: pre-identify hook exited with status 1
74 warning: pre-identify hook exited with status 1
75 [1]
75 [1]
76 $ hg cat b
76 $ hg cat b
77 pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
77 pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
78 b
78 b
79 post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
79 post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
80
80
81 $ cd ../b
81 $ cd ../b
82 $ hg pull ../a
82 $ hg pull ../a
83 pulling from ../a
83 pulling from ../a
84 searching for changes
84 searching for changes
85 prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
85 prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
86 adding changesets
86 adding changesets
87 adding manifests
87 adding manifests
88 adding file changes
88 adding file changes
89 added 3 changesets with 2 changes to 2 files
89 added 3 changesets with 2 changes to 2 files
90 changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
90 changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
91 incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
91 incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
92 incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
92 incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
93 incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
93 incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
94 (run 'hg update' to get a working copy)
94 (run 'hg update' to get a working copy)
95
95
96 tag hooks can see env vars
96 tag hooks can see env vars
97
97
98 $ cd ../a
98 $ cd ../a
99 $ cat >> .hg/hgrc <<EOF
99 $ cat >> .hg/hgrc <<EOF
100 > pretag = python "$TESTDIR/printenv.py" pretag
100 > pretag = python "$TESTDIR/printenv.py" pretag
101 > tag = sh -c "HG_PARENT1= HG_PARENT2= python \"$TESTDIR/printenv.py\" tag"
101 > tag = sh -c "HG_PARENT1= HG_PARENT2= python \"$TESTDIR/printenv.py\" tag"
102 > EOF
102 > EOF
103 $ hg tag -d '3 0' a
103 $ hg tag -d '3 0' a
104 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
104 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
105 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
105 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
106 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
106 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
107 4:539e4b31b6dc
107 4:539e4b31b6dc
108 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
108 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
109 commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
109 commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
110 commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
110 commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
111 $ hg tag -l la
111 $ hg tag -l la
112 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
112 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
113 tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
113 tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
114
114
115 pretag hook can forbid tagging
115 pretag hook can forbid tagging
116
116
117 $ echo "pretag.forbid = python \"$TESTDIR/printenv.py\" pretag.forbid 1" >> .hg/hgrc
117 $ echo "pretag.forbid = python \"$TESTDIR/printenv.py\" pretag.forbid 1" >> .hg/hgrc
118 $ hg tag -d '4 0' fa
118 $ hg tag -d '4 0' fa
119 pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
119 pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
120 pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
120 pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
121 abort: pretag.forbid hook exited with status 1
121 abort: pretag.forbid hook exited with status 1
122 [255]
122 [255]
123 $ hg tag -l fla
123 $ hg tag -l fla
124 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
124 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
125 pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
125 pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
126 abort: pretag.forbid hook exited with status 1
126 abort: pretag.forbid hook exited with status 1
127 [255]
127 [255]
128
128
129 pretxncommit hook can see changeset, can roll back txn, changeset no
129 pretxncommit hook can see changeset, can roll back txn, changeset no
130 more there after
130 more there after
131
131
132 $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
132 $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
133 $ echo "pretxncommit.forbid1 = python \"$TESTDIR/printenv.py\" pretxncommit.forbid 1" >> .hg/hgrc
133 $ echo "pretxncommit.forbid1 = python \"$TESTDIR/printenv.py\" pretxncommit.forbid 1" >> .hg/hgrc
134 $ echo z > z
134 $ echo z > z
135 $ hg add z
135 $ hg add z
136 $ hg -q tip
136 $ hg -q tip
137 4:539e4b31b6dc
137 4:539e4b31b6dc
138 $ hg commit -m 'fail' -d '4 0'
138 $ hg commit -m 'fail' -d '4 0'
139 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
139 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
140 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
140 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
141 5:6f611f8018c1
141 5:6f611f8018c1
142 5:6f611f8018c1
142 5:6f611f8018c1
143 pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
143 pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
144 transaction abort!
144 transaction abort!
145 rollback completed
145 rollback completed
146 abort: pretxncommit.forbid1 hook exited with status 1
146 abort: pretxncommit.forbid1 hook exited with status 1
147 [255]
147 [255]
148 $ hg -q tip
148 $ hg -q tip
149 4:539e4b31b6dc
149 4:539e4b31b6dc
150
150
151 precommit hook can prevent commit
151 precommit hook can prevent commit
152
152
153 $ echo "precommit.forbid = python \"$TESTDIR/printenv.py\" precommit.forbid 1" >> .hg/hgrc
153 $ echo "precommit.forbid = python \"$TESTDIR/printenv.py\" precommit.forbid 1" >> .hg/hgrc
154 $ hg commit -m 'fail' -d '4 0'
154 $ hg commit -m 'fail' -d '4 0'
155 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
155 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
156 precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
156 precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
157 abort: precommit.forbid hook exited with status 1
157 abort: precommit.forbid hook exited with status 1
158 [255]
158 [255]
159 $ hg -q tip
159 $ hg -q tip
160 4:539e4b31b6dc
160 4:539e4b31b6dc
161
161
162 preupdate hook can prevent update
162 preupdate hook can prevent update
163
163
164 $ echo "preupdate = python \"$TESTDIR/printenv.py\" preupdate" >> .hg/hgrc
164 $ echo "preupdate = python \"$TESTDIR/printenv.py\" preupdate" >> .hg/hgrc
165 $ hg update 1
165 $ hg update 1
166 preupdate hook: HG_PARENT1=ab228980c14d
166 preupdate hook: HG_PARENT1=ab228980c14d
167 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
167 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
168
168
169 update hook
169 update hook
170
170
171 $ echo "update = python \"$TESTDIR/printenv.py\" update" >> .hg/hgrc
171 $ echo "update = python \"$TESTDIR/printenv.py\" update" >> .hg/hgrc
172 $ hg update
172 $ hg update
173 preupdate hook: HG_PARENT1=539e4b31b6dc
173 preupdate hook: HG_PARENT1=539e4b31b6dc
174 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
174 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
175 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
176
176
177 pushkey hook
177 pushkey hook
178
178
179 $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey" >> .hg/hgrc
179 $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey" >> .hg/hgrc
180 $ cd ../b
180 $ cd ../b
181 $ hg bookmark -r null foo
181 $ hg bookmark -r null foo
182 $ hg push -B foo ../a
182 $ hg push -B foo ../a
183 pushing to ../a
183 pushing to ../a
184 searching for changes
184 searching for changes
185 no changes found
185 no changes found
186 exporting bookmark foo
186 exporting bookmark foo
187 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
187 pushkey hook: HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1
188 [1]
188 [1]
189 $ cd ../a
189 $ cd ../a
190
190
191 listkeys hook
191 listkeys hook
192
192
193 $ echo "listkeys = python \"$TESTDIR/printenv.py\" listkeys" >> .hg/hgrc
193 $ echo "listkeys = python \"$TESTDIR/printenv.py\" listkeys" >> .hg/hgrc
194 $ hg bookmark -r null bar
194 $ hg bookmark -r null bar
195 $ cd ../b
195 $ cd ../b
196 $ hg pull -B bar ../a
196 $ hg pull -B bar ../a
197 pulling from ../a
197 pulling from ../a
198 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
198 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
199 no changes found
199 no changes found
200 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
200 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
201 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
201 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
202 adding remote bookmark bar
202 adding remote bookmark bar
203 importing bookmark bar
203 importing bookmark bar
204 $ cd ../a
204 $ cd ../a
205
205
206 test that prepushkey can prevent incoming keys
206 test that prepushkey can prevent incoming keys
207
207
208 $ echo "prepushkey = python \"$TESTDIR/printenv.py\" prepushkey.forbid 1" >> .hg/hgrc
208 $ echo "prepushkey = python \"$TESTDIR/printenv.py\" prepushkey.forbid 1" >> .hg/hgrc
209 $ cd ../b
209 $ cd ../b
210 $ hg bookmark -r null baz
210 $ hg bookmark -r null baz
211 $ hg push -B baz ../a
211 $ hg push -B baz ../a
212 pushing to ../a
212 pushing to ../a
213 searching for changes
213 searching for changes
214 no changes found
214 no changes found
215 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
215 listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
216 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
216 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
217 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
217 listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
218 exporting bookmark baz
218 exporting bookmark baz
219 prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000
219 prepushkey.forbid hook: HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000
220 abort: prepushkey hook exited with status 1
220 abort: prepushkey hook exited with status 1
221 [255]
221 [255]
222 $ cd ../a
222 $ cd ../a
223
223
224 test that prelistkeys can prevent listing keys
224 test that prelistkeys can prevent listing keys
225
225
226 $ echo "prelistkeys = python \"$TESTDIR/printenv.py\" prelistkeys.forbid 1" >> .hg/hgrc
226 $ echo "prelistkeys = python \"$TESTDIR/printenv.py\" prelistkeys.forbid 1" >> .hg/hgrc
227 $ hg bookmark -r null quux
227 $ hg bookmark -r null quux
228 $ cd ../b
228 $ cd ../b
229 $ hg pull -B quux ../a
229 $ hg pull -B quux ../a
230 pulling from ../a
230 pulling from ../a
231 prelistkeys.forbid hook: HG_NAMESPACE=bookmarks
231 prelistkeys.forbid hook: HG_NAMESPACE=bookmarks
232 abort: prelistkeys hook exited with status 1
232 abort: prelistkeys hook exited with status 1
233 [255]
233 [255]
234 $ cd ../a
234 $ cd ../a
235
235
236 prechangegroup hook can prevent incoming changes
236 prechangegroup hook can prevent incoming changes
237
237
238 $ cd ../b
238 $ cd ../b
239 $ hg -q tip
239 $ hg -q tip
240 3:07f3376c1e65
240 3:07f3376c1e65
241 $ cat > .hg/hgrc <<EOF
241 $ cat > .hg/hgrc <<EOF
242 > [hooks]
242 > [hooks]
243 > prechangegroup.forbid = python "$TESTDIR/printenv.py" prechangegroup.forbid 1
243 > prechangegroup.forbid = python "$TESTDIR/printenv.py" prechangegroup.forbid 1
244 > EOF
244 > EOF
245 $ hg pull ../a
245 $ hg pull ../a
246 pulling from ../a
246 pulling from ../a
247 searching for changes
247 searching for changes
248 prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
248 prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
249 abort: prechangegroup.forbid hook exited with status 1
249 abort: prechangegroup.forbid hook exited with status 1
250 [255]
250 [255]
251
251
252 pretxnchangegroup hook can see incoming changes, can roll back txn,
252 pretxnchangegroup hook can see incoming changes, can roll back txn,
253 incoming changes no longer there after
253 incoming changes no longer there after
254
254
255 $ cat > .hg/hgrc <<EOF
255 $ cat > .hg/hgrc <<EOF
256 > [hooks]
256 > [hooks]
257 > pretxnchangegroup.forbid0 = hg tip -q
257 > pretxnchangegroup.forbid0 = hg tip -q
258 > pretxnchangegroup.forbid1 = python "$TESTDIR/printenv.py" pretxnchangegroup.forbid 1
258 > pretxnchangegroup.forbid1 = python "$TESTDIR/printenv.py" pretxnchangegroup.forbid 1
259 > EOF
259 > EOF
260 $ hg pull ../a
260 $ hg pull ../a
261 pulling from ../a
261 pulling from ../a
262 searching for changes
262 searching for changes
263 adding changesets
263 adding changesets
264 adding manifests
264 adding manifests
265 adding file changes
265 adding file changes
266 added 1 changesets with 1 changes to 1 files
266 added 1 changesets with 1 changes to 1 files
267 4:539e4b31b6dc
267 4:539e4b31b6dc
268 pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
268 pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
269 transaction abort!
269 transaction abort!
270 rollback completed
270 rollback completed
271 abort: pretxnchangegroup.forbid1 hook exited with status 1
271 abort: pretxnchangegroup.forbid1 hook exited with status 1
272 [255]
272 [255]
273 $ hg -q tip
273 $ hg -q tip
274 3:07f3376c1e65
274 3:07f3376c1e65
275
275
276 outgoing hooks can see env vars
276 outgoing hooks can see env vars
277
277
278 $ rm .hg/hgrc
278 $ rm .hg/hgrc
279 $ cat > ../a/.hg/hgrc <<EOF
279 $ cat > ../a/.hg/hgrc <<EOF
280 > [hooks]
280 > [hooks]
281 > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
281 > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
282 > outgoing = python "$TESTDIR/printenv.py" outgoing
282 > outgoing = python "$TESTDIR/printenv.py" outgoing
283 > EOF
283 > EOF
284 $ hg pull ../a
284 $ hg pull ../a
285 pulling from ../a
285 pulling from ../a
286 searching for changes
286 searching for changes
287 preoutgoing hook: HG_SOURCE=pull
287 preoutgoing hook: HG_SOURCE=pull
288 adding changesets
288 adding changesets
289 outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
289 outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
290 adding manifests
290 adding manifests
291 adding file changes
291 adding file changes
292 added 1 changesets with 1 changes to 1 files
292 added 1 changesets with 1 changes to 1 files
293 adding remote bookmark quux
293 adding remote bookmark quux
294 (run 'hg update' to get a working copy)
294 (run 'hg update' to get a working copy)
295 $ hg rollback
295 $ hg rollback
296 repository tip rolled back to revision 3 (undo pull)
296 repository tip rolled back to revision 3 (undo pull)
297
297
298 preoutgoing hook can prevent outgoing changes
298 preoutgoing hook can prevent outgoing changes
299
299
300 $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> ../a/.hg/hgrc
300 $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> ../a/.hg/hgrc
301 $ hg pull ../a
301 $ hg pull ../a
302 pulling from ../a
302 pulling from ../a
303 searching for changes
303 searching for changes
304 preoutgoing hook: HG_SOURCE=pull
304 preoutgoing hook: HG_SOURCE=pull
305 preoutgoing.forbid hook: HG_SOURCE=pull
305 preoutgoing.forbid hook: HG_SOURCE=pull
306 abort: preoutgoing.forbid hook exited with status 1
306 abort: preoutgoing.forbid hook exited with status 1
307 [255]
307 [255]
308
308
309 outgoing hooks work for local clones
309 outgoing hooks work for local clones
310
310
311 $ cd ..
311 $ cd ..
312 $ cat > a/.hg/hgrc <<EOF
312 $ cat > a/.hg/hgrc <<EOF
313 > [hooks]
313 > [hooks]
314 > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
314 > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
315 > outgoing = python "$TESTDIR/printenv.py" outgoing
315 > outgoing = python "$TESTDIR/printenv.py" outgoing
316 > EOF
316 > EOF
317 $ hg clone a c
317 $ hg clone a c
318 preoutgoing hook: HG_SOURCE=clone
318 preoutgoing hook: HG_SOURCE=clone
319 outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
319 outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
320 updating to branch default
320 updating to branch default
321 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
321 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
322 $ rm -rf c
322 $ rm -rf c
323
323
324 preoutgoing hook can prevent outgoing changes for local clones
324 preoutgoing hook can prevent outgoing changes for local clones
325
325
326 $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> a/.hg/hgrc
326 $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> a/.hg/hgrc
327 $ hg clone a zzz
327 $ hg clone a zzz
328 preoutgoing hook: HG_SOURCE=clone
328 preoutgoing hook: HG_SOURCE=clone
329 preoutgoing.forbid hook: HG_SOURCE=clone
329 preoutgoing.forbid hook: HG_SOURCE=clone
330 abort: preoutgoing.forbid hook exited with status 1
330 abort: preoutgoing.forbid hook exited with status 1
331 [255]
331 [255]
332
332
333 $ cd "$TESTTMP/b"
333 $ cd "$TESTTMP/b"
334
334
335 $ cat > hooktests.py <<EOF
335 $ cat > hooktests.py <<EOF
336 > from mercurial import util
336 > from mercurial import util
337 >
337 >
338 > uncallable = 0
338 > uncallable = 0
339 >
339 >
340 > def printargs(args):
340 > def printargs(args):
341 > args.pop('ui', None)
341 > args.pop('ui', None)
342 > args.pop('repo', None)
342 > args.pop('repo', None)
343 > a = list(args.items())
343 > a = list(args.items())
344 > a.sort()
344 > a.sort()
345 > print 'hook args:'
345 > print 'hook args:'
346 > for k, v in a:
346 > for k, v in a:
347 > print ' ', k, v
347 > print ' ', k, v
348 >
348 >
349 > def passhook(**args):
349 > def passhook(**args):
350 > printargs(args)
350 > printargs(args)
351 >
351 >
352 > def failhook(**args):
352 > def failhook(**args):
353 > printargs(args)
353 > printargs(args)
354 > return True
354 > return True
355 >
355 >
356 > class LocalException(Exception):
356 > class LocalException(Exception):
357 > pass
357 > pass
358 >
358 >
359 > def raisehook(**args):
359 > def raisehook(**args):
360 > raise LocalException('exception from hook')
360 > raise LocalException('exception from hook')
361 >
361 >
362 > def aborthook(**args):
362 > def aborthook(**args):
363 > raise util.Abort('raise abort from hook')
363 > raise util.Abort('raise abort from hook')
364 >
364 >
365 > def brokenhook(**args):
365 > def brokenhook(**args):
366 > return 1 + {}
366 > return 1 + {}
367 >
367 >
368 > def verbosehook(ui, **args):
368 > def verbosehook(ui, **args):
369 > ui.note('verbose output from hook\n')
369 > ui.note('verbose output from hook\n')
370 >
370 >
371 > def printtags(ui, repo, **args):
371 > def printtags(ui, repo, **args):
372 > print repo.tags().keys()
372 > print repo.tags().keys()
373 >
373 >
374 > class container:
374 > class container:
375 > unreachable = 1
375 > unreachable = 1
376 > EOF
376 > EOF
377
377
378 test python hooks
378 test python hooks
379
379
380 #if windows
380 #if windows
381 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
381 $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH"
382 #else
382 #else
383 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
383 $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH"
384 #endif
384 #endif
385 $ export PYTHONPATH
385 $ export PYTHONPATH
386
386
387 $ echo '[hooks]' > ../a/.hg/hgrc
387 $ echo '[hooks]' > ../a/.hg/hgrc
388 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
388 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
389 $ hg pull ../a 2>&1 | grep 'raised an exception'
389 $ hg pull ../a 2>&1 | grep 'raised an exception'
390 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
390 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
391
391
392 $ echo '[hooks]' > ../a/.hg/hgrc
392 $ echo '[hooks]' > ../a/.hg/hgrc
393 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
393 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
394 $ hg pull ../a 2>&1 | grep 'raised an exception'
394 $ hg pull ../a 2>&1 | grep 'raised an exception'
395 error: preoutgoing.raise hook raised an exception: exception from hook
395 error: preoutgoing.raise hook raised an exception: exception from hook
396
396
397 $ echo '[hooks]' > ../a/.hg/hgrc
397 $ echo '[hooks]' > ../a/.hg/hgrc
398 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
398 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
399 $ hg pull ../a
399 $ hg pull ../a
400 pulling from ../a
400 pulling from ../a
401 searching for changes
401 searching for changes
402 error: preoutgoing.abort hook failed: raise abort from hook
402 error: preoutgoing.abort hook failed: raise abort from hook
403 abort: raise abort from hook
403 abort: raise abort from hook
404 [255]
404 [255]
405
405
406 $ echo '[hooks]' > ../a/.hg/hgrc
406 $ echo '[hooks]' > ../a/.hg/hgrc
407 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
407 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
408 $ hg pull ../a
408 $ hg pull ../a
409 pulling from ../a
409 pulling from ../a
410 searching for changes
410 searching for changes
411 hook args:
411 hook args:
412 hooktype preoutgoing
412 hooktype preoutgoing
413 source pull
413 source pull
414 abort: preoutgoing.fail hook failed
414 abort: preoutgoing.fail hook failed
415 [255]
415 [255]
416
416
417 $ echo '[hooks]' > ../a/.hg/hgrc
417 $ echo '[hooks]' > ../a/.hg/hgrc
418 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
418 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
419 $ hg pull ../a
419 $ hg pull ../a
420 pulling from ../a
420 pulling from ../a
421 searching for changes
421 searching for changes
422 abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
422 abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
423 [255]
423 [255]
424
424
425 $ echo '[hooks]' > ../a/.hg/hgrc
425 $ echo '[hooks]' > ../a/.hg/hgrc
426 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
426 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
427 $ hg pull ../a
427 $ hg pull ../a
428 pulling from ../a
428 pulling from ../a
429 searching for changes
429 searching for changes
430 abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
430 abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
431 [255]
431 [255]
432
432
433 $ echo '[hooks]' > ../a/.hg/hgrc
433 $ echo '[hooks]' > ../a/.hg/hgrc
434 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
434 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
435 $ hg pull ../a
435 $ hg pull ../a
436 pulling from ../a
436 pulling from ../a
437 searching for changes
437 searching for changes
438 abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module)
438 abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module)
439 [255]
439 [255]
440
440
441 $ echo '[hooks]' > ../a/.hg/hgrc
441 $ echo '[hooks]' > ../a/.hg/hgrc
442 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
442 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
443 $ hg pull ../a
443 $ hg pull ../a
444 pulling from ../a
444 pulling from ../a
445 searching for changes
445 searching for changes
446 abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
446 abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
447 [255]
447 [255]
448
448
449 $ echo '[hooks]' > ../a/.hg/hgrc
449 $ echo '[hooks]' > ../a/.hg/hgrc
450 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
450 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
451 $ hg pull ../a
451 $ hg pull ../a
452 pulling from ../a
452 pulling from ../a
453 searching for changes
453 searching for changes
454 abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
454 abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
455 [255]
455 [255]
456
456
457 $ echo '[hooks]' > ../a/.hg/hgrc
457 $ echo '[hooks]' > ../a/.hg/hgrc
458 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
458 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
459 $ hg pull ../a
459 $ hg pull ../a
460 pulling from ../a
460 pulling from ../a
461 searching for changes
461 searching for changes
462 hook args:
462 hook args:
463 hooktype preoutgoing
463 hooktype preoutgoing
464 source pull
464 source pull
465 adding changesets
465 adding changesets
466 adding manifests
466 adding manifests
467 adding file changes
467 adding file changes
468 added 1 changesets with 1 changes to 1 files
468 added 1 changesets with 1 changes to 1 files
469 adding remote bookmark quux
469 adding remote bookmark quux
470 (run 'hg update' to get a working copy)
470 (run 'hg update' to get a working copy)
471
471
472 make sure --traceback works
472 make sure --traceback works
473
473
474 $ echo '[hooks]' > .hg/hgrc
474 $ echo '[hooks]' > .hg/hgrc
475 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
475 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
476
476
477 $ echo aa > a
477 $ echo aa > a
478 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
478 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
479 Traceback (most recent call last):
479 Traceback (most recent call last):
480
480
481 $ cd ..
481 $ cd ..
482 $ hg init c
482 $ hg init c
483 $ cd c
483 $ cd c
484
484
485 $ cat > hookext.py <<EOF
485 $ cat > hookext.py <<EOF
486 > def autohook(**args):
486 > def autohook(**args):
487 > print "Automatically installed hook"
487 > print "Automatically installed hook"
488 >
488 >
489 > def reposetup(ui, repo):
489 > def reposetup(ui, repo):
490 > repo.ui.setconfig("hooks", "commit.auto", autohook)
490 > repo.ui.setconfig("hooks", "commit.auto", autohook)
491 > EOF
491 > EOF
492 $ echo '[extensions]' >> .hg/hgrc
492 $ echo '[extensions]' >> .hg/hgrc
493 $ echo 'hookext = hookext.py' >> .hg/hgrc
493 $ echo 'hookext = hookext.py' >> .hg/hgrc
494
494
495 $ touch foo
495 $ touch foo
496 $ hg add foo
496 $ hg add foo
497 $ hg ci -d '0 0' -m 'add foo'
497 $ hg ci -d '0 0' -m 'add foo'
498 Automatically installed hook
498 Automatically installed hook
499 $ echo >> foo
499 $ echo >> foo
500 $ hg ci --debug -d '0 0' -m 'change foo'
500 $ hg ci --debug -d '0 0' -m 'change foo'
501 foo
501 foo
502 calling hook commit.auto: <function autohook at *> (glob)
502 calling hook commit.auto: <function autohook at *> (glob)
503 Automatically installed hook
503 Automatically installed hook
504 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
504 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
505
505
506 $ hg showconfig hooks
506 $ hg showconfig hooks
507 hooks.commit.auto=<function autohook at *> (glob)
507 hooks.commit.auto=<function autohook at *> (glob)
508
508
509 test python hook configured with python:[file]:[hook] syntax
509 test python hook configured with python:[file]:[hook] syntax
510
510
511 $ cd ..
511 $ cd ..
512 $ mkdir d
512 $ mkdir d
513 $ cd d
513 $ cd d
514 $ hg init repo
514 $ hg init repo
515 $ mkdir hooks
515 $ mkdir hooks
516
516
517 $ cd hooks
517 $ cd hooks
518 $ cat > testhooks.py <<EOF
518 $ cat > testhooks.py <<EOF
519 > def testhook(**args):
519 > def testhook(**args):
520 > print 'hook works'
520 > print 'hook works'
521 > EOF
521 > EOF
522 $ echo '[hooks]' > ../repo/.hg/hgrc
522 $ echo '[hooks]' > ../repo/.hg/hgrc
523 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
523 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
524
524
525 $ cd ../repo
525 $ cd ../repo
526 $ hg commit -d '0 0'
526 $ hg commit -d '0 0'
527 hook works
527 hook works
528 nothing changed
528 nothing changed
529 [1]
529 [1]
530
530
531 $ echo '[hooks]' > .hg/hgrc
531 $ echo '[hooks]' > .hg/hgrc
532 $ echo "update.ne = python:`pwd`/nonexisting.py:testhook" >> .hg/hgrc
532 $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc
533 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
533 $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc
534
534
535 $ hg up null
535 $ hg up null
536 loading update.ne hook failed:
536 loading update.ne hook failed:
537 abort: No such file or directory: $TESTTMP/d/repo/nonexisting.py
537 abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py
538 [255]
538 [255]
539
539
540 $ hg id
540 $ hg id
541 loading pre-identify.npmd hook failed:
541 loading pre-identify.npmd hook failed:
542 abort: No module named repo!
542 abort: No module named repo!
543 [255]
543 [255]
544
544
545 $ cd ../../b
545 $ cd ../../b
546
546
547 make sure --traceback works on hook import failure
547 make sure --traceback works on hook import failure
548
548
549 $ cat > importfail.py <<EOF
549 $ cat > importfail.py <<EOF
550 > import somebogusmodule
550 > import somebogusmodule
551 > # dereference something in the module to force demandimport to load it
551 > # dereference something in the module to force demandimport to load it
552 > somebogusmodule.whatever
552 > somebogusmodule.whatever
553 > EOF
553 > EOF
554
554
555 $ echo '[hooks]' > .hg/hgrc
555 $ echo '[hooks]' > .hg/hgrc
556 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
556 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
557
557
558 $ echo a >> a
558 $ echo a >> a
559 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
559 $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])'
560 exception from first failed import attempt:
560 exception from first failed import attempt:
561 Traceback (most recent call last):
561 Traceback (most recent call last):
562 ImportError: No module named somebogusmodule
562 ImportError: No module named somebogusmodule
563 exception from second failed import attempt:
563 exception from second failed import attempt:
564 Traceback (most recent call last):
564 Traceback (most recent call last):
565 ImportError: No module named hgext_importfail
565 ImportError: No module named hgext_importfail
566 Traceback (most recent call last):
566 Traceback (most recent call last):
567 Abort: precommit.importfail hook is invalid (import of "importfail" failed)
567 Abort: precommit.importfail hook is invalid (import of "importfail" failed)
568 abort: precommit.importfail hook is invalid (import of "importfail" failed)
568 abort: precommit.importfail hook is invalid (import of "importfail" failed)
569
569
570 Issue1827: Hooks Update & Commit not completely post operation
570 Issue1827: Hooks Update & Commit not completely post operation
571
571
572 commit and update hooks should run after command completion
572 commit and update hooks should run after command completion
573
573
574 $ echo '[hooks]' > .hg/hgrc
574 $ echo '[hooks]' > .hg/hgrc
575 $ echo 'commit = hg id' >> .hg/hgrc
575 $ echo 'commit = hg id' >> .hg/hgrc
576 $ echo 'update = hg id' >> .hg/hgrc
576 $ echo 'update = hg id' >> .hg/hgrc
577 $ echo bb > a
577 $ echo bb > a
578 $ hg ci -ma
578 $ hg ci -ma
579 223eafe2750c tip
579 223eafe2750c tip
580 $ hg up 0
580 $ hg up 0
581 cb9a9f314b8b
581 cb9a9f314b8b
582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583
583
584 make sure --verbose (and --quiet/--debug etc.) are propogated to the local ui
584 make sure --verbose (and --quiet/--debug etc.) are propogated to the local ui
585 that is passed to pre/post hooks
585 that is passed to pre/post hooks
586
586
587 $ echo '[hooks]' > .hg/hgrc
587 $ echo '[hooks]' > .hg/hgrc
588 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
588 $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc
589 $ hg id
589 $ hg id
590 cb9a9f314b8b
590 cb9a9f314b8b
591 $ hg id --verbose
591 $ hg id --verbose
592 calling hook pre-identify: hooktests.verbosehook
592 calling hook pre-identify: hooktests.verbosehook
593 verbose output from hook
593 verbose output from hook
594 cb9a9f314b8b
594 cb9a9f314b8b
595
595
596 Ensure hooks can be prioritized
596 Ensure hooks can be prioritized
597
597
598 $ echo '[hooks]' > .hg/hgrc
598 $ echo '[hooks]' > .hg/hgrc
599 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
599 $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc
600 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
600 $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc
601 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
601 $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc
602 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
602 $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc
603 $ hg id --verbose
603 $ hg id --verbose
604 calling hook pre-identify.b: hooktests.verbosehook
604 calling hook pre-identify.b: hooktests.verbosehook
605 verbose output from hook
605 verbose output from hook
606 calling hook pre-identify.a: hooktests.verbosehook
606 calling hook pre-identify.a: hooktests.verbosehook
607 verbose output from hook
607 verbose output from hook
608 calling hook pre-identify.c: hooktests.verbosehook
608 calling hook pre-identify.c: hooktests.verbosehook
609 verbose output from hook
609 verbose output from hook
610 cb9a9f314b8b
610 cb9a9f314b8b
611
611
612 new tags must be visible in pretxncommit (issue3210)
612 new tags must be visible in pretxncommit (issue3210)
613
613
614 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
614 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc
615 $ hg tag -f foo
615 $ hg tag -f foo
616 ['a', 'foo', 'tip']
616 ['a', 'foo', 'tip']
617
617
618 new commits must be visible in pretxnchangegroup (issue3428)
618 new commits must be visible in pretxnchangegroup (issue3428)
619
619
620 $ cd ..
620 $ cd ..
621 $ hg init to
621 $ hg init to
622 $ echo '[hooks]' >> to/.hg/hgrc
622 $ echo '[hooks]' >> to/.hg/hgrc
623 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
623 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
624 $ echo a >> to/a
624 $ echo a >> to/a
625 $ hg --cwd to ci -Ama
625 $ hg --cwd to ci -Ama
626 adding a
626 adding a
627 $ hg clone to from
627 $ hg clone to from
628 updating to branch default
628 updating to branch default
629 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
629 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
630 $ echo aa >> from/a
630 $ echo aa >> from/a
631 $ hg --cwd from ci -mb
631 $ hg --cwd from ci -mb
632 $ hg --cwd from push
632 $ hg --cwd from push
633 pushing to $TESTTMP/to (glob)
633 pushing to $TESTTMP/to (glob)
634 searching for changes
634 searching for changes
635 adding changesets
635 adding changesets
636 adding manifests
636 adding manifests
637 adding file changes
637 adding file changes
638 added 1 changesets with 1 changes to 1 files
638 added 1 changesets with 1 changes to 1 files
639 changeset: 1:9836a07b9b9d
639 changeset: 1:9836a07b9b9d
640 tag: tip
640 tag: tip
641 user: test
641 user: test
642 date: Thu Jan 01 00:00:00 1970 +0000
642 date: Thu Jan 01 00:00:00 1970 +0000
643 summary: b
643 summary: b
644
644
@@ -1,806 +1,806 b''
1 test merge-tools configuration - mostly exercising filemerge.py
1 test merge-tools configuration - mostly exercising filemerge.py
2
2
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
4 $ hg init
4 $ hg init
5
5
6 revision 0
6 revision 0
7
7
8 $ echo "revision 0" > f
8 $ echo "revision 0" > f
9 $ echo "space" >> f
9 $ echo "space" >> f
10 $ hg commit -Am "revision 0"
10 $ hg commit -Am "revision 0"
11 adding f
11 adding f
12
12
13 revision 1
13 revision 1
14
14
15 $ echo "revision 1" > f
15 $ echo "revision 1" > f
16 $ echo "space" >> f
16 $ echo "space" >> f
17 $ hg commit -Am "revision 1"
17 $ hg commit -Am "revision 1"
18 $ hg update 0 > /dev/null
18 $ hg update 0 > /dev/null
19
19
20 revision 2
20 revision 2
21
21
22 $ echo "revision 2" > f
22 $ echo "revision 2" > f
23 $ echo "space" >> f
23 $ echo "space" >> f
24 $ hg commit -Am "revision 2"
24 $ hg commit -Am "revision 2"
25 created new head
25 created new head
26 $ hg update 0 > /dev/null
26 $ hg update 0 > /dev/null
27
27
28 revision 3 - simple to merge
28 revision 3 - simple to merge
29
29
30 $ echo "revision 3" >> f
30 $ echo "revision 3" >> f
31 $ hg commit -Am "revision 3"
31 $ hg commit -Am "revision 3"
32 created new head
32 created new head
33 $ echo "[merge-tools]" > .hg/hgrc
33 $ echo "[merge-tools]" > .hg/hgrc
34
34
35 $ beforemerge() {
35 $ beforemerge() {
36 > cat .hg/hgrc
36 > cat .hg/hgrc
37 > echo "# hg update -C 1"
37 > echo "# hg update -C 1"
38 > hg update -C 1 > /dev/null
38 > hg update -C 1 > /dev/null
39 > }
39 > }
40 $ aftermerge() {
40 $ aftermerge() {
41 > echo "# cat f"
41 > echo "# cat f"
42 > cat f
42 > cat f
43 > echo "# hg stat"
43 > echo "# hg stat"
44 > hg stat
44 > hg stat
45 > rm -f f.orig
45 > rm -f f.orig
46 > }
46 > }
47
47
48 Tool selection
48 Tool selection
49
49
50 default is internal merge:
50 default is internal merge:
51
51
52 $ beforemerge
52 $ beforemerge
53 [merge-tools]
53 [merge-tools]
54 # hg update -C 1
54 # hg update -C 1
55
55
56 hg merge -r 2
56 hg merge -r 2
57 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
57 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
58 running from a devel copy, not a temp installation
58 running from a devel copy, not a temp installation
59
59
60 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
60 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
61 merging f
61 merging f
62 warning: conflicts during merge.
62 warning: conflicts during merge.
63 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
63 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
64 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
64 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
65 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
65 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
66 [1]
66 [1]
67 $ aftermerge
67 $ aftermerge
68 # cat f
68 # cat f
69 <<<<<<< local
69 <<<<<<< local
70 revision 1
70 revision 1
71 =======
71 =======
72 revision 2
72 revision 2
73 >>>>>>> other
73 >>>>>>> other
74 space
74 space
75 # hg stat
75 # hg stat
76 M f
76 M f
77 ? f.orig
77 ? f.orig
78
78
79 simplest hgrc using false for merge:
79 simplest hgrc using false for merge:
80
80
81 $ echo "false.whatever=" >> .hg/hgrc
81 $ echo "false.whatever=" >> .hg/hgrc
82 $ beforemerge
82 $ beforemerge
83 [merge-tools]
83 [merge-tools]
84 false.whatever=
84 false.whatever=
85 # hg update -C 1
85 # hg update -C 1
86 $ hg merge -r 2
86 $ hg merge -r 2
87 merging f
87 merging f
88 merging f failed!
88 merging f failed!
89 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
89 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
90 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
90 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
91 [1]
91 [1]
92 $ aftermerge
92 $ aftermerge
93 # cat f
93 # cat f
94 revision 1
94 revision 1
95 space
95 space
96 # hg stat
96 # hg stat
97 M f
97 M f
98 ? f.orig
98 ? f.orig
99
99
100 unexecutable file in $PATH shouldn't be found:
100 unexecutable file in $PATH shouldn't be found:
101
101
102 $ touch false
102 $ touch false
103 $ hg up -qC 1
103 $ hg up -qC 1
104 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
104 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
105 merging f
105 merging f
106 warning: conflicts during merge.
106 warning: conflicts during merge.
107 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
107 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
108 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
108 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
109 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
109 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
110 [1]
110 [1]
111 $ rm false
111 $ rm false
112
112
113 executable directory in $PATH shouldn't be found:
113 executable directory in $PATH shouldn't be found:
114
114
115 $ mkdir false
115 $ mkdir false
116 $ hg up -qC 1
116 $ hg up -qC 1
117 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
117 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
118 merging f
118 merging f
119 warning: conflicts during merge.
119 warning: conflicts during merge.
120 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
120 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
121 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
121 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
122 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
122 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
123 [1]
123 [1]
124 $ rmdir false
124 $ rmdir false
125
125
126 true with higher .priority gets precedence:
126 true with higher .priority gets precedence:
127
127
128 $ echo "true.priority=1" >> .hg/hgrc
128 $ echo "true.priority=1" >> .hg/hgrc
129 $ beforemerge
129 $ beforemerge
130 [merge-tools]
130 [merge-tools]
131 false.whatever=
131 false.whatever=
132 true.priority=1
132 true.priority=1
133 # hg update -C 1
133 # hg update -C 1
134 $ hg merge -r 2
134 $ hg merge -r 2
135 merging f
135 merging f
136 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
136 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
137 (branch merge, don't forget to commit)
137 (branch merge, don't forget to commit)
138 $ aftermerge
138 $ aftermerge
139 # cat f
139 # cat f
140 revision 1
140 revision 1
141 space
141 space
142 # hg stat
142 # hg stat
143 M f
143 M f
144
144
145 unless lowered on command line:
145 unless lowered on command line:
146
146
147 $ beforemerge
147 $ beforemerge
148 [merge-tools]
148 [merge-tools]
149 false.whatever=
149 false.whatever=
150 true.priority=1
150 true.priority=1
151 # hg update -C 1
151 # hg update -C 1
152 $ hg merge -r 2 --config merge-tools.true.priority=-7
152 $ hg merge -r 2 --config merge-tools.true.priority=-7
153 merging f
153 merging f
154 merging f failed!
154 merging f failed!
155 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
155 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
156 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
156 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
157 [1]
157 [1]
158 $ aftermerge
158 $ aftermerge
159 # cat f
159 # cat f
160 revision 1
160 revision 1
161 space
161 space
162 # hg stat
162 # hg stat
163 M f
163 M f
164 ? f.orig
164 ? f.orig
165
165
166 or false set higher on command line:
166 or false set higher on command line:
167
167
168 $ beforemerge
168 $ beforemerge
169 [merge-tools]
169 [merge-tools]
170 false.whatever=
170 false.whatever=
171 true.priority=1
171 true.priority=1
172 # hg update -C 1
172 # hg update -C 1
173 $ hg merge -r 2 --config merge-tools.false.priority=117
173 $ hg merge -r 2 --config merge-tools.false.priority=117
174 merging f
174 merging f
175 merging f failed!
175 merging f failed!
176 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
176 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
177 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
177 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
178 [1]
178 [1]
179 $ aftermerge
179 $ aftermerge
180 # cat f
180 # cat f
181 revision 1
181 revision 1
182 space
182 space
183 # hg stat
183 # hg stat
184 M f
184 M f
185 ? f.orig
185 ? f.orig
186
186
187 or true.executable not found in PATH:
187 or true.executable not found in PATH:
188
188
189 $ beforemerge
189 $ beforemerge
190 [merge-tools]
190 [merge-tools]
191 false.whatever=
191 false.whatever=
192 true.priority=1
192 true.priority=1
193 # hg update -C 1
193 # hg update -C 1
194 $ hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool
194 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
195 merging f
195 merging f
196 merging f failed!
196 merging f failed!
197 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
197 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
198 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
198 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
199 [1]
199 [1]
200 $ aftermerge
200 $ aftermerge
201 # cat f
201 # cat f
202 revision 1
202 revision 1
203 space
203 space
204 # hg stat
204 # hg stat
205 M f
205 M f
206 ? f.orig
206 ? f.orig
207
207
208 or true.executable with bogus path:
208 or true.executable with bogus path:
209
209
210 $ beforemerge
210 $ beforemerge
211 [merge-tools]
211 [merge-tools]
212 false.whatever=
212 false.whatever=
213 true.priority=1
213 true.priority=1
214 # hg update -C 1
214 # hg update -C 1
215 $ hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool
215 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
216 merging f
216 merging f
217 merging f failed!
217 merging f failed!
218 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
218 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
219 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
219 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
220 [1]
220 [1]
221 $ aftermerge
221 $ aftermerge
222 # cat f
222 # cat f
223 revision 1
223 revision 1
224 space
224 space
225 # hg stat
225 # hg stat
226 M f
226 M f
227 ? f.orig
227 ? f.orig
228
228
229 but true.executable set to cat found in PATH works:
229 but true.executable set to cat found in PATH works:
230
230
231 $ echo "true.executable=cat" >> .hg/hgrc
231 $ echo "true.executable=cat" >> .hg/hgrc
232 $ beforemerge
232 $ beforemerge
233 [merge-tools]
233 [merge-tools]
234 false.whatever=
234 false.whatever=
235 true.priority=1
235 true.priority=1
236 true.executable=cat
236 true.executable=cat
237 # hg update -C 1
237 # hg update -C 1
238 $ hg merge -r 2
238 $ hg merge -r 2
239 merging f
239 merging f
240 revision 1
240 revision 1
241 space
241 space
242 revision 0
242 revision 0
243 space
243 space
244 revision 2
244 revision 2
245 space
245 space
246 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
246 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
247 (branch merge, don't forget to commit)
247 (branch merge, don't forget to commit)
248 $ aftermerge
248 $ aftermerge
249 # cat f
249 # cat f
250 revision 1
250 revision 1
251 space
251 space
252 # hg stat
252 # hg stat
253 M f
253 M f
254
254
255 and true.executable set to cat with path works:
255 and true.executable set to cat with path works:
256
256
257 $ beforemerge
257 $ beforemerge
258 [merge-tools]
258 [merge-tools]
259 false.whatever=
259 false.whatever=
260 true.priority=1
260 true.priority=1
261 true.executable=cat
261 true.executable=cat
262 # hg update -C 1
262 # hg update -C 1
263 $ hg merge -r 2 --config merge-tools.true.executable=cat
263 $ hg merge -r 2 --config merge-tools.true.executable=cat
264 merging f
264 merging f
265 revision 1
265 revision 1
266 space
266 space
267 revision 0
267 revision 0
268 space
268 space
269 revision 2
269 revision 2
270 space
270 space
271 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
271 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
272 (branch merge, don't forget to commit)
272 (branch merge, don't forget to commit)
273 $ aftermerge
273 $ aftermerge
274 # cat f
274 # cat f
275 revision 1
275 revision 1
276 space
276 space
277 # hg stat
277 # hg stat
278 M f
278 M f
279
279
280 #if unix-permissions
280 #if unix-permissions
281
281
282 environment variables in true.executable are handled:
282 environment variables in true.executable are handled:
283
283
284 $ echo 'echo "custom merge tool"' > "$HGTMP/merge.sh"
284 $ echo 'echo "custom merge tool"' > "$HGTMP/merge.sh"
285 $ beforemerge
285 $ beforemerge
286 [merge-tools]
286 [merge-tools]
287 false.whatever=
287 false.whatever=
288 true.priority=1
288 true.priority=1
289 true.executable=cat
289 true.executable=cat
290 # hg update -C 1
290 # hg update -C 1
291 $ hg --config merge-tools.true.executable='sh' \
291 $ hg --config merge-tools.true.executable='sh' \
292 > --config merge-tools.true.args="$HGTMP/merge.sh" \
292 > --config merge-tools.true.args="$HGTMP/merge.sh" \
293 > merge -r 2
293 > merge -r 2
294 merging f
294 merging f
295 custom merge tool
295 custom merge tool
296 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
296 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
297 (branch merge, don't forget to commit)
297 (branch merge, don't forget to commit)
298 $ aftermerge
298 $ aftermerge
299 # cat f
299 # cat f
300 revision 1
300 revision 1
301 space
301 space
302 # hg stat
302 # hg stat
303 M f
303 M f
304
304
305 #endif
305 #endif
306
306
307 Tool selection and merge-patterns
307 Tool selection and merge-patterns
308
308
309 merge-patterns specifies new tool false:
309 merge-patterns specifies new tool false:
310
310
311 $ beforemerge
311 $ beforemerge
312 [merge-tools]
312 [merge-tools]
313 false.whatever=
313 false.whatever=
314 true.priority=1
314 true.priority=1
315 true.executable=cat
315 true.executable=cat
316 # hg update -C 1
316 # hg update -C 1
317 $ hg merge -r 2 --config merge-patterns.f=false
317 $ hg merge -r 2 --config merge-patterns.f=false
318 merging f
318 merging f
319 merging f failed!
319 merging f failed!
320 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
320 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
321 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
321 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
322 [1]
322 [1]
323 $ aftermerge
323 $ aftermerge
324 # cat f
324 # cat f
325 revision 1
325 revision 1
326 space
326 space
327 # hg stat
327 # hg stat
328 M f
328 M f
329 ? f.orig
329 ? f.orig
330
330
331 merge-patterns specifies executable not found in PATH and gets warning:
331 merge-patterns specifies executable not found in PATH and gets warning:
332
332
333 $ beforemerge
333 $ beforemerge
334 [merge-tools]
334 [merge-tools]
335 false.whatever=
335 false.whatever=
336 true.priority=1
336 true.priority=1
337 true.executable=cat
337 true.executable=cat
338 # hg update -C 1
338 # hg update -C 1
339 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool
339 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
340 couldn't find merge tool true specified for f
340 couldn't find merge tool true specified for f
341 merging f
341 merging f
342 merging f failed!
342 merging f failed!
343 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
343 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
344 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
344 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
345 [1]
345 [1]
346 $ aftermerge
346 $ aftermerge
347 # cat f
347 # cat f
348 revision 1
348 revision 1
349 space
349 space
350 # hg stat
350 # hg stat
351 M f
351 M f
352 ? f.orig
352 ? f.orig
353
353
354 merge-patterns specifies executable with bogus path and gets warning:
354 merge-patterns specifies executable with bogus path and gets warning:
355
355
356 $ beforemerge
356 $ beforemerge
357 [merge-tools]
357 [merge-tools]
358 false.whatever=
358 false.whatever=
359 true.priority=1
359 true.priority=1
360 true.executable=cat
360 true.executable=cat
361 # hg update -C 1
361 # hg update -C 1
362 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool
362 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
363 couldn't find merge tool true specified for f
363 couldn't find merge tool true specified for f
364 merging f
364 merging f
365 merging f failed!
365 merging f failed!
366 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
366 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
367 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
367 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
368 [1]
368 [1]
369 $ aftermerge
369 $ aftermerge
370 # cat f
370 # cat f
371 revision 1
371 revision 1
372 space
372 space
373 # hg stat
373 # hg stat
374 M f
374 M f
375 ? f.orig
375 ? f.orig
376
376
377 ui.merge overrules priority
377 ui.merge overrules priority
378
378
379 ui.merge specifies false:
379 ui.merge specifies false:
380
380
381 $ beforemerge
381 $ beforemerge
382 [merge-tools]
382 [merge-tools]
383 false.whatever=
383 false.whatever=
384 true.priority=1
384 true.priority=1
385 true.executable=cat
385 true.executable=cat
386 # hg update -C 1
386 # hg update -C 1
387 $ hg merge -r 2 --config ui.merge=false
387 $ hg merge -r 2 --config ui.merge=false
388 merging f
388 merging f
389 merging f failed!
389 merging f failed!
390 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
390 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
391 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
391 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
392 [1]
392 [1]
393 $ aftermerge
393 $ aftermerge
394 # cat f
394 # cat f
395 revision 1
395 revision 1
396 space
396 space
397 # hg stat
397 # hg stat
398 M f
398 M f
399 ? f.orig
399 ? f.orig
400
400
401 ui.merge specifies internal:fail:
401 ui.merge specifies internal:fail:
402
402
403 $ beforemerge
403 $ beforemerge
404 [merge-tools]
404 [merge-tools]
405 false.whatever=
405 false.whatever=
406 true.priority=1
406 true.priority=1
407 true.executable=cat
407 true.executable=cat
408 # hg update -C 1
408 # hg update -C 1
409 $ hg merge -r 2 --config ui.merge=internal:fail
409 $ hg merge -r 2 --config ui.merge=internal:fail
410 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
410 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
411 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
411 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
412 [1]
412 [1]
413 $ aftermerge
413 $ aftermerge
414 # cat f
414 # cat f
415 revision 1
415 revision 1
416 space
416 space
417 # hg stat
417 # hg stat
418 M f
418 M f
419
419
420 ui.merge specifies internal:local:
420 ui.merge specifies internal:local:
421
421
422 $ beforemerge
422 $ beforemerge
423 [merge-tools]
423 [merge-tools]
424 false.whatever=
424 false.whatever=
425 true.priority=1
425 true.priority=1
426 true.executable=cat
426 true.executable=cat
427 # hg update -C 1
427 # hg update -C 1
428 $ hg merge -r 2 --config ui.merge=internal:local
428 $ hg merge -r 2 --config ui.merge=internal:local
429 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
429 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
430 (branch merge, don't forget to commit)
430 (branch merge, don't forget to commit)
431 $ aftermerge
431 $ aftermerge
432 # cat f
432 # cat f
433 revision 1
433 revision 1
434 space
434 space
435 # hg stat
435 # hg stat
436 M f
436 M f
437
437
438 ui.merge specifies internal:other:
438 ui.merge specifies internal:other:
439
439
440 $ beforemerge
440 $ beforemerge
441 [merge-tools]
441 [merge-tools]
442 false.whatever=
442 false.whatever=
443 true.priority=1
443 true.priority=1
444 true.executable=cat
444 true.executable=cat
445 # hg update -C 1
445 # hg update -C 1
446 $ hg merge -r 2 --config ui.merge=internal:other
446 $ hg merge -r 2 --config ui.merge=internal:other
447 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
447 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
448 (branch merge, don't forget to commit)
448 (branch merge, don't forget to commit)
449 $ aftermerge
449 $ aftermerge
450 # cat f
450 # cat f
451 revision 2
451 revision 2
452 space
452 space
453 # hg stat
453 # hg stat
454 M f
454 M f
455
455
456 ui.merge specifies internal:prompt:
456 ui.merge specifies internal:prompt:
457
457
458 $ beforemerge
458 $ beforemerge
459 [merge-tools]
459 [merge-tools]
460 false.whatever=
460 false.whatever=
461 true.priority=1
461 true.priority=1
462 true.executable=cat
462 true.executable=cat
463 # hg update -C 1
463 # hg update -C 1
464 $ hg merge -r 2 --config ui.merge=internal:prompt
464 $ hg merge -r 2 --config ui.merge=internal:prompt
465 no tool found to merge f
465 no tool found to merge f
466 keep (l)ocal or take (o)ther? l
466 keep (l)ocal or take (o)ther? l
467 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
467 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
468 (branch merge, don't forget to commit)
468 (branch merge, don't forget to commit)
469 $ aftermerge
469 $ aftermerge
470 # cat f
470 # cat f
471 revision 1
471 revision 1
472 space
472 space
473 # hg stat
473 # hg stat
474 M f
474 M f
475
475
476 ui.merge specifies internal:dump:
476 ui.merge specifies internal:dump:
477
477
478 $ beforemerge
478 $ beforemerge
479 [merge-tools]
479 [merge-tools]
480 false.whatever=
480 false.whatever=
481 true.priority=1
481 true.priority=1
482 true.executable=cat
482 true.executable=cat
483 # hg update -C 1
483 # hg update -C 1
484 $ hg merge -r 2 --config ui.merge=internal:dump
484 $ hg merge -r 2 --config ui.merge=internal:dump
485 merging f
485 merging f
486 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
486 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
487 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
487 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
488 [1]
488 [1]
489 $ aftermerge
489 $ aftermerge
490 # cat f
490 # cat f
491 revision 1
491 revision 1
492 space
492 space
493 # hg stat
493 # hg stat
494 M f
494 M f
495 ? f.base
495 ? f.base
496 ? f.local
496 ? f.local
497 ? f.orig
497 ? f.orig
498 ? f.other
498 ? f.other
499
499
500 f.base:
500 f.base:
501
501
502 $ cat f.base
502 $ cat f.base
503 revision 0
503 revision 0
504 space
504 space
505
505
506 f.local:
506 f.local:
507
507
508 $ cat f.local
508 $ cat f.local
509 revision 1
509 revision 1
510 space
510 space
511
511
512 f.other:
512 f.other:
513
513
514 $ cat f.other
514 $ cat f.other
515 revision 2
515 revision 2
516 space
516 space
517 $ rm f.base f.local f.other
517 $ rm f.base f.local f.other
518
518
519 ui.merge specifies internal:other but is overruled by pattern for false:
519 ui.merge specifies internal:other but is overruled by pattern for false:
520
520
521 $ beforemerge
521 $ beforemerge
522 [merge-tools]
522 [merge-tools]
523 false.whatever=
523 false.whatever=
524 true.priority=1
524 true.priority=1
525 true.executable=cat
525 true.executable=cat
526 # hg update -C 1
526 # hg update -C 1
527 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
527 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
528 merging f
528 merging f
529 merging f failed!
529 merging f failed!
530 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
530 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
531 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
531 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
532 [1]
532 [1]
533 $ aftermerge
533 $ aftermerge
534 # cat f
534 # cat f
535 revision 1
535 revision 1
536 space
536 space
537 # hg stat
537 # hg stat
538 M f
538 M f
539 ? f.orig
539 ? f.orig
540
540
541 Premerge
541 Premerge
542
542
543 ui.merge specifies internal:other but is overruled by --tool=false
543 ui.merge specifies internal:other but is overruled by --tool=false
544
544
545 $ beforemerge
545 $ beforemerge
546 [merge-tools]
546 [merge-tools]
547 false.whatever=
547 false.whatever=
548 true.priority=1
548 true.priority=1
549 true.executable=cat
549 true.executable=cat
550 # hg update -C 1
550 # hg update -C 1
551 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
551 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
552 merging f
552 merging f
553 merging f failed!
553 merging f failed!
554 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
554 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
555 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
555 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
556 [1]
556 [1]
557 $ aftermerge
557 $ aftermerge
558 # cat f
558 # cat f
559 revision 1
559 revision 1
560 space
560 space
561 # hg stat
561 # hg stat
562 M f
562 M f
563 ? f.orig
563 ? f.orig
564
564
565 HGMERGE specifies internal:other but is overruled by --tool=false
565 HGMERGE specifies internal:other but is overruled by --tool=false
566
566
567 $ HGMERGE=internal:other ; export HGMERGE
567 $ HGMERGE=internal:other ; export HGMERGE
568 $ beforemerge
568 $ beforemerge
569 [merge-tools]
569 [merge-tools]
570 false.whatever=
570 false.whatever=
571 true.priority=1
571 true.priority=1
572 true.executable=cat
572 true.executable=cat
573 # hg update -C 1
573 # hg update -C 1
574 $ hg merge -r 2 --tool=false
574 $ hg merge -r 2 --tool=false
575 merging f
575 merging f
576 merging f failed!
576 merging f failed!
577 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
577 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
578 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
578 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
579 [1]
579 [1]
580 $ aftermerge
580 $ aftermerge
581 # cat f
581 # cat f
582 revision 1
582 revision 1
583 space
583 space
584 # hg stat
584 # hg stat
585 M f
585 M f
586 ? f.orig
586 ? f.orig
587
587
588 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
588 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
589
589
590 Default is silent simplemerge:
590 Default is silent simplemerge:
591
591
592 $ beforemerge
592 $ beforemerge
593 [merge-tools]
593 [merge-tools]
594 false.whatever=
594 false.whatever=
595 true.priority=1
595 true.priority=1
596 true.executable=cat
596 true.executable=cat
597 # hg update -C 1
597 # hg update -C 1
598 $ hg merge -r 3
598 $ hg merge -r 3
599 merging f
599 merging f
600 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
600 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
601 (branch merge, don't forget to commit)
601 (branch merge, don't forget to commit)
602 $ aftermerge
602 $ aftermerge
603 # cat f
603 # cat f
604 revision 1
604 revision 1
605 space
605 space
606 revision 3
606 revision 3
607 # hg stat
607 # hg stat
608 M f
608 M f
609
609
610 .premerge=True is same:
610 .premerge=True is same:
611
611
612 $ beforemerge
612 $ beforemerge
613 [merge-tools]
613 [merge-tools]
614 false.whatever=
614 false.whatever=
615 true.priority=1
615 true.priority=1
616 true.executable=cat
616 true.executable=cat
617 # hg update -C 1
617 # hg update -C 1
618 $ hg merge -r 3 --config merge-tools.true.premerge=True
618 $ hg merge -r 3 --config merge-tools.true.premerge=True
619 merging f
619 merging f
620 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
620 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
621 (branch merge, don't forget to commit)
621 (branch merge, don't forget to commit)
622 $ aftermerge
622 $ aftermerge
623 # cat f
623 # cat f
624 revision 1
624 revision 1
625 space
625 space
626 revision 3
626 revision 3
627 # hg stat
627 # hg stat
628 M f
628 M f
629
629
630 .premerge=False executes merge-tool:
630 .premerge=False executes merge-tool:
631
631
632 $ beforemerge
632 $ beforemerge
633 [merge-tools]
633 [merge-tools]
634 false.whatever=
634 false.whatever=
635 true.priority=1
635 true.priority=1
636 true.executable=cat
636 true.executable=cat
637 # hg update -C 1
637 # hg update -C 1
638 $ hg merge -r 3 --config merge-tools.true.premerge=False
638 $ hg merge -r 3 --config merge-tools.true.premerge=False
639 merging f
639 merging f
640 revision 1
640 revision 1
641 space
641 space
642 revision 0
642 revision 0
643 space
643 space
644 revision 0
644 revision 0
645 space
645 space
646 revision 3
646 revision 3
647 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
647 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
648 (branch merge, don't forget to commit)
648 (branch merge, don't forget to commit)
649 $ aftermerge
649 $ aftermerge
650 # cat f
650 # cat f
651 revision 1
651 revision 1
652 space
652 space
653 # hg stat
653 # hg stat
654 M f
654 M f
655
655
656 Tool execution
656 Tool execution
657
657
658 set tools.args explicit to include $base $local $other $output:
658 set tools.args explicit to include $base $local $other $output:
659
659
660 $ beforemerge
660 $ beforemerge
661 [merge-tools]
661 [merge-tools]
662 false.whatever=
662 false.whatever=
663 true.priority=1
663 true.priority=1
664 true.executable=cat
664 true.executable=cat
665 # hg update -C 1
665 # hg update -C 1
666 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
666 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
667 > | sed 's,==> .* <==,==> ... <==,g'
667 > | sed 's,==> .* <==,==> ... <==,g'
668 merging f
668 merging f
669 ==> ... <==
669 ==> ... <==
670 revision 0
670 revision 0
671 space
671 space
672
672
673 ==> ... <==
673 ==> ... <==
674 revision 1
674 revision 1
675 space
675 space
676
676
677 ==> ... <==
677 ==> ... <==
678 revision 2
678 revision 2
679 space
679 space
680
680
681 ==> ... <==
681 ==> ... <==
682 revision 1
682 revision 1
683 space
683 space
684 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
684 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
685 (branch merge, don't forget to commit)
685 (branch merge, don't forget to commit)
686 $ aftermerge
686 $ aftermerge
687 # cat f
687 # cat f
688 revision 1
688 revision 1
689 space
689 space
690 # hg stat
690 # hg stat
691 M f
691 M f
692
692
693 Merge with "echo mergeresult > $local":
693 Merge with "echo mergeresult > $local":
694
694
695 $ beforemerge
695 $ beforemerge
696 [merge-tools]
696 [merge-tools]
697 false.whatever=
697 false.whatever=
698 true.priority=1
698 true.priority=1
699 true.executable=cat
699 true.executable=cat
700 # hg update -C 1
700 # hg update -C 1
701 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
701 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
702 merging f
702 merging f
703 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
703 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
704 (branch merge, don't forget to commit)
704 (branch merge, don't forget to commit)
705 $ aftermerge
705 $ aftermerge
706 # cat f
706 # cat f
707 mergeresult
707 mergeresult
708 # hg stat
708 # hg stat
709 M f
709 M f
710
710
711 - and $local is the file f:
711 - and $local is the file f:
712
712
713 $ beforemerge
713 $ beforemerge
714 [merge-tools]
714 [merge-tools]
715 false.whatever=
715 false.whatever=
716 true.priority=1
716 true.priority=1
717 true.executable=cat
717 true.executable=cat
718 # hg update -C 1
718 # hg update -C 1
719 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
719 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
720 merging f
720 merging f
721 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
721 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
722 (branch merge, don't forget to commit)
722 (branch merge, don't forget to commit)
723 $ aftermerge
723 $ aftermerge
724 # cat f
724 # cat f
725 mergeresult
725 mergeresult
726 # hg stat
726 # hg stat
727 M f
727 M f
728
728
729 Merge with "echo mergeresult > $output" - the variable is a bit magic:
729 Merge with "echo mergeresult > $output" - the variable is a bit magic:
730
730
731 $ beforemerge
731 $ beforemerge
732 [merge-tools]
732 [merge-tools]
733 false.whatever=
733 false.whatever=
734 true.priority=1
734 true.priority=1
735 true.executable=cat
735 true.executable=cat
736 # hg update -C 1
736 # hg update -C 1
737 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
737 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
738 merging f
738 merging f
739 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
739 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
740 (branch merge, don't forget to commit)
740 (branch merge, don't forget to commit)
741 $ aftermerge
741 $ aftermerge
742 # cat f
742 # cat f
743 mergeresult
743 mergeresult
744 # hg stat
744 # hg stat
745 M f
745 M f
746
746
747 Merge using tool with a path that must be quoted:
747 Merge using tool with a path that must be quoted:
748
748
749 $ beforemerge
749 $ beforemerge
750 [merge-tools]
750 [merge-tools]
751 false.whatever=
751 false.whatever=
752 true.priority=1
752 true.priority=1
753 true.executable=cat
753 true.executable=cat
754 # hg update -C 1
754 # hg update -C 1
755 $ cat <<EOF > 'my merge tool'
755 $ cat <<EOF > 'my merge tool'
756 > cat "\$1" "\$2" "\$3" > "\$4"
756 > cat "\$1" "\$2" "\$3" > "\$4"
757 > EOF
757 > EOF
758 $ hg --config merge-tools.true.executable='sh' \
758 $ hg --config merge-tools.true.executable='sh' \
759 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
759 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
760 > merge -r 2
760 > merge -r 2
761 merging f
761 merging f
762 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
762 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
763 (branch merge, don't forget to commit)
763 (branch merge, don't forget to commit)
764 $ rm -f 'my merge tool'
764 $ rm -f 'my merge tool'
765 $ aftermerge
765 $ aftermerge
766 # cat f
766 # cat f
767 revision 0
767 revision 0
768 space
768 space
769 revision 1
769 revision 1
770 space
770 space
771 revision 2
771 revision 2
772 space
772 space
773 # hg stat
773 # hg stat
774 M f
774 M f
775
775
776 Merge post-processing
776 Merge post-processing
777
777
778 cat is a bad merge-tool and doesn't change:
778 cat is a bad merge-tool and doesn't change:
779
779
780 $ beforemerge
780 $ beforemerge
781 [merge-tools]
781 [merge-tools]
782 false.whatever=
782 false.whatever=
783 true.priority=1
783 true.priority=1
784 true.executable=cat
784 true.executable=cat
785 # hg update -C 1
785 # hg update -C 1
786 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
786 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
787 merging f
787 merging f
788 revision 1
788 revision 1
789 space
789 space
790 revision 0
790 revision 0
791 space
791 space
792 revision 2
792 revision 2
793 space
793 space
794 output file f appears unchanged
794 output file f appears unchanged
795 was merge successful (yn)? n
795 was merge successful (yn)? n
796 merging f failed!
796 merging f failed!
797 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
797 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
798 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
798 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
799 [1]
799 [1]
800 $ aftermerge
800 $ aftermerge
801 # cat f
801 # cat f
802 revision 1
802 revision 1
803 space
803 space
804 # hg stat
804 # hg stat
805 M f
805 M f
806 ? f.orig
806 ? f.orig
@@ -1,280 +1,280 b''
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" serve || exit 80
2
2
3 $ cat > writelines.py <<EOF
3 $ cat > writelines.py <<EOF
4 > import sys
4 > import sys
5 > path = sys.argv[1]
5 > path = sys.argv[1]
6 > args = sys.argv[2:]
6 > args = sys.argv[2:]
7 > assert (len(args) % 2) == 0
7 > assert (len(args) % 2) == 0
8 >
8 >
9 > f = file(path, 'wb')
9 > f = file(path, 'wb')
10 > for i in xrange(len(args)/2):
10 > for i in xrange(len(args)/2):
11 > count, s = args[2*i:2*i+2]
11 > count, s = args[2*i:2*i+2]
12 > count = int(count)
12 > count = int(count)
13 > s = s.decode('string_escape')
13 > s = s.decode('string_escape')
14 > f.write(s*count)
14 > f.write(s*count)
15 > f.close()
15 > f.close()
16 >
16 >
17 > EOF
17 > EOF
18 $ echo "[extensions]" >> $HGRCPATH
18 $ echo "[extensions]" >> $HGRCPATH
19 $ echo "mq=" >> $HGRCPATH
19 $ echo "mq=" >> $HGRCPATH
20 $ echo "[diff]" >> $HGRCPATH
20 $ echo "[diff]" >> $HGRCPATH
21 $ echo "git=1" >> $HGRCPATH
21 $ echo "git=1" >> $HGRCPATH
22 $ hg init repo
22 $ hg init repo
23 $ cd repo
23 $ cd repo
24
24
25 qimport without file or revision
25 qimport without file or revision
26
26
27 $ hg qimport
27 $ hg qimport
28 abort: no files or revisions specified
28 abort: no files or revisions specified
29 [255]
29 [255]
30
30
31 qimport non-existing-file
31 qimport non-existing-file
32
32
33 $ hg qimport non-existing-file
33 $ hg qimport non-existing-file
34 abort: unable to read file non-existing-file
34 abort: unable to read file non-existing-file
35 [255]
35 [255]
36
36
37 qimport null revision
37 qimport null revision
38
38
39 $ hg qimport -r null
39 $ hg qimport -r null
40 abort: revision -1 is not mutable
40 abort: revision -1 is not mutable
41 (see "hg help phases" for details)
41 (see "hg help phases" for details)
42 [255]
42 [255]
43 $ hg qseries
43 $ hg qseries
44
44
45 import email
45 import email
46
46
47 $ hg qimport --push -n email - <<EOF
47 $ hg qimport --push -n email - <<EOF
48 > From: Username in email <test@example.net>
48 > From: Username in email <test@example.net>
49 > Subject: [PATCH] Message in email
49 > Subject: [PATCH] Message in email
50 > Date: Fri, 02 Jan 1970 00:00:00 +0000
50 > Date: Fri, 02 Jan 1970 00:00:00 +0000
51 >
51 >
52 > Text before patch.
52 > Text before patch.
53 >
53 >
54 > # HG changeset patch
54 > # HG changeset patch
55 > # User Username in patch <test@example.net>
55 > # User Username in patch <test@example.net>
56 > # Date 0 0
56 > # Date 0 0
57 > # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
57 > # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
58 > # Parent 0000000000000000000000000000000000000000
58 > # Parent 0000000000000000000000000000000000000000
59 > First line of commit message.
59 > First line of commit message.
60 >
60 >
61 > More text in commit message.
61 > More text in commit message.
62 > --- confuse the diff detection
62 > --- confuse the diff detection
63 >
63 >
64 > diff --git a/x b/x
64 > diff --git a/x b/x
65 > new file mode 100644
65 > new file mode 100644
66 > --- /dev/null
66 > --- /dev/null
67 > +++ b/x
67 > +++ b/x
68 > @@ -0,0 +1,1 @@
68 > @@ -0,0 +1,1 @@
69 > +new file
69 > +new file
70 > Text after patch.
70 > Text after patch.
71 >
71 >
72 > EOF
72 > EOF
73 adding email to series file
73 adding email to series file
74 applying email
74 applying email
75 now at: email
75 now at: email
76
76
77 hg tip -v
77 hg tip -v
78
78
79 $ hg tip -v
79 $ hg tip -v
80 changeset: 0:1a706973a7d8
80 changeset: 0:1a706973a7d8
81 tag: email
81 tag: email
82 tag: qbase
82 tag: qbase
83 tag: qtip
83 tag: qtip
84 tag: tip
84 tag: tip
85 user: Username in patch <test@example.net>
85 user: Username in patch <test@example.net>
86 date: Thu Jan 01 00:00:00 1970 +0000
86 date: Thu Jan 01 00:00:00 1970 +0000
87 files: x
87 files: x
88 description:
88 description:
89 First line of commit message.
89 First line of commit message.
90
90
91 More text in commit message.
91 More text in commit message.
92
92
93
93
94 $ hg qpop
94 $ hg qpop
95 popping email
95 popping email
96 patch queue now empty
96 patch queue now empty
97 $ hg qdelete email
97 $ hg qdelete email
98
98
99 import URL
99 import URL
100
100
101 $ echo foo >> foo
101 $ echo foo >> foo
102 $ hg add foo
102 $ hg add foo
103 $ hg diff > url.diff
103 $ hg diff > url.diff
104 $ hg revert --no-backup foo
104 $ hg revert --no-backup foo
105 $ rm foo
105 $ rm foo
106
106
107 Under unix: file:///foobar/blah
107 Under unix: file:///foobar/blah
108 Under windows: file:///c:/foobar/blah
108 Under windows: file:///c:/foobar/blah
109
109
110 $ patchurl=`pwd | tr '\\\\' /`/url.diff
110 $ patchurl=`pwd | tr '\\\\' /`/url.diff
111 $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
111 $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
112 $ hg qimport file://"$patchurl"
112 $ hg qimport file://"$patchurl"
113 adding url.diff to series file
113 adding url.diff to series file
114 $ rm url.diff
114 $ rm url.diff
115 $ hg qun
115 $ hg qun
116 url.diff
116 url.diff
117
117
118 import patch that already exists
118 import patch that already exists
119
119
120 $ echo foo2 >> foo
120 $ echo foo2 >> foo
121 $ hg add foo
121 $ hg add foo
122 $ hg diff > ../url.diff
122 $ hg diff > ../url.diff
123 $ hg revert --no-backup foo
123 $ hg revert --no-backup foo
124 $ rm foo
124 $ rm foo
125 $ hg qimport ../url.diff
125 $ hg qimport ../url.diff
126 abort: patch "url.diff" already exists
126 abort: patch "url.diff" already exists
127 [255]
127 [255]
128 $ hg qpush
128 $ hg qpush
129 applying url.diff
129 applying url.diff
130 now at: url.diff
130 now at: url.diff
131 $ cat foo
131 $ cat foo
132 foo
132 foo
133 $ hg qpop
133 $ hg qpop
134 popping url.diff
134 popping url.diff
135 patch queue now empty
135 patch queue now empty
136
136
137 qimport -f
137 qimport -f
138
138
139 $ hg qimport -f ../url.diff
139 $ hg qimport -f ../url.diff
140 adding url.diff to series file
140 adding url.diff to series file
141 $ hg qpush
141 $ hg qpush
142 applying url.diff
142 applying url.diff
143 now at: url.diff
143 now at: url.diff
144 $ cat foo
144 $ cat foo
145 foo2
145 foo2
146 $ hg qpop
146 $ hg qpop
147 popping url.diff
147 popping url.diff
148 patch queue now empty
148 patch queue now empty
149
149
150 build diff with CRLF
150 build diff with CRLF
151
151
152 $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
152 $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
153 $ hg ci -Am addb
153 $ hg ci -Am addb
154 adding b
154 adding b
155 $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
155 $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
156 $ hg diff > b.diff
156 $ hg diff > b.diff
157 $ hg up -C
157 $ hg up -C
158 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
158 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
159
159
160 qimport CRLF diff
160 qimport CRLF diff
161
161
162 $ hg qimport b.diff
162 $ hg qimport b.diff
163 adding b.diff to series file
163 adding b.diff to series file
164 $ hg qpush
164 $ hg qpush
165 applying b.diff
165 applying b.diff
166 now at: b.diff
166 now at: b.diff
167
167
168 try to import --push
168 try to import --push
169
169
170 $ cat > appendfoo.diff <<EOF
170 $ cat > appendfoo.diff <<EOF
171 > append foo
171 > append foo
172 >
172 >
173 > diff -r 07f494440405 -r 261500830e46 baz
173 > diff -r 07f494440405 -r 261500830e46 baz
174 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
174 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
175 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
175 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
176 > @@ -0,0 +1,1 @@
176 > @@ -0,0 +1,1 @@
177 > +foo
177 > +foo
178 > EOF
178 > EOF
179
179
180 $ cat > appendbar.diff <<EOF
180 $ cat > appendbar.diff <<EOF
181 > append bar
181 > append bar
182 >
182 >
183 > diff -r 07f494440405 -r 261500830e46 baz
183 > diff -r 07f494440405 -r 261500830e46 baz
184 > --- a/baz Thu Jan 01 00:00:00 1970 +0000
184 > --- a/baz Thu Jan 01 00:00:00 1970 +0000
185 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
185 > +++ b/baz Thu Jan 01 00:00:00 1970 +0000
186 > @@ -1,1 +1,2 @@
186 > @@ -1,1 +1,2 @@
187 > foo
187 > foo
188 > +bar
188 > +bar
189 > EOF
189 > EOF
190
190
191 $ hg qimport --push appendfoo.diff appendbar.diff
191 $ hg qimport --push appendfoo.diff appendbar.diff
192 adding appendfoo.diff to series file
192 adding appendfoo.diff to series file
193 adding appendbar.diff to series file
193 adding appendbar.diff to series file
194 applying appendfoo.diff
194 applying appendfoo.diff
195 applying appendbar.diff
195 applying appendbar.diff
196 now at: appendbar.diff
196 now at: appendbar.diff
197 $ hg qfin -a
197 $ hg qfin -a
198 patch b.diff finalized without changeset message
198 patch b.diff finalized without changeset message
199 $ hg qimport -r 'p1(.)::' -P
199 $ hg qimport -r 'p1(.)::' -P
200 $ hg qpop -a
200 $ hg qpop -a
201 popping 3.diff
201 popping 3.diff
202 popping 2.diff
202 popping 2.diff
203 patch queue now empty
203 patch queue now empty
204 $ hg qdel 3.diff
204 $ hg qdel 3.diff
205 $ hg qdel -k 2.diff
205 $ hg qdel -k 2.diff
206
206
207 qimport -e
207 qimport -e
208
208
209 $ hg qimport -e 2.diff
209 $ hg qimport -e 2.diff
210 adding 2.diff to series file
210 adding 2.diff to series file
211 $ hg qdel -k 2.diff
211 $ hg qdel -k 2.diff
212
212
213 qimport -e --name newname oldexisitingpatch
213 qimport -e --name newname oldexisitingpatch
214
214
215 $ hg qimport -e --name this-name-is-better 2.diff
215 $ hg qimport -e --name this-name-is-better 2.diff
216 renaming 2.diff to this-name-is-better
216 renaming 2.diff to this-name-is-better
217 adding this-name-is-better to series file
217 adding this-name-is-better to series file
218 $ hg qser
218 $ hg qser
219 this-name-is-better
219 this-name-is-better
220 url.diff
220 url.diff
221
221
222 qimport -e --name without --force
222 qimport -e --name without --force
223
223
224 $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
224 $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
225 $ hg qimport -e --name this-name-is-better 3.diff
225 $ hg qimport -e --name this-name-is-better 3.diff
226 abort: patch "this-name-is-better" already exists
226 abort: patch "this-name-is-better" already exists
227 [255]
227 [255]
228 $ hg qser
228 $ hg qser
229 this-name-is-better
229 this-name-is-better
230 url.diff
230 url.diff
231
231
232 qimport -e --name with --force
232 qimport -e --name with --force
233
233
234 $ hg qimport --force -e --name this-name-is-better 3.diff
234 $ hg qimport --force -e --name this-name-is-better 3.diff
235 renaming 3.diff to this-name-is-better
235 renaming 3.diff to this-name-is-better
236 adding this-name-is-better to series file
236 adding this-name-is-better to series file
237 $ hg qser
237 $ hg qser
238 this-name-is-better
238 this-name-is-better
239 url.diff
239 url.diff
240
240
241 qimport with bad name, should abort before reading file
241 qimport with bad name, should abort before reading file
242
242
243 $ hg qimport non-existant-file --name .hg
243 $ hg qimport non-existent-file --name .hg
244 abort: patch name cannot begin with ".hg"
244 abort: patch name cannot begin with ".hg"
245 [255]
245 [255]
246
246
247 qimport http:// patch with leading slashes in url
247 qimport http:// patch with leading slashes in url
248
248
249 set up hgweb
249 set up hgweb
250
250
251 $ cd ..
251 $ cd ..
252 $ hg init served
252 $ hg init served
253 $ cd served
253 $ cd served
254 $ echo a > a
254 $ echo a > a
255 $ hg ci -Am patch
255 $ hg ci -Am patch
256 adding a
256 adding a
257 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
257 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
258 $ cat hg.pid >> $DAEMON_PIDS
258 $ cat hg.pid >> $DAEMON_PIDS
259
259
260 $ cd ../repo
260 $ cd ../repo
261 $ hg qimport http://localhost:$HGPORT/raw-rev/0///
261 $ hg qimport http://localhost:$HGPORT/raw-rev/0///
262 adding 0 to series file
262 adding 0 to series file
263
263
264 check qimport phase:
264 check qimport phase:
265
265
266 $ hg -q qpush
266 $ hg -q qpush
267 now at: 0
267 now at: 0
268 $ hg phase qparent
268 $ hg phase qparent
269 1: draft
269 1: draft
270 $ hg qimport -r qparent
270 $ hg qimport -r qparent
271 $ hg phase qbase
271 $ hg phase qbase
272 1: draft
272 1: draft
273 $ hg qfinish qbase
273 $ hg qfinish qbase
274 $ echo '[mq]' >> $HGRCPATH
274 $ echo '[mq]' >> $HGRCPATH
275 $ echo 'secret=true' >> $HGRCPATH
275 $ echo 'secret=true' >> $HGRCPATH
276 $ hg qimport -r qparent
276 $ hg qimport -r qparent
277 $ hg phase qbase
277 $ hg phase qbase
278 1: secret
278 1: secret
279
279
280 $ cd ..
280 $ cd ..
@@ -1,546 +1,546 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3 $ echo "[diff]" >> $HGRCPATH
3 $ echo "[diff]" >> $HGRCPATH
4 $ echo "nodates=1" >> $HGRCPATH
4 $ echo "nodates=1" >> $HGRCPATH
5
5
6 $ hg init a
6 $ hg init a
7 $ cd a
7 $ cd a
8
8
9 $ mkdir 1 2
9 $ mkdir 1 2
10 $ echo 'base' > 1/base
10 $ echo 'base' > 1/base
11 $ echo 'base' > 2/base
11 $ echo 'base' > 2/base
12 $ hg ci -Ambase
12 $ hg ci -Ambase
13 adding 1/base
13 adding 1/base
14 adding 2/base
14 adding 2/base
15
15
16 $ hg qnew -mmqbase mqbase
16 $ hg qnew -mmqbase mqbase
17
17
18 $ echo 'patched' > 1/base
18 $ echo 'patched' > 1/base
19 $ echo 'patched' > 2/base
19 $ echo 'patched' > 2/base
20 $ hg qrefresh
20 $ hg qrefresh
21
21
22 $ hg qdiff
22 $ hg qdiff
23 diff -r e7af5904b465 1/base
23 diff -r e7af5904b465 1/base
24 --- a/1/base
24 --- a/1/base
25 +++ b/1/base
25 +++ b/1/base
26 @@ -1,1 +1,1 @@
26 @@ -1,1 +1,1 @@
27 -base
27 -base
28 +patched
28 +patched
29 diff -r e7af5904b465 2/base
29 diff -r e7af5904b465 2/base
30 --- a/2/base
30 --- a/2/base
31 +++ b/2/base
31 +++ b/2/base
32 @@ -1,1 +1,1 @@
32 @@ -1,1 +1,1 @@
33 -base
33 -base
34 +patched
34 +patched
35
35
36 $ hg qdiff .
36 $ hg qdiff .
37 diff -r e7af5904b465 1/base
37 diff -r e7af5904b465 1/base
38 --- a/1/base
38 --- a/1/base
39 +++ b/1/base
39 +++ b/1/base
40 @@ -1,1 +1,1 @@
40 @@ -1,1 +1,1 @@
41 -base
41 -base
42 +patched
42 +patched
43 diff -r e7af5904b465 2/base
43 diff -r e7af5904b465 2/base
44 --- a/2/base
44 --- a/2/base
45 +++ b/2/base
45 +++ b/2/base
46 @@ -1,1 +1,1 @@
46 @@ -1,1 +1,1 @@
47 -base
47 -base
48 +patched
48 +patched
49
49
50 $ cat .hg/patches/mqbase
50 $ cat .hg/patches/mqbase
51 # HG changeset patch
51 # HG changeset patch
52 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
52 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
53 mqbase
53 mqbase
54
54
55 diff -r e7af5904b465 1/base
55 diff -r e7af5904b465 1/base
56 --- a/1/base
56 --- a/1/base
57 +++ b/1/base
57 +++ b/1/base
58 @@ -1,1 +1,1 @@
58 @@ -1,1 +1,1 @@
59 -base
59 -base
60 +patched
60 +patched
61 diff -r e7af5904b465 2/base
61 diff -r e7af5904b465 2/base
62 --- a/2/base
62 --- a/2/base
63 +++ b/2/base
63 +++ b/2/base
64 @@ -1,1 +1,1 @@
64 @@ -1,1 +1,1 @@
65 -base
65 -base
66 +patched
66 +patched
67
67
68 $ echo 'patched again' > base
68 $ echo 'patched again' > base
69 $ hg qrefresh 1
69 $ hg qrefresh 1
70
70
71 $ hg qdiff
71 $ hg qdiff
72 diff -r e7af5904b465 1/base
72 diff -r e7af5904b465 1/base
73 --- a/1/base
73 --- a/1/base
74 +++ b/1/base
74 +++ b/1/base
75 @@ -1,1 +1,1 @@
75 @@ -1,1 +1,1 @@
76 -base
76 -base
77 +patched
77 +patched
78 diff -r e7af5904b465 2/base
78 diff -r e7af5904b465 2/base
79 --- a/2/base
79 --- a/2/base
80 +++ b/2/base
80 +++ b/2/base
81 @@ -1,1 +1,1 @@
81 @@ -1,1 +1,1 @@
82 -base
82 -base
83 +patched
83 +patched
84
84
85 $ hg qdiff .
85 $ hg qdiff .
86 diff -r e7af5904b465 1/base
86 diff -r e7af5904b465 1/base
87 --- a/1/base
87 --- a/1/base
88 +++ b/1/base
88 +++ b/1/base
89 @@ -1,1 +1,1 @@
89 @@ -1,1 +1,1 @@
90 -base
90 -base
91 +patched
91 +patched
92 diff -r e7af5904b465 2/base
92 diff -r e7af5904b465 2/base
93 --- a/2/base
93 --- a/2/base
94 +++ b/2/base
94 +++ b/2/base
95 @@ -1,1 +1,1 @@
95 @@ -1,1 +1,1 @@
96 -base
96 -base
97 +patched
97 +patched
98
98
99 $ cat .hg/patches/mqbase
99 $ cat .hg/patches/mqbase
100 # HG changeset patch
100 # HG changeset patch
101 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
101 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
102 mqbase
102 mqbase
103
103
104 diff -r e7af5904b465 1/base
104 diff -r e7af5904b465 1/base
105 --- a/1/base
105 --- a/1/base
106 +++ b/1/base
106 +++ b/1/base
107 @@ -1,1 +1,1 @@
107 @@ -1,1 +1,1 @@
108 -base
108 -base
109 +patched
109 +patched
110
110
111 qrefresh . in subdir:
111 qrefresh . in subdir:
112
112
113 $ ( cd 1 ; hg qrefresh . )
113 $ ( cd 1 ; hg qrefresh . )
114
114
115 $ hg qdiff
115 $ hg qdiff
116 diff -r e7af5904b465 1/base
116 diff -r e7af5904b465 1/base
117 --- a/1/base
117 --- a/1/base
118 +++ b/1/base
118 +++ b/1/base
119 @@ -1,1 +1,1 @@
119 @@ -1,1 +1,1 @@
120 -base
120 -base
121 +patched
121 +patched
122 diff -r e7af5904b465 2/base
122 diff -r e7af5904b465 2/base
123 --- a/2/base
123 --- a/2/base
124 +++ b/2/base
124 +++ b/2/base
125 @@ -1,1 +1,1 @@
125 @@ -1,1 +1,1 @@
126 -base
126 -base
127 +patched
127 +patched
128
128
129 $ hg qdiff .
129 $ hg qdiff .
130 diff -r e7af5904b465 1/base
130 diff -r e7af5904b465 1/base
131 --- a/1/base
131 --- a/1/base
132 +++ b/1/base
132 +++ b/1/base
133 @@ -1,1 +1,1 @@
133 @@ -1,1 +1,1 @@
134 -base
134 -base
135 +patched
135 +patched
136 diff -r e7af5904b465 2/base
136 diff -r e7af5904b465 2/base
137 --- a/2/base
137 --- a/2/base
138 +++ b/2/base
138 +++ b/2/base
139 @@ -1,1 +1,1 @@
139 @@ -1,1 +1,1 @@
140 -base
140 -base
141 +patched
141 +patched
142
142
143 $ cat .hg/patches/mqbase
143 $ cat .hg/patches/mqbase
144 # HG changeset patch
144 # HG changeset patch
145 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
145 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
146 mqbase
146 mqbase
147
147
148 diff -r e7af5904b465 1/base
148 diff -r e7af5904b465 1/base
149 --- a/1/base
149 --- a/1/base
150 +++ b/1/base
150 +++ b/1/base
151 @@ -1,1 +1,1 @@
151 @@ -1,1 +1,1 @@
152 -base
152 -base
153 +patched
153 +patched
154
154
155 qrefresh in hg-root again:
155 qrefresh in hg-root again:
156
156
157 $ hg qrefresh
157 $ hg qrefresh
158
158
159 $ hg qdiff
159 $ hg qdiff
160 diff -r e7af5904b465 1/base
160 diff -r e7af5904b465 1/base
161 --- a/1/base
161 --- a/1/base
162 +++ b/1/base
162 +++ b/1/base
163 @@ -1,1 +1,1 @@
163 @@ -1,1 +1,1 @@
164 -base
164 -base
165 +patched
165 +patched
166 diff -r e7af5904b465 2/base
166 diff -r e7af5904b465 2/base
167 --- a/2/base
167 --- a/2/base
168 +++ b/2/base
168 +++ b/2/base
169 @@ -1,1 +1,1 @@
169 @@ -1,1 +1,1 @@
170 -base
170 -base
171 +patched
171 +patched
172
172
173 $ hg qdiff .
173 $ hg qdiff .
174 diff -r e7af5904b465 1/base
174 diff -r e7af5904b465 1/base
175 --- a/1/base
175 --- a/1/base
176 +++ b/1/base
176 +++ b/1/base
177 @@ -1,1 +1,1 @@
177 @@ -1,1 +1,1 @@
178 -base
178 -base
179 +patched
179 +patched
180 diff -r e7af5904b465 2/base
180 diff -r e7af5904b465 2/base
181 --- a/2/base
181 --- a/2/base
182 +++ b/2/base
182 +++ b/2/base
183 @@ -1,1 +1,1 @@
183 @@ -1,1 +1,1 @@
184 -base
184 -base
185 +patched
185 +patched
186
186
187 $ cat .hg/patches/mqbase
187 $ cat .hg/patches/mqbase
188 # HG changeset patch
188 # HG changeset patch
189 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
189 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
190 mqbase
190 mqbase
191
191
192 diff -r e7af5904b465 1/base
192 diff -r e7af5904b465 1/base
193 --- a/1/base
193 --- a/1/base
194 +++ b/1/base
194 +++ b/1/base
195 @@ -1,1 +1,1 @@
195 @@ -1,1 +1,1 @@
196 -base
196 -base
197 +patched
197 +patched
198 diff -r e7af5904b465 2/base
198 diff -r e7af5904b465 2/base
199 --- a/2/base
199 --- a/2/base
200 +++ b/2/base
200 +++ b/2/base
201 @@ -1,1 +1,1 @@
201 @@ -1,1 +1,1 @@
202 -base
202 -base
203 +patched
203 +patched
204
204
205
205
206 qrefresh --short tests:
206 qrefresh --short tests:
207
207
208 $ echo 'orphan' > orphanchild
208 $ echo 'orphan' > orphanchild
209 $ hg add orphanchild
209 $ hg add orphanchild
210 $ hg qrefresh nonexistingfilename # clear patch
210 $ hg qrefresh nonexistentfilename # clear patch
211 $ hg qrefresh --short 1/base
211 $ hg qrefresh --short 1/base
212 $ hg qrefresh --short 2/base
212 $ hg qrefresh --short 2/base
213
213
214 $ hg qdiff
214 $ hg qdiff
215 diff -r e7af5904b465 1/base
215 diff -r e7af5904b465 1/base
216 --- a/1/base
216 --- a/1/base
217 +++ b/1/base
217 +++ b/1/base
218 @@ -1,1 +1,1 @@
218 @@ -1,1 +1,1 @@
219 -base
219 -base
220 +patched
220 +patched
221 diff -r e7af5904b465 2/base
221 diff -r e7af5904b465 2/base
222 --- a/2/base
222 --- a/2/base
223 +++ b/2/base
223 +++ b/2/base
224 @@ -1,1 +1,1 @@
224 @@ -1,1 +1,1 @@
225 -base
225 -base
226 +patched
226 +patched
227 diff -r e7af5904b465 orphanchild
227 diff -r e7af5904b465 orphanchild
228 --- /dev/null
228 --- /dev/null
229 +++ b/orphanchild
229 +++ b/orphanchild
230 @@ -0,0 +1,1 @@
230 @@ -0,0 +1,1 @@
231 +orphan
231 +orphan
232
232
233 $ cat .hg/patches/mqbase
233 $ cat .hg/patches/mqbase
234 # HG changeset patch
234 # HG changeset patch
235 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
235 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
236 mqbase
236 mqbase
237
237
238 diff -r e7af5904b465 1/base
238 diff -r e7af5904b465 1/base
239 --- a/1/base
239 --- a/1/base
240 +++ b/1/base
240 +++ b/1/base
241 @@ -1,1 +1,1 @@
241 @@ -1,1 +1,1 @@
242 -base
242 -base
243 +patched
243 +patched
244 diff -r e7af5904b465 2/base
244 diff -r e7af5904b465 2/base
245 --- a/2/base
245 --- a/2/base
246 +++ b/2/base
246 +++ b/2/base
247 @@ -1,1 +1,1 @@
247 @@ -1,1 +1,1 @@
248 -base
248 -base
249 +patched
249 +patched
250
250
251 $ hg st
251 $ hg st
252 A orphanchild
252 A orphanchild
253 ? base
253 ? base
254
254
255 diff shows what is not in patch:
255 diff shows what is not in patch:
256
256
257 $ hg diff
257 $ hg diff
258 diff -r ???????????? orphanchild (glob)
258 diff -r ???????????? orphanchild (glob)
259 --- /dev/null
259 --- /dev/null
260 +++ b/orphanchild
260 +++ b/orphanchild
261 @@ -0,0 +1,1 @@
261 @@ -0,0 +1,1 @@
262 +orphan
262 +orphan
263
263
264 Before starting exclusive tests:
264 Before starting exclusive tests:
265
265
266 $ cat .hg/patches/mqbase
266 $ cat .hg/patches/mqbase
267 # HG changeset patch
267 # HG changeset patch
268 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
268 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
269 mqbase
269 mqbase
270
270
271 diff -r e7af5904b465 1/base
271 diff -r e7af5904b465 1/base
272 --- a/1/base
272 --- a/1/base
273 +++ b/1/base
273 +++ b/1/base
274 @@ -1,1 +1,1 @@
274 @@ -1,1 +1,1 @@
275 -base
275 -base
276 +patched
276 +patched
277 diff -r e7af5904b465 2/base
277 diff -r e7af5904b465 2/base
278 --- a/2/base
278 --- a/2/base
279 +++ b/2/base
279 +++ b/2/base
280 @@ -1,1 +1,1 @@
280 @@ -1,1 +1,1 @@
281 -base
281 -base
282 +patched
282 +patched
283
283
284 Exclude 2/base:
284 Exclude 2/base:
285
285
286 $ hg qref -s -X 2/base
286 $ hg qref -s -X 2/base
287
287
288 $ cat .hg/patches/mqbase
288 $ cat .hg/patches/mqbase
289 # HG changeset patch
289 # HG changeset patch
290 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
290 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
291 mqbase
291 mqbase
292
292
293 diff -r e7af5904b465 1/base
293 diff -r e7af5904b465 1/base
294 --- a/1/base
294 --- a/1/base
295 +++ b/1/base
295 +++ b/1/base
296 @@ -1,1 +1,1 @@
296 @@ -1,1 +1,1 @@
297 -base
297 -base
298 +patched
298 +patched
299
299
300 status shows 2/base as dirty:
300 status shows 2/base as dirty:
301
301
302 $ hg status
302 $ hg status
303 M 2/base
303 M 2/base
304 A orphanchild
304 A orphanchild
305 ? base
305 ? base
306
306
307 Remove 1/base and add 2/base again but not orphanchild:
307 Remove 1/base and add 2/base again but not orphanchild:
308
308
309 $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
309 $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
310
310
311 $ cat .hg/patches/mqbase
311 $ cat .hg/patches/mqbase
312 # HG changeset patch
312 # HG changeset patch
313 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
313 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
314 mqbase
314 mqbase
315
315
316 diff -r e7af5904b465 2/base
316 diff -r e7af5904b465 2/base
317 --- a/2/base
317 --- a/2/base
318 +++ b/2/base
318 +++ b/2/base
319 @@ -1,1 +1,1 @@
319 @@ -1,1 +1,1 @@
320 -base
320 -base
321 +patched
321 +patched
322
322
323 Add 1/base with include filter - and thus remove 2/base from patch:
323 Add 1/base with include filter - and thus remove 2/base from patch:
324
324
325 $ hg qref -s -I 1/ o* */*
325 $ hg qref -s -I 1/ o* */*
326
326
327 $ cat .hg/patches/mqbase
327 $ cat .hg/patches/mqbase
328 # HG changeset patch
328 # HG changeset patch
329 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
329 # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
330 mqbase
330 mqbase
331
331
332 diff -r e7af5904b465 1/base
332 diff -r e7af5904b465 1/base
333 --- a/1/base
333 --- a/1/base
334 +++ b/1/base
334 +++ b/1/base
335 @@ -1,1 +1,1 @@
335 @@ -1,1 +1,1 @@
336 -base
336 -base
337 +patched
337 +patched
338
338
339 $ cd ..
339 $ cd ..
340
340
341
341
342 Test qrefresh --git losing copy metadata:
342 Test qrefresh --git losing copy metadata:
343
343
344 $ hg init repo
344 $ hg init repo
345 $ cd repo
345 $ cd repo
346
346
347 $ echo "[diff]" >> .hg/hgrc
347 $ echo "[diff]" >> .hg/hgrc
348 $ echo "git=True" >> .hg/hgrc
348 $ echo "git=True" >> .hg/hgrc
349 $ echo a > a
349 $ echo a > a
350
350
351 $ hg ci -Am adda
351 $ hg ci -Am adda
352 adding a
352 adding a
353 $ hg copy a ab
353 $ hg copy a ab
354 $ echo b >> ab
354 $ echo b >> ab
355 $ hg copy a ac
355 $ hg copy a ac
356 $ echo c >> ac
356 $ echo c >> ac
357
357
358 Capture changes:
358 Capture changes:
359
359
360 $ hg qnew -f p1
360 $ hg qnew -f p1
361
361
362 $ hg qdiff
362 $ hg qdiff
363 diff --git a/a b/ab
363 diff --git a/a b/ab
364 copy from a
364 copy from a
365 copy to ab
365 copy to ab
366 --- a/a
366 --- a/a
367 +++ b/ab
367 +++ b/ab
368 @@ -1,1 +1,2 @@
368 @@ -1,1 +1,2 @@
369 a
369 a
370 +b
370 +b
371 diff --git a/a b/ac
371 diff --git a/a b/ac
372 copy from a
372 copy from a
373 copy to ac
373 copy to ac
374 --- a/a
374 --- a/a
375 +++ b/ac
375 +++ b/ac
376 @@ -1,1 +1,2 @@
376 @@ -1,1 +1,2 @@
377 a
377 a
378 +c
378 +c
379
379
380 Refresh and check changes again:
380 Refresh and check changes again:
381
381
382 $ hg qrefresh
382 $ hg qrefresh
383
383
384 $ hg qdiff
384 $ hg qdiff
385 diff --git a/a b/ab
385 diff --git a/a b/ab
386 copy from a
386 copy from a
387 copy to ab
387 copy to ab
388 --- a/a
388 --- a/a
389 +++ b/ab
389 +++ b/ab
390 @@ -1,1 +1,2 @@
390 @@ -1,1 +1,2 @@
391 a
391 a
392 +b
392 +b
393 diff --git a/a b/ac
393 diff --git a/a b/ac
394 copy from a
394 copy from a
395 copy to ac
395 copy to ac
396 --- a/a
396 --- a/a
397 +++ b/ac
397 +++ b/ac
398 @@ -1,1 +1,2 @@
398 @@ -1,1 +1,2 @@
399 a
399 a
400 +c
400 +c
401
401
402 $ cd ..
402 $ cd ..
403
403
404
404
405 Issue1441: qrefresh confused after hg rename:
405 Issue1441: qrefresh confused after hg rename:
406
406
407 $ hg init repo-1441
407 $ hg init repo-1441
408 $ cd repo-1441
408 $ cd repo-1441
409 $ echo a > a
409 $ echo a > a
410 $ hg add a
410 $ hg add a
411 $ hg qnew -f p
411 $ hg qnew -f p
412 $ hg mv a b
412 $ hg mv a b
413 $ hg qrefresh
413 $ hg qrefresh
414
414
415 $ hg qdiff
415 $ hg qdiff
416 diff -r 000000000000 b
416 diff -r 000000000000 b
417 --- /dev/null
417 --- /dev/null
418 +++ b/b
418 +++ b/b
419 @@ -0,0 +1,1 @@
419 @@ -0,0 +1,1 @@
420 +a
420 +a
421
421
422 $ cd ..
422 $ cd ..
423
423
424
424
425 Issue2025: qrefresh does not honor filtering options when tip !=
425 Issue2025: qrefresh does not honor filtering options when tip !=
426 qtip:
426 qtip:
427
427
428 $ hg init repo-2025
428 $ hg init repo-2025
429 $ cd repo-2025
429 $ cd repo-2025
430 $ echo a > a
430 $ echo a > a
431 $ echo b > b
431 $ echo b > b
432 $ hg ci -qAm addab
432 $ hg ci -qAm addab
433 $ echo a >> a
433 $ echo a >> a
434 $ echo b >> b
434 $ echo b >> b
435 $ hg qnew -f patch
435 $ hg qnew -f patch
436 $ hg up -qC 0
436 $ hg up -qC 0
437 $ echo c > c
437 $ echo c > c
438 $ hg ci -qAm addc
438 $ hg ci -qAm addc
439 $ hg up -qC 1
439 $ hg up -qC 1
440
440
441 refresh with tip != qtip:
441 refresh with tip != qtip:
442
442
443 $ hg --config diff.nodates=1 qrefresh -I b
443 $ hg --config diff.nodates=1 qrefresh -I b
444
444
445 $ hg st
445 $ hg st
446 M a
446 M a
447
447
448 $ cat b
448 $ cat b
449 b
449 b
450 b
450 b
451
451
452 $ cat .hg/patches/patch
452 $ cat .hg/patches/patch
453 # HG changeset patch
453 # HG changeset patch
454 # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
454 # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
455
455
456 diff -r 1a60229be7ac b
456 diff -r 1a60229be7ac b
457 --- a/b
457 --- a/b
458 +++ b/b
458 +++ b/b
459 @@ -1,1 +1,2 @@
459 @@ -1,1 +1,2 @@
460 b
460 b
461 +b
461 +b
462
462
463 $ cd ..
463 $ cd ..
464
464
465
465
466 Issue1441 with git patches:
466 Issue1441 with git patches:
467
467
468 $ hg init repo-1441-git
468 $ hg init repo-1441-git
469 $ cd repo-1441-git
469 $ cd repo-1441-git
470
470
471 $ echo "[diff]" >> .hg/hgrc
471 $ echo "[diff]" >> .hg/hgrc
472 $ echo "git=True" >> .hg/hgrc
472 $ echo "git=True" >> .hg/hgrc
473
473
474 $ echo a > a
474 $ echo a > a
475 $ hg add a
475 $ hg add a
476 $ hg qnew -f p
476 $ hg qnew -f p
477 $ hg mv a b
477 $ hg mv a b
478 $ hg qrefresh
478 $ hg qrefresh
479
479
480 $ hg qdiff --nodates
480 $ hg qdiff --nodates
481 diff --git a/b b/b
481 diff --git a/b b/b
482 new file mode 100644
482 new file mode 100644
483 --- /dev/null
483 --- /dev/null
484 +++ b/b
484 +++ b/b
485 @@ -0,0 +1,1 @@
485 @@ -0,0 +1,1 @@
486 +a
486 +a
487
487
488 $ cd ..
488 $ cd ..
489
489
490 Refresh with bad usernames. Mercurial used to abort on bad usernames,
490 Refresh with bad usernames. Mercurial used to abort on bad usernames,
491 but only after writing the bad name into the patch.
491 but only after writing the bad name into the patch.
492
492
493 $ hg init bad-usernames
493 $ hg init bad-usernames
494 $ cd bad-usernames
494 $ cd bad-usernames
495 $ touch a
495 $ touch a
496 $ hg add a
496 $ hg add a
497 $ hg qnew a
497 $ hg qnew a
498 $ hg qrefresh -u 'foo
498 $ hg qrefresh -u 'foo
499 > bar'
499 > bar'
500 transaction abort!
500 transaction abort!
501 rollback completed
501 rollback completed
502 refresh interrupted while patch was popped! (revert --all, qpush to recover)
502 refresh interrupted while patch was popped! (revert --all, qpush to recover)
503 abort: username 'foo\nbar' contains a newline!
503 abort: username 'foo\nbar' contains a newline!
504 [255]
504 [255]
505 $ rm a
505 $ rm a
506 $ cat .hg/patches/a
506 $ cat .hg/patches/a
507 # HG changeset patch
507 # HG changeset patch
508 # Parent 0000000000000000000000000000000000000000
508 # Parent 0000000000000000000000000000000000000000
509 diff --git a/a b/a
509 diff --git a/a b/a
510 new file mode 100644
510 new file mode 100644
511 $ hg qpush
511 $ hg qpush
512 applying a
512 applying a
513 now at: a
513 now at: a
514 $ hg qrefresh -u ' '
514 $ hg qrefresh -u ' '
515 transaction abort!
515 transaction abort!
516 rollback completed
516 rollback completed
517 refresh interrupted while patch was popped! (revert --all, qpush to recover)
517 refresh interrupted while patch was popped! (revert --all, qpush to recover)
518 abort: empty username!
518 abort: empty username!
519 [255]
519 [255]
520 $ cat .hg/patches/a
520 $ cat .hg/patches/a
521 # HG changeset patch
521 # HG changeset patch
522 # Parent 0000000000000000000000000000000000000000
522 # Parent 0000000000000000000000000000000000000000
523 diff --git a/a b/a
523 diff --git a/a b/a
524 new file mode 100644
524 new file mode 100644
525 $ cd ..
525 $ cd ..
526
526
527 Refresh with phase data:
527 Refresh with phase data:
528
528
529
529
530
530
531 $ cd repo
531 $ cd repo
532 $ echo 'babar' >> a
532 $ echo 'babar' >> a
533 $ hg qnew -m 'update a' p2.diff
533 $ hg qnew -m 'update a' p2.diff
534 $ hg phase p2.diff
534 $ hg phase p2.diff
535 2: draft
535 2: draft
536 $ echo 'beber' >> a
536 $ echo 'beber' >> a
537 $ hg qref
537 $ hg qref
538 $ hg phase p2.diff
538 $ hg phase p2.diff
539 2: draft
539 2: draft
540 $ hg phase --force --secret p2.diff
540 $ hg phase --force --secret p2.diff
541 $ echo 'bibir' >> a
541 $ echo 'bibir' >> a
542 $ hg qref
542 $ hg qref
543 $ hg phase p2.diff
543 $ hg phase p2.diff
544 2: secret
544 2: secret
545
545
546 $ cd ..
546 $ cd ..
@@ -1,402 +1,402 b''
1 Create configuration
1 Create configuration
2
2
3 $ echo "[ui]" >> $HGRCPATH
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
4 $ echo "interactive=true" >> $HGRCPATH
5
5
6 help record (no record)
6 help record (no record)
7
7
8 $ hg help record
8 $ hg help record
9 record extension - commands to interactively select changes for
9 record extension - commands to interactively select changes for
10 commit/qrefresh
10 commit/qrefresh
11
11
12 use "hg help extensions" for information on enabling extensions
12 use "hg help extensions" for information on enabling extensions
13
13
14 help qrecord (no record)
14 help qrecord (no record)
15
15
16 $ hg help qrecord
16 $ hg help qrecord
17 'qrecord' is provided by the following extension:
17 'qrecord' is provided by the following extension:
18
18
19 record commands to interactively select changes for commit/qrefresh
19 record commands to interactively select changes for commit/qrefresh
20
20
21 use "hg help extensions" for information on enabling extensions
21 use "hg help extensions" for information on enabling extensions
22
22
23 $ echo "[extensions]" >> $HGRCPATH
23 $ echo "[extensions]" >> $HGRCPATH
24 $ echo "record=" >> $HGRCPATH
24 $ echo "record=" >> $HGRCPATH
25
25
26 help record (record)
26 help record (record)
27
27
28 $ hg help record
28 $ hg help record
29 hg record [OPTION]... [FILE]...
29 hg record [OPTION]... [FILE]...
30
30
31 interactively select changes to commit
31 interactively select changes to commit
32
32
33 If a list of files is omitted, all changes reported by "hg status" will be
33 If a list of files is omitted, all changes reported by "hg status" will be
34 candidates for recording.
34 candidates for recording.
35
35
36 See "hg help dates" for a list of formats valid for -d/--date.
36 See "hg help dates" for a list of formats valid for -d/--date.
37
37
38 You will be prompted for whether to record changes to each modified file,
38 You will be prompted for whether to record changes to each modified file,
39 and for files with multiple changes, for each change to use. For each
39 and for files with multiple changes, for each change to use. For each
40 query, the following responses are possible:
40 query, the following responses are possible:
41
41
42 y - record this change
42 y - record this change
43 n - skip this change
43 n - skip this change
44 e - edit this change manually
44 e - edit this change manually
45
45
46 s - skip remaining changes to this file
46 s - skip remaining changes to this file
47 f - record remaining changes to this file
47 f - record remaining changes to this file
48
48
49 d - done, skip remaining changes and files
49 d - done, skip remaining changes and files
50 a - record all changes to all remaining files
50 a - record all changes to all remaining files
51 q - quit, recording no changes
51 q - quit, recording no changes
52
52
53 ? - display help
53 ? - display help
54
54
55 This command is not available when committing a merge.
55 This command is not available when committing a merge.
56
56
57 options:
57 options:
58
58
59 -A --addremove mark new/missing files as added/removed before
59 -A --addremove mark new/missing files as added/removed before
60 committing
60 committing
61 --close-branch mark a branch as closed, hiding it from the branch
61 --close-branch mark a branch as closed, hiding it from the branch
62 list
62 list
63 --amend amend the parent of the working dir
63 --amend amend the parent of the working dir
64 -I --include PATTERN [+] include names matching the given patterns
64 -I --include PATTERN [+] include names matching the given patterns
65 -X --exclude PATTERN [+] exclude names matching the given patterns
65 -X --exclude PATTERN [+] exclude names matching the given patterns
66 -m --message TEXT use text as commit message
66 -m --message TEXT use text as commit message
67 -l --logfile FILE read commit message from file
67 -l --logfile FILE read commit message from file
68 -d --date DATE record the specified date as commit date
68 -d --date DATE record the specified date as commit date
69 -u --user USER record the specified user as committer
69 -u --user USER record the specified user as committer
70 -S --subrepos recurse into subrepositories
70 -S --subrepos recurse into subrepositories
71 -w --ignore-all-space ignore white space when comparing lines
71 -w --ignore-all-space ignore white space when comparing lines
72 -b --ignore-space-change ignore changes in the amount of white space
72 -b --ignore-space-change ignore changes in the amount of white space
73 -B --ignore-blank-lines ignore changes whose lines are all blank
73 -B --ignore-blank-lines ignore changes whose lines are all blank
74
74
75 [+] marked option can be specified multiple times
75 [+] marked option can be specified multiple times
76
76
77 use "hg -v help record" to show more info
77 use "hg -v help record" to show more info
78
78
79 help (no mq, so no qrecord)
79 help (no mq, so no qrecord)
80
80
81 $ hg help qrecord
81 $ hg help qrecord
82 hg qrecord [OPTION]... PATCH [FILE]...
82 hg qrecord [OPTION]... PATCH [FILE]...
83
83
84 interactively record a new patch
84 interactively record a new patch
85
85
86 See "hg help qnew" & "hg help record" for more information and usage.
86 See "hg help qnew" & "hg help record" for more information and usage.
87
87
88 use "hg -v help qrecord" to show more info
88 use "hg -v help qrecord" to show more info
89
89
90 $ hg init a
90 $ hg init a
91
91
92 qrecord (mq not present)
92 qrecord (mq not present)
93
93
94 $ hg -R a qrecord
94 $ hg -R a qrecord
95 hg qrecord: invalid arguments
95 hg qrecord: invalid arguments
96 hg qrecord [OPTION]... PATCH [FILE]...
96 hg qrecord [OPTION]... PATCH [FILE]...
97
97
98 interactively record a new patch
98 interactively record a new patch
99
99
100 use "hg help qrecord" to show the full help text
100 use "hg help qrecord" to show the full help text
101 [255]
101 [255]
102
102
103 qrecord patch (mq not present)
103 qrecord patch (mq not present)
104
104
105 $ hg -R a qrecord patch
105 $ hg -R a qrecord patch
106 abort: 'mq' extension not loaded
106 abort: 'mq' extension not loaded
107 [255]
107 [255]
108
108
109 help (bad mq)
109 help (bad mq)
110
110
111 $ echo "mq=nonexistant" >> $HGRCPATH
111 $ echo "mq=nonexistent" >> $HGRCPATH
112 $ hg help qrecord
112 $ hg help qrecord
113 *** failed to import extension mq from nonexistant: [Errno 2] * (glob)
113 *** failed to import extension mq from nonexistent: [Errno 2] * (glob)
114 hg qrecord [OPTION]... PATCH [FILE]...
114 hg qrecord [OPTION]... PATCH [FILE]...
115
115
116 interactively record a new patch
116 interactively record a new patch
117
117
118 See "hg help qnew" & "hg help record" for more information and usage.
118 See "hg help qnew" & "hg help record" for more information and usage.
119
119
120 use "hg -v help qrecord" to show more info
120 use "hg -v help qrecord" to show more info
121
121
122 help (mq present)
122 help (mq present)
123
123
124 $ sed 's/mq=nonexistant/mq=/' $HGRCPATH > hgrc.tmp
124 $ sed 's/mq=nonexistent/mq=/' $HGRCPATH > hgrc.tmp
125 $ mv hgrc.tmp $HGRCPATH
125 $ mv hgrc.tmp $HGRCPATH
126
126
127 $ hg help qrecord
127 $ hg help qrecord
128 hg qrecord [OPTION]... PATCH [FILE]...
128 hg qrecord [OPTION]... PATCH [FILE]...
129
129
130 interactively record a new patch
130 interactively record a new patch
131
131
132 See "hg help qnew" & "hg help record" for more information and usage.
132 See "hg help qnew" & "hg help record" for more information and usage.
133
133
134 options:
134 options:
135
135
136 -e --edit edit commit message
136 -e --edit edit commit message
137 -g --git use git extended diff format
137 -g --git use git extended diff format
138 -U --currentuser add "From: <current user>" to patch
138 -U --currentuser add "From: <current user>" to patch
139 -u --user USER add "From: <USER>" to patch
139 -u --user USER add "From: <USER>" to patch
140 -D --currentdate add "Date: <current date>" to patch
140 -D --currentdate add "Date: <current date>" to patch
141 -d --date DATE add "Date: <DATE>" to patch
141 -d --date DATE add "Date: <DATE>" to patch
142 -I --include PATTERN [+] include names matching the given patterns
142 -I --include PATTERN [+] include names matching the given patterns
143 -X --exclude PATTERN [+] exclude names matching the given patterns
143 -X --exclude PATTERN [+] exclude names matching the given patterns
144 -m --message TEXT use text as commit message
144 -m --message TEXT use text as commit message
145 -l --logfile FILE read commit message from file
145 -l --logfile FILE read commit message from file
146 -w --ignore-all-space ignore white space when comparing lines
146 -w --ignore-all-space ignore white space when comparing lines
147 -b --ignore-space-change ignore changes in the amount of white space
147 -b --ignore-space-change ignore changes in the amount of white space
148 -B --ignore-blank-lines ignore changes whose lines are all blank
148 -B --ignore-blank-lines ignore changes whose lines are all blank
149 --mq operate on patch repository
149 --mq operate on patch repository
150
150
151 [+] marked option can be specified multiple times
151 [+] marked option can be specified multiple times
152
152
153 use "hg -v help qrecord" to show more info
153 use "hg -v help qrecord" to show more info
154
154
155 $ cd a
155 $ cd a
156
156
157 Base commit
157 Base commit
158
158
159 $ cat > 1.txt <<EOF
159 $ cat > 1.txt <<EOF
160 > 1
160 > 1
161 > 2
161 > 2
162 > 3
162 > 3
163 > 4
163 > 4
164 > 5
164 > 5
165 > EOF
165 > EOF
166 $ cat > 2.txt <<EOF
166 $ cat > 2.txt <<EOF
167 > a
167 > a
168 > b
168 > b
169 > c
169 > c
170 > d
170 > d
171 > e
171 > e
172 > f
172 > f
173 > EOF
173 > EOF
174
174
175 $ mkdir dir
175 $ mkdir dir
176 $ cat > dir/a.txt <<EOF
176 $ cat > dir/a.txt <<EOF
177 > hello world
177 > hello world
178 >
178 >
179 > someone
179 > someone
180 > up
180 > up
181 > there
181 > there
182 > loves
182 > loves
183 > me
183 > me
184 > EOF
184 > EOF
185
185
186 $ hg add 1.txt 2.txt dir/a.txt
186 $ hg add 1.txt 2.txt dir/a.txt
187 $ hg commit -m 'initial checkin'
187 $ hg commit -m 'initial checkin'
188
188
189 Changing files
189 Changing files
190
190
191 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
191 $ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new
192 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
192 $ sed -e 's/b/b b/' 2.txt > 2.txt.new
193 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
193 $ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new
194
194
195 $ mv -f 1.txt.new 1.txt
195 $ mv -f 1.txt.new 1.txt
196 $ mv -f 2.txt.new 2.txt
196 $ mv -f 2.txt.new 2.txt
197 $ mv -f dir/a.txt.new dir/a.txt
197 $ mv -f dir/a.txt.new dir/a.txt
198
198
199 Whole diff
199 Whole diff
200
200
201 $ hg diff --nodates
201 $ hg diff --nodates
202 diff -r 1057167b20ef 1.txt
202 diff -r 1057167b20ef 1.txt
203 --- a/1.txt
203 --- a/1.txt
204 +++ b/1.txt
204 +++ b/1.txt
205 @@ -1,5 +1,5 @@
205 @@ -1,5 +1,5 @@
206 1
206 1
207 -2
207 -2
208 +2 2
208 +2 2
209 3
209 3
210 -4
210 -4
211 +4 4
211 +4 4
212 5
212 5
213 diff -r 1057167b20ef 2.txt
213 diff -r 1057167b20ef 2.txt
214 --- a/2.txt
214 --- a/2.txt
215 +++ b/2.txt
215 +++ b/2.txt
216 @@ -1,5 +1,5 @@
216 @@ -1,5 +1,5 @@
217 a
217 a
218 -b
218 -b
219 +b b
219 +b b
220 c
220 c
221 d
221 d
222 e
222 e
223 diff -r 1057167b20ef dir/a.txt
223 diff -r 1057167b20ef dir/a.txt
224 --- a/dir/a.txt
224 --- a/dir/a.txt
225 +++ b/dir/a.txt
225 +++ b/dir/a.txt
226 @@ -1,4 +1,4 @@
226 @@ -1,4 +1,4 @@
227 -hello world
227 -hello world
228 +hello world!
228 +hello world!
229
229
230 someone
230 someone
231 up
231 up
232
232
233 qrecord with bad patch name, should abort before prompting
233 qrecord with bad patch name, should abort before prompting
234
234
235 $ hg qrecord .hg
235 $ hg qrecord .hg
236 abort: patch name cannot begin with ".hg"
236 abort: patch name cannot begin with ".hg"
237 [255]
237 [255]
238
238
239 qrecord a.patch
239 qrecord a.patch
240
240
241 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
241 $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
242 > y
242 > y
243 > y
243 > y
244 > n
244 > n
245 > y
245 > y
246 > y
246 > y
247 > n
247 > n
248 > EOF
248 > EOF
249 diff --git a/1.txt b/1.txt
249 diff --git a/1.txt b/1.txt
250 2 hunks, 2 lines changed
250 2 hunks, 2 lines changed
251 examine changes to '1.txt'? [Ynesfdaq?]
251 examine changes to '1.txt'? [Ynesfdaq?]
252 @@ -1,3 +1,3 @@
252 @@ -1,3 +1,3 @@
253 1
253 1
254 -2
254 -2
255 +2 2
255 +2 2
256 3
256 3
257 record change 1/4 to '1.txt'? [Ynesfdaq?]
257 record change 1/4 to '1.txt'? [Ynesfdaq?]
258 @@ -3,3 +3,3 @@
258 @@ -3,3 +3,3 @@
259 3
259 3
260 -4
260 -4
261 +4 4
261 +4 4
262 5
262 5
263 record change 2/4 to '1.txt'? [Ynesfdaq?]
263 record change 2/4 to '1.txt'? [Ynesfdaq?]
264 diff --git a/2.txt b/2.txt
264 diff --git a/2.txt b/2.txt
265 1 hunks, 1 lines changed
265 1 hunks, 1 lines changed
266 examine changes to '2.txt'? [Ynesfdaq?]
266 examine changes to '2.txt'? [Ynesfdaq?]
267 @@ -1,5 +1,5 @@
267 @@ -1,5 +1,5 @@
268 a
268 a
269 -b
269 -b
270 +b b
270 +b b
271 c
271 c
272 d
272 d
273 e
273 e
274 record change 3/4 to '2.txt'? [Ynesfdaq?]
274 record change 3/4 to '2.txt'? [Ynesfdaq?]
275 diff --git a/dir/a.txt b/dir/a.txt
275 diff --git a/dir/a.txt b/dir/a.txt
276 1 hunks, 1 lines changed
276 1 hunks, 1 lines changed
277 examine changes to 'dir/a.txt'? [Ynesfdaq?]
277 examine changes to 'dir/a.txt'? [Ynesfdaq?]
278
278
279 After qrecord a.patch 'tip'"
279 After qrecord a.patch 'tip'"
280
280
281 $ hg tip -p
281 $ hg tip -p
282 changeset: 1:5d1ca63427ee
282 changeset: 1:5d1ca63427ee
283 tag: a.patch
283 tag: a.patch
284 tag: qbase
284 tag: qbase
285 tag: qtip
285 tag: qtip
286 tag: tip
286 tag: tip
287 user: test
287 user: test
288 date: Thu Jan 01 00:00:00 1970 +0000
288 date: Thu Jan 01 00:00:00 1970 +0000
289 summary: aaa
289 summary: aaa
290
290
291 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
291 diff -r 1057167b20ef -r 5d1ca63427ee 1.txt
292 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
292 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
293 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
293 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
294 @@ -1,5 +1,5 @@
294 @@ -1,5 +1,5 @@
295 1
295 1
296 -2
296 -2
297 +2 2
297 +2 2
298 3
298 3
299 4
299 4
300 5
300 5
301 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
301 diff -r 1057167b20ef -r 5d1ca63427ee 2.txt
302 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
302 --- a/2.txt Thu Jan 01 00:00:00 1970 +0000
303 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
303 +++ b/2.txt Thu Jan 01 00:00:00 1970 +0000
304 @@ -1,5 +1,5 @@
304 @@ -1,5 +1,5 @@
305 a
305 a
306 -b
306 -b
307 +b b
307 +b b
308 c
308 c
309 d
309 d
310 e
310 e
311
311
312
312
313 After qrecord a.patch 'diff'"
313 After qrecord a.patch 'diff'"
314
314
315 $ hg diff --nodates
315 $ hg diff --nodates
316 diff -r 5d1ca63427ee 1.txt
316 diff -r 5d1ca63427ee 1.txt
317 --- a/1.txt
317 --- a/1.txt
318 +++ b/1.txt
318 +++ b/1.txt
319 @@ -1,5 +1,5 @@
319 @@ -1,5 +1,5 @@
320 1
320 1
321 2 2
321 2 2
322 3
322 3
323 -4
323 -4
324 +4 4
324 +4 4
325 5
325 5
326 diff -r 5d1ca63427ee dir/a.txt
326 diff -r 5d1ca63427ee dir/a.txt
327 --- a/dir/a.txt
327 --- a/dir/a.txt
328 +++ b/dir/a.txt
328 +++ b/dir/a.txt
329 @@ -1,4 +1,4 @@
329 @@ -1,4 +1,4 @@
330 -hello world
330 -hello world
331 +hello world!
331 +hello world!
332
332
333 someone
333 someone
334 up
334 up
335
335
336 qrecord b.patch
336 qrecord b.patch
337
337
338 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
338 $ hg qrecord -d '0 0' -m bbb b.patch <<EOF
339 > y
339 > y
340 > y
340 > y
341 > y
341 > y
342 > y
342 > y
343 > EOF
343 > EOF
344 diff --git a/1.txt b/1.txt
344 diff --git a/1.txt b/1.txt
345 1 hunks, 1 lines changed
345 1 hunks, 1 lines changed
346 examine changes to '1.txt'? [Ynesfdaq?]
346 examine changes to '1.txt'? [Ynesfdaq?]
347 @@ -1,5 +1,5 @@
347 @@ -1,5 +1,5 @@
348 1
348 1
349 2 2
349 2 2
350 3
350 3
351 -4
351 -4
352 +4 4
352 +4 4
353 5
353 5
354 record change 1/2 to '1.txt'? [Ynesfdaq?]
354 record change 1/2 to '1.txt'? [Ynesfdaq?]
355 diff --git a/dir/a.txt b/dir/a.txt
355 diff --git a/dir/a.txt b/dir/a.txt
356 1 hunks, 1 lines changed
356 1 hunks, 1 lines changed
357 examine changes to 'dir/a.txt'? [Ynesfdaq?]
357 examine changes to 'dir/a.txt'? [Ynesfdaq?]
358 @@ -1,4 +1,4 @@
358 @@ -1,4 +1,4 @@
359 -hello world
359 -hello world
360 +hello world!
360 +hello world!
361
361
362 someone
362 someone
363 up
363 up
364 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
364 record change 2/2 to 'dir/a.txt'? [Ynesfdaq?]
365
365
366 After qrecord b.patch 'tip'
366 After qrecord b.patch 'tip'
367
367
368 $ hg tip -p
368 $ hg tip -p
369 changeset: 2:b056198bf878
369 changeset: 2:b056198bf878
370 tag: b.patch
370 tag: b.patch
371 tag: qtip
371 tag: qtip
372 tag: tip
372 tag: tip
373 user: test
373 user: test
374 date: Thu Jan 01 00:00:00 1970 +0000
374 date: Thu Jan 01 00:00:00 1970 +0000
375 summary: bbb
375 summary: bbb
376
376
377 diff -r 5d1ca63427ee -r b056198bf878 1.txt
377 diff -r 5d1ca63427ee -r b056198bf878 1.txt
378 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
378 --- a/1.txt Thu Jan 01 00:00:00 1970 +0000
379 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
379 +++ b/1.txt Thu Jan 01 00:00:00 1970 +0000
380 @@ -1,5 +1,5 @@
380 @@ -1,5 +1,5 @@
381 1
381 1
382 2 2
382 2 2
383 3
383 3
384 -4
384 -4
385 +4 4
385 +4 4
386 5
386 5
387 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
387 diff -r 5d1ca63427ee -r b056198bf878 dir/a.txt
388 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
388 --- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
389 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
389 +++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000
390 @@ -1,4 +1,4 @@
390 @@ -1,4 +1,4 @@
391 -hello world
391 -hello world
392 +hello world!
392 +hello world!
393
393
394 someone
394 someone
395 up
395 up
396
396
397
397
398 After qrecord b.patch 'diff'
398 After qrecord b.patch 'diff'
399
399
400 $ hg diff --nodates
400 $ hg diff --nodates
401
401
402 $ cd ..
402 $ cd ..
@@ -1,637 +1,637 b''
1 $ hg init
1 $ hg init
2 $ mkdir d1 d1/d11 d2
2 $ mkdir d1 d1/d11 d2
3 $ echo d1/a > d1/a
3 $ echo d1/a > d1/a
4 $ echo d1/ba > d1/ba
4 $ echo d1/ba > d1/ba
5 $ echo d1/a1 > d1/d11/a1
5 $ echo d1/a1 > d1/d11/a1
6 $ echo d1/b > d1/b
6 $ echo d1/b > d1/b
7 $ echo d2/b > d2/b
7 $ echo d2/b > d2/b
8 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
8 $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
9 $ hg commit -m "1"
9 $ hg commit -m "1"
10
10
11 rename a single file
11 rename a single file
12
12
13 $ hg rename d1/d11/a1 d2/c
13 $ hg rename d1/d11/a1 d2/c
14 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
14 $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
15 abort: filename contains 'con', which is reserved on Windows: 'd1/con.xml'
15 abort: filename contains 'con', which is reserved on Windows: 'd1/con.xml'
16 [255]
16 [255]
17 $ hg sum
17 $ hg sum
18 parent: 0:9b4b6e7b2c26 tip
18 parent: 0:9b4b6e7b2c26 tip
19 1
19 1
20 branch: default
20 branch: default
21 commit: 1 renamed
21 commit: 1 renamed
22 update: (current)
22 update: (current)
23 $ hg status -C
23 $ hg status -C
24 A d2/c
24 A d2/c
25 d1/d11/a1
25 d1/d11/a1
26 R d1/d11/a1
26 R d1/d11/a1
27 $ hg update -C
27 $ hg update -C
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 $ rm d2/c
29 $ rm d2/c
30
30
31 rename a single file using absolute paths
31 rename a single file using absolute paths
32
32
33 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
33 $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
34 $ hg status -C
34 $ hg status -C
35 A d2/c
35 A d2/c
36 d1/d11/a1
36 d1/d11/a1
37 R d1/d11/a1
37 R d1/d11/a1
38 $ hg update -C
38 $ hg update -C
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 $ rm d2/c
40 $ rm d2/c
41
41
42 rename --after a single file
42 rename --after a single file
43
43
44 $ mv d1/d11/a1 d2/c
44 $ mv d1/d11/a1 d2/c
45 $ hg rename --after d1/d11/a1 d2/c
45 $ hg rename --after d1/d11/a1 d2/c
46 $ hg status -C
46 $ hg status -C
47 A d2/c
47 A d2/c
48 d1/d11/a1
48 d1/d11/a1
49 R d1/d11/a1
49 R d1/d11/a1
50 $ hg update -C
50 $ hg update -C
51 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 $ rm d2/c
52 $ rm d2/c
53
53
54 rename --after a single file when src and tgt already tracked
54 rename --after a single file when src and tgt already tracked
55
55
56 $ mv d1/d11/a1 d2/c
56 $ mv d1/d11/a1 d2/c
57 $ hg addrem -s 0
57 $ hg addrem -s 0
58 removing d1/d11/a1
58 removing d1/d11/a1
59 adding d2/c
59 adding d2/c
60 $ hg rename --after d1/d11/a1 d2/c
60 $ hg rename --after d1/d11/a1 d2/c
61 $ hg status -C
61 $ hg status -C
62 A d2/c
62 A d2/c
63 d1/d11/a1
63 d1/d11/a1
64 R d1/d11/a1
64 R d1/d11/a1
65 $ hg update -C
65 $ hg update -C
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
67 $ rm d2/c
67 $ rm d2/c
68
68
69 rename --after a single file to a nonexistant target filename
69 rename --after a single file to a nonexistent target filename
70
70
71 $ hg rename --after d1/a dummy
71 $ hg rename --after d1/a dummy
72 d1/a: not recording move - dummy does not exist (glob)
72 d1/a: not recording move - dummy does not exist (glob)
73
73
74 move a single file to an existing directory
74 move a single file to an existing directory
75
75
76 $ hg rename d1/d11/a1 d2
76 $ hg rename d1/d11/a1 d2
77 $ hg status -C
77 $ hg status -C
78 A d2/a1
78 A d2/a1
79 d1/d11/a1
79 d1/d11/a1
80 R d1/d11/a1
80 R d1/d11/a1
81 $ hg update -C
81 $ hg update -C
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 $ rm d2/a1
83 $ rm d2/a1
84
84
85 move --after a single file to an existing directory
85 move --after a single file to an existing directory
86
86
87 $ mv d1/d11/a1 d2
87 $ mv d1/d11/a1 d2
88 $ hg rename --after d1/d11/a1 d2
88 $ hg rename --after d1/d11/a1 d2
89 $ hg status -C
89 $ hg status -C
90 A d2/a1
90 A d2/a1
91 d1/d11/a1
91 d1/d11/a1
92 R d1/d11/a1
92 R d1/d11/a1
93 $ hg update -C
93 $ hg update -C
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 $ rm d2/a1
95 $ rm d2/a1
96
96
97 rename a file using a relative path
97 rename a file using a relative path
98
98
99 $ (cd d1/d11; hg rename ../../d2/b e)
99 $ (cd d1/d11; hg rename ../../d2/b e)
100 $ hg status -C
100 $ hg status -C
101 A d1/d11/e
101 A d1/d11/e
102 d2/b
102 d2/b
103 R d2/b
103 R d2/b
104 $ hg update -C
104 $ hg update -C
105 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
106 $ rm d1/d11/e
106 $ rm d1/d11/e
107
107
108 rename --after a file using a relative path
108 rename --after a file using a relative path
109
109
110 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
110 $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
111 $ hg status -C
111 $ hg status -C
112 A d1/d11/e
112 A d1/d11/e
113 d2/b
113 d2/b
114 R d2/b
114 R d2/b
115 $ hg update -C
115 $ hg update -C
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 $ rm d1/d11/e
117 $ rm d1/d11/e
118
118
119 rename directory d1 as d3
119 rename directory d1 as d3
120
120
121 $ hg rename d1/ d3
121 $ hg rename d1/ d3
122 moving d1/a to d3/a (glob)
122 moving d1/a to d3/a (glob)
123 moving d1/b to d3/b (glob)
123 moving d1/b to d3/b (glob)
124 moving d1/ba to d3/ba (glob)
124 moving d1/ba to d3/ba (glob)
125 moving d1/d11/a1 to d3/d11/a1 (glob)
125 moving d1/d11/a1 to d3/d11/a1 (glob)
126 $ hg status -C
126 $ hg status -C
127 A d3/a
127 A d3/a
128 d1/a
128 d1/a
129 A d3/b
129 A d3/b
130 d1/b
130 d1/b
131 A d3/ba
131 A d3/ba
132 d1/ba
132 d1/ba
133 A d3/d11/a1
133 A d3/d11/a1
134 d1/d11/a1
134 d1/d11/a1
135 R d1/a
135 R d1/a
136 R d1/b
136 R d1/b
137 R d1/ba
137 R d1/ba
138 R d1/d11/a1
138 R d1/d11/a1
139 $ hg update -C
139 $ hg update -C
140 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 $ rm -rf d3
141 $ rm -rf d3
142
142
143 rename --after directory d1 as d3
143 rename --after directory d1 as d3
144
144
145 $ mv d1 d3
145 $ mv d1 d3
146 $ hg rename --after d1 d3
146 $ hg rename --after d1 d3
147 moving d1/a to d3/a (glob)
147 moving d1/a to d3/a (glob)
148 moving d1/b to d3/b (glob)
148 moving d1/b to d3/b (glob)
149 moving d1/ba to d3/ba (glob)
149 moving d1/ba to d3/ba (glob)
150 moving d1/d11/a1 to d3/d11/a1 (glob)
150 moving d1/d11/a1 to d3/d11/a1 (glob)
151 $ hg status -C
151 $ hg status -C
152 A d3/a
152 A d3/a
153 d1/a
153 d1/a
154 A d3/b
154 A d3/b
155 d1/b
155 d1/b
156 A d3/ba
156 A d3/ba
157 d1/ba
157 d1/ba
158 A d3/d11/a1
158 A d3/d11/a1
159 d1/d11/a1
159 d1/d11/a1
160 R d1/a
160 R d1/a
161 R d1/b
161 R d1/b
162 R d1/ba
162 R d1/ba
163 R d1/d11/a1
163 R d1/d11/a1
164 $ hg update -C
164 $ hg update -C
165 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
165 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ rm -rf d3
166 $ rm -rf d3
167
167
168 move a directory using a relative path
168 move a directory using a relative path
169
169
170 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
170 $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
171 moving ../d1/d11/a1 to d3/d11/a1 (glob)
171 moving ../d1/d11/a1 to d3/d11/a1 (glob)
172 $ hg status -C
172 $ hg status -C
173 A d2/d3/d11/a1
173 A d2/d3/d11/a1
174 d1/d11/a1
174 d1/d11/a1
175 R d1/d11/a1
175 R d1/d11/a1
176 $ hg update -C
176 $ hg update -C
177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 $ rm -rf d2/d3
178 $ rm -rf d2/d3
179
179
180 move --after a directory using a relative path
180 move --after a directory using a relative path
181
181
182 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
182 $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
183 moving ../d1/d11/a1 to d3/d11/a1 (glob)
183 moving ../d1/d11/a1 to d3/d11/a1 (glob)
184 $ hg status -C
184 $ hg status -C
185 A d2/d3/d11/a1
185 A d2/d3/d11/a1
186 d1/d11/a1
186 d1/d11/a1
187 R d1/d11/a1
187 R d1/d11/a1
188 $ hg update -C
188 $ hg update -C
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ rm -rf d2/d3
190 $ rm -rf d2/d3
191
191
192 move directory d1/d11 to an existing directory d2 (removes empty d1)
192 move directory d1/d11 to an existing directory d2 (removes empty d1)
193
193
194 $ hg rename d1/d11/ d2
194 $ hg rename d1/d11/ d2
195 moving d1/d11/a1 to d2/d11/a1 (glob)
195 moving d1/d11/a1 to d2/d11/a1 (glob)
196 $ hg status -C
196 $ hg status -C
197 A d2/d11/a1
197 A d2/d11/a1
198 d1/d11/a1
198 d1/d11/a1
199 R d1/d11/a1
199 R d1/d11/a1
200 $ hg update -C
200 $ hg update -C
201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
202 $ rm -rf d2/d11
202 $ rm -rf d2/d11
203
203
204 move directories d1 and d2 to a new directory d3
204 move directories d1 and d2 to a new directory d3
205
205
206 $ mkdir d3
206 $ mkdir d3
207 $ hg rename d1 d2 d3
207 $ hg rename d1 d2 d3
208 moving d1/a to d3/d1/a (glob)
208 moving d1/a to d3/d1/a (glob)
209 moving d1/b to d3/d1/b (glob)
209 moving d1/b to d3/d1/b (glob)
210 moving d1/ba to d3/d1/ba (glob)
210 moving d1/ba to d3/d1/ba (glob)
211 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
211 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
212 moving d2/b to d3/d2/b (glob)
212 moving d2/b to d3/d2/b (glob)
213 $ hg status -C
213 $ hg status -C
214 A d3/d1/a
214 A d3/d1/a
215 d1/a
215 d1/a
216 A d3/d1/b
216 A d3/d1/b
217 d1/b
217 d1/b
218 A d3/d1/ba
218 A d3/d1/ba
219 d1/ba
219 d1/ba
220 A d3/d1/d11/a1
220 A d3/d1/d11/a1
221 d1/d11/a1
221 d1/d11/a1
222 A d3/d2/b
222 A d3/d2/b
223 d2/b
223 d2/b
224 R d1/a
224 R d1/a
225 R d1/b
225 R d1/b
226 R d1/ba
226 R d1/ba
227 R d1/d11/a1
227 R d1/d11/a1
228 R d2/b
228 R d2/b
229 $ hg update -C
229 $ hg update -C
230 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
231 $ rm -rf d3
231 $ rm -rf d3
232
232
233 move --after directories d1 and d2 to a new directory d3
233 move --after directories d1 and d2 to a new directory d3
234
234
235 $ mkdir d3
235 $ mkdir d3
236 $ mv d1 d2 d3
236 $ mv d1 d2 d3
237 $ hg rename --after d1 d2 d3
237 $ hg rename --after d1 d2 d3
238 moving d1/a to d3/d1/a (glob)
238 moving d1/a to d3/d1/a (glob)
239 moving d1/b to d3/d1/b (glob)
239 moving d1/b to d3/d1/b (glob)
240 moving d1/ba to d3/d1/ba (glob)
240 moving d1/ba to d3/d1/ba (glob)
241 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
241 moving d1/d11/a1 to d3/d1/d11/a1 (glob)
242 moving d2/b to d3/d2/b (glob)
242 moving d2/b to d3/d2/b (glob)
243 $ hg status -C
243 $ hg status -C
244 A d3/d1/a
244 A d3/d1/a
245 d1/a
245 d1/a
246 A d3/d1/b
246 A d3/d1/b
247 d1/b
247 d1/b
248 A d3/d1/ba
248 A d3/d1/ba
249 d1/ba
249 d1/ba
250 A d3/d1/d11/a1
250 A d3/d1/d11/a1
251 d1/d11/a1
251 d1/d11/a1
252 A d3/d2/b
252 A d3/d2/b
253 d2/b
253 d2/b
254 R d1/a
254 R d1/a
255 R d1/b
255 R d1/b
256 R d1/ba
256 R d1/ba
257 R d1/d11/a1
257 R d1/d11/a1
258 R d2/b
258 R d2/b
259 $ hg update -C
259 $ hg update -C
260 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
261 $ rm -rf d3
261 $ rm -rf d3
262
262
263 move everything under directory d1 to existing directory d2, do not
263 move everything under directory d1 to existing directory d2, do not
264 overwrite existing files (d2/b)
264 overwrite existing files (d2/b)
265
265
266 $ hg rename d1/* d2
266 $ hg rename d1/* d2
267 d2/b: not overwriting - file exists
267 d2/b: not overwriting - file exists
268 moving d1/d11/a1 to d2/d11/a1 (glob)
268 moving d1/d11/a1 to d2/d11/a1 (glob)
269 $ hg status -C
269 $ hg status -C
270 A d2/a
270 A d2/a
271 d1/a
271 d1/a
272 A d2/ba
272 A d2/ba
273 d1/ba
273 d1/ba
274 A d2/d11/a1
274 A d2/d11/a1
275 d1/d11/a1
275 d1/d11/a1
276 R d1/a
276 R d1/a
277 R d1/ba
277 R d1/ba
278 R d1/d11/a1
278 R d1/d11/a1
279 $ diff -u d1/b d2/b
279 $ diff -u d1/b d2/b
280 --- d1/b * (glob)
280 --- d1/b * (glob)
281 +++ d2/b * (glob)
281 +++ d2/b * (glob)
282 @@ * (glob)
282 @@ * (glob)
283 -d1/b
283 -d1/b
284 +d2/b
284 +d2/b
285 [1]
285 [1]
286 $ hg update -C
286 $ hg update -C
287 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 $ rm d2/a d2/ba d2/d11/a1
288 $ rm d2/a d2/ba d2/d11/a1
289
289
290 attempt to move one file into a non-existent directory
290 attempt to move one file into a non-existent directory
291
291
292 $ hg rename d1/a dx/
292 $ hg rename d1/a dx/
293 abort: destination dx/ is not a directory
293 abort: destination dx/ is not a directory
294 [255]
294 [255]
295 $ hg status -C
295 $ hg status -C
296 $ hg update -C
296 $ hg update -C
297 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
297 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
298
298
299 attempt to move potentially more than one file into a non-existent directory
299 attempt to move potentially more than one file into a non-existent directory
300
300
301 $ hg rename 'glob:d1/**' dx
301 $ hg rename 'glob:d1/**' dx
302 abort: with multiple sources, destination must be an existing directory
302 abort: with multiple sources, destination must be an existing directory
303 [255]
303 [255]
304
304
305 move every file under d1 to d2/d21 (glob)
305 move every file under d1 to d2/d21 (glob)
306
306
307 $ mkdir d2/d21
307 $ mkdir d2/d21
308 $ hg rename 'glob:d1/**' d2/d21
308 $ hg rename 'glob:d1/**' d2/d21
309 moving d1/a to d2/d21/a (glob)
309 moving d1/a to d2/d21/a (glob)
310 moving d1/b to d2/d21/b (glob)
310 moving d1/b to d2/d21/b (glob)
311 moving d1/ba to d2/d21/ba (glob)
311 moving d1/ba to d2/d21/ba (glob)
312 moving d1/d11/a1 to d2/d21/a1 (glob)
312 moving d1/d11/a1 to d2/d21/a1 (glob)
313 $ hg status -C
313 $ hg status -C
314 A d2/d21/a
314 A d2/d21/a
315 d1/a
315 d1/a
316 A d2/d21/a1
316 A d2/d21/a1
317 d1/d11/a1
317 d1/d11/a1
318 A d2/d21/b
318 A d2/d21/b
319 d1/b
319 d1/b
320 A d2/d21/ba
320 A d2/d21/ba
321 d1/ba
321 d1/ba
322 R d1/a
322 R d1/a
323 R d1/b
323 R d1/b
324 R d1/ba
324 R d1/ba
325 R d1/d11/a1
325 R d1/d11/a1
326 $ hg update -C
326 $ hg update -C
327 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
327 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 $ rm -rf d2/d21
328 $ rm -rf d2/d21
329
329
330 move --after some files under d1 to d2/d21 (glob)
330 move --after some files under d1 to d2/d21 (glob)
331
331
332 $ mkdir d2/d21
332 $ mkdir d2/d21
333 $ mv d1/a d1/d11/a1 d2/d21
333 $ mv d1/a d1/d11/a1 d2/d21
334 $ hg rename --after 'glob:d1/**' d2/d21
334 $ hg rename --after 'glob:d1/**' d2/d21
335 moving d1/a to d2/d21/a (glob)
335 moving d1/a to d2/d21/a (glob)
336 d1/b: not recording move - d2/d21/b does not exist (glob)
336 d1/b: not recording move - d2/d21/b does not exist (glob)
337 d1/ba: not recording move - d2/d21/ba does not exist (glob)
337 d1/ba: not recording move - d2/d21/ba does not exist (glob)
338 moving d1/d11/a1 to d2/d21/a1 (glob)
338 moving d1/d11/a1 to d2/d21/a1 (glob)
339 $ hg status -C
339 $ hg status -C
340 A d2/d21/a
340 A d2/d21/a
341 d1/a
341 d1/a
342 A d2/d21/a1
342 A d2/d21/a1
343 d1/d11/a1
343 d1/d11/a1
344 R d1/a
344 R d1/a
345 R d1/d11/a1
345 R d1/d11/a1
346 $ hg update -C
346 $ hg update -C
347 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
347 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 $ rm -rf d2/d21
348 $ rm -rf d2/d21
349
349
350 move every file under d1 starting with an 'a' to d2/d21 (regexp)
350 move every file under d1 starting with an 'a' to d2/d21 (regexp)
351
351
352 $ mkdir d2/d21
352 $ mkdir d2/d21
353 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
353 $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
354 moving d1/a to d2/d21/a (glob)
354 moving d1/a to d2/d21/a (glob)
355 moving d1/d11/a1 to d2/d21/a1 (glob)
355 moving d1/d11/a1 to d2/d21/a1 (glob)
356 $ hg status -C
356 $ hg status -C
357 A d2/d21/a
357 A d2/d21/a
358 d1/a
358 d1/a
359 A d2/d21/a1
359 A d2/d21/a1
360 d1/d11/a1
360 d1/d11/a1
361 R d1/a
361 R d1/a
362 R d1/d11/a1
362 R d1/d11/a1
363 $ hg update -C
363 $ hg update -C
364 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
365 $ rm -rf d2/d21
365 $ rm -rf d2/d21
366
366
367 attempt to overwrite an existing file
367 attempt to overwrite an existing file
368
368
369 $ echo "ca" > d1/ca
369 $ echo "ca" > d1/ca
370 $ hg rename d1/ba d1/ca
370 $ hg rename d1/ba d1/ca
371 d1/ca: not overwriting - file exists
371 d1/ca: not overwriting - file exists
372 $ hg status -C
372 $ hg status -C
373 ? d1/ca
373 ? d1/ca
374 $ hg update -C
374 $ hg update -C
375 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
375 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
376
376
377 forced overwrite of an existing file
377 forced overwrite of an existing file
378
378
379 $ echo "ca" > d1/ca
379 $ echo "ca" > d1/ca
380 $ hg rename --force d1/ba d1/ca
380 $ hg rename --force d1/ba d1/ca
381 $ hg status -C
381 $ hg status -C
382 A d1/ca
382 A d1/ca
383 d1/ba
383 d1/ba
384 R d1/ba
384 R d1/ba
385 $ hg update -C
385 $ hg update -C
386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
387 $ rm d1/ca
387 $ rm d1/ca
388
388
389 attempt to overwrite an existing broken symlink
389 attempt to overwrite an existing broken symlink
390
390
391 #if symlink
391 #if symlink
392 $ ln -s ba d1/ca
392 $ ln -s ba d1/ca
393 $ hg rename --traceback d1/ba d1/ca
393 $ hg rename --traceback d1/ba d1/ca
394 d1/ca: not overwriting - file exists
394 d1/ca: not overwriting - file exists
395 $ hg status -C
395 $ hg status -C
396 ? d1/ca
396 ? d1/ca
397 $ hg update -C
397 $ hg update -C
398 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
398 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
399 $ rm d1/ca
399 $ rm d1/ca
400
400
401 replace a symlink with a file
401 replace a symlink with a file
402
402
403 $ ln -s ba d1/ca
403 $ ln -s ba d1/ca
404 $ hg rename --force d1/ba d1/ca
404 $ hg rename --force d1/ba d1/ca
405 $ hg status -C
405 $ hg status -C
406 A d1/ca
406 A d1/ca
407 d1/ba
407 d1/ba
408 R d1/ba
408 R d1/ba
409 $ hg update -C
409 $ hg update -C
410 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
410 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
411 $ rm d1/ca
411 $ rm d1/ca
412 #endif
412 #endif
413
413
414 do not copy more than one source file to the same destination file
414 do not copy more than one source file to the same destination file
415
415
416 $ mkdir d3
416 $ mkdir d3
417 $ hg rename d1/* d2/* d3
417 $ hg rename d1/* d2/* d3
418 moving d1/d11/a1 to d3/d11/a1 (glob)
418 moving d1/d11/a1 to d3/d11/a1 (glob)
419 d3/b: not overwriting - d2/b collides with d1/b
419 d3/b: not overwriting - d2/b collides with d1/b
420 $ hg status -C
420 $ hg status -C
421 A d3/a
421 A d3/a
422 d1/a
422 d1/a
423 A d3/b
423 A d3/b
424 d1/b
424 d1/b
425 A d3/ba
425 A d3/ba
426 d1/ba
426 d1/ba
427 A d3/d11/a1
427 A d3/d11/a1
428 d1/d11/a1
428 d1/d11/a1
429 R d1/a
429 R d1/a
430 R d1/b
430 R d1/b
431 R d1/ba
431 R d1/ba
432 R d1/d11/a1
432 R d1/d11/a1
433 $ hg update -C
433 $ hg update -C
434 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
434 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
435 $ rm -rf d3
435 $ rm -rf d3
436
436
437 move a whole subtree with "hg rename ."
437 move a whole subtree with "hg rename ."
438
438
439 $ mkdir d3
439 $ mkdir d3
440 $ (cd d1; hg rename . ../d3)
440 $ (cd d1; hg rename . ../d3)
441 moving a to ../d3/d1/a
441 moving a to ../d3/d1/a
442 moving b to ../d3/d1/b
442 moving b to ../d3/d1/b
443 moving ba to ../d3/d1/ba
443 moving ba to ../d3/d1/ba
444 moving d11/a1 to ../d3/d1/d11/a1 (glob)
444 moving d11/a1 to ../d3/d1/d11/a1 (glob)
445 $ hg status -C
445 $ hg status -C
446 A d3/d1/a
446 A d3/d1/a
447 d1/a
447 d1/a
448 A d3/d1/b
448 A d3/d1/b
449 d1/b
449 d1/b
450 A d3/d1/ba
450 A d3/d1/ba
451 d1/ba
451 d1/ba
452 A d3/d1/d11/a1
452 A d3/d1/d11/a1
453 d1/d11/a1
453 d1/d11/a1
454 R d1/a
454 R d1/a
455 R d1/b
455 R d1/b
456 R d1/ba
456 R d1/ba
457 R d1/d11/a1
457 R d1/d11/a1
458 $ hg update -C
458 $ hg update -C
459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 $ rm -rf d3
460 $ rm -rf d3
461
461
462 move a whole subtree with "hg rename --after ."
462 move a whole subtree with "hg rename --after ."
463
463
464 $ mkdir d3
464 $ mkdir d3
465 $ mv d1/* d3
465 $ mv d1/* d3
466 $ (cd d1; hg rename --after . ../d3)
466 $ (cd d1; hg rename --after . ../d3)
467 moving a to ../d3/a
467 moving a to ../d3/a
468 moving b to ../d3/b
468 moving b to ../d3/b
469 moving ba to ../d3/ba
469 moving ba to ../d3/ba
470 moving d11/a1 to ../d3/d11/a1 (glob)
470 moving d11/a1 to ../d3/d11/a1 (glob)
471 $ hg status -C
471 $ hg status -C
472 A d3/a
472 A d3/a
473 d1/a
473 d1/a
474 A d3/b
474 A d3/b
475 d1/b
475 d1/b
476 A d3/ba
476 A d3/ba
477 d1/ba
477 d1/ba
478 A d3/d11/a1
478 A d3/d11/a1
479 d1/d11/a1
479 d1/d11/a1
480 R d1/a
480 R d1/a
481 R d1/b
481 R d1/b
482 R d1/ba
482 R d1/ba
483 R d1/d11/a1
483 R d1/d11/a1
484 $ hg update -C
484 $ hg update -C
485 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
485 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
486 $ rm -rf d3
486 $ rm -rf d3
487
487
488 move the parent tree with "hg rename .."
488 move the parent tree with "hg rename .."
489
489
490 $ (cd d1/d11; hg rename .. ../../d3)
490 $ (cd d1/d11; hg rename .. ../../d3)
491 moving ../a to ../../d3/a (glob)
491 moving ../a to ../../d3/a (glob)
492 moving ../b to ../../d3/b (glob)
492 moving ../b to ../../d3/b (glob)
493 moving ../ba to ../../d3/ba (glob)
493 moving ../ba to ../../d3/ba (glob)
494 moving a1 to ../../d3/d11/a1
494 moving a1 to ../../d3/d11/a1
495 $ hg status -C
495 $ hg status -C
496 A d3/a
496 A d3/a
497 d1/a
497 d1/a
498 A d3/b
498 A d3/b
499 d1/b
499 d1/b
500 A d3/ba
500 A d3/ba
501 d1/ba
501 d1/ba
502 A d3/d11/a1
502 A d3/d11/a1
503 d1/d11/a1
503 d1/d11/a1
504 R d1/a
504 R d1/a
505 R d1/b
505 R d1/b
506 R d1/ba
506 R d1/ba
507 R d1/d11/a1
507 R d1/d11/a1
508 $ hg update -C
508 $ hg update -C
509 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
509 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
510 $ rm -rf d3
510 $ rm -rf d3
511
511
512 skip removed files
512 skip removed files
513
513
514 $ hg remove d1/b
514 $ hg remove d1/b
515 $ hg rename d1 d3
515 $ hg rename d1 d3
516 moving d1/a to d3/a (glob)
516 moving d1/a to d3/a (glob)
517 moving d1/ba to d3/ba (glob)
517 moving d1/ba to d3/ba (glob)
518 moving d1/d11/a1 to d3/d11/a1 (glob)
518 moving d1/d11/a1 to d3/d11/a1 (glob)
519 $ hg status -C
519 $ hg status -C
520 A d3/a
520 A d3/a
521 d1/a
521 d1/a
522 A d3/ba
522 A d3/ba
523 d1/ba
523 d1/ba
524 A d3/d11/a1
524 A d3/d11/a1
525 d1/d11/a1
525 d1/d11/a1
526 R d1/a
526 R d1/a
527 R d1/b
527 R d1/b
528 R d1/ba
528 R d1/ba
529 R d1/d11/a1
529 R d1/d11/a1
530 $ hg update -C
530 $ hg update -C
531 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 $ rm -rf d3
532 $ rm -rf d3
533
533
534 transitive rename
534 transitive rename
535
535
536 $ hg rename d1/b d1/bb
536 $ hg rename d1/b d1/bb
537 $ hg rename d1/bb d1/bc
537 $ hg rename d1/bb d1/bc
538 $ hg status -C
538 $ hg status -C
539 A d1/bc
539 A d1/bc
540 d1/b
540 d1/b
541 R d1/b
541 R d1/b
542 $ hg update -C
542 $ hg update -C
543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
543 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
544 $ rm d1/bc
544 $ rm d1/bc
545
545
546 transitive rename --after
546 transitive rename --after
547
547
548 $ hg rename d1/b d1/bb
548 $ hg rename d1/b d1/bb
549 $ mv d1/bb d1/bc
549 $ mv d1/bb d1/bc
550 $ hg rename --after d1/bb d1/bc
550 $ hg rename --after d1/bb d1/bc
551 $ hg status -C
551 $ hg status -C
552 A d1/bc
552 A d1/bc
553 d1/b
553 d1/b
554 R d1/b
554 R d1/b
555 $ hg update -C
555 $ hg update -C
556 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
556 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
557 $ rm d1/bc
557 $ rm d1/bc
558
558
559 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
559 $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
560 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
560 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
561 $ hg rename d1/b d1/bb
561 $ hg rename d1/b d1/bb
562 $ echo "some stuff added to d1/bb" >> d1/bb
562 $ echo "some stuff added to d1/bb" >> d1/bb
563 $ hg rename d1/bb d1/b
563 $ hg rename d1/bb d1/b
564 $ hg status -C
564 $ hg status -C
565 M d1/b
565 M d1/b
566 $ hg update -C
566 $ hg update -C
567 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
568
568
569 overwriting with renames (issue1959)
569 overwriting with renames (issue1959)
570
570
571 $ hg rename d1/a d1/c
571 $ hg rename d1/a d1/c
572 $ hg rename d1/b d1/a
572 $ hg rename d1/b d1/a
573 $ hg status -C
573 $ hg status -C
574 A d1/a
574 A d1/a
575 d1/b
575 d1/b
576 A d1/c
576 A d1/c
577 d1/a
577 d1/a
578 R d1/b
578 R d1/b
579 $ hg diff --git
579 $ hg diff --git
580 diff --git a/d1/b b/d1/a
580 diff --git a/d1/b b/d1/a
581 rename from d1/b
581 rename from d1/b
582 rename to d1/a
582 rename to d1/a
583 diff --git a/d1/a b/d1/c
583 diff --git a/d1/a b/d1/c
584 copy from d1/a
584 copy from d1/a
585 copy to d1/c
585 copy to d1/c
586 $ hg update -C
586 $ hg update -C
587 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
587 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
588
588
589 check illegal path components
589 check illegal path components
590
590
591 $ hg rename d1/d11/a1 .hg/foo
591 $ hg rename d1/d11/a1 .hg/foo
592 abort: path contains illegal component: .hg/foo (glob)
592 abort: path contains illegal component: .hg/foo (glob)
593 [255]
593 [255]
594 $ hg status -C
594 $ hg status -C
595 $ hg rename d1/d11/a1 ../foo
595 $ hg rename d1/d11/a1 ../foo
596 abort: ../foo not under root
596 abort: ../foo not under root
597 [255]
597 [255]
598 $ hg status -C
598 $ hg status -C
599
599
600 $ mv d1/d11/a1 .hg/foo
600 $ mv d1/d11/a1 .hg/foo
601 $ hg rename --after d1/d11/a1 .hg/foo
601 $ hg rename --after d1/d11/a1 .hg/foo
602 abort: path contains illegal component: .hg/foo (glob)
602 abort: path contains illegal component: .hg/foo (glob)
603 [255]
603 [255]
604 $ hg status -C
604 $ hg status -C
605 ! d1/d11/a1
605 ! d1/d11/a1
606 $ hg update -C
606 $ hg update -C
607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
607 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
608 $ rm .hg/foo
608 $ rm .hg/foo
609
609
610 $ hg rename d1/d11/a1 .hg
610 $ hg rename d1/d11/a1 .hg
611 abort: path contains illegal component: .hg/a1 (glob)
611 abort: path contains illegal component: .hg/a1 (glob)
612 [255]
612 [255]
613 $ hg status -C
613 $ hg status -C
614 $ hg rename d1/d11/a1 ..
614 $ hg rename d1/d11/a1 ..
615 abort: ../a1 not under root (glob)
615 abort: ../a1 not under root (glob)
616 [255]
616 [255]
617 $ hg status -C
617 $ hg status -C
618
618
619 $ mv d1/d11/a1 .hg
619 $ mv d1/d11/a1 .hg
620 $ hg rename --after d1/d11/a1 .hg
620 $ hg rename --after d1/d11/a1 .hg
621 abort: path contains illegal component: .hg/a1 (glob)
621 abort: path contains illegal component: .hg/a1 (glob)
622 [255]
622 [255]
623 $ hg status -C
623 $ hg status -C
624 ! d1/d11/a1
624 ! d1/d11/a1
625 $ hg update -C
625 $ hg update -C
626 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
626 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 $ rm .hg/a1
627 $ rm .hg/a1
628
628
629 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
629 $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
630 abort: path contains illegal component: .hg/foo (glob)
630 abort: path contains illegal component: .hg/foo (glob)
631 [255]
631 [255]
632 $ hg status -C
632 $ hg status -C
633 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
633 $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
634 abort: ../../../foo not under root
634 abort: ../../../foo not under root
635 [255]
635 [255]
636 $ hg status -C
636 $ hg status -C
637
637
@@ -1,256 +1,256 b''
1 $ "$TESTDIR/hghave" symlink || exit 80
1 $ "$TESTDIR/hghave" symlink || exit 80
2
2
3 == tests added in 0.7 ==
3 == tests added in 0.7 ==
4
4
5 $ hg init test-symlinks-0.7; cd test-symlinks-0.7;
5 $ hg init test-symlinks-0.7; cd test-symlinks-0.7;
6 $ touch foo; ln -s foo bar;
6 $ touch foo; ln -s foo bar;
7
7
8 import with addremove -- symlink walking should _not_ screwup.
8 import with addremove -- symlink walking should _not_ screwup.
9
9
10 $ hg addremove
10 $ hg addremove
11 adding bar
11 adding bar
12 adding foo
12 adding foo
13
13
14 commit -- the symlink should _not_ appear added to dir state
14 commit -- the symlink should _not_ appear added to dir state
15
15
16 $ hg commit -m 'initial'
16 $ hg commit -m 'initial'
17
17
18 $ touch bomb
18 $ touch bomb
19
19
20 again, symlink should _not_ show up on dir state
20 again, symlink should _not_ show up on dir state
21
21
22 $ hg addremove
22 $ hg addremove
23 adding bomb
23 adding bomb
24
24
25 Assert screamed here before, should go by without consequence
25 Assert screamed here before, should go by without consequence
26
26
27 $ hg commit -m 'is there a bug?'
27 $ hg commit -m 'is there a bug?'
28 $ cd ..
28 $ cd ..
29
29
30
30
31 == fifo & ignore ==
31 == fifo & ignore ==
32
32
33 $ hg init test; cd test;
33 $ hg init test; cd test;
34
34
35 $ mkdir dir
35 $ mkdir dir
36 $ touch a.c dir/a.o dir/b.o
36 $ touch a.c dir/a.o dir/b.o
37
37
38 test what happens if we want to trick hg
38 test what happens if we want to trick hg
39
39
40 $ hg commit -A -m 0
40 $ hg commit -A -m 0
41 adding a.c
41 adding a.c
42 adding dir/a.o
42 adding dir/a.o
43 adding dir/b.o
43 adding dir/b.o
44 $ echo "relglob:*.o" > .hgignore
44 $ echo "relglob:*.o" > .hgignore
45 $ rm a.c
45 $ rm a.c
46 $ rm dir/a.o
46 $ rm dir/a.o
47 $ rm dir/b.o
47 $ rm dir/b.o
48 $ mkdir dir/a.o
48 $ mkdir dir/a.o
49 $ ln -s nonexist dir/b.o
49 $ ln -s nonexistent dir/b.o
50 $ mkfifo a.c
50 $ mkfifo a.c
51
51
52 it should show a.c, dir/a.o and dir/b.o deleted
52 it should show a.c, dir/a.o and dir/b.o deleted
53
53
54 $ hg status
54 $ hg status
55 M dir/b.o
55 M dir/b.o
56 ! a.c
56 ! a.c
57 ! dir/a.o
57 ! dir/a.o
58 ? .hgignore
58 ? .hgignore
59 $ hg status a.c
59 $ hg status a.c
60 a.c: unsupported file type (type is fifo)
60 a.c: unsupported file type (type is fifo)
61 ! a.c
61 ! a.c
62 $ cd ..
62 $ cd ..
63
63
64
64
65 == symlinks from outside the tree ==
65 == symlinks from outside the tree ==
66
66
67 test absolute path through symlink outside repo
67 test absolute path through symlink outside repo
68
68
69 $ p=`pwd`
69 $ p=`pwd`
70 $ hg init x
70 $ hg init x
71 $ ln -s x y
71 $ ln -s x y
72 $ cd x
72 $ cd x
73 $ touch f
73 $ touch f
74 $ hg add f
74 $ hg add f
75 $ hg status "$p"/y/f
75 $ hg status "$p"/y/f
76 A f
76 A f
77
77
78 try symlink outside repo to file inside
78 try symlink outside repo to file inside
79
79
80 $ ln -s x/f ../z
80 $ ln -s x/f ../z
81
81
82 this should fail
82 this should fail
83
83
84 $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || :
84 $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || :
85 abort: ../z not under root
85 abort: ../z not under root
86 $ cd ..
86 $ cd ..
87
87
88
88
89 == cloning symlinks ==
89 == cloning symlinks ==
90 $ hg init clone; cd clone;
90 $ hg init clone; cd clone;
91
91
92 try cloning symlink in a subdir
92 try cloning symlink in a subdir
93 1. commit a symlink
93 1. commit a symlink
94
94
95 $ mkdir -p a/b/c
95 $ mkdir -p a/b/c
96 $ cd a/b/c
96 $ cd a/b/c
97 $ ln -s /path/to/symlink/source demo
97 $ ln -s /path/to/symlink/source demo
98 $ cd ../../..
98 $ cd ../../..
99 $ hg stat
99 $ hg stat
100 ? a/b/c/demo
100 ? a/b/c/demo
101 $ hg commit -A -m 'add symlink in a/b/c subdir'
101 $ hg commit -A -m 'add symlink in a/b/c subdir'
102 adding a/b/c/demo
102 adding a/b/c/demo
103
103
104 2. clone it
104 2. clone it
105
105
106 $ cd ..
106 $ cd ..
107 $ hg clone clone clonedest
107 $ hg clone clone clonedest
108 updating to branch default
108 updating to branch default
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
110
111
111
112 == symlink and git diffs ==
112 == symlink and git diffs ==
113
113
114 git symlink diff
114 git symlink diff
115
115
116 $ cd clonedest
116 $ cd clonedest
117 $ hg diff --git -r null:tip
117 $ hg diff --git -r null:tip
118 diff --git a/a/b/c/demo b/a/b/c/demo
118 diff --git a/a/b/c/demo b/a/b/c/demo
119 new file mode 120000
119 new file mode 120000
120 --- /dev/null
120 --- /dev/null
121 +++ b/a/b/c/demo
121 +++ b/a/b/c/demo
122 @@ -0,0 +1,1 @@
122 @@ -0,0 +1,1 @@
123 +/path/to/symlink/source
123 +/path/to/symlink/source
124 \ No newline at end of file
124 \ No newline at end of file
125 $ hg export --git tip > ../sl.diff
125 $ hg export --git tip > ../sl.diff
126
126
127 import git symlink diff
127 import git symlink diff
128
128
129 $ hg rm a/b/c/demo
129 $ hg rm a/b/c/demo
130 $ hg commit -m'remove link'
130 $ hg commit -m'remove link'
131 $ hg import ../sl.diff
131 $ hg import ../sl.diff
132 applying ../sl.diff
132 applying ../sl.diff
133 $ hg diff --git -r 1:tip
133 $ hg diff --git -r 1:tip
134 diff --git a/a/b/c/demo b/a/b/c/demo
134 diff --git a/a/b/c/demo b/a/b/c/demo
135 new file mode 120000
135 new file mode 120000
136 --- /dev/null
136 --- /dev/null
137 +++ b/a/b/c/demo
137 +++ b/a/b/c/demo
138 @@ -0,0 +1,1 @@
138 @@ -0,0 +1,1 @@
139 +/path/to/symlink/source
139 +/path/to/symlink/source
140 \ No newline at end of file
140 \ No newline at end of file
141
141
142 == symlinks and addremove ==
142 == symlinks and addremove ==
143
143
144 directory moved and symlinked
144 directory moved and symlinked
145
145
146 $ mkdir foo
146 $ mkdir foo
147 $ touch foo/a
147 $ touch foo/a
148 $ hg ci -Ama
148 $ hg ci -Ama
149 adding foo/a
149 adding foo/a
150 $ mv foo bar
150 $ mv foo bar
151 $ ln -s bar foo
151 $ ln -s bar foo
152
152
153 now addremove should remove old files
153 now addremove should remove old files
154
154
155 $ hg addremove
155 $ hg addremove
156 adding bar/a
156 adding bar/a
157 adding foo
157 adding foo
158 removing foo/a
158 removing foo/a
159 $ cd ..
159 $ cd ..
160
160
161 == root of repository is symlinked ==
161 == root of repository is symlinked ==
162
162
163 $ hg init root
163 $ hg init root
164 $ ln -s root link
164 $ ln -s root link
165 $ cd root
165 $ cd root
166 $ echo foo > foo
166 $ echo foo > foo
167 $ hg status
167 $ hg status
168 ? foo
168 ? foo
169 $ hg status ../link
169 $ hg status ../link
170 ? foo
170 ? foo
171 $ hg add foo
171 $ hg add foo
172 $ hg cp foo "$TESTTMP/link/bar"
172 $ hg cp foo "$TESTTMP/link/bar"
173 foo has not been committed yet, so no copy data will be stored for bar.
173 foo has not been committed yet, so no copy data will be stored for bar.
174 $ cd ..
174 $ cd ..
175
175
176
176
177 $ hg init b
177 $ hg init b
178 $ cd b
178 $ cd b
179 $ ln -s nothing dangling
179 $ ln -s nothing dangling
180 $ hg commit -m 'commit symlink without adding' dangling
180 $ hg commit -m 'commit symlink without adding' dangling
181 abort: dangling: file not tracked!
181 abort: dangling: file not tracked!
182 [255]
182 [255]
183 $ hg add dangling
183 $ hg add dangling
184 $ hg commit -m 'add symlink'
184 $ hg commit -m 'add symlink'
185
185
186 $ hg tip -v
186 $ hg tip -v
187 changeset: 0:cabd88b706fc
187 changeset: 0:cabd88b706fc
188 tag: tip
188 tag: tip
189 user: test
189 user: test
190 date: Thu Jan 01 00:00:00 1970 +0000
190 date: Thu Jan 01 00:00:00 1970 +0000
191 files: dangling
191 files: dangling
192 description:
192 description:
193 add symlink
193 add symlink
194
194
195
195
196 $ hg manifest --debug
196 $ hg manifest --debug
197 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling
197 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling
198 $ "$TESTDIR/readlink.py" dangling
198 $ "$TESTDIR/readlink.py" dangling
199 dangling -> nothing
199 dangling -> nothing
200
200
201 $ rm dangling
201 $ rm dangling
202 $ ln -s void dangling
202 $ ln -s void dangling
203 $ hg commit -m 'change symlink'
203 $ hg commit -m 'change symlink'
204 $ "$TESTDIR/readlink.py" dangling
204 $ "$TESTDIR/readlink.py" dangling
205 dangling -> void
205 dangling -> void
206
206
207
207
208 modifying link
208 modifying link
209
209
210 $ rm dangling
210 $ rm dangling
211 $ ln -s empty dangling
211 $ ln -s empty dangling
212 $ "$TESTDIR/readlink.py" dangling
212 $ "$TESTDIR/readlink.py" dangling
213 dangling -> empty
213 dangling -> empty
214
214
215
215
216 reverting to rev 0:
216 reverting to rev 0:
217
217
218 $ hg revert -r 0 -a
218 $ hg revert -r 0 -a
219 reverting dangling
219 reverting dangling
220 $ "$TESTDIR/readlink.py" dangling
220 $ "$TESTDIR/readlink.py" dangling
221 dangling -> nothing
221 dangling -> nothing
222
222
223
223
224 backups:
224 backups:
225
225
226 $ "$TESTDIR/readlink.py" *.orig
226 $ "$TESTDIR/readlink.py" *.orig
227 dangling.orig -> empty
227 dangling.orig -> empty
228 $ rm *.orig
228 $ rm *.orig
229 $ hg up -C
229 $ hg up -C
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
231
231
232 copies
232 copies
233
233
234 $ hg cp -v dangling dangling2
234 $ hg cp -v dangling dangling2
235 copying dangling to dangling2
235 copying dangling to dangling2
236 $ hg st -Cmard
236 $ hg st -Cmard
237 A dangling2
237 A dangling2
238 dangling
238 dangling
239 $ "$TESTDIR/readlink.py" dangling dangling2
239 $ "$TESTDIR/readlink.py" dangling dangling2
240 dangling -> void
240 dangling -> void
241 dangling2 -> void
241 dangling2 -> void
242
242
243
243
244 Issue995: hg copy -A incorrectly handles symbolic links
244 Issue995: hg copy -A incorrectly handles symbolic links
245
245
246 $ hg up -C
246 $ hg up -C
247 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 $ mkdir dir
248 $ mkdir dir
249 $ ln -s dir dirlink
249 $ ln -s dir dirlink
250 $ hg ci -qAm 'add dirlink'
250 $ hg ci -qAm 'add dirlink'
251 $ mkdir newdir
251 $ mkdir newdir
252 $ mv dir newdir/dir
252 $ mv dir newdir/dir
253 $ mv dirlink newdir/dirlink
253 $ mv dirlink newdir/dirlink
254 $ hg mv -A dirlink newdir/dirlink
254 $ hg mv -A dirlink newdir/dirlink
255
255
256 $ cd ..
256 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now