Mercurial > hg
annotate tests/test-import-bypass.t @ 16221:4fc9fcd991c1
bugzilla: modify access interface to include new bug states
As a first step to allowing comment text to update bug state, rework the
Bugzilla access interface to use a dictionary keyed on bug ID. Dictionary
entries will contain new state info in future changes.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Thu, 01 Mar 2012 14:51:40 +0000 |
parents | 0e0060bf2f44 |
children | 8149ff405c78 |
rev | line source |
---|---|
15442
db0340f4b507
tests: use 'hghave execbit' for tests that manipulate x bit in file system
Mads Kiilerich <mads@kiilerich.com>
parents:
15441
diff
changeset
|
1 $ "$TESTDIR/hghave" symlink execbit || exit 80 |
15441
e0348815e806
tests: use 'hghave symlink' for tests using symlinks
Mads Kiilerich <mads@kiilerich.com>
parents:
15198
diff
changeset
|
2 |
14611 | 3 $ echo "[extensions]" >> $HGRCPATH |
4 $ echo "purge=" >> $HGRCPATH | |
5 $ echo "graphlog=" >> $HGRCPATH | |
6 | |
7 $ shortlog() { | |
8 > hg glog --template '{rev}:{node|short} {author} {date|hgdate} - {branch} - {desc|firstline}\n' | |
9 > } | |
10 | |
11 Test --bypass with other options | |
12 | |
13 $ hg init repo-options | |
14 $ cd repo-options | |
15 $ echo a > a | |
16 $ hg ci -Am adda | |
17 adding a | |
18 $ echo a >> a | |
19 $ hg branch foo | |
20 marked working directory as branch foo | |
15615 | 21 (branches are permanent and global, did you want a bookmark?) |
14611 | 22 $ hg ci -Am changea |
23 $ hg export . > ../test.diff | |
24 $ hg up null | |
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
26 | |
27 Test importing an existing revision | |
28 | |
29 $ hg import --bypass --exact ../test.diff | |
30 applying ../test.diff | |
31 $ shortlog | |
32 o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
33 | | |
34 o 0:07f494440405 test 0 0 - default - adda | |
35 | |
36 | |
37 Test failure without --exact | |
38 | |
39 $ hg import --bypass ../test.diff | |
40 applying ../test.diff | |
41 unable to find 'a' for patching | |
42 abort: patch failed to apply | |
43 [255] | |
44 $ hg st | |
45 $ shortlog | |
46 o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
47 | | |
48 o 0:07f494440405 test 0 0 - default - adda | |
49 | |
50 | |
51 Test --user, --date and --message | |
52 | |
53 $ hg up 0 | |
54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
55 $ hg import --bypass --u test2 -d '1 0' -m patch2 ../test.diff | |
56 applying ../test.diff | |
57 $ cat .hg/last-message.txt | |
58 patch2 (no-eol) | |
59 $ shortlog | |
60 o 2:2e127d1da504 test2 1 0 - default - patch2 | |
61 | | |
62 | o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
63 |/ | |
64 @ 0:07f494440405 test 0 0 - default - adda | |
65 | |
15198
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
66 $ hg rollback |
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
67 repository tip rolled back to revision 1 (undo import) |
14611 | 68 |
69 Test --import-branch | |
70 | |
71 $ hg import --bypass --import-branch ../test.diff | |
72 applying ../test.diff | |
73 $ shortlog | |
74 o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
75 | | |
76 @ 0:07f494440405 test 0 0 - default - adda | |
77 | |
15198
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
78 $ hg rollback |
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
79 repository tip rolled back to revision 1 (undo import) |
14611 | 80 |
81 Test --strip | |
82 | |
83 $ hg import --bypass --strip 0 - <<EOF | |
84 > # HG changeset patch | |
85 > # User test | |
86 > # Date 0 0 | |
87 > # Branch foo | |
88 > # Node ID 4e322f7ce8e3e4203950eac9ece27bf7e45ffa6c | |
89 > # Parent 07f4944404050f47db2e5c5071e0e84e7a27bba9 | |
90 > changea | |
91 > | |
92 > diff -r 07f494440405 -r 4e322f7ce8e3 a | |
93 > --- a Thu Jan 01 00:00:00 1970 +0000 | |
94 > +++ a Thu Jan 01 00:00:00 1970 +0000 | |
95 > @@ -1,1 +1,2 @@ | |
96 > a | |
97 > +a | |
98 > EOF | |
99 applying patch from stdin | |
15198
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
100 $ hg rollback |
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
101 repository tip rolled back to revision 1 (undo import) |
14611 | 102 |
103 Test unsupported combinations | |
104 | |
105 $ hg import --bypass --no-commit ../test.diff | |
106 abort: cannot use --no-commit with --bypass | |
107 [255] | |
108 $ hg import --bypass --similarity 50 ../test.diff | |
109 abort: cannot use --similarity with --bypass | |
110 [255] | |
111 | |
112 Test commit editor | |
113 | |
16124
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
114 $ cat > ../test.diff <<EOF |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
115 > diff -r 07f494440405 -r 4e322f7ce8e3 a |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
116 > --- a/a Thu Jan 01 00:00:00 1970 +0000 |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
117 > +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
118 > @@ -1,1 +1,2 @@ |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
119 > -a |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
120 > +b |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
121 > +c |
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
122 > EOF |
14611 | 123 $ HGEDITOR=cat hg import --bypass ../test.diff |
124 applying ../test.diff | |
125 | |
126 | |
127 HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
128 HG: Leave message empty to abort commit. | |
129 HG: -- | |
130 HG: user: test | |
131 HG: branch 'default' | |
132 HG: changed a | |
133 abort: empty commit message | |
134 [255] | |
135 | |
136 Test patch.eol is handled | |
137 | |
138 $ python -c 'file("a", "wb").write("a\r\n")' | |
139 $ hg ci -m makeacrlf | |
140 $ hg import -m 'should fail because of eol' --bypass ../test.diff | |
141 applying ../test.diff | |
142 patching file a | |
143 Hunk #1 FAILED at 0 | |
144 abort: patch failed to apply | |
145 [255] | |
146 $ hg --config patch.eol=auto import -d '0 0' -m 'test patch.eol' --bypass ../test.diff | |
147 applying ../test.diff | |
148 $ shortlog | |
16124
0e0060bf2f44
patch: fuzz more aggressively to match patch(1) behaviour
Patrick Mezard <patrick@mezard.eu>
parents:
15623
diff
changeset
|
149 o 3:c606edafba99 test 0 0 - default - test patch.eol |
14611 | 150 | |
151 @ 2:872023de769d test 0 0 - default - makeacrlf | |
152 | | |
153 | o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
154 |/ | |
155 o 0:07f494440405 test 0 0 - default - adda | |
156 | |
157 | |
158 Test applying multiple patches | |
159 | |
160 $ hg up -qC 0 | |
161 $ echo e > e | |
162 $ hg ci -Am adde | |
163 adding e | |
164 created new head | |
165 $ hg export . > ../patch1.diff | |
166 $ hg up -qC 1 | |
167 $ echo f > f | |
168 $ hg ci -Am addf | |
169 adding f | |
170 $ hg export . > ../patch2.diff | |
171 $ cd .. | |
172 $ hg clone -r1 repo-options repo-multi1 | |
173 adding changesets | |
174 adding manifests | |
175 adding file changes | |
176 added 2 changesets with 2 changes to 1 files | |
177 updating to branch foo | |
178 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
179 $ cd repo-multi1 | |
180 $ hg up 0 | |
181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
182 $ hg import --bypass ../patch1.diff ../patch2.diff | |
183 applying ../patch1.diff | |
184 applying ../patch2.diff | |
185 $ shortlog | |
186 o 3:bc8ca3f8a7c4 test 0 0 - default - addf | |
187 | | |
188 o 2:16581080145e test 0 0 - default - adde | |
189 | | |
190 | o 1:4e322f7ce8e3 test 0 0 - foo - changea | |
191 |/ | |
192 @ 0:07f494440405 test 0 0 - default - adda | |
193 | |
194 | |
195 Test applying multiple patches with --exact | |
196 | |
197 $ cd .. | |
198 $ hg clone -r1 repo-options repo-multi2 | |
199 adding changesets | |
200 adding manifests | |
201 adding file changes | |
202 added 2 changesets with 2 changes to 1 files | |
203 updating to branch foo | |
204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
205 $ cd repo-multi2 | |
206 $ hg import --bypass --exact ../patch1.diff ../patch2.diff | |
207 applying ../patch1.diff | |
208 applying ../patch2.diff | |
209 $ shortlog | |
210 o 3:d60cb8989666 test 0 0 - foo - addf | |
211 | | |
212 | o 2:16581080145e test 0 0 - default - adde | |
213 | | | |
214 @ | 1:4e322f7ce8e3 test 0 0 - foo - changea | |
215 |/ | |
216 o 0:07f494440405 test 0 0 - default - adda | |
217 | |
218 | |
219 $ cd .. | |
220 | |
221 Test complicated patch with --exact | |
222 | |
223 $ hg init repo-exact | |
224 $ cd repo-exact | |
225 $ echo a > a | |
226 $ echo c > c | |
227 $ echo d > d | |
228 $ echo e > e | |
229 $ echo f > f | |
230 $ chmod +x f | |
231 $ ln -s c linkc | |
232 $ hg ci -Am t | |
233 adding a | |
234 adding c | |
235 adding d | |
236 adding e | |
237 adding f | |
238 adding linkc | |
239 $ hg cp a aa1 | |
240 $ echo b >> a | |
241 $ echo b > b | |
242 $ hg add b | |
243 $ hg cp a aa2 | |
244 $ echo aa >> aa2 | |
245 $ chmod +x e | |
246 $ chmod -x f | |
247 $ ln -s a linka | |
248 $ hg rm d | |
249 $ hg rm linkc | |
250 $ hg mv c cc | |
251 $ hg ci -m patch | |
252 $ hg export --git . > ../test.diff | |
253 $ hg up -C null | |
254 0 files updated, 0 files merged, 7 files removed, 0 files unresolved | |
255 $ hg purge | |
256 $ hg st | |
257 $ hg import --bypass --exact ../test.diff | |
258 applying ../test.diff | |
259 | |
260 The patch should have matched the exported revision and generated no additional | |
261 data. If not, diff both heads to debug it. | |
262 | |
263 $ shortlog | |
264 o 1:2978fd5c8aa4 test 0 0 - default - patch | |
265 | | |
266 o 0:a0e19e636a43 test 0 0 - default - t | |
267 |