diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-03-12 14:11:15 +0100 |
commit | dd91e772430dc294e3bf478c119ef8d43c0a3358 (patch) | |
tree | 6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Tools/Scripts/webkitpy/common/checkout/scm/git.py | |
parent | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff) | |
download | qtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz |
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Tools/Scripts/webkitpy/common/checkout/scm/git.py')
-rw-r--r-- | Tools/Scripts/webkitpy/common/checkout/scm/git.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/Tools/Scripts/webkitpy/common/checkout/scm/git.py index 7c5d80cc3..c7dbd7ca1 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/git.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/git.py @@ -170,11 +170,28 @@ class Git(SCM, SVNRepository): return_code = self.run(["git", "show", "HEAD:%s" % path], return_exit_code=True, decode_output=False) return return_code != self.ERROR_FILE_IS_MISSING + def _branch_from_ref(self, ref): + return ref.replace('refs/heads/', '') + + def _current_branch(self): + return self._branch_from_ref(self.run(['git', 'symbolic-ref', '-q', 'HEAD'], cwd=self.checkout_root).strip()) + + def _upstream_branch(self): + current_branch = self._current_branch() + return self._branch_from_ref(self.read_git_config('branch.%s.merge' % current_branch, cwd=self.checkout_root).strip()) + def merge_base(self, git_commit): if git_commit: - # Special-case HEAD.. to mean working-copy changes only. - if git_commit.upper() == 'HEAD..': - return 'HEAD' + # Rewrite UPSTREAM to the upstream branch + if 'UPSTREAM' in git_commit: + upstream = self._upstream_branch() + if not upstream: + raise ScriptError(message='No upstream/tracking branch set.') + git_commit = git_commit.replace('UPSTREAM', upstream) + + # Special-case <refname>.. to include working copy changes, e.g., 'HEAD....' shows only the diffs from HEAD. + if git_commit.endswith('....'): + return git_commit[:-4] if '..' not in git_commit: git_commit = git_commit + "^.." + git_commit @@ -350,8 +367,7 @@ class Git(SCM, SVNRepository): return self.push_local_commits_to_server(username=username, password=password) def _commit_on_branch(self, message, git_commit, username=None, password=None): - branch_ref = self.run(['git', 'symbolic-ref', 'HEAD']).strip() - branch_name = branch_ref.replace('refs/heads/', '') + branch_name = self._current_branch() commit_ids = self.commit_ids_from_commitish_arguments([git_commit]) # We want to squash all this branch's commits into one commit with the proper description. |