Make webkit-patch pretty-diff do the right thing for upstream branchs.

If your current branch has an upstream branch, then diff to that
branch. That way you get the same diff that git cl upload gives
instead of the diff to origin/master.

TBR=esprehn@chromium.org

Review URL: https://codereview.chromium.org/948663002
This commit is contained in:
Ojan Vafai 2015-02-20 20:28:12 -08:00
parent a267c39c01
commit 2cf6dc759d

View File

@ -138,6 +138,9 @@ class Git(SCM):
def _upstream_branch(self):
current_branch = self.current_branch()
# If the remote is pointing to something other than "." than the upstream branch isn't a local branch.
if self.read_git_config('branch.%s.remote' % current_branch, cwd=self.checkout_root, executive=self._executive) != ".":
return None
return self._branch_from_ref(self.read_git_config('branch.%s.merge' % current_branch, cwd=self.checkout_root, executive=self._executive).strip())
def _merge_base(self, git_commit=None):
@ -157,6 +160,10 @@ class Git(SCM):
git_commit = git_commit + "^.." + git_commit
return git_commit
upstream = self._upstream_branch()
if upstream:
return upstream
return self._remote_merge_base()
def changed_files(self, git_commit=None):