From 2cf6dc759d669241cd54e1891ba1d04e6ba16a31 Mon Sep 17 00:00:00 2001 From: Ojan Vafai Date: Fri, 20 Feb 2015 20:28:12 -0800 Subject: [PATCH] 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 --- tools/webkitpy/common/checkout/scm/git.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/webkitpy/common/checkout/scm/git.py b/tools/webkitpy/common/checkout/scm/git.py index 9f0571880a0..909bd8ccd11 100644 --- a/tools/webkitpy/common/checkout/scm/git.py +++ b/tools/webkitpy/common/checkout/scm/git.py @@ -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):