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)
1647 1647
1648 return (commit, remote, branch) 1648 return (commit, remote, branch)
1649 1649
1650 def create_fake_fetch(self, revision, diff): 1650 def checkout_base_revision(self, diff):
1651 current_branch = self.repo.active_branch
1652 base_commit = diff.get("sourceControlBaseRevision") 1651 base_commit = diff.get("sourceControlBaseRevision")
1653 if base_commit: 1652 if base_commit:
1654 try: 1653 try:
1655 self.repo.git.checkout(base_commit) 1654 self.repo.git.checkout(base_commit)
1656 except git.exc.GitCommandError: 1655 except git.exc.GitCommandError:
1656 print("Could not get base commit %s" % base_commit)
1657 base_commit = None 1657 base_commit = None
1658 1658
1659 if not base_commit: 1659 if not base_commit:
@@ -1665,11 +1665,18 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
1665 Colors.ENDC)) 1665 Colors.ENDC))
1666 self.repo.git.checkout(self.repo.head.commit.hexsha) 1666 self.repo.git.checkout(self.repo.head.commit.hexsha)
1667 1667
1668 def create_fake_fetch(self, revision, diff):
1669 current_branch = self.repo.active_branch
1668 pq = self.get_differentials_to_apply_for_revision() 1670 pq = self.get_differentials_to_apply_for_revision()
1671
1672 checkout_base_revision = True
1669 if pq: 1673 if pq:
1670 n = 0 1674 n = 0
1671 while pq != []: 1675 while pq != []:
1672 (r, d) = pq.pop() 1676 (r, d) = pq.pop()
1677 if checkout_base_revision:
1678 self.checkout_base_revision(d)
1679 checkout_base_revision = False
1673 1680
1674 filename = self.write_patch_file(r, d) 1681 filename = self.write_patch_file(r, d)
1675 print("Applying D{}".format(r['id'])) 1682 print("Applying D{}".format(r['id']))