Show More
@@ -54,7 +54,7 import mimetypes | |||
|
54 | 54 | import operator |
|
55 | 55 | import re |
|
56 | 56 | |
|
57 | from mercurial.node import bin, nullid | |
|
57 | from mercurial.node import bin, nullid, short | |
|
58 | 58 | from mercurial.i18n import _ |
|
59 | 59 | from mercurial.pycompat import getattr |
|
60 | 60 | from mercurial.thirdparty import attr |
@@ -115,6 +115,10 eh.configitem( | |||
|
115 | 115 | eh.configitem( |
|
116 | 116 | b'phabricator', b'curlcmd', default=None, |
|
117 | 117 | ) |
|
118 | # developer config: phabricator.debug | |
|
119 | eh.configitem( | |
|
120 | b'phabricator', b'debug', default=False, | |
|
121 | ) | |
|
118 | 122 | # developer config: phabricator.repophid |
|
119 | 123 | eh.configitem( |
|
120 | 124 | b'phabricator', b'repophid', default=None, |
@@ -279,6 +283,21 def vcrcommand(name, flags, spec, helpca | |||
|
279 | 283 | return decorate |
|
280 | 284 | |
|
281 | 285 | |
|
286 | def _debug(ui, *msg, **opts): | |
|
287 | """write debug output for Phabricator if ``phabricator.debug`` is set | |
|
288 | ||
|
289 | Specifically, this avoids dumping Conduit and HTTP auth chatter that is | |
|
290 | printed with the --debug argument. | |
|
291 | """ | |
|
292 | if ui.configbool(b"phabricator", b"debug"): | |
|
293 | flag = ui.debugflag | |
|
294 | try: | |
|
295 | ui.debugflag = True | |
|
296 | ui.write(*msg, **opts) | |
|
297 | finally: | |
|
298 | ui.debugflag = flag | |
|
299 | ||
|
300 | ||
|
282 | 301 | def urlencodenested(params): |
|
283 | 302 | """like urlencode, but works with nested parameters. |
|
284 | 303 | |
@@ -455,7 +474,8 def getoldnodedrevmap(repo, nodelist): | |||
|
455 | 474 | has_node = unfi.changelog.index.has_node |
|
456 | 475 | |
|
457 | 476 | result = {} # {node: (oldnode?, lastdiff?, drev)} |
|
458 | toconfirm = {} # {node: (force, {precnode}, drev)} | |
|
477 | # ordered for test stability when printing new -> old mapping below | |
|
478 | toconfirm = util.sortdict() # {node: (force, {precnode}, drev)} | |
|
459 | 479 | for node in nodelist: |
|
460 | 480 | ctx = unfi[node] |
|
461 | 481 | # For tags like "D123", put them into "toconfirm" to verify later |
@@ -526,6 +546,15 def getoldnodedrevmap(repo, nodelist): | |||
|
526 | 546 | lastdiff = max(diffs, key=lambda d: int(d[b'id'])) |
|
527 | 547 | oldnodes = getnodes(lastdiff, precset) |
|
528 | 548 | |
|
549 | _debug( | |
|
550 | unfi.ui, | |
|
551 | b"%s mapped to old nodes %s\n" | |
|
552 | % ( | |
|
553 | short(newnode), | |
|
554 | stringutil.pprint([short(n) for n in sorted(oldnodes)]), | |
|
555 | ), | |
|
556 | ) | |
|
557 | ||
|
529 | 558 | # If this commit was the result of `hg fold` after submission, |
|
530 | 559 | # and now resubmitted with --fold, the easiest thing to do is |
|
531 | 560 | # to leave the node clear. This only results in creating a new |
@@ -1194,6 +1223,11 def _amend_diff_properties(unfi, drevid, | |||
|
1194 | 1223 | This is a utility function for the amend phase of ``phabsend``, which |
|
1195 | 1224 | converts failures to warning messages. |
|
1196 | 1225 | """ |
|
1226 | _debug( | |
|
1227 | unfi.ui, | |
|
1228 | b"new commits: %s\n" % stringutil.pprint([short(n) for n in newnodes]), | |
|
1229 | ) | |
|
1230 | ||
|
1197 | 1231 | try: |
|
1198 | 1232 | writediffproperties([unfi[newnode] for newnode in newnodes], diff) |
|
1199 | 1233 | except util.urlerr.urlerror: |
@@ -2,6 +2,9 | |||
|
2 | 2 | $ cat >> $HGRCPATH <<EOF |
|
3 | 3 | > [extensions] |
|
4 | 4 | > phabricator = |
|
5 | > | |
|
6 | > [phabricator] | |
|
7 | > debug = True | |
|
5 | 8 | > EOF |
|
6 | 9 | $ hg init repo |
|
7 | 10 | $ cd repo |
@@ -90,6 +93,7 Create a differential diff: | |||
|
90 | 93 | adding alpha |
|
91 | 94 | $ hg phabsend -r . --test-vcr "$VCR/phabsend-create-alpha.json" |
|
92 | 95 | D7915 - created - d386117f30e6: create alpha for phabricator test \xe2\x82\xac (esc) |
|
96 | new commits: ['347bf67801e5'] | |
|
93 | 97 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d386117f30e6-24ffe649-phabsend.hg |
|
94 | 98 | $ echo more >> alpha |
|
95 | 99 | $ HGEDITOR=true hg ci --amend |
@@ -98,8 +102,10 Create a differential diff: | |||
|
98 | 102 | $ hg ci --addremove -m 'create beta for phabricator test' |
|
99 | 103 | adding beta |
|
100 | 104 | $ hg phabsend -r ".^::" --test-vcr "$VCR/phabsend-update-alpha-create-beta.json" |
|
105 | c44b38f24a45 mapped to old nodes [] | |
|
101 | 106 | D7915 - updated - c44b38f24a45: create alpha for phabricator test \xe2\x82\xac (esc) |
|
102 | 107 | D7916 - created - 9e6901f21d5b: create beta for phabricator test |
|
108 | new commits: ['a692622e6937'] | |
|
103 | 109 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9e6901f21d5b-1fcd4f0e-phabsend.hg |
|
104 | 110 | $ unset HGENCODING |
|
105 | 111 | |
@@ -115,6 +121,7 behind to identify it. | |||
|
115 | 121 | D7917 - created - 7b4185ab5d16: create public change for phabricator testing |
|
116 | 122 | D7918 - created - 251c1c333fc6: create draft change for phabricator testing |
|
117 | 123 | warning: not updating public commit 2:7b4185ab5d16 |
|
124 | new commits: ['3244dc4a3334'] | |
|
118 | 125 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/251c1c333fc6-41cb7c3b-phabsend.hg |
|
119 | 126 | $ hg tags -v |
|
120 | 127 | tip 3:3244dc4a3334 |
@@ -160,15 +167,18 Commenting when phabsending: | |||
|
160 | 167 | adding comment |
|
161 | 168 | $ hg phabsend -r . -m "For default branch" --test-vcr "$VCR/phabsend-comment-created.json" |
|
162 | 169 | D7919 - created - d5dddca9023d: create comment for phabricator test |
|
170 | new commits: ['f7db812bbe1d'] | |
|
163 | 171 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d5dddca9023d-adf673ba-phabsend.hg |
|
164 | 172 | $ echo comment2 >> comment |
|
165 | 173 | $ hg ci --amend |
|
166 | 174 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f7db812bbe1d-8fcded77-amend.hg |
|
167 | 175 | $ hg phabsend -r . -m "Address review comments" --test-vcr "$VCR/phabsend-comment-updated.json" |
|
176 | 1849d7828727 mapped to old nodes [] | |
|
168 | 177 | D7919 - updated - 1849d7828727: create comment for phabricator test |
|
169 | 178 | |
|
170 | 179 | Phabsending a skipped commit: |
|
171 | 180 | $ hg phabsend --no-amend -r . --test-vcr "$VCR/phabsend-skipped.json" |
|
181 | 1849d7828727 mapped to old nodes ['1849d7828727'] | |
|
172 | 182 | D7919 - skipped - 1849d7828727: create comment for phabricator test |
|
173 | 183 | |
|
174 | 184 | Phabesending a new binary, a modified binary, and a removed binary |
@@ -186,6 +196,9 Phabesending a new binary, a modified bi | |||
|
186 | 196 | uploading bin@d8d62a881b54 |
|
187 | 197 | D8008 - created - d8d62a881b54: modify binary |
|
188 | 198 | D8009 - created - af55645b2e29: remove binary |
|
199 | new commits: ['b8139fbb4a57'] | |
|
200 | new commits: ['c88ce4c2d2ad'] | |
|
201 | new commits: ['75dbbc901145'] | |
|
189 | 202 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/aa24a81f55de-a3a0cf24-phabsend.hg |
|
190 | 203 | |
|
191 | 204 | Phabsend a renamed binary and a copied binary, with and without content changes |
@@ -234,6 +247,11 viewable on each side. | |||
|
234 | 247 | uploading bin2_moved_copied@1b87b363a5e4 |
|
235 | 248 | uploading bin2_moved@1b87b363a5e4 |
|
236 | 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 | 255 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/f42f9195e00c-e82a0769-phabsend.hg |
|
238 | 256 | |
|
239 | 257 | Phabreading a DREV with a local:commits time as a string: |
@@ -312,6 +330,7 A bad .arcconfig doesn't error out | |||
|
312 | 330 | $ hg config phabricator --debug |
|
313 | 331 | invalid JSON in $TESTTMP/repo/.arcconfig |
|
314 | 332 | read config from: */.hgrc (glob) |
|
333 | */.hgrc:*: phabricator.debug=True (glob) | |
|
315 | 334 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=https://phab.mercurial-scm.org/ (glob) |
|
316 | 335 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=HG (glob) |
|
317 | 336 | |
@@ -325,6 +344,7 The .arcconfig content overrides global | |||
|
325 | 344 | $ mv .hg/hgrc .hg/hgrc.bak |
|
326 | 345 | $ hg config phabricator --debug |
|
327 | 346 | read config from: */.hgrc (glob) |
|
347 | */.hgrc:*: phabricator.debug=True (glob) | |
|
328 | 348 | $TESTTMP/repo/.arcconfig: phabricator.callsign=HG |
|
329 | 349 | $TESTTMP/repo/.arcconfig: phabricator.url=https://phab.mercurial-scm.org/ |
|
330 | 350 | |
@@ -336,6 +356,7 But it doesn't override local config | |||
|
336 | 356 | > EOF |
|
337 | 357 | $ hg config phabricator --debug |
|
338 | 358 | read config from: */.hgrc (glob) |
|
359 | */.hgrc:*: phabricator.debug=True (glob) | |
|
339 | 360 | $TESTTMP/repo/.hg/hgrc:*: phabricator.url=local (glob) |
|
340 | 361 | $TESTTMP/repo/.hg/hgrc:*: phabricator.callsign=local (glob) |
|
341 | 362 | $ mv .hg/hgrc.bak .hg/hgrc |
General Comments 0
You need to be logged in to leave comments.
Login now