From bfbf8963aff0f5c747a9ece4ec60233a913d225e Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Wed, 8 Jan 2025 11:16:33 +0100 Subject: [PATCH] When submitting multiple revisions, chain them together This fixes #387. --- apis/phabricator.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apis/phabricator.py b/apis/phabricator.py index de38a84..d9e92c5 100644 --- a/apis/phabricator.py +++ b/apis/phabricator.py @@ -84,6 +84,19 @@ def submit_to_phabricator(rev_id): if result['error']: raise Exception("Got an error from phabricator when trying to set the bugzilla id for %s" % (p)) + + # Chain revisions together if needed + parent_rev = phab_revisions[0] + for child_rev in phab_revisions[1:]: + cmd = "echo " + quote_echo_string("""{"transactions": [{"type":"parents.add", "value":"%s"}], "objectIdentifier": "%s"}""" % (child_rev, parent_rev)) + cmd += " | %s call-conduit --conduit-uri=%s differential.revision.edit --""" % (_arc(), self.url) + ret = self.run(cmd, shell=True) + result = json.loads(ret.stdout.decode()) + if result['error']: + raise Exception("Got an error from phabricator when trying chain revisions, parent: %s, child %s" % (parent_rev, child_rev)) + parent_rev = child_rev + + for p in phab_revisions: self.logger.log("Submitted phabricator patch at {0}".format(self.url + p), level=LogLevel.Info) return phab_revisions