Show More
@@ -431,12 +431,13 b' def writediffproperties(ctx, diff):' | |||||
431 | } |
|
431 | } | |
432 | callconduit(ctx.repo().ui, b'differential.setdiffproperty', params) |
|
432 | callconduit(ctx.repo().ui, b'differential.setdiffproperty', params) | |
433 |
|
433 | |||
434 |
def createdifferentialrevision(ctx, revid=None, parentrevid |
|
434 | def createdifferentialrevision(ctx, revid=None, parentrevphid=None, | |
435 |
olddiff=None, actions=None, |
|
435 | oldnode=None, olddiff=None, actions=None, | |
|
436 | comment=None): | |||
436 | """create or update a Differential Revision |
|
437 | """create or update a Differential Revision | |
437 |
|
438 | |||
438 | If revid is None, create a new Differential Revision, otherwise update |
|
439 | If revid is None, create a new Differential Revision, otherwise update | |
439 | revid. If parentrevid is not None, set it as a dependency. |
|
440 | revid. If parentrevphid is not None, set it as a dependency. | |
440 |
|
441 | |||
441 | If oldnode is not None, check if the patch content (without commit message |
|
442 | If oldnode is not None, check if the patch content (without commit message | |
442 | and metadata) has changed before creating another diff. |
|
443 | and metadata) has changed before creating another diff. | |
@@ -465,14 +466,10 b' def createdifferentialrevision(ctx, revi' | |||||
465 | diff = olddiff |
|
466 | diff = olddiff | |
466 | writediffproperties(ctx, diff) |
|
467 | writediffproperties(ctx, diff) | |
467 |
|
468 | |||
468 | # Use a temporary summary to set dependency. There might be better ways but |
|
469 | # Set the parent Revision every time, so commit re-ordering is picked-up | |
469 | # I cannot find them for now. But do not do that if we are updating an |
|
470 | if parentrevphid: | |
470 | # existing revision (revid is not None) since that introduces visible |
|
471 | transactions.append({b'type': b'parents.set', | |
471 | # churns (someone edited "Summary" twice) on the web page. |
|
472 | b'value': [parentrevphid]}) | |
472 | if parentrevid and revid is None: |
|
|||
473 | summary = b'Depends on D%d' % parentrevid |
|
|||
474 | transactions += [{b'type': b'summary', b'value': summary}, |
|
|||
475 | {b'type': b'summary', b'value': b' '}] |
|
|||
476 |
|
473 | |||
477 | if actions: |
|
474 | if actions: | |
478 | transactions += actions |
|
475 | transactions += actions | |
@@ -583,9 +580,9 b' def phabsend(ui, repo, *revs, **opts):' | |||||
583 | drevids = [] # [int] |
|
580 | drevids = [] # [int] | |
584 | diffmap = {} # {newnode: diff} |
|
581 | diffmap = {} # {newnode: diff} | |
585 |
|
582 | |||
586 | # Send patches one by one so we know their Differential Revision IDs and |
|
583 | # Send patches one by one so we know their Differential Revision PHIDs and | |
587 | # can provide dependency relationship |
|
584 | # can provide dependency relationship | |
588 | lastrevid = None |
|
585 | lastrevphid = None | |
589 | for rev in revs: |
|
586 | for rev in revs: | |
590 | ui.debug(b'sending rev %d\n' % rev) |
|
587 | ui.debug(b'sending rev %d\n' % rev) | |
591 | ctx = repo[rev] |
|
588 | ctx = repo[rev] | |
@@ -595,10 +592,11 b' def phabsend(ui, repo, *revs, **opts):' | |||||
595 | if oldnode != ctx.node() or opts.get(b'amend'): |
|
592 | if oldnode != ctx.node() or opts.get(b'amend'): | |
596 | # Create or update Differential Revision |
|
593 | # Create or update Differential Revision | |
597 | revision, diff = createdifferentialrevision( |
|
594 | revision, diff = createdifferentialrevision( | |
598 | ctx, revid, lastrevid, oldnode, olddiff, actions, |
|
595 | ctx, revid, lastrevphid, oldnode, olddiff, actions, | |
599 | opts.get(b'comment')) |
|
596 | opts.get(b'comment')) | |
600 | diffmap[ctx.node()] = diff |
|
597 | diffmap[ctx.node()] = diff | |
601 | newrevid = int(revision[b'object'][b'id']) |
|
598 | newrevid = int(revision[b'object'][b'id']) | |
|
599 | newrevphid = revision[b'object'][b'phid'] | |||
602 | if revid: |
|
600 | if revid: | |
603 | action = b'updated' |
|
601 | action = b'updated' | |
604 | else: |
|
602 | else: | |
@@ -612,8 +610,9 b' def phabsend(ui, repo, *revs, **opts):' | |||||
612 | tags.tag(repo, tagname, ctx.node(), message=None, user=None, |
|
610 | tags.tag(repo, tagname, ctx.node(), message=None, user=None, | |
613 | date=None, local=True) |
|
611 | date=None, local=True) | |
614 | else: |
|
612 | else: | |
615 | # Nothing changed. But still set "newrevid" so the next revision |
|
613 | # Nothing changed. But still set "newrevphid" so the next revision | |
616 | # could depend on this one. |
|
614 | # could depend on this one and "newrevid" for the summary line. | |
|
615 | newrevphid = querydrev(repo, str(revid))[0][b'phid'] | |||
617 | newrevid = revid |
|
616 | newrevid = revid | |
618 | action = b'skipped' |
|
617 | action = b'skipped' | |
619 |
|
618 | |||
@@ -628,7 +627,7 b' def phabsend(ui, repo, *revs, **opts):' | |||||
628 | ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, |
|
627 | ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, | |
629 | desc)) |
|
628 | desc)) | |
630 | drevids.append(newrevid) |
|
629 | drevids.append(newrevid) | |
631 | lastrevid = newrevid |
|
630 | lastrevphid = newrevphid | |
632 |
|
631 | |||
633 | # Update commit messages and remove tags |
|
632 | # Update commit messages and remove tags | |
634 | if opts.get(b'amend'): |
|
633 | if opts.get(b'amend'): |
@@ -700,7 +700,7 b'' | |||||
700 | "phab.mercurial-scm.org" |
|
700 | "phab.mercurial-scm.org" | |
701 | ] |
|
701 | ] | |
702 | }, |
|
702 | }, | |
703 |
"body": "api.token=cli-hahayouwish&transactions%5B0%5D%5Btype%5D=update&transactions%5B0%5D%5Bvalue%5D=PHID-DIFF-4pugk2zedyh2xm27uuvh&transactions%5B1%5D%5Btype%5D= |
|
703 | "body": "api.token=cli-hahayouwish&transactions%5B0%5D%5Btype%5D=update&transactions%5B0%5D%5Bvalue%5D=PHID-DIFF-4pugk2zedyh2xm27uuvh&transactions%5B1%5D%5Btype%5D=parents.set&transactions%5B1%5D%5Bvalue%5D%5B0%5D=PHID-DREV-qb4xy3abx7eu4puizvjl&transactions%5B2%5D%5Btype%5D=title&transactions%5B2%5D%5Bvalue%5D=create+draft+change+for+phabricator+testing", | |
704 | "uri": "https://phab.mercurial-scm.org//api/differential.revision.edit", |
|
704 | "uri": "https://phab.mercurial-scm.org//api/differential.revision.edit", | |
705 | "method": "POST" |
|
705 | "method": "POST" | |
706 | }, |
|
706 | }, |
@@ -768,7 +768,7 b'' | |||||
768 | "phab.mercurial-scm.org" |
|
768 | "phab.mercurial-scm.org" | |
769 | ] |
|
769 | ] | |
770 | }, |
|
770 | }, | |
771 |
"body": "api.token=cli-hahayouwish&transactions%5B0%5D%5Btype%5D=update&transactions%5B0%5D%5Bvalue%5D=PHID-DIFF-uhbyhoejzbniwwzj2q5c&transactions%5B1%5D%5Btype%5D= |
|
771 | "body": "api.token=cli-hahayouwish&transactions%5B0%5D%5Btype%5D=update&transactions%5B0%5D%5Bvalue%5D=PHID-DIFF-uhbyhoejzbniwwzj2q5c&transactions%5B1%5D%5Btype%5D=parents.set&transactions%5B1%5D%5Bvalue%5D%5B0%5D=PHID-DREV-kikesmfxhzpfaxbzgj3l&transactions%5B2%5D%5Btype%5D=title&transactions%5B2%5D%5Bvalue%5D=create+beta+for+phabricator+test", | |
772 | "uri": "https://phab.mercurial-scm.org//api/differential.revision.edit", |
|
772 | "uri": "https://phab.mercurial-scm.org//api/differential.revision.edit", | |
773 | "method": "POST" |
|
773 | "method": "POST" | |
774 | }, |
|
774 | }, |
General Comments 0
You need to be logged in to leave comments.
Login now