diff options
author | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-11-14 10:30:59 -0300 |
---|---|---|
committer | Thibault Saunier <thibault.saunier@osg.samsung.com> | 2016-11-14 13:07:17 -0300 |
commit | 733f0bba2197ba3e500a31c28de41716fb88c88f (patch) | |
tree | 7bdb19dbcdf3868a0f847b4a95e6a85fc90ac726 | |
parent | df7afa8b6a31faf5a8ef45deca3ac9eef81418e3 (diff) |
Never add dependency on already closed revisions
Fixes T7574
Reviewed-by: Daniel Stone <daniels@collabora.com>
Differential Revision: https://phabricator.freedesktop.org/D1480
-rwxr-xr-x | git-phab | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1008,7 +1008,7 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri) name="local:commits", data=json.dumps(commit_infos)) - def attach_commit(self, commit): + def attach_commit(self, commit, proposed_commits): linter_message = None print(" * Running linters...", end="") linter_status = "none" @@ -1041,9 +1041,13 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri) except IndexError: last_revision_id = None - if last_revision_id: + # Make sure that we do no add dependency on already closed revision + # (avoiding making query on the server when not needed) + if last_revision_id and \ + self.repo.head.commit.parents[0] not in proposed_commits and \ + not self.phabricator.differential.query(ids=[last_revision_id], + status="status-closed"): body.append("Depends on D%s" % last_revision_id) - phab_fields.append("Projects: %s" % ','.join(self.project_phids)) summary = ('\n'.join(body) + '\n' + @@ -1205,7 +1209,8 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri) if not patch_attachement_failure and commit in commits: print("-> Attaching %s:" % self.format_commit(commit)) try: - new, revision, diff = self.attach_commit(commit) + new, revision, diff = self.attach_commit( + commit, all_commits) except Exception as e: logging.exception("Failed proposing patch. " "Finnish rebuilding branch " |