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

Unified Diff: tests/git_cl_test.py

Issue 1891233003: Support getting changes of non-HEAD branches (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@branch-to-cl
Patch Set: fix Created 4 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 | « scm.py ('k') | tests/presubmit_unittest.py » ('j') | 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 a78c7383c5dc992a6906de3cbae6d36d50dbd4ad..47d05fe3178237a0ee72f333f85813ffc0cf1734 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -313,14 +313,14 @@ class TestGitCl(TestCase):
'fake_ancestor_sha'),
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', 'rev-parse', '--show-cdup'],), ''),
- ((['git', 'rev-parse', 'HEAD'],), '12345'),
+ ((['git', 'rev-parse', 'refs/heads/master'],), '12345'),
((['git', 'diff', '--name-status', '--no-renames', '-r',
- 'fake_ancestor_sha...', '.'],),
+ 'fake_ancestor_sha...refs/heads/master', '.'],),
'M\t.gitignore\n'),
((['git', 'config', 'branch.master.rietveldpatchset'],),
''),
((['git', 'log', '--pretty=format:%s%n%n%b',
- 'fake_ancestor_sha...'],),
+ 'fake_ancestor_sha...refs/heads/master'],),
'foo'),
((['git', 'config', 'user.email'],), 'me@example.com'),
stat_call,
@@ -383,9 +383,11 @@ class TestGitCl(TestCase):
((['git',
'rev-parse', '--verify', diff_base],), fake_ancestor),
((['git',
- 'merge-base', fake_ancestor, 'HEAD'],), fake_ancestor),
+ 'merge-base', fake_ancestor, 'refs/heads/'+working_branch],),
+ fake_ancestor),
((['git',
- 'rev-list', '^' + fake_ancestor, 'HEAD'],), fake_cl),
+ 'rev-list', '^' + fake_ancestor, 'refs/heads/'+working_branch],),
+ fake_cl),
# Mock a config miss (error code 1)
((['git',
'config', 'gitcl.remotebranch'],), (('', None), 1)),
@@ -449,14 +451,14 @@ class TestGitCl(TestCase):
]
@classmethod
- def _dcommit_calls_normal(cls):
+ def _dcommit_calls_normal(cls, working_branch='master'):
return [
((['git', 'rev-parse', '--show-cdup'],), ''),
- ((['git', 'rev-parse', 'HEAD'],),
+ ((['git', 'rev-parse', 'refs/heads/'+working_branch],),
'00ff397798ea57439712ed7e04ab96e13969ef40'),
((['git',
- 'diff', '--name-status', '--no-renames', '-r', 'fake_ancestor_sha...',
- '.'],),
+ 'diff', '--name-status', '--no-renames', '-r',
+ 'fake_ancestor_sha...refs/heads/'+working_branch, '.'],),
'M\tPRESUBMIT.py'),
((['git',
'config', 'branch.working.rietveldpatchset'],), '31137'),
@@ -665,7 +667,7 @@ class TestGitCl(TestCase):
self.calls = (
self._dcommit_calls_1() +
self._git_sanity_checks('fake_ancestor_sha', 'working') +
- self._dcommit_calls_normal() +
+ self._dcommit_calls_normal('working') +
self._dcommit_calls_3())
git_cl.main(['dcommit'])
@@ -723,16 +725,17 @@ class TestGitCl(TestCase):
cls._git_sanity_checks('fake_ancestor_sha', 'master',
get_remote_branch=False)) + [
((['git', 'rev-parse', '--show-cdup'],), ''),
- ((['git', 'rev-parse', 'HEAD'],), '12345'),
+ ((['git', 'rev-parse', 'refs/heads/master'],), '12345'),
((['git',
'diff', '--name-status', '--no-renames', '-r',
- 'fake_ancestor_sha...', '.'],),
+ 'fake_ancestor_sha...refs/heads/master', '.'],),
'M\t.gitignore\n'),
((['git', 'config', 'branch.master.gerritpatchset'],), ''),
] + ([] if issue else [
((['git',
- 'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),
+ 'log', '--pretty=format:%s%n%n%b',
+ 'fake_ancestor_sha...refs/heads/master'],),
'foo'),
]) + [
((['git', 'config', 'user.email'],), 'me@example.com'),
« no previous file with comments | « scm.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698