##// END OF EJS Templates
tests: clarify a comment describing a phabricator test scenario...
Matt Harbison -
r45667:cf3e07d7 5.4 stable
parent child Browse files
Show More
@@ -1,965 +1,965 b''
1 1 #require vcr
2 2 $ cat >> $HGRCPATH <<EOF
3 3 > [extensions]
4 4 > phabricator =
5 5 >
6 6 > [auth]
7 7 > hgphab.schemes = https
8 8 > hgphab.prefix = phab.mercurial-scm.org
9 9 > # When working on the extension and making phabricator interaction
10 10 > # changes, edit this to be a real phabricator token. When done, edit
11 11 > # it back. The VCR transcripts will be auto-sanitised to replace your real
12 12 > # token with this value.
13 13 > hgphab.phabtoken = cli-hahayouwish
14 14 >
15 15 > [phabricator]
16 16 > debug = True
17 17 > EOF
18 18 $ hg init repo
19 19 $ cd repo
20 20 $ cat >> .hg/hgrc <<EOF
21 21 > [phabricator]
22 22 > url = https://phab.mercurial-scm.org/
23 23 > callsign = HG
24 24 > EOF
25 25 $ VCR="$TESTDIR/phabricator"
26 26
27 27 Error is handled reasonably. We override the phabtoken here so that
28 28 when you're developing changes to phabricator.py you can edit the
29 29 above config and have a real token in the test but not have to edit
30 30 this test.
31 31 $ hg phabread --config auth.hgphab.phabtoken=cli-notavalidtoken \
32 32 > --test-vcr "$VCR/phabread-conduit-error.json" D4480 | head
33 33 abort: Conduit Error (ERR-INVALID-AUTH): API token "cli-notavalidtoken" has the wrong length. API tokens should be 32 characters long.
34 34
35 35 Missing arguments don't crash, and may print the command help
36 36
37 37 $ hg debugcallconduit
38 38 hg debugcallconduit: invalid arguments
39 39 hg debugcallconduit METHOD
40 40
41 41 call Conduit API
42 42
43 43 options:
44 44
45 45 (use 'hg debugcallconduit -h' to show more help)
46 46 [255]
47 47 $ hg phabread
48 48 abort: empty DREVSPEC set
49 49 [255]
50 50
51 51 Basic phabread:
52 52 $ hg phabread --test-vcr "$VCR/phabread-4480.json" D4480 | head
53 53 # HG changeset patch
54 54 # Date 1536771503 0
55 55 # Parent a5de21c9e3703f8e8eb064bd7d893ff2f703c66a
56 56 exchangev2: start to implement pull with wire protocol v2
57 57
58 58 Wire protocol version 2 will take a substantially different
59 59 approach to exchange than version 1 (at least as far as pulling
60 60 is concerned).
61 61
62 62 This commit establishes a new exchangev2 module for holding
63 63
64 64 Phabread with multiple DREVSPEC
65 65
66 66 TODO: attempt to order related revisions like --stack?
67 67 $ hg phabread --test-vcr "$VCR/phabread-multi-drev.json" D8205 8206 D8207 \
68 68 > | grep '^Differential Revision'
69 69 Differential Revision: https://phab.mercurial-scm.org/D8205
70 70 Differential Revision: https://phab.mercurial-scm.org/D8206
71 71 Differential Revision: https://phab.mercurial-scm.org/D8207
72 72
73 73 Empty DREVSPECs don't crash
74 74
75 75 $ hg phabread --test-vcr "$VCR/phabread-empty-drev.json" D7917-D7917
76 76 abort: empty DREVSPEC set
77 77 [255]
78 78
79 79
80 80 phabupdate with an accept:
81 81 $ hg phabupdate --accept D4564 \
82 82 > -m 'I think I like where this is headed. Will read rest of series later.'\
83 83 > --test-vcr "$VCR/accept-4564.json"
84 84 abort: Conduit Error (ERR-CONDUIT-CORE): Validation errors:
85 85 - You can not accept this revision because it has already been closed. Only open revisions can be accepted.
86 86 [255]
87 87 $ hg phabupdate --accept D7913 -m 'LGTM' --test-vcr "$VCR/accept-7913.json"
88 88
89 89 Create a differential diff:
90 90 $ HGENCODING=utf-8; export HGENCODING
91 91 $ echo alpha > alpha
92 92 $ hg ci --addremove -m 'create alpha for phabricator test €'
93 93 adding alpha
94 94 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json"
95 95 D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc)
96 96 new commits: ['347bf67801e5']
97 97 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg
98 98 $ echo more >> alpha
99 99 $ HGEDITOR=true hg ci --amend
100 100 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg
101 101 $ echo beta > beta
102 102 $ hg ci --addremove -m 'create beta for phabricator test'
103 103 adding beta
104 104 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json"
105 105 c44b38f24a45 mapped to old nodes []
106 106 D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc)
107 107 D7916 - created - 9e6901f21d5b: create beta for phabricator test
108 108 new commits: ['a692622e6937']
109 109 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg
110 110 $ unset HGENCODING
111 111
112 112 The amend won't explode after posting a public commit. The local tag is left
113 113 behind to identify it.
114 114
115 115 $ echo 'public change' > beta
116 116 $ hg ci -m 'create public change for phabricator testing'
117 117 $ hg phase --public .
118 118 $ echo 'draft change' > alpha
119 119 $ hg ci -m 'create draft change for phabricator testing'
120 120 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json"
121 121 D7917 - created - 7b4185ab5d16: create public change for phabricator testing
122 122 D7918 - created - 251c1c333fc6: create draft change for phabricator testing
123 123 warning: not updating public commit 2:7b4185ab5d16
124 124 new commits: ['3244dc4a3334']
125 125 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg
126 126 $ hg tags -v
127 127 tip 3:3244dc4a3334
128 128 D7917 2:7b4185ab5d16 local
129 129
130 130 $ hg debugcallconduit user.search --test-vcr "$VCR/phab-conduit.json" <<EOF
131 131 > {
132 132 > "constraints": {
133 133 > "isBot": true
134 134 > }
135 135 > }
136 136 > EOF
137 137 {
138 138 "cursor": {
139 139 "after": null,
140 140 "before": null,
141 141 "limit": 100,
142 142 "order": null
143 143 },
144 144 "data": [],
145 145 "maps": {},
146 146 "query": {
147 147 "queryKey": null
148 148 }
149 149 }
150 150
151 151 Template keywords
152 152 $ hg log -T'{rev} {phabreview|json}\n'
153 153 3 {"id": "D7918", "url": "https://phab.mercurial-scm.org/D7918"}
154 154 2 {"id": "D7917", "url": "https://phab.mercurial-scm.org/D7917"}
155 155 1 {"id": "D7916", "url": "https://phab.mercurial-scm.org/D7916"}
156 156 0 {"id": "D7915", "url": "https://phab.mercurial-scm.org/D7915"}
157 157
158 158 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n'
159 159 3 https://phab.mercurial-scm.org/D7918 D7918
160 160 2 https://phab.mercurial-scm.org/D7917 D7917
161 161 1 https://phab.mercurial-scm.org/D7916 D7916
162 162 0 https://phab.mercurial-scm.org/D7915 D7915
163 163
164 164 Commenting when phabsending:
165 165 $ echo comment > comment
166 166 $ hg ci --addremove -m "create comment for phabricator test"
167 167 adding comment
168 168 $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json"
169 169 D7919 - created - d5dddca9023d: create comment for phabricator test
170 170 new commits: ['f7db812bbe1d']
171 171 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg
172 172 $ echo comment2 >> comment
173 173 $ hg ci --amend
174 174 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg
175 175 $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json"
176 176 1849d7828727 mapped to old nodes []
177 177 D7919 - updated - 1849d7828727: create comment for phabricator test
178 178
179 179 Phabsending a skipped commit:
180 180 $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json"
181 181 1849d7828727 mapped to old nodes ['1849d7828727']
182 182 D7919 - skipped - 1849d7828727: create comment for phabricator test
183 183
184 Phabsend doesn't create an instability when rebasing existing revisions on top
184 Phabsend doesn't create an instability when restacking existing revisions on top
185 185 of new revisions.
186 186
187 187 $ hg init reorder
188 188 $ cd reorder
189 189 $ cat >> .hg/hgrc <<EOF
190 190 > [phabricator]
191 191 > url = https://phab.mercurial-scm.org/
192 192 > callsign = HG
193 193 > [experimental]
194 194 > evolution = all
195 195 > EOF
196 196
197 197 $ echo "add" > file1.txt
198 198 $ hg ci -Aqm 'added'
199 199 $ echo "mod1" > file1.txt
200 200 $ hg ci -m 'modified 1'
201 201 $ echo "mod2" > file1.txt
202 202 $ hg ci -m 'modified 2'
203 203 $ hg phabsend -r . --test-vcr "$VCR/phabsend-add-parent-setup.json"
204 204 D8433 - created - 5d3959e20d1d: modified 2
205 205 new commits: ['2b4aa8a88d61']
206 206 $ hg log -G -T compact
207 207 @ 3[tip]:1 2b4aa8a88d61 1970-01-01 00:00 +0000 test
208 208 | modified 2
209 209 |
210 210 o 1 d549263bcb2d 1970-01-01 00:00 +0000 test
211 211 | modified 1
212 212 |
213 213 o 0 5cbade24e0fa 1970-01-01 00:00 +0000 test
214 214 added
215 215
216 216 Also check that it doesn't create more orphans outside of the stack
217 217
218 218 $ hg up -q 1
219 219 $ echo "mod3" > file1.txt
220 220 $ hg ci -m 'modified 3'
221 221 created new head
222 222 $ hg up -q 3
223 223 $ hg phabsend -r ".^ + ." --test-vcr "$VCR/phabsend-add-parent.json"
224 224 2b4aa8a88d61 mapped to old nodes ['2b4aa8a88d61']
225 225 D8434 - created - d549263bcb2d: modified 1
226 226 D8433 - updated - 2b4aa8a88d61: modified 2
227 227 new commits: ['876a60d024de']
228 228 new commits: ['0c6523cb1d0f']
229 229 restabilizing 1eda4bf55021 as d2c78c3a3e01
230 230 $ hg log -G -T compact
231 231 o 7[tip]:5 d2c78c3a3e01 1970-01-01 00:00 +0000 test
232 232 | modified 3
233 233 |
234 234 | @ 6 0c6523cb1d0f 1970-01-01 00:00 +0000 test
235 235 |/ modified 2
236 236 |
237 237 o 5:0 876a60d024de 1970-01-01 00:00 +0000 test
238 238 | modified 1
239 239 |
240 240 o 0 5cbade24e0fa 1970-01-01 00:00 +0000 test
241 241 added
242 242
243 243 Posting obsolete commits is disallowed
244 244
245 245 $ echo "mod3" > file1.txt
246 246 $ hg ci -m 'modified A'
247 247 $ echo "mod4" > file1.txt
248 248 $ hg ci -m 'modified B'
249 249
250 250 $ hg up '.^'
251 251 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 252 $ echo 'obsolete' > file1.txt
253 253 $ hg amend --config extensions.amend=
254 254 1 new orphan changesets
255 255 $ hg log -G
256 256 @ changeset: 10:082be6c94150
257 257 | tag: tip
258 258 | parent: 6:0c6523cb1d0f
259 259 | user: test
260 260 | date: Thu Jan 01 00:00:00 1970 +0000
261 261 | summary: modified A
262 262 |
263 263 | * changeset: 9:a67643f48146
264 264 | | user: test
265 265 | | date: Thu Jan 01 00:00:00 1970 +0000
266 266 | | instability: orphan
267 267 | | summary: modified B
268 268 | |
269 269 | x changeset: 8:db79727cb2f7
270 270 |/ parent: 6:0c6523cb1d0f
271 271 | user: test
272 272 | date: Thu Jan 01 00:00:00 1970 +0000
273 273 | obsolete: rewritten using amend as 10:082be6c94150
274 274 | summary: modified A
275 275 |
276 276 | o changeset: 7:d2c78c3a3e01
277 277 | | parent: 5:876a60d024de
278 278 | | user: test
279 279 | | date: Thu Jan 01 00:00:00 1970 +0000
280 280 | | summary: modified 3
281 281 | |
282 282 o | changeset: 6:0c6523cb1d0f
283 283 |/ user: test
284 284 | date: Thu Jan 01 00:00:00 1970 +0000
285 285 | summary: modified 2
286 286 |
287 287 o changeset: 5:876a60d024de
288 288 | parent: 0:5cbade24e0fa
289 289 | user: test
290 290 | date: Thu Jan 01 00:00:00 1970 +0000
291 291 | summary: modified 1
292 292 |
293 293 o changeset: 0:5cbade24e0fa
294 294 user: test
295 295 date: Thu Jan 01 00:00:00 1970 +0000
296 296 summary: added
297 297
298 298 $ hg phabsend -r 5::
299 299 abort: obsolete commits cannot be posted for review
300 300 [255]
301 301
302 302 Don't restack existing orphans
303 303
304 304 $ hg phabsend -r 5::tip --test-vcr "$VCR/phabsend-no-restack-orphan.json"
305 305 876a60d024de mapped to old nodes ['876a60d024de']
306 306 0c6523cb1d0f mapped to old nodes ['0c6523cb1d0f']
307 307 D8434 - updated - 876a60d024de: modified 1
308 308 D8433 - updated - 0c6523cb1d0f: modified 2
309 309 D8435 - created - 082be6c94150: modified A
310 310 new commits: ['b5913193c805']
311 311 not restabilizing unchanged d2c78c3a3e01
312 312 $ hg log -G
313 313 @ changeset: 11:b5913193c805
314 314 | tag: tip
315 315 | parent: 6:0c6523cb1d0f
316 316 | user: test
317 317 | date: Thu Jan 01 00:00:00 1970 +0000
318 318 | summary: modified A
319 319 |
320 320 | * changeset: 9:a67643f48146
321 321 | | user: test
322 322 | | date: Thu Jan 01 00:00:00 1970 +0000
323 323 | | instability: orphan
324 324 | | summary: modified B
325 325 | |
326 326 | x changeset: 8:db79727cb2f7
327 327 |/ parent: 6:0c6523cb1d0f
328 328 | user: test
329 329 | date: Thu Jan 01 00:00:00 1970 +0000
330 330 | obsolete: rewritten using amend, phabsend as 11:b5913193c805
331 331 | summary: modified A
332 332 |
333 333 | o changeset: 7:d2c78c3a3e01
334 334 | | parent: 5:876a60d024de
335 335 | | user: test
336 336 | | date: Thu Jan 01 00:00:00 1970 +0000
337 337 | | summary: modified 3
338 338 | |
339 339 o | changeset: 6:0c6523cb1d0f
340 340 |/ user: test
341 341 | date: Thu Jan 01 00:00:00 1970 +0000
342 342 | summary: modified 2
343 343 |
344 344 o changeset: 5:876a60d024de
345 345 | parent: 0:5cbade24e0fa
346 346 | user: test
347 347 | date: Thu Jan 01 00:00:00 1970 +0000
348 348 | summary: modified 1
349 349 |
350 350 o changeset: 0:5cbade24e0fa
351 351 user: test
352 352 date: Thu Jan 01 00:00:00 1970 +0000
353 353 summary: added
354 354
355 355 $ cd ..
356 356
357 357 Phabesending a new binary, a modified binary, and a removed binary
358 358
359 359 >>> open('bin', 'wb').write(b'\0a') and None
360 360 $ hg ci -Am 'add binary'
361 361 adding bin
362 362 >>> open('bin', 'wb').write(b'\0b') and None
363 363 $ hg ci -m 'modify binary'
364 364 $ hg rm bin
365 365 $ hg ci -m 'remove binary'
366 366 $ hg phabsend -r .~2:: --test-vcr "$VCR/phabsend-binary.json"
367 367 uploading bin@aa24a81f55de
368 368 D8007 - created - aa24a81f55de: add binary
369 369 uploading bin@d8d62a881b54
370 370 D8008 - created - d8d62a881b54: modify binary
371 371 D8009 - created - af55645b2e29: remove binary
372 372 new commits: ['b8139fbb4a57']
373 373 new commits: ['c88ce4c2d2ad']
374 374 new commits: ['75dbbc901145']
375 375 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg
376 376
377 377 Phabsend a renamed binary and a copied binary, with and without content changes
378 378 to src and dest
379 379
380 380 >>> open('bin2', 'wb').write(b'\0c') and None
381 381 $ hg ci -Am 'add another binary'
382 382 adding bin2
383 383
384 384 TODO: "bin2" can't be viewed in this commit (left or right side), and the URL
385 385 looks much different than when viewing "bin2_moved". No idea if this is a phab
386 386 bug, or phabsend bug. The patch (as printed by phabread) look reasonable
387 387 though.
388 388
389 389 $ hg mv bin2 bin2_moved
390 390 $ hg ci -m "moved binary"
391 391
392 392 Note: "bin2_moved" is also not viewable in phabricator with this review
393 393
394 394 $ hg cp bin2_moved bin2_copied
395 395 $ hg ci -m "copied binary"
396 396
397 397 Note: "bin2_moved_again" is marked binary in phabricator, and both sides of it
398 398 are viewable in their proper state. "bin2_copied" is not viewable, and not
399 399 listed as binary in phabricator.
400 400
401 401 >>> open('bin2_copied', 'wb').write(b'\0move+mod') and None
402 402 $ hg mv bin2_copied bin2_moved_again
403 403 $ hg ci -m "move+mod copied binary"
404 404
405 405 Note: "bin2_moved" and "bin2_moved_copy" are both marked binary, and both
406 406 viewable on each side.
407 407
408 408 >>> open('bin2_moved', 'wb').write(b'\0precopy mod') and None
409 409 $ hg cp bin2_moved bin2_moved_copied
410 410 >>> open('bin2_moved', 'wb').write(b'\0copy src+mod') and None
411 411 $ hg ci -m "copy+mod moved binary"
412 412
413 413 $ hg phabsend -r .~4:: --test-vcr "$VCR/phabsend-binary-renames.json"
414 414 uploading bin2@f42f9195e00c
415 415 D8128 - created - f42f9195e00c: add another binary
416 416 D8129 - created - 834ab31d80ae: moved binary
417 417 D8130 - created - 494b750e5194: copied binary
418 418 uploading bin2_moved_again@25f766b50cc2
419 419 D8131 - created - 25f766b50cc2: move+mod copied binary
420 420 uploading bin2_moved_copied@1b87b363a5e4
421 421 uploading bin2_moved@1b87b363a5e4
422 422 D8132 - created - 1b87b363a5e4: copy+mod moved binary
423 423 new commits: ['90437c20312a']
424 424 new commits: ['f391f4da4c61']
425 425 new commits: ['da86a9f3268c']
426 426 new commits: ['003ffc16ba66']
427 427 new commits: ['13bd750c36fa']
428 428 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg
429 429
430 430 Phabreading a DREV with a local:commits time as a string:
431 431 $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285
432 432 # HG changeset patch
433 433 # User Pulkit Goyal <7895pulkit@gmail.com>
434 434 # Date 1509404054 -19800
435 435 # Node ID 44fc1c1f1774a76423b9c732af6938435099bcc5
436 436 # Parent 8feef8ef8389a3b544e0a74624f1efc3a8d85d35
437 437 repoview: add a new attribute _visibilityexceptions and related API
438 438
439 439 Currently we don't have a defined way in core to make some hidden revisions
440 440 visible in filtered repo. Extensions to achieve the purpose of unhiding some
441 441 hidden commits, wrap repoview.pinnedrevs() function.
442 442
443 443 To make the above task simple and have well defined API, this patch adds a new
444 444 attribute '_visibilityexceptions' to repoview class which will contains
445 445 the hidden revs which should be exception.
446 446 This will allow to set different exceptions for different repoview objects
447 447 backed by the same unfiltered repo.
448 448
449 449 This patch also adds API to add revs to the attribute set and get them.
450 450
451 451 Thanks to Jun for suggesting the use of repoview class instead of localrepo.
452 452
453 453 Differential Revision: https://phab.mercurial-scm.org/D1285
454 454 diff --git a/mercurial/repoview.py b/mercurial/repoview.py
455 455 --- a/mercurial/repoview.py
456 456 +++ b/mercurial/repoview.py
457 457 @@ * @@ (glob)
458 458 subclasses of `localrepo`. Eg: `bundlerepo` or `statichttprepo`.
459 459 """
460 460
461 461 + # hidden revs which should be visible
462 462 + _visibilityexceptions = set()
463 463 +
464 464 def __init__(self, repo, filtername):
465 465 object.__setattr__(self, r'_unfilteredrepo', repo)
466 466 object.__setattr__(self, r'filtername', filtername)
467 467 @@ -231,6 +234,14 @@
468 468 return self
469 469 return self.unfiltered().filtered(name)
470 470
471 471 + def addvisibilityexceptions(self, revs):
472 472 + """adds hidden revs which should be visible to set of exceptions"""
473 473 + self._visibilityexceptions.update(revs)
474 474 +
475 475 + def getvisibilityexceptions(self):
476 476 + """returns the set of hidden revs which should be visible"""
477 477 + return self._visibilityexceptions
478 478 +
479 479 # everything access are forwarded to the proxied repo
480 480 def __getattr__(self, attr):
481 481 return getattr(self._unfilteredrepo, attr)
482 482 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
483 483 --- a/mercurial/localrepo.py
484 484 +++ b/mercurial/localrepo.py
485 485 @@ -570,6 +570,14 @@
486 486 def close(self):
487 487 self._writecaches()
488 488
489 489 + def addvisibilityexceptions(self, exceptions):
490 490 + # should be called on a filtered repository
491 491 + pass
492 492 +
493 493 + def getvisibilityexceptions(self):
494 494 + # should be called on a filtered repository
495 495 + return set()
496 496 +
497 497 def _loadextensions(self):
498 498 extensions.loadall(self.ui)
499 499
500 500
501 501 A bad .arcconfig doesn't error out
502 502 $ echo 'garbage' > .arcconfig
503 503 $ hg config phabricator --debug
504 504 invalid JSON in $TESTTMP/repo/.arcconfig
505 505 read config from: */.hgrc (glob)
506 506 */.hgrc:*: phabricator.debug=True (glob)
507 507 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob)
508 508 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob)
509 509
510 510 The .arcconfig content overrides global config
511 511 $ cat >> $HGRCPATH << EOF
512 512 > [phabricator]
513 513 > url = global
514 514 > callsign = global
515 515 > EOF
516 516 $ cp $TESTDIR/../.arcconfig .
517 517 $ mv .hg/hgrc .hg/hgrc.bak
518 518 $ hg config phabricator --debug
519 519 read config from: */.hgrc (glob)
520 520 */.hgrc:*: phabricator.debug=True (glob)
521 521 $TESTTMP/repo/.arcconfig: phabricator.callsign=HG
522 522 $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/
523 523
524 524 But it doesn't override local config
525 525 $ cat >> .hg/hgrc << EOF
526 526 > [phabricator]
527 527 > url = local
528 528 > callsign = local
529 529 > EOF
530 530 $ hg config phabricator --debug
531 531 read config from: */.hgrc (glob)
532 532 */.hgrc:*: phabricator.debug=True (glob)
533 533 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob)
534 534 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob)
535 535 $ mv .hg/hgrc.bak .hg/hgrc
536 536
537 537 Phabimport works with a stack
538 538
539 539 $ cd ..
540 540 $ hg clone repo repo2 -qr 1
541 541 $ cp repo/.hg/hgrc repo2/.hg/
542 542 $ cd repo2
543 543 $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json"
544 544 applying patch from D7917
545 545 applying patch from D7918
546 546 $ hg log -r .: -G -Tcompact
547 547 o 3[tip] aaef04066140 1970-01-01 00:00 +0000 test
548 548 | create draft change for phabricator testing
549 549 |
550 550 o 2 8de3712202d1 1970-01-01 00:00 +0000 test
551 551 | create public change for phabricator testing
552 552 |
553 553 @ 1 a692622e6937 1970-01-01 00:00 +0000 test
554 554 | create beta for phabricator test
555 555 ~
556 556 Phabimport can create secret commits
557 557
558 558 $ hg rollback --config ui.rollback=True
559 559 repository tip rolled back to revision 1 (undo phabimport)
560 560 $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" \
561 561 > --config phabimport.secret=True
562 562 applying patch from D7917
563 563 applying patch from D7918
564 564 $ hg log -r 'reverse(.:)' -T phases
565 565 changeset: 3:aaef04066140
566 566 tag: tip
567 567 phase: secret
568 568 user: test
569 569 date: Thu Jan 01 00:00:00 1970 +0000
570 570 summary: create draft change for phabricator testing
571 571
572 572 changeset: 2:8de3712202d1
573 573 phase: secret
574 574 user: test
575 575 date: Thu Jan 01 00:00:00 1970 +0000
576 576 summary: create public change for phabricator testing
577 577
578 578 changeset: 1:a692622e6937
579 579 phase: public
580 580 user: test
581 581 date: Thu Jan 01 00:00:00 1970 +0000
582 582 summary: create beta for phabricator test
583 583
584 584 Phabimport accepts multiple DREVSPECs
585 585
586 586 $ hg rollback --config ui.rollback=True
587 587 repository tip rolled back to revision 1 (undo phabimport)
588 588 $ hg phabimport --no-stack D7917 D7918 --test-vcr "$VCR/phabimport-multi-drev.json"
589 589 applying patch from D7917
590 590 applying patch from D7918
591 591
592 592 Phabsend requires a linear range of commits
593 593
594 594 $ hg phabsend -r 0+2+3
595 595 abort: cannot phabsend multiple head revisions: c44b38f24a45
596 596 (the revisions must form a linear chain)
597 597 [255]
598 598
599 599 Validate arguments with --fold
600 600
601 601 $ hg phabsend --fold -r 1
602 602 abort: cannot fold a single revision
603 603 [255]
604 604 $ hg phabsend --fold --no-amend -r 1::
605 605 abort: cannot fold with --no-amend
606 606 [255]
607 607 $ hg phabsend --fold -r 1::
608 608 abort: cannot fold revisions with different DREV values
609 609 [255]
610 610
611 611 Setup a series of commits to be folded, and include the Test Plan field multiple
612 612 times to test the concatenation logic. No Test Plan field in the last one to
613 613 ensure missing fields are skipped.
614 614
615 615 $ hg init ../folded
616 616 $ cd ../folded
617 617 $ cat >> .hg/hgrc <<EOF
618 618 > [phabricator]
619 619 > url = https://phab.mercurial-scm.org/
620 620 > callsign = HG
621 621 > EOF
622 622
623 623 $ echo 'added' > file.txt
624 624 $ hg ci -Aqm 'added file'
625 625
626 626 $ cat > log.txt <<EOF
627 627 > one: first commit to review
628 628 >
629 629 > This file was modified with 'mod1' as its contents.
630 630 >
631 631 > Test Plan:
632 632 > LOL! What testing?!
633 633 > EOF
634 634 $ echo mod1 > file.txt
635 635 $ hg ci -l log.txt
636 636
637 637 $ cat > log.txt <<EOF
638 638 > two: second commit to review
639 639 >
640 640 > This file was modified with 'mod2' as its contents.
641 641 >
642 642 > Test Plan:
643 643 > Haha! yeah, right.
644 644 >
645 645 > EOF
646 646 $ echo mod2 > file.txt
647 647 $ hg ci -l log.txt
648 648
649 649 $ echo mod3 > file.txt
650 650 $ hg ci -m '3: a commit with no detailed message'
651 651
652 652 The folding of immutable commits works...
653 653
654 654 $ hg phase -r tip --public
655 655 $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-immutable.json"
656 656 D8386 - created - a959a3f69d8d: one: first commit to review
657 657 D8386 - created - 24a4438154ba: two: second commit to review
658 658 D8386 - created - d235829e802c: 3: a commit with no detailed message
659 659 warning: not updating public commit 1:a959a3f69d8d
660 660 warning: not updating public commit 2:24a4438154ba
661 661 warning: not updating public commit 3:d235829e802c
662 662 no newnodes to update
663 663
664 664 $ hg phase -r 0 --draft --force
665 665
666 666 ... as does the initial mutable fold...
667 667
668 668 $ echo y | hg phabsend --fold --confirm -r 1:: \
669 669 > --test-vcr "$VCR/phabsend-fold-initial.json"
670 670 NEW - a959a3f69d8d: one: first commit to review
671 671 NEW - 24a4438154ba: two: second commit to review
672 672 NEW - d235829e802c: 3: a commit with no detailed message
673 673 Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
674 674 D8387 - created - a959a3f69d8d: one: first commit to review
675 675 D8387 - created - 24a4438154ba: two: second commit to review
676 676 D8387 - created - d235829e802c: 3: a commit with no detailed message
677 677 updating local commit list for D8387
678 678 new commits: ['602c4e738243', '832553266fe8', '921f8265efbd']
679 679 saved backup bundle to $TESTTMP/folded/.hg/strip-backup/a959a3f69d8d-a4a24136-phabsend.hg
680 680
681 681 ... and doesn't mangle the local commits.
682 682
683 683 $ hg log -T '{rev}:{node|short}\n{indent(desc, " ")}\n'
684 684 3:921f8265efbd
685 685 3: a commit with no detailed message
686 686
687 687 Differential Revision: https://phab.mercurial-scm.org/D8387
688 688 2:832553266fe8
689 689 two: second commit to review
690 690
691 691 This file was modified with 'mod2' as its contents.
692 692
693 693 Test Plan:
694 694 Haha! yeah, right.
695 695
696 696 Differential Revision: https://phab.mercurial-scm.org/D8387
697 697 1:602c4e738243
698 698 one: first commit to review
699 699
700 700 This file was modified with 'mod1' as its contents.
701 701
702 702 Test Plan:
703 703 LOL! What testing?!
704 704
705 705 Differential Revision: https://phab.mercurial-scm.org/D8387
706 706 0:98d480e0d494
707 707 added file
708 708
709 709 Setup some obsmarkers by adding a file to the middle commit. This stress tests
710 710 getoldnodedrevmap() in later phabsends.
711 711
712 712 $ hg up '.^'
713 713 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
714 714 $ echo 'modified' > file2.txt
715 715 $ hg add file2.txt
716 716 $ hg amend --config experimental.evolution=all --config extensions.amend=
717 717 1 new orphan changesets
718 718 $ hg up 3
719 719 obsolete feature not enabled but 1 markers found!
720 720 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
721 721 $ hg rebase --config experimental.evolution=all --config extensions.rebase=
722 722 note: not rebasing 2:832553266fe8 "two: second commit to review", already in destination as 4:0124e5474c88 "two: second commit to review" (tip)
723 723 rebasing 3:921f8265efbd "3: a commit with no detailed message"
724 724
725 725 When commits have changed locally, the local commit list on Phabricator is
726 726 updated.
727 727
728 728 $ echo y | hg phabsend --fold --confirm -r 1:: \
729 729 > --test-vcr "$VCR/phabsend-fold-updated.json"
730 730 obsolete feature not enabled but 2 markers found!
731 731 602c4e738243 mapped to old nodes ['602c4e738243']
732 732 0124e5474c88 mapped to old nodes ['832553266fe8']
733 733 e4edb1fe3565 mapped to old nodes ['921f8265efbd']
734 734 D8387 - 602c4e738243: one: first commit to review
735 735 D8387 - 0124e5474c88: two: second commit to review
736 736 D8387 - e4edb1fe3565: 3: a commit with no detailed message
737 737 Send the above changes to https://phab.mercurial-scm.org/ (yn)? y
738 738 D8387 - updated - 602c4e738243: one: first commit to review
739 739 D8387 - updated - 0124e5474c88: two: second commit to review
740 740 D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
741 741 obsolete feature not enabled but 2 markers found! (?)
742 742 updating local commit list for D8387
743 743 new commits: ['602c4e738243', '0124e5474c88', 'e4edb1fe3565']
744 744 $ hg log -Tcompact
745 745 obsolete feature not enabled but 2 markers found!
746 746 5[tip] e4edb1fe3565 1970-01-01 00:00 +0000 test
747 747 3: a commit with no detailed message
748 748
749 749 4:1 0124e5474c88 1970-01-01 00:00 +0000 test
750 750 two: second commit to review
751 751
752 752 1 602c4e738243 1970-01-01 00:00 +0000 test
753 753 one: first commit to review
754 754
755 755 0 98d480e0d494 1970-01-01 00:00 +0000 test
756 756 added file
757 757
758 758 When nothing has changed locally since the last phabsend, the commit list isn't
759 759 updated, and nothing is changed locally afterward.
760 760
761 761 $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-no-changes.json"
762 762 obsolete feature not enabled but 2 markers found!
763 763 602c4e738243 mapped to old nodes ['602c4e738243']
764 764 0124e5474c88 mapped to old nodes ['0124e5474c88']
765 765 e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
766 766 D8387 - updated - 602c4e738243: one: first commit to review
767 767 D8387 - updated - 0124e5474c88: two: second commit to review
768 768 D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
769 769 obsolete feature not enabled but 2 markers found! (?)
770 770 local commit list for D8387 is already up-to-date
771 771 $ hg log -Tcompact
772 772 obsolete feature not enabled but 2 markers found!
773 773 5[tip] e4edb1fe3565 1970-01-01 00:00 +0000 test
774 774 3: a commit with no detailed message
775 775
776 776 4:1 0124e5474c88 1970-01-01 00:00 +0000 test
777 777 two: second commit to review
778 778
779 779 1 602c4e738243 1970-01-01 00:00 +0000 test
780 780 one: first commit to review
781 781
782 782 0 98d480e0d494 1970-01-01 00:00 +0000 test
783 783 added file
784 784
785 785 Fold will accept new revisions at the end...
786 786
787 787 $ echo 'another mod' > file2.txt
788 788 $ hg ci -m 'four: extend the fold range'
789 789 obsolete feature not enabled but 2 markers found!
790 790 $ hg phabsend --fold -r 1:: --test-vcr "$VCR/phabsend-fold-extend-end.json" \
791 791 > --config experimental.evolution=all
792 792 602c4e738243 mapped to old nodes ['602c4e738243']
793 793 0124e5474c88 mapped to old nodes ['0124e5474c88']
794 794 e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
795 795 D8387 - updated - 602c4e738243: one: first commit to review
796 796 D8387 - updated - 0124e5474c88: two: second commit to review
797 797 D8387 - updated - e4edb1fe3565: 3: a commit with no detailed message
798 798 D8387 - created - 94aaae213b23: four: extend the fold range
799 799 updating local commit list for D8387
800 800 new commits: ['602c4e738243', '0124e5474c88', 'e4edb1fe3565', '51a04fea8707']
801 801 $ hg log -r . -T '{desc}\n'
802 802 four: extend the fold range
803 803
804 804 Differential Revision: https://phab.mercurial-scm.org/D8387
805 805 $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n' -r 1::
806 806 obsolete feature not enabled but 3 markers found!
807 807 1 https://phab.mercurial-scm.org/D8387 D8387
808 808 4 https://phab.mercurial-scm.org/D8387 D8387
809 809 5 https://phab.mercurial-scm.org/D8387 D8387
810 810 7 https://phab.mercurial-scm.org/D8387 D8387
811 811
812 812 ... and also accepts new revisions at the beginning of the range
813 813
814 814 It's a bit unfortunate that not having a Differential URL on the first commit
815 815 causes a new Differential Revision to be created, though it isn't *entirely*
816 816 unreasonable. At least this updates the subsequent commits.
817 817
818 818 TODO: See if it can reuse the existing Differential.
819 819
820 820 $ hg phabsend --fold -r 0:: --test-vcr "$VCR/phabsend-fold-extend-front.json" \
821 821 > --config experimental.evolution=all
822 822 602c4e738243 mapped to old nodes ['602c4e738243']
823 823 0124e5474c88 mapped to old nodes ['0124e5474c88']
824 824 e4edb1fe3565 mapped to old nodes ['e4edb1fe3565']
825 825 51a04fea8707 mapped to old nodes ['51a04fea8707']
826 826 D8388 - created - 98d480e0d494: added file
827 827 D8388 - updated - 602c4e738243: one: first commit to review
828 828 D8388 - updated - 0124e5474c88: two: second commit to review
829 829 D8388 - updated - e4edb1fe3565: 3: a commit with no detailed message
830 830 D8388 - updated - 51a04fea8707: four: extend the fold range
831 831 updating local commit list for D8388
832 832 new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', 'ac7db67f0991']
833 833
834 834 $ hg log -T '{rev}:{node|short}\n{indent(desc, " ")}\n'
835 835 obsolete feature not enabled but 8 markers found!
836 836 12:ac7db67f0991
837 837 four: extend the fold range
838 838
839 839 Differential Revision: https://phab.mercurial-scm.org/D8388
840 840 11:30682b960804
841 841 3: a commit with no detailed message
842 842
843 843 Differential Revision: https://phab.mercurial-scm.org/D8388
844 844 10:3ee132d41dbc
845 845 two: second commit to review
846 846
847 847 This file was modified with 'mod2' as its contents.
848 848
849 849 Test Plan:
850 850 Haha! yeah, right.
851 851
852 852 Differential Revision: https://phab.mercurial-scm.org/D8388
853 853 9:6320b7d714cf
854 854 one: first commit to review
855 855
856 856 This file was modified with 'mod1' as its contents.
857 857
858 858 Test Plan:
859 859 LOL! What testing?!
860 860
861 861 Differential Revision: https://phab.mercurial-scm.org/D8388
862 862 8:15e9b14b4b4c
863 863 added file
864 864
865 865 Differential Revision: https://phab.mercurial-scm.org/D8388
866 866
867 867 Test phabsend --fold with an `hg split` at the end of the range
868 868
869 869 $ echo foo > file3.txt
870 870 $ hg add file3.txt
871 871
872 872 $ hg log -r . -T '{desc}' > log.txt
873 873 $ echo 'amended mod' > file2.txt
874 874 $ hg ci --amend -l log.txt --config experimental.evolution=all
875 875
876 876 $ cat <<EOF | hg --config extensions.split= --config ui.interactive=True \
877 877 > --config experimental.evolution=all split -r .
878 878 > n
879 879 > y
880 880 > y
881 881 > y
882 882 > y
883 883 > EOF
884 884 diff --git a/file2.txt b/file2.txt
885 885 1 hunks, 1 lines changed
886 886 examine changes to 'file2.txt'?
887 887 (enter ? for help) [Ynesfdaq?] n
888 888
889 889 diff --git a/file3.txt b/file3.txt
890 890 new file mode 100644
891 891 examine changes to 'file3.txt'?
892 892 (enter ? for help) [Ynesfdaq?] y
893 893
894 894 @@ -0,0 +1,1 @@
895 895 +foo
896 896 record change 2/2 to 'file3.txt'?
897 897 (enter ? for help) [Ynesfdaq?] y
898 898
899 899 created new head
900 900 diff --git a/file2.txt b/file2.txt
901 901 1 hunks, 1 lines changed
902 902 examine changes to 'file2.txt'?
903 903 (enter ? for help) [Ynesfdaq?] y
904 904
905 905 @@ -1,1 +1,1 @@
906 906 -modified
907 907 +amended mod
908 908 record this change to 'file2.txt'?
909 909 (enter ? for help) [Ynesfdaq?] y
910 910
911 911 $ hg phabsend --fold -r 8:: --test-vcr "$VCR/phabsend-fold-split-end.json" \
912 912 > --config experimental.evolution=all
913 913 15e9b14b4b4c mapped to old nodes ['15e9b14b4b4c']
914 914 6320b7d714cf mapped to old nodes ['6320b7d714cf']
915 915 3ee132d41dbc mapped to old nodes ['3ee132d41dbc']
916 916 30682b960804 mapped to old nodes ['30682b960804']
917 917 6bc15dc99efd mapped to old nodes ['ac7db67f0991']
918 918 b50946d5e490 mapped to old nodes ['ac7db67f0991']
919 919 D8388 - updated - 15e9b14b4b4c: added file
920 920 D8388 - updated - 6320b7d714cf: one: first commit to review
921 921 D8388 - updated - 3ee132d41dbc: two: second commit to review
922 922 D8388 - updated - 30682b960804: 3: a commit with no detailed message
923 923 D8388 - updated - 6bc15dc99efd: four: extend the fold range
924 924 D8388 - updated - b50946d5e490: four: extend the fold range
925 925 updating local commit list for D8388
926 926 new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', '6bc15dc99efd', 'b50946d5e490']
927 927
928 928 Test phabsend --fold with an `hg fold` at the end of the range
929 929
930 930 $ hg --config experimental.evolution=all --config extensions.rebase= \
931 931 > rebase -r '.^' -r . -d '.^^' --collapse -l log.txt
932 932 rebasing 14:6bc15dc99efd "four: extend the fold range"
933 933 rebasing 15:b50946d5e490 "four: extend the fold range" (tip)
934 934
935 935 $ hg phabsend --fold -r 8:: --test-vcr "$VCR/phabsend-fold-fold-end.json" \
936 936 > --config experimental.evolution=all
937 937 15e9b14b4b4c mapped to old nodes ['15e9b14b4b4c']
938 938 6320b7d714cf mapped to old nodes ['6320b7d714cf']
939 939 3ee132d41dbc mapped to old nodes ['3ee132d41dbc']
940 940 30682b960804 mapped to old nodes ['30682b960804']
941 941 e919cdf3d4fe mapped to old nodes ['6bc15dc99efd', 'b50946d5e490']
942 942 D8388 - updated - 15e9b14b4b4c: added file
943 943 D8388 - updated - 6320b7d714cf: one: first commit to review
944 944 D8388 - updated - 3ee132d41dbc: two: second commit to review
945 945 D8388 - updated - 30682b960804: 3: a commit with no detailed message
946 946 D8388 - updated - e919cdf3d4fe: four: extend the fold range
947 947 updating local commit list for D8388
948 948 new commits: ['15e9b14b4b4c', '6320b7d714cf', '3ee132d41dbc', '30682b960804', 'e919cdf3d4fe']
949 949
950 950 $ hg log -r tip -v
951 951 obsolete feature not enabled but 12 markers found!
952 952 changeset: 16:e919cdf3d4fe
953 953 tag: tip
954 954 parent: 11:30682b960804
955 955 user: test
956 956 date: Thu Jan 01 00:00:00 1970 +0000
957 957 files: file2.txt file3.txt
958 958 description:
959 959 four: extend the fold range
960 960
961 961 Differential Revision: https://phab.mercurial-scm.org/D8388
962 962
963 963
964 964
965 965 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now