Commit 9d3b8fce authored by clemensh's avatar clemensh Committed by Commit bot

[mergeinfo.py] Use remotes/origin/master instead of master

I don't have a local master branch, so those commands failed for me.

R=hablich@chromium.org
NOTRY=true

Review-Url: https://codereview.chromium.org/2733923002
Cr-Commit-Position: refs/heads/master@{#43752}
parent a7d07a3d
......@@ -25,10 +25,9 @@ def describe_commit(git_working_dir, hash_to_search, one_line=False):
def get_followup_commits(git_working_dir, hash_to_search):
return git_execute(git_working_dir, ['log',
'--grep=' + hash_to_search,
GIT_OPTION_HASH_ONLY,
'master']).strip().splitlines()
cmd = ['log', '--grep=' + hash_to_search, GIT_OPTION_HASH_ONLY,
'remotes/origin/master'];
return git_execute(git_working_dir, cmd).strip().splitlines()
def get_merge_commits(git_working_dir, hash_to_search):
merges = get_related_commits_not_on_master(git_working_dir, hash_to_search)
......@@ -45,7 +44,7 @@ def get_related_commits_not_on_master(git_working_dir, grep_command):
GIT_OPTION_ONELINE,
'--decorate',
'--not',
'master',
'remotes/origin/master',
GIT_OPTION_HASH_ONLY])
return commits.splitlines()
......
......@@ -30,12 +30,19 @@ class TestMergeInfo(unittest.TestCase):
raise Exception(err)
return output
def _update_origin(self):
# Fetch from origin to get/update the origin/master branch
self._execute_git(['fetch', 'origin'])
def setUp(self):
if path.exists(self.base_dir):
shutil.rmtree(self.base_dir)
check_call(["git", "init", self.base_dir])
# Add fake remote with name 'origin'
self._execute_git(['remote', 'add', 'origin', self.base_dir])
# Initial commit
message = '''Initial commit'''
......@@ -68,6 +75,7 @@ class TestMergeInfo(unittest.TestCase):
def _make_empty_commit(self, message):
self._execute_git(["commit", "--allow-empty", "-m", message])
self._update_origin()
return self._get_commits()[-1]
def testCanDescribeCommit(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment