Show More
@@ -54,7 +54,7 b' import mimetypes' | |||||
54 | import operator |
|
54 | import operator | |
55 | import re |
|
55 | import re | |
56 |
|
56 | |||
57 | from mercurial.node import bin, nullid |
|
57 | from mercurial.node import bin, nullid, short | |
58 | from mercurial.i18n import _ |
|
58 | from mercurial.i18n import _ | |
59 | from mercurial.pycompat import getattr |
|
59 | from mercurial.pycompat import getattr | |
60 | from mercurial.thirdparty import attr |
|
60 | from mercurial.thirdparty import attr | |
@@ -115,6 +115,10 b' eh.configitem(' | |||||
115 | eh.configitem( |
|
115 | eh.configitem( | |
116 | b'phabricator', b'curlcmd', default=None, |
|
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 | # developer config: phabricator.repophid |
|
122 | # developer config: phabricator.repophid | |
119 | eh.configitem( |
|
123 | eh.configitem( | |
120 | b'phabricator', b'repophid', default=None, |
|
124 | b'phabricator', b'repophid', default=None, | |
@@ -279,6 +283,21 b' def vcrcommand(name, flags, spec, helpca' | |||||
279 | return decorate |
|
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 | def urlencodenested(params): |
|
301 | def urlencodenested(params): | |
283 | """like urlencode, but works with nested parameters. |
|
302 | """like urlencode, but works with nested parameters. | |
284 |
|
303 | |||
@@ -455,7 +474,8 b' def getoldnodedrevmap(repo, nodelist):' | |||||
455 | has_node = unfi.changelog.index.has_node |
|
474 | has_node = unfi.changelog.index.has_node | |
456 |
|
475 | |||
457 | result = {} # {node: (oldnode?, lastdiff?, drev)} |
|
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 | for node in nodelist: |
|
479 | for node in nodelist: | |
460 | ctx = unfi[node] |
|
480 | ctx = unfi[node] | |
461 | # For tags like "D123", put them into "toconfirm" to verify later |
|
481 | # For tags like "D123", put them into "toconfirm" to verify later | |
@@ -526,6 +546,15 b' def getoldnodedrevmap(repo, nodelist):' | |||||
526 | lastdiff = max(diffs, key=lambda d: int(d[b'id'])) |
|
546 | lastdiff = max(diffs, key=lambda d: int(d[b'id'])) | |
527 | oldnodes = getnodes(lastdiff, precset) |
|
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 | # If this commit was the result of `hg fold` after submission, |
|
558 | # If this commit was the result of `hg fold` after submission, | |
530 | # and now resubmitted with --fold, the easiest thing to do is |
|
559 | # and now resubmitted with --fold, the easiest thing to do is | |
531 | # to leave the node clear. This only results in creating a new |
|
560 | # to leave the node clear. This only results in creating a new | |
@@ -1194,6 +1223,11 b' def _amend_diff_properties(unfi, drevid,' | |||||
1194 | This is a utility function for the amend phase of ``phabsend``, which |
|
1223 | This is a utility function for the amend phase of ``phabsend``, which | |
1195 | converts failures to warning messages. |
|
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 | try: |
|
1231 | try: | |
1198 | writediffproperties([unfi[newnode] for newnode in newnodes], diff) |
|
1232 | writediffproperties([unfi[newnode] for newnode in newnodes], diff) | |
1199 | except util.urlerr.urlerror: |
|
1233 | except util.urlerr.urlerror: |
@@ -2,6 +2,9 b'' | |||||
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 | |
@@ -90,6 +93,7 b' Create a differential diff:' | |||||
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 | |
@@ -98,8 +102,10 b' Create a differential diff:' | |||||
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 | |||
@@ -115,6 +121,7 b' behind to identify it.' | |||||
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 | |
@@ -160,15 +167,18 b' Commenting when phabsending:' | |||||
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 | |
@@ -186,6 +196,9 b' Phabesending a new binary, a modified bi' | |||||
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 | |
@@ -234,6 +247,11 b' viewable on each side.' | |||||
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: | |
@@ -312,6 +330,7 b" A bad .arcconfig doesn't error out" | |||||
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 | |||
@@ -325,6 +344,7 b' The .arcconfig content overrides global ' | |||||
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 | |||
@@ -336,6 +356,7 b" But it doesn't override local config" | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now