| Index: tests/git_cl_test.py
|
| diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
|
| index 81540a9d33063d04c3f4e31edb5e53ce20028285..d48831e3cb1590b5cdc575b66d915a72f305e108 100755
|
| --- a/tests/git_cl_test.py
|
| +++ b/tests/git_cl_test.py
|
| @@ -609,12 +609,7 @@ class TestGitCl(TestCase):
|
| ((['git', 'config', 'core.editor'],), ''),
|
| ] + cc_call + private_call + [
|
| ((['git', 'config', 'branch.master.base-url'],), ''),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],), ''),
|
| - ((['git',
|
| - 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
|
| - (('', None), 0)),
|
| - ((['git', 'rev-parse', '--show-cdup'],), ''),
|
| - ((['git', 'svn', 'info'],), ''),
|
| + ((['git', 'config', 'remote.origin.url'],), ''),
|
| ((['git', 'config', 'rietveld.project'],), ''),
|
| ((['git', 'config', 'branch.master.rietveldissue', '1'],), ''),
|
| ((['git', 'config', 'branch.master.rietveldserver',
|
| @@ -659,106 +654,6 @@ class TestGitCl(TestCase):
|
| 'refs/remotes/origin/master'],), ''),
|
| ]
|
|
|
| - @classmethod
|
| - def _dcommit_calls_1(cls):
|
| - return [
|
| - ((['git', 'config', 'rietveld.autoupdate'],),
|
| - ''),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],),
|
| - ''),
|
| - ((['git',
|
| - 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
|
| - ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n'
|
| - 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'),
|
| - None),
|
| - 0)),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
|
| - ((['git', 'config',
|
| - 'branch.working.git-cl-similarity'],), CERR1),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
|
| - ((['git', 'config', '--bool',
|
| - 'branch.working.git-find-copies'],), CERR1),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
|
| - ((['git',
|
| - 'config', 'branch.working.rietveldissue'],), '12345'),
|
| - ((['git',
|
| - 'config', 'rietveld.server'],), 'codereview.example.com'),
|
| - ((['git',
|
| - 'config', 'branch.working.merge'],), 'refs/heads/master'),
|
| - ((['git', 'config', 'branch.working.remote'],), 'origin'),
|
| - ((['git', 'config', 'branch.working.merge'],),
|
| - 'refs/heads/master'),
|
| - ((['git', 'config', 'branch.working.remote'],), 'origin'),
|
| - ((['git', 'rev-list', '--merges',
|
| - '--grep=^SVN changes up to revision [0-9]*$',
|
| - 'refs/remotes/origin/master^!'],), ''),
|
| - ((['git', 'rev-list', '^refs/heads/working',
|
| - 'refs/remotes/origin/master'],),
|
| - ''),
|
| - ((['git',
|
| - 'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],),
|
| - '3fc18b62c4966193eb435baabe2d18a3810ec82e'),
|
| - ((['git',
|
| - 'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e',
|
| - 'refs/remotes/origin/master'],), ''),
|
| - ((['git',
|
| - 'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
|
| - 'fake_ancestor_sha'),
|
| - ]
|
| -
|
| - @classmethod
|
| - def _dcommit_calls_normal(cls):
|
| - return [
|
| - ((['git', 'rev-parse', '--show-cdup'],), ''),
|
| - ((['git', 'rev-parse', 'HEAD'],),
|
| - '00ff397798ea57439712ed7e04ab96e13969ef40'),
|
| - ((['git',
|
| - 'diff', '--name-status', '--no-renames', '-r', 'fake_ancestor_sha...',
|
| - '.'],),
|
| - 'M\tPRESUBMIT.py'),
|
| - ((['git',
|
| - 'config', 'branch.working.rietveldpatchset'],), '31137'),
|
| - ((['git', 'config', 'branch.working.rietveldserver'],),
|
| - 'codereview.example.com'),
|
| - ((['git', 'config', 'user.email'],), 'author@example.com'),
|
| - ((['git', 'config', 'rietveld.tree-status-url'],), ''),
|
| - ]
|
| -
|
| - @classmethod
|
| - def _dcommit_calls_bypassed(cls):
|
| - return [
|
| - ((['git', 'config', 'branch.working.rietveldserver'],),
|
| - 'codereview.example.com'),
|
| - ]
|
| -
|
| - @classmethod
|
| - def _dcommit_calls_3(cls):
|
| - return [
|
| - ((['git',
|
| - 'diff', '--no-ext-diff', '--stat', '-l100000', '-C50',
|
| - 'fake_ancestor_sha', 'refs/heads/working'],),
|
| - (' PRESUBMIT.py | 2 +-\n'
|
| - ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')),
|
| - ((['git', 'show-ref', '--quiet', '--verify',
|
| - 'refs/heads/git-cl-commit'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ((['git', 'show-ref', '--quiet', '--verify',
|
| - 'refs/heads/git-cl-cherry-pick'],), CERR1),
|
| - ((['git', 'rev-parse', '--show-cdup'],), '\n'),
|
| - ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
|
| - ((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
|
| - ((['git', 'commit', '-m',
|
| - 'Issue: 12345\n\nR=john@chromium.org\n\n'
|
| - 'Review-Url: https://codereview.example.com/12345 .'],),
|
| - ''),
|
| - ((['git', 'config', 'rietveld.force-https-commit-url'],), ''),
|
| - ((['git',
|
| - 'svn', 'dcommit', '-C50', '--no-rebase', '--rmdir'],),
|
| - (('', None), 0)),
|
| - ((['git', 'checkout', '-q', 'working'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ]
|
| -
|
| @staticmethod
|
| def _cmd_line(description, args, similarity, find_copies, private, cc):
|
| """Returns the upload command line passed to upload.RealMain()."""
|
| @@ -926,350 +821,6 @@ class TestGitCl(TestCase):
|
| 'desc\n\nBUG=500658\nBUG=proj:1234',
|
| [])
|
|
|
| - def test_dcommit(self):
|
| - self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| - self.calls = (
|
| - self._dcommit_calls_1() +
|
| - self._git_sanity_checks('fake_ancestor_sha', 'working') +
|
| - self._dcommit_calls_normal() +
|
| - self._dcommit_calls_3())
|
| - git_cl.main(['dcommit'])
|
| -
|
| - def test_dcommit_bypass_hooks(self):
|
| - self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| - self.calls = (
|
| - self._dcommit_calls_1() +
|
| - self._dcommit_calls_bypassed() +
|
| - self._dcommit_calls_3())
|
| - git_cl.main(['dcommit', '--bypass-hooks'])
|
| -
|
| - def _land_rietveld_common(self, debug=False):
|
| - if debug:
|
| - # Very useful due to finally clause in git cl land raising exceptions and
|
| - # shadowing real cause of failure.
|
| - self.mock(git_cl, '_IS_BEING_TESTED', True)
|
| - else:
|
| - self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| -
|
| - self.mock(git_cl._GitNumbererState, 'load', classmethod(lambda _, url, ref:
|
| - self._mocked_call(['_GitNumbererState', url, ref])))
|
| - self.mock(RietveldMock, 'update_description', staticmethod(
|
| - lambda i, d: self._mocked_call(['update_description', i, d])))
|
| - self.mock(RietveldMock, 'add_comment', staticmethod(
|
| - lambda i, c: self._mocked_call(['add_comment', i, c])))
|
| - self.calls = [
|
| - ((['git', 'config', 'rietveld.autoupdate'],), ''),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],), CERR1),
|
| - ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
|
| - CERR1),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
|
| - ((['git', 'config', 'branch.feature.git-cl-similarity'],), CERR1),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
|
| - ((['git', 'config', '--bool', 'branch.feature.git-find-copies'],),
|
| - CERR1),
|
| - ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
|
| - ((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
|
| - ((['git', 'config', 'rietveld.server'],),
|
| - 'https://codereview.chromium.org'),
|
| - ((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'),
|
| - ((['git', 'config', 'branch.feature.remote'],), 'origin'),
|
| - ((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'),
|
| - ((['git', 'config', 'branch.feature.remote'],), 'origin'),
|
| - ((['git', 'rev-list', '--merges',
|
| - '--grep=^SVN changes up to revision [0-9]*$',
|
| - 'refs/remotes/origin/master^!'],), ''),
|
| - ((['git', 'rev-list', '^feature', 'refs/remotes/origin/master'],),
|
| - ''), # No commits to rebase, according to local view of origin.
|
| - ((['git', 'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
|
| - 'fake_ancestor_sha'),
|
| - ] + self._git_sanity_checks('fake_ancestor_sha', 'feature') + [
|
| - ((['git', 'rev-parse', '--show-cdup'],), ''),
|
| - ((['git', 'rev-parse', 'HEAD'],), 'fake_sha'),
|
| - ((['git', 'diff', '--name-status', '--no-renames', '-r',
|
| - 'fake_ancestor_sha...', '.'],),
|
| - 'M\tfile1.cpp'),
|
| - ((['git', 'config', 'branch.feature.rietveldpatchset'],), '20001'),
|
| - ((['git', 'config', 'branch.feature.rietveldserver'],),
|
| - 'https://codereview.chromium.org'),
|
| - ((['git', 'config', 'user.email'],), 'user@e.mail'),
|
| - ((['git', 'config', 'rietveld.tree-status-url'],), CERR1),
|
| - ((['git', 'diff', '--no-ext-diff', '--stat', '-l100000', '-C50',
|
| - 'fake_ancestor_sha', 'feature'],),
|
| - # This command just prints smth like this:
|
| - # file1.cpp | 53 ++++++--
|
| - # 1 file changed, 33 insertions(+), 20 deletions(-)\n
|
| - ''),
|
| - ((['git', 'show-ref', '--quiet', '--verify',
|
| - 'refs/heads/git-cl-commit'],),
|
| - ''), # 0 return code means branch exists.
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ((['git', 'show-ref', '--quiet', '--verify',
|
| - 'refs/heads/git-cl-cherry-pick'],),
|
| - CERR1), # This means git-cl-cherry-pick branch does not exist.
|
| - ((['git', 'rev-parse', '--show-cdup'],), ''),
|
| - ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
|
| - ((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
|
| - ((['git', 'commit', '-m',
|
| - 'Issue: 123\n\nR=john@chromium.org\n\n'
|
| - 'Review-Url: https://codereview.chromium.org/123 .'],), ''),
|
| - ((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'),
|
| - ((['git', 'config', 'branch.feature.remote'],), 'origin'),
|
| - ((['git', 'config', '--get', 'remote.origin.url'],),
|
| - 'https://chromium.googlesource.com/infra/infra'),
|
| - ]
|
| -
|
| - def test_land_rietveld(self):
|
| - self._land_rietveld_common(debug=False)
|
| - self.calls += [
|
| - ((['git', 'config', 'remote.origin.url'],),
|
| - 'https://chromium.googlesource.com/infra/infra'),
|
| - ((['_GitNumbererState',
|
| - 'https://chromium.googlesource.com/infra/infra',
|
| - 'refs/heads/master'],),
|
| - git_cl._GitNumbererState(None, False)),
|
| - ((['git', 'push', '--porcelain', 'origin', 'HEAD:refs/heads/master'],),
|
| - ''),
|
| - ((['git', 'rev-parse', 'HEAD'],), 'fake_sha_rebased'),
|
| - ((['git', 'checkout', '-q', 'feature'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ((['git', 'config', 'rietveld.viewvc-url'],),
|
| - 'https://chromium.googlesource.com/infra/infra/+/'),
|
| - ((['update_description', 123,
|
| - 'Issue: 123\n\nR=john@chromium.org\n\nCommitted: '
|
| - 'https://chromium.googlesource.com/infra/infra/+/fake_sha_rebased'],),
|
| - ''),
|
| - ((['add_comment', 123, 'Committed patchset #2 (id:20001) manually as '
|
| - 'fake_sha_rebased (presubmit successful).'],), ''),
|
| - ]
|
| - git_cl.main(['land'])
|
| -
|
| - def test_land_rietveld_gnumbd(self):
|
| - self._land_rietveld_common(debug=False)
|
| - self.mock(git_cl, 'WaitForRealCommit',
|
| - lambda *a: self._mocked_call(['WaitForRealCommit'] + list(a)))
|
| - self.calls += [
|
| - ((['git', 'config', 'remote.origin.url'],),
|
| - 'https://chromium.googlesource.com/chromium/src'),
|
| - ((['_GitNumbererState',
|
| - 'https://chromium.googlesource.com/chromium/src',
|
| - 'refs/heads/master'],),
|
| - git_cl._GitNumbererState('refs/pending', True)),
|
| - ((['git', 'rev-parse', 'HEAD'],), 'fake_sha_rebased'),
|
| - ((['git', 'retry', 'fetch', 'origin',
|
| - '+refs/pending/heads/master:refs/git-cl/pending/heads/master'],), ''),
|
| - ((['git', 'checkout', 'refs/git-cl/pending/heads/master'],), ''),
|
| - ((['git', 'cherry-pick', 'fake_sha_rebased'],), ''),
|
| -
|
| - ((['git', 'retry', 'push', '--porcelain', 'origin',
|
| - 'HEAD:refs/pending/heads/master'],),''),
|
| - ((['git', 'rev-parse', 'HEAD'],), 'fake_sha_rebased_on_pending'),
|
| -
|
| - ((['git', 'checkout', '-q', 'feature'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| -
|
| - ((['WaitForRealCommit', 'origin', 'fake_sha_rebased_on_pending',
|
| - 'refs/remotes/origin/master', 'refs/heads/master'],),
|
| - 'fake_sha_gnumbded'),
|
| -
|
| - ((['git', 'config', 'rietveld.viewvc-url'],),
|
| - 'https://chromium.googlesource.com/infra/infra/+/'),
|
| - ((['update_description', 123,
|
| - 'Issue: 123\n\nR=john@chromium.org\n\nCommitted: '
|
| - 'https://chromium.googlesource.com/infra/infra/+/fake_sha_gnumbded'],),
|
| - ''),
|
| - ((['add_comment', 123, 'Committed patchset #2 (id:20001) manually as '
|
| - 'fake_sha_gnumbded (presubmit successful).'],),
|
| - ''),
|
| - ]
|
| - git_cl.main(['land'])
|
| -
|
| - def test_land_rietveld_git_numberer(self):
|
| - self._land_rietveld_common(debug=False)
|
| -
|
| - # Special mocks to check validity of timestamp.
|
| - original_git_amend_head = git_cl._git_amend_head
|
| - def _git_amend_head_mock(msg, tstamp):
|
| - self._mocked_call(['git_amend_head committer timestamp', tstamp])
|
| - return original_git_amend_head(msg, tstamp)
|
| - self.mock(git_cl, '_git_amend_head', _git_amend_head_mock)
|
| -
|
| - self.calls += [
|
| - ((['git', 'config', 'remote.origin.url'],),
|
| - 'https://chromium.googlesource.com/chromium/src'),
|
| - ((['_GitNumbererState',
|
| - 'https://chromium.googlesource.com/chromium/src',
|
| - 'refs/heads/master'],),
|
| - git_cl._GitNumbererState(None, True)),
|
| -
|
| - ((['git', 'show', '-s', '--format=%B', 'fake_ancestor_sha'],),
|
| - 'This is parent commit.\n'
|
| - '\n'
|
| - 'Cr-Commit-Position: refs/heads/master@{#543}\n'
|
| - 'Cr-Branched-From: refs/svn/2014@{#2208}'),
|
| - ((['git', 'show', '-s', '--format=%ct', 'fake_ancestor_sha'],),
|
| - '1480022355'), # Committer's unix timestamp.
|
| - ((['git', 'show', '-s', '--format=%ct', 'HEAD'],),
|
| - '1480024000'),
|
| -
|
| - ((['git_amend_head committer timestamp', 1480024000],), None),
|
| - ((['git', 'commit', '--amend', '-m',
|
| - 'Issue: 123\n\nR=john@chromium.org\n'
|
| - '\n'
|
| - 'Review-Url: https://codereview.chromium.org/123 .\n'
|
| - 'Cr-Commit-Position: refs/heads/master@{#544}\n'
|
| - 'Cr-Branched-From: refs/svn/2014@{#2208}'],), ''),
|
| -
|
| - ((['git', 'push', '--porcelain', 'origin', 'HEAD:refs/heads/master'],),
|
| - ''),
|
| - ((['git', 'rev-parse', 'HEAD'],), 'fake_sha_rebased'),
|
| - ((['git', 'checkout', '-q', 'feature'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ((['git', 'config', 'rietveld.viewvc-url'],),
|
| - 'https://chromium.googlesource.com/infra/infra/+/'),
|
| - ((['update_description', 123,
|
| - 'Issue: 123\n\nR=john@chromium.org\n'
|
| - '\n'
|
| - 'Review-Url: https://codereview.chromium.org/123 .\n'
|
| - 'Cr-Commit-Position: refs/heads/master@{#544}\n'
|
| - 'Cr-Branched-From: refs/svn/2014@{#2208}\n'
|
| - 'Committed: '
|
| - 'https://chromium.googlesource.com/infra/infra/+/fake_sha_rebased'],),
|
| - ''),
|
| - ((['add_comment', 123, 'Committed patchset #2 (id:20001) manually as '
|
| - 'fake_sha_rebased (presubmit successful).'],), ''),
|
| - ]
|
| - git_cl.main(['land'])
|
| -
|
| - def test_land_rietveld_git_numberer_bad_parent(self):
|
| - self._land_rietveld_common(debug=False)
|
| - self.calls += [
|
| - ((['git', 'config', 'remote.origin.url'],),
|
| - 'https://chromium.googlesource.com/v8/v8'),
|
| - ((['_GitNumbererState',
|
| - 'https://chromium.googlesource.com/v8/v8', 'refs/heads/master'],),
|
| - git_cl._GitNumbererState(None, True)),
|
| -
|
| - ((['git', 'show', '-s', '--format=%B', 'fake_ancestor_sha'],),
|
| - 'This is parent commit with no footer.'),
|
| -
|
| - ((['git', 'checkout', '-q', 'feature'],), ''),
|
| - ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
|
| - ]
|
| - with self.assertRaises(ValueError) as cm:
|
| - git_cl.main(['land'])
|
| - self.assertEqual(cm.exception.message,
|
| - 'Unable to infer commit position from footers')
|
| -
|
| - def test_GitNumbererState_not_whitelisted_repo(self):
|
| - self.calls = [
|
| - ((['git', 'config', 'rietveld.autoupdate'],), CERR1),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],), CERR1),
|
| - ]
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/tools/build',
|
| - remote_ref='refs/whatever')
|
| - self.assertEqual(res.pending_prefix, None)
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| - def test_GitNumbererState_fail_fetch(self):
|
| - self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| - self.calls = [
|
| - ((['git', 'fetch', 'https://chromium.googlesource.com/chromium/src',
|
| - '+refs/meta/config:refs/git_cl/meta/config',
|
| - '+refs/gnumbd-config/main:refs/git_cl/gnumbd-config/main'],), CERR1),
|
| - ((['git', 'config', 'rietveld.autoupdate'],), CERR1),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],),
|
| - 'refs/pending-prefix'),
|
| - ]
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/whatever')
|
| - self.assertEqual(res.pending_prefix, 'refs/pending-prefix/')
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| - def test_GitNumbererState_fail_gnumbd_and_validator(self):
|
| - self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| - self.calls = [
|
| - ((['git', 'fetch', 'https://chromium.googlesource.com/chromium/src',
|
| - '+refs/meta/config:refs/git_cl/meta/config',
|
| - '+refs/gnumbd-config/main:refs/git_cl/gnumbd-config/main'],), ''),
|
| - ((['git', 'show', 'refs/git_cl/gnumbd-config/main:config.json'],),
|
| - 'ba d conig'),
|
| - ((['git', 'config', 'rietveld.autoupdate'],), CERR1),
|
| - ((['git', 'config', 'rietveld.pending-ref-prefix'],), CERR1),
|
| - ((['git', 'show', 'refs/git_cl/meta/config:project.config'],), CERR1),
|
| - ]
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/whatever')
|
| - self.assertEqual(res.pending_prefix, None)
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| - def test_GitNumbererState_valid_configs(self):
|
| - class NamedTempFileStab(StringIO.StringIO):
|
| - @classmethod
|
| - @contextlib.contextmanager
|
| - def create(cls, *_, **__):
|
| - yield cls()
|
| - name = 'tempfile'
|
| - self.mock(git_cl.tempfile, 'NamedTemporaryFile', NamedTempFileStab.create)
|
| - self.calls = [
|
| - ((['git', 'fetch', 'https://chromium.googlesource.com/chromium/src',
|
| - '+refs/meta/config:refs/git_cl/meta/config',
|
| - '+refs/gnumbd-config/main:refs/git_cl/gnumbd-config/main'],), ''),
|
| - ((['git', 'show', 'refs/git_cl/gnumbd-config/main:config.json'],),
|
| - '''{
|
| - "pending_tag_prefix": "refs/pending-tags",
|
| - "pending_ref_prefix": "refs/pending",
|
| - "enabled_refglobs": [
|
| - "refs/heads/m*"
|
| - ]
|
| - }
|
| - '''),
|
| - ((['git', 'show', 'refs/git_cl/meta/config:project.config'],),
|
| - '''
|
| - [plugin "git-numberer"]
|
| - validate-enabled-refglob = refs/else/*
|
| - validate-enabled-refglob = refs/heads/*
|
| - validate-disabled-refglob = refs/heads/disabled
|
| - validate-disabled-refglob = refs/branch-heads/*
|
| - '''),
|
| - ((['git', 'config', '-f', 'tempfile', '--get-all',
|
| - 'plugin.git-numberer.validate-enabled-refglob'],),
|
| - 'refs/else/*\n'
|
| - 'refs/heads/*\n'),
|
| - ((['git', 'config', '-f', 'tempfile', '--get-all',
|
| - 'plugin.git-numberer.validate-disabled-refglob'],),
|
| - 'refs/heads/disabled\n'
|
| - 'refs/branch-heads/*\n'),
|
| - ] * 4 # 4 tests below have exactly same IO.
|
| -
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/heads/master')
|
| - self.assertEqual(res.pending_prefix, 'refs/pending/')
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/heads/test')
|
| - self.assertEqual(res.pending_prefix, None)
|
| - self.assertEqual(res.should_git_number, True)
|
| -
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/heads/disabled')
|
| - self.assertEqual(res.pending_prefix, None)
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| - # Validator is disabled by default, even if it's not explicitely in disabled
|
| - # refglobs.
|
| - res = git_cl._GitNumbererState.load(
|
| - remote_url='https://chromium.googlesource.com/chromium/src',
|
| - remote_ref='refs/arbitrary/ref')
|
| - self.assertEqual(res.pending_prefix, None)
|
| - self.assertEqual(res.should_git_number, False)
|
| -
|
| @classmethod
|
| def _gerrit_ensure_auth_calls(cls, issue=None, skip_auth_check=False):
|
| cmd = ['git', 'config', '--bool', 'gerrit.skip-ensure-authenticated']
|
|
|