summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2017-02-28 09:03:55 -0300
committerThibault Saunier <thibault.saunier@osg.samsung.com>2017-02-28 09:07:05 -0300
commitbdaeadef362a0320340926a92ff04f215ab4665e (patch)
treedab5cf3b353854f3d09fd5838194887414c42361
parentdcc28348e9d25a21e0f980a1cbb66f5397da98c6 (diff)
Checkout the base commit of the first differential when building fake branch
If there are several depending revision it will always fail as the base revision won't be accessible in the local repo
-rwxr-xr-xgit-phab11
1 files changed, 9 insertions, 2 deletions
diff --git a/git-phab b/git-phab
index b53721a..d562066 100755
--- a/git-phab
+++ b/git-phab
@@ -1647,13 +1647,13 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
return (commit, remote, branch)
- def create_fake_fetch(self, revision, diff):
- current_branch = self.repo.active_branch
+ def checkout_base_revision(self, diff):
base_commit = diff.get("sourceControlBaseRevision")
if base_commit:
try:
self.repo.git.checkout(base_commit)
except git.exc.GitCommandError:
+ print("Could not get base commit %s" % base_commit)
base_commit = None
if not base_commit:
@@ -1665,11 +1665,18 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
Colors.ENDC))
self.repo.git.checkout(self.repo.head.commit.hexsha)
+ def create_fake_fetch(self, revision, diff):
+ current_branch = self.repo.active_branch
pq = self.get_differentials_to_apply_for_revision()
+
+ checkout_base_revision = True
if pq:
n = 0
while pq != []:
(r, d) = pq.pop()
+ if checkout_base_revision:
+ self.checkout_base_revision(d)
+ checkout_base_revision = False
filename = self.write_patch_file(r, d)
print("Applying D{}".format(r['id']))