Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: tests/git_cl_test.py

Issue 1110293002: Make git cl upload correctly track upstream refs when uploading to Gerrit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Long line fix & rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_cl_test.py
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index f633581165cdbc6af2c56e06aab5eaec7e807686..bb963c76a0a381fb91429d04e45d55df53fc2690 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -581,7 +581,8 @@ class TestGitCl(TestCase):
]
@staticmethod
- def _gerrit_upload_calls(description, reviewers, squash):
+ def _gerrit_upload_calls(description, reviewers, squash,
+ expected_upstream_ref='origin/refs/heads/master'):
calls = [
((['git', 'log', '--pretty=format:%s\n\n%b',
'fake_ancestor_sha..HEAD'],),
@@ -620,7 +621,8 @@ class TestGitCl(TestCase):
ref_to_push = 'HEAD'
calls += [
- ((['git', 'rev-list', 'origin/master..' + ref_to_push],), ''),
+ ((['git', 'rev-list',
+ expected_upstream_ref + '..' + ref_to_push],), ''),
((['git', 'config', 'rietveld.cc'],), '')
]
receive_pack = '--receive-pack=git receive-pack '
@@ -632,7 +634,8 @@ class TestGitCl(TestCase):
receive_pack += ''
calls += [
((['git',
- 'push', receive_pack, 'origin', ref_to_push + ':refs/for/master'],),
+ 'push', receive_pack, 'origin',
+ ref_to_push + ':refs/for/refs/heads/master'],),
'')
]
if squash:
@@ -650,10 +653,13 @@ class TestGitCl(TestCase):
upload_args,
description,
reviewers,
- squash=False):
+ squash=False,
+ expected_upstream_ref='origin/refs/heads/master'):
"""Generic gerrit upload test framework."""
self.calls = self._gerrit_base_calls()
- self.calls += self._gerrit_upload_calls(description, reviewers, squash)
+ self.calls += self._gerrit_upload_calls(
+ description, reviewers, squash,
+ expected_upstream_ref=expected_upstream_ref)
git_cl.main(['upload'] + upload_args)
def test_gerrit_upload_without_change_id(self):
@@ -686,7 +692,8 @@ class TestGitCl(TestCase):
['--squash'],
'desc\n\nBUG=\nChange-Id:123456789\n',
[],
- squash=True)
+ squash=True,
+ expected_upstream_ref='origin/master')
def test_config_gerrit_download_hook(self):
self.mock(git_cl, 'FindCodereviewSettingsFile', CodereviewSettingsFileMock)
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698