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