Mercurial > hg
comparison tests/test-phabricator.t @ 44715:38f7b2f02f6d
phabricator: add debug logging to show previous node values in `phabsend`
This isn't real useful here, but was very useful showing how `phabsend --fold`
handles commits created by `hg fold` and `hg split`. It introduces a new debug
function and flag instead of using `ui.debug()`, because `--debug` prints out
all of the API chatter.
Differential Revision: https://phab.mercurial-scm.org/D8389
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 05 Apr 2020 21:19:21 -0400 |
parents | a7f8c657a3f0 |
children | ed81fa859426 |
comparison
equal
deleted
inserted
replaced
44714:8dbcd5138102 | 44715:38f7b2f02f6d |
---|---|
1 #require vcr | 1 #require vcr |
2 $ cat >> $HGRCPATH <<EOF | 2 $ cat >> $HGRCPATH <<EOF |
3 > [extensions] | 3 > [extensions] |
4 > phabricator = | 4 > phabricator = |
5 > | |
6 > [phabricator] | |
7 > debug = True | |
5 > EOF | 8 > EOF |
6 $ hg init repo | 9 $ hg init repo |
7 $ cd repo | 10 $ cd repo |
8 $ cat >> .hg/hgrc <<EOF | 11 $ cat >> .hg/hgrc <<EOF |
9 > [phabricator] | 12 > [phabricator] |
88 $ echo alpha > alpha | 91 $ echo alpha > alpha |
89 $ hg ci --addremove -m 'create alpha for phabricator test €' | 92 $ hg ci --addremove -m 'create alpha for phabricator test €' |
90 adding alpha | 93 adding alpha |
91 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" | 94 $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" |
92 D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) | 95 D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) |
96 new commits: ['347bf67801e5'] | |
93 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg | 97 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg |
94 $ echo more >> alpha | 98 $ echo more >> alpha |
95 $ HGEDITOR=true hg ci --amend | 99 $ HGEDITOR=true hg ci --amend |
96 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg | 100 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/347bf67801e5-3bf313e4-amend.hg |
97 $ echo beta > beta | 101 $ echo beta > beta |
98 $ hg ci --addremove -m 'create beta for phabricator test' | 102 $ hg ci --addremove -m 'create beta for phabricator test' |
99 adding beta | 103 adding beta |
100 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" | 104 $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" |
105 c44b38f24a45 mapped to old nodes [] | |
101 D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc) | 106 D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc) |
102 D7916 - created - 9e6901f21d5b: create beta for phabricator test | 107 D7916 - created - 9e6901f21d5b: create beta for phabricator test |
108 new commits: ['a692622e6937'] | |
103 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg | 109 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg |
104 $ unset HGENCODING | 110 $ unset HGENCODING |
105 | 111 |
106 The amend won't explode after posting a public commit. The local tag is left | 112 The amend won't explode after posting a public commit. The local tag is left |
107 behind to identify it. | 113 behind to identify it. |
113 $ hg ci -m 'create draft change for phabricator testing' | 119 $ hg ci -m 'create draft change for phabricator testing' |
114 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" | 120 $ hg phabsend --amend -r '.^::' --test-vcr "$VCR/phabsend-create-public.json" |
115 D7917 - created - 7b4185ab5d16: create public change for phabricator testing | 121 D7917 - created - 7b4185ab5d16: create public change for phabricator testing |
116 D7918 - created - 251c1c333fc6: create draft change for phabricator testing | 122 D7918 - created - 251c1c333fc6: create draft change for phabricator testing |
117 warning: not updating public commit 2:7b4185ab5d16 | 123 warning: not updating public commit 2:7b4185ab5d16 |
124 new commits: ['3244dc4a3334'] | |
118 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg | 125 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg |
119 $ hg tags -v | 126 $ hg tags -v |
120 tip 3:3244dc4a3334 | 127 tip 3:3244dc4a3334 |
121 D7917 2:7b4185ab5d16 local | 128 D7917 2:7b4185ab5d16 local |
122 | 129 |
158 $ echo comment > comment | 165 $ echo comment > comment |
159 $ hg ci --addremove -m "create comment for phabricator test" | 166 $ hg ci --addremove -m "create comment for phabricator test" |
160 adding comment | 167 adding comment |
161 $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json" | 168 $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json" |
162 D7919 - created - d5dddca9023d: create comment for phabricator test | 169 D7919 - created - d5dddca9023d: create comment for phabricator test |
170 new commits: ['f7db812bbe1d'] | |
163 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg | 171 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg |
164 $ echo comment2 >> comment | 172 $ echo comment2 >> comment |
165 $ hg ci --amend | 173 $ hg ci --amend |
166 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg | 174 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg |
167 $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json" | 175 $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json" |
176 1849d7828727 mapped to old nodes [] | |
168 D7919 - updated - 1849d7828727: create comment for phabricator test | 177 D7919 - updated - 1849d7828727: create comment for phabricator test |
169 | 178 |
170 Phabsending a skipped commit: | 179 Phabsending a skipped commit: |
171 $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json" | 180 $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json" |
181 1849d7828727 mapped to old nodes ['1849d7828727'] | |
172 D7919 - skipped - 1849d7828727: create comment for phabricator test | 182 D7919 - skipped - 1849d7828727: create comment for phabricator test |
173 | 183 |
174 Phabesending a new binary, a modified binary, and a removed binary | 184 Phabesending a new binary, a modified binary, and a removed binary |
175 | 185 |
176 >>> open('bin', 'wb').write(b'\0a') and None | 186 >>> open('bin', 'wb').write(b'\0a') and None |
184 uploading bin@aa24a81f55de | 194 uploading bin@aa24a81f55de |
185 D8007 - created - aa24a81f55de: add binary | 195 D8007 - created - aa24a81f55de: add binary |
186 uploading bin@d8d62a881b54 | 196 uploading bin@d8d62a881b54 |
187 D8008 - created - d8d62a881b54: modify binary | 197 D8008 - created - d8d62a881b54: modify binary |
188 D8009 - created - af55645b2e29: remove binary | 198 D8009 - created - af55645b2e29: remove binary |
199 new commits: ['b8139fbb4a57'] | |
200 new commits: ['c88ce4c2d2ad'] | |
201 new commits: ['75dbbc901145'] | |
189 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg | 202 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg |
190 | 203 |
191 Phabsend a renamed binary and a copied binary, with and without content changes | 204 Phabsend a renamed binary and a copied binary, with and without content changes |
192 to src and dest | 205 to src and dest |
193 | 206 |
232 uploading bin2_moved_again@25f766b50cc2 | 245 uploading bin2_moved_again@25f766b50cc2 |
233 D8131 - created - 25f766b50cc2: move+mod copied binary | 246 D8131 - created - 25f766b50cc2: move+mod copied binary |
234 uploading bin2_moved_copied@1b87b363a5e4 | 247 uploading bin2_moved_copied@1b87b363a5e4 |
235 uploading bin2_moved@1b87b363a5e4 | 248 uploading bin2_moved@1b87b363a5e4 |
236 D8132 - created - 1b87b363a5e4: copy+mod moved binary | 249 D8132 - created - 1b87b363a5e4: copy+mod moved binary |
250 new commits: ['90437c20312a'] | |
251 new commits: ['f391f4da4c61'] | |
252 new commits: ['da86a9f3268c'] | |
253 new commits: ['003ffc16ba66'] | |
254 new commits: ['13bd750c36fa'] | |
237 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg | 255 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg |
238 | 256 |
239 Phabreading a DREV with a local:commits time as a string: | 257 Phabreading a DREV with a local:commits time as a string: |
240 $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285 | 258 $ hg phabread --test-vcr "$VCR/phabread-str-time.json" D1285 |
241 # HG changeset patch | 259 # HG changeset patch |
310 A bad .arcconfig doesn't error out | 328 A bad .arcconfig doesn't error out |
311 $ echo 'garbage' > .arcconfig | 329 $ echo 'garbage' > .arcconfig |
312 $ hg config phabricator --debug | 330 $ hg config phabricator --debug |
313 invalid JSON in $TESTTMP/repo/.arcconfig | 331 invalid JSON in $TESTTMP/repo/.arcconfig |
314 read config from: */.hgrc (glob) | 332 read config from: */.hgrc (glob) |
333 */.hgrc:*: phabricator.debug=True (glob) | |
315 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob) | 334 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob) |
316 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob) | 335 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob) |
317 | 336 |
318 The .arcconfig content overrides global config | 337 The .arcconfig content overrides global config |
319 $ cat >> $HGRCPATH << EOF | 338 $ cat >> $HGRCPATH << EOF |
323 > EOF | 342 > EOF |
324 $ cp $TESTDIR/../.arcconfig . | 343 $ cp $TESTDIR/../.arcconfig . |
325 $ mv .hg/hgrc .hg/hgrc.bak | 344 $ mv .hg/hgrc .hg/hgrc.bak |
326 $ hg config phabricator --debug | 345 $ hg config phabricator --debug |
327 read config from: */.hgrc (glob) | 346 read config from: */.hgrc (glob) |
347 */.hgrc:*: phabricator.debug=True (glob) | |
328 $TESTTMP/repo/.arcconfig: phabricator.callsign=HG | 348 $TESTTMP/repo/.arcconfig: phabricator.callsign=HG |
329 $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ | 349 $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ |
330 | 350 |
331 But it doesn't override local config | 351 But it doesn't override local config |
332 $ cat >> .hg/hgrc << EOF | 352 $ cat >> .hg/hgrc << EOF |
334 > url = local | 354 > url = local |
335 > callsign = local | 355 > callsign = local |
336 > EOF | 356 > EOF |
337 $ hg config phabricator --debug | 357 $ hg config phabricator --debug |
338 read config from: */.hgrc (glob) | 358 read config from: */.hgrc (glob) |
359 */.hgrc:*: phabricator.debug=True (glob) | |
339 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob) | 360 $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob) |
340 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob) | 361 $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob) |
341 $ mv .hg/hgrc.bak .hg/hgrc | 362 $ mv .hg/hgrc.bak .hg/hgrc |
342 | 363 |
343 Phabimport works with a stack | 364 Phabimport works with a stack |