Enable OAuth2 by default.
ClientLogin will be supposedly turned off on Apr 20.
R=maruel@chromium.org
BUG=356813
Review URL: https://codereview.chromium.org/1095033002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294899 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/.gitignore b/.gitignore
index 5061e26..4db19bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,7 +46,3 @@
/tests/subversion_config/servers
/tests/svn/
/tests/svnrepo/
-
-# Ignore "flag file" used by auth.py.
-# TODO(vadimsh): Remove this once OAuth2 is default.
-/USE_OAUTH2
diff --git a/auth.py b/auth.py
index 15fc15d..cc1b82b 100644
--- a/auth.py
+++ b/auth.py
@@ -111,7 +111,7 @@
"""
default = lambda val, d: val if val is not None else d
return AuthConfig(
- default(use_oauth2, _should_use_oauth2()),
+ default(use_oauth2, True),
default(save_cookies, True),
default(use_local_webserver, not _is_headless()),
default(webserver_port, 8090),
@@ -481,14 +481,6 @@
## Private functions.
-def _should_use_oauth2():
- """Default value for use_oauth2 config option.
-
- Used to selectively enable OAuth2 by default.
- """
- return os.path.exists(os.path.join(DEPOT_TOOLS_DIR, 'USE_OAUTH2'))
-
-
def _is_headless():
"""True if machine doesn't seem to have a display."""
return sys.platform == 'linux2' and not os.environ.get('DISPLAY')
diff --git a/tests/abandon.sh b/tests/abandon.sh
index da4cf7f..314f556 100755
--- a/tests/abandon.sh
+++ b/tests/abandon.sh
@@ -24,7 +24,7 @@
git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
# Switch back to master, delete the branch.
git checkout master
diff --git a/tests/basic.sh b/tests/basic.sh
index 85dedae..224d097 100755
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -21,7 +21,7 @@
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
- "$GIT_CL upload 2>&1 | grep -q 'You must configure'"
+ "$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@@ -32,7 +32,7 @@
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@@ -46,7 +46,7 @@
$URL/edit
test_expect_success "git-cl dcommits ok" \
- "$GIT_CL dcommit -f"
+ "$GIT_CL dcommit -f --no-oauth2"
git checkout -q master
git svn -q rebase >/dev/null 2>&1
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 68be49f..ed1d7a5 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -96,7 +96,6 @@
self.mock(git_cl.upload, 'RealMain', self.fail)
self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock)
- self.mock(git_cl.auth, '_should_use_oauth2', lambda: False)
# It's important to reset settings to not have inter-tests interference.
git_cl.settings = None
@@ -171,13 +170,13 @@
((['get_or_create_merge_base', 'master', 'master'],),
'fake_ancestor_sha'),
((['git', 'config', 'gerrit.host'],), ''),
+ ((['git', 'config', 'branch.master.rietveldissue'],), ''),
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'rev-parse', 'HEAD'],), '12345'),
((['git', 'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'),
- ((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],),
''),
((['git', 'log', '--pretty=format:%s%n%n%b',
diff --git a/tests/owners.sh b/tests/owners.sh
index 853fcf7..afe1810 100755
--- a/tests/owners.sh
+++ b/tests/owners.sh
@@ -30,16 +30,16 @@
git add OWNERS PRESUBMIT.py ; git commit -q -m "add OWNERS"
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status has a suggested reviewer" \
"$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'"
test_expect_failure "git-cl dcommit fails w/ missing LGTM" \
- "$GIT_CL dcommit -f"
+ "$GIT_CL dcommit -f --no-oauth2"
test_expect_success "git-cl dcommit --tbr succeeds" \
- "$GIT_CL dcommit --tbr -f | grep -q -- '--tbr was specified'"
+ "$GIT_CL dcommit --tbr -f --no-oauth2 | grep -q -- '--tbr was specified'"
)
SUCCESS=$?
diff --git a/tests/patch.sh b/tests/patch.sh
index 22f6c21..4306c02 100755
--- a/tests/patch.sh
+++ b/tests/patch.sh
@@ -24,7 +24,7 @@
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@@ -33,7 +33,7 @@
git checkout -q -b test2 master
- test_expect_success "$GIT_CL patch $ISSUE"
+ test_expect_success "$GIT_CL patch $ISSUE --no-oauth2"
)
SUCCESS=$?
diff --git a/tests/post-dcommit-hook-test.sh b/tests/post-dcommit-hook-test.sh
index ec4e4d0..5ecb653 100755
--- a/tests/post-dcommit-hook-test.sh
+++ b/tests/post-dcommit-hook-test.sh
@@ -28,7 +28,7 @@
TBR=foo"
test_expect_success "dcommitted code" \
- "$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
+ "$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
test_expect_success "post-cl-dcommit hook executed" \
"git symbolic-ref HEAD | grep -q COMMITTED"
diff --git a/tests/push-basic.sh b/tests/push-basic.sh
index b68f804..e98d58f 100755
--- a/tests/push-basic.sh
+++ b/tests/push-basic.sh
@@ -21,7 +21,7 @@
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
- "$GIT_CL upload 2>&1 | grep -q 'You must configure'"
+ "$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@@ -31,7 +31,7 @@
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
@@ -48,7 +48,7 @@
"curl -s $($GIT_CL_STATUS --field=url) | grep 'URL:[[:space:]]*[^<]' | grep -q '@master'"
test_expect_success "git-cl land ok" \
- "$GIT_CL land -f"
+ "$GIT_CL land -f --no-oauth2"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1
diff --git a/tests/push-from-logs.sh b/tests/push-from-logs.sh
index 0fef2a7..f835c77 100755
--- a/tests/push-from-logs.sh
+++ b/tests/push-from-logs.sh
@@ -21,7 +21,7 @@
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
- "$GIT_CL upload 2>&1 | grep -q 'You must configure'"
+ "$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
@@ -31,7 +31,7 @@
# Prevent the editor from coming up when you upload.
export EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test master | \
+ "$GIT_CL upload --no-oauth2 -m test master | \
grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
@@ -41,13 +41,13 @@
# Should contain 'branch work' x 2.
test_expect_success "git-cl status has the right description for the log" \
"$GIT_CL_STATUS --field desc | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
-
+
test_expect_success "git-cl status has the right subject from message" \
"$GIT_CL_STATUS --field desc | \
[ $( egrep -q '^test$' --byte-offset) | grep '^0:' ]
test_expect_success "git-cl push ok" \
- "$GIT_CL push -f"
+ "$GIT_CL push -f --no-oauth2"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1
diff --git a/tests/rename.sh b/tests/rename.sh
index b16bea1..9b5d6dd 100755
--- a/tests/rename.sh
+++ b/tests/rename.sh
@@ -24,7 +24,7 @@
git commit -q -m "renamed"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
# Look at the uploaded patch and verify it is a rename patch.
echo "Rename test not fully implemented yet. :("
diff --git a/tests/save-description-on-failure.sh b/tests/save-description-on-failure.sh
index 3584688..1297fa0 100755
--- a/tests/save-description-on-failure.sh
+++ b/tests/save-description-on-failure.sh
@@ -34,7 +34,8 @@
# Try to upload the change to an unresolvable hostname; git-cl should fail.
export GIT_EDITOR=$(which true)
git config rietveld.server bogus.example.com:80
- test_expect_failure "uploading to bogus server" "$GIT_CL upload 2>/dev/null"
+ test_expect_failure "uploading to bogus server" \
+ "$GIT_CL upload --no-oauth2 2>/dev/null"
# Check that the change's description was saved.
test_expect_success "description was backed up" \
diff --git a/tests/submit-from-new-dir.sh b/tests/submit-from-new-dir.sh
index f04d9dc..063568a 100755
--- a/tests/submit-from-new-dir.sh
+++ b/tests/submit-from-new-dir.sh
@@ -28,9 +28,9 @@
git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
- "$GIT_CL upload -m test master | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl dcommits ok" \
- "$GIT_CL dcommit -f"
+ "$GIT_CL dcommit -f --no-oauth2"
)
SUCCESS=$?
diff --git a/tests/submodule-merge-test.sh b/tests/submodule-merge-test.sh
index 2dc49ea..a703958 100755
--- a/tests/submodule-merge-test.sh
+++ b/tests/submodule-merge-test.sh
@@ -27,7 +27,7 @@
git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs`
test_expect_success "dcommitted code" \
- "$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'"
+ "$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
cd ..
diff --git a/tests/upload-local-tracking-branch.sh b/tests/upload-local-tracking-branch.sh
index 0efd6e0..8c2e6fb 100755
--- a/tests/upload-local-tracking-branch.sh
+++ b/tests/upload-local-tracking-branch.sh
@@ -24,7 +24,7 @@
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test | grep -q 'Issue created'"
)
SUCCESS=$?
diff --git a/tests/upload-stale.sh b/tests/upload-stale.sh
index 72d1ad3..3ce6141 100755
--- a/tests/upload-stale.sh
+++ b/tests/upload-stale.sh
@@ -23,7 +23,7 @@
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
- "$GIT_CL upload -m test | grep -q 'Issue created'"
+ "$GIT_CL upload --no-oauth2 -m test | grep -q 'Issue created'"
test_expect_failure "description shouldn't contain unrelated commits" \
"$GIT_CL_STATUS | grep -q 'second commit'"