From cfc9712bc80a9807370a21a7274d8f24d6483cc7 Mon Sep 17 00:00:00 2001 From: Bryce Thomas Date: Thu, 13 Dec 2018 20:21:47 +0000 Subject: [PATCH] Fix git cl format following removal of Rietveld. Commit a185e2e3c83d805d3306a3f1fe9258ae2e75f231 removed the Rietveld code review implementation, albeit hasn't expunged all references to Rietveld. This leads to an assertion error when running |git cl format| on a non-Gerrit change. There appears to have been a recent attempt to articulate this error better in a185e2e3c83d805d3306a3f1fe9258ae2e75f231, albeit not fix the underlying issue. This change addresses the immediate issue by defaulting the code review implementation to Gerrit rather than Reitveld. R=joenotcharles@google.com, tandrii@chromium.org Bug: 914150 Change-Id: I64d33e5a172cc43339ec417f7f0a7820e0337772 Reviewed-on: https://chromium-review.googlesource.com/c/1372928 Reviewed-by: Edward Lesmes Reviewed-by: Dirk Pranke Commit-Queue: Bryce Thomas --- git_cl.py | 4 ++-- tests/git_cl_test.py | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/git_cl.py b/git_cl.py index eb5ba35a58..549aae25ce 100755 --- a/git_cl.py +++ b/git_cl.py @@ -1133,9 +1133,9 @@ class Changelist(object): self.issue = int(issue) return - # No issue is set for this branch, so decide based on repo-wide settings. + # No issue is set for this branch, so default to gerrit. return self._load_codereview_impl( - codereview='gerrit' if settings.GetIsGerrit() else 'rietveld', + codereview='gerrit', **kwargs) def IsGerrit(self): diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 0525007adc..c88131b658 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -1615,8 +1615,6 @@ class TestGitCl(TestCase): self.calls += [ ((['git', 'symbolic-ref', 'HEAD'],), 'master'), ((['git', 'config', 'branch.master.gerritissue'],), CERR1), - ((['git', 'config', 'rietveld.autoupdate'],), CERR1), - ((['git', 'config', 'gerrit.host'],), 'true'), ] if detect_gerrit_server: self.calls += self._get_gerrit_codereview_server_calls( @@ -1767,8 +1765,6 @@ class TestGitCl(TestCase): self.calls = [ ((['git', 'symbolic-ref', 'HEAD'],), 'master'), ((['git', 'config', 'branch.master.gerritissue'],), CERR1), - ((['git', 'config', 'rietveld.autoupdate'],), CERR1), - ((['git', 'config', 'gerrit.host'],), 'true'), ((['git', 'config', 'branch.master.gerritserver'],), CERR1), ((['git', 'config', 'branch.master.merge'],), 'refs/heads/master'), ((['git', 'config', 'branch.master.remote'],), 'origin'), @@ -2045,8 +2041,6 @@ class TestGitCl(TestCase): 'refs/heads/master\nrefs/heads/foo\nrefs/heads/bar'), ((['git', 'config', 'branch.master.gerritissue'],), '456'), ((['git', 'config', 'branch.foo.gerritissue'],), CERR1), - ((['git', 'config', 'rietveld.autoupdate'],), CERR1), - ((['git', 'config', 'gerrit.host'],), 'true'), ((['git', 'config', 'branch.bar.gerritissue'],), '789'), ((['git', 'symbolic-ref', 'HEAD'],), 'master'), ((['git', 'tag', 'git-cl-archived-456-foo', 'foo'],), ''), @@ -2082,8 +2076,6 @@ class TestGitCl(TestCase): 'refs/heads/master\nrefs/heads/foo\nrefs/heads/bar'), ((['git', 'config', 'branch.master.gerritissue'],), '456'), ((['git', 'config', 'branch.foo.gerritissue'],), CERR1), - ((['git', 'config', 'rietveld.autoupdate'],), CERR1), - ((['git', 'config', 'gerrit.host'],), 'true'), ((['git', 'config', 'branch.bar.gerritissue'],), '789'), ((['git', 'symbolic-ref', 'HEAD'],), 'master'),] @@ -2104,8 +2096,6 @@ class TestGitCl(TestCase): ((['git', 'config', 'branch.master.gerritissue'],), '1'), ((['git', 'config', 'branch.foo.gerritissue'],), '456'), ((['git', 'config', 'branch.bar.gerritissue'],), CERR1), - ((['git', 'config', 'rietveld.autoupdate'],), CERR1), - ((['git', 'config', 'gerrit.host'],), 'true'), ((['git', 'symbolic-ref', 'HEAD'],), 'master'), ((['git', 'branch', '-D', 'foo'],), '')]