Commit 19f3fe60 authored by vadimsh@chromium.org's avatar vadimsh@chromium.org

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
parent d6d15b8e
...@@ -46,7 +46,3 @@ ...@@ -46,7 +46,3 @@
/tests/subversion_config/servers /tests/subversion_config/servers
/tests/svn/ /tests/svn/
/tests/svnrepo/ /tests/svnrepo/
# Ignore "flag file" used by auth.py.
# TODO(vadimsh): Remove this once OAuth2 is default.
/USE_OAUTH2
...@@ -111,7 +111,7 @@ def make_auth_config( ...@@ -111,7 +111,7 @@ def make_auth_config(
""" """
default = lambda val, d: val if val is not None else d default = lambda val, d: val if val is not None else d
return AuthConfig( return AuthConfig(
default(use_oauth2, _should_use_oauth2()), default(use_oauth2, True),
default(save_cookies, True), default(save_cookies, True),
default(use_local_webserver, not _is_headless()), default(use_local_webserver, not _is_headless()),
default(webserver_port, 8090), default(webserver_port, 8090),
...@@ -481,14 +481,6 @@ class Authenticator(object): ...@@ -481,14 +481,6 @@ class Authenticator(object):
## Private functions. ## 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(): def _is_headless():
"""True if machine doesn't seem to have a display.""" """True if machine doesn't seem to have a display."""
return sys.platform == 'linux2' and not os.environ.get('DISPLAY') return sys.platform == 'linux2' and not os.environ.get('DISPLAY')
......
...@@ -24,7 +24,7 @@ setup_gitsvn ...@@ -24,7 +24,7 @@ setup_gitsvn
git add test; git commit -q -m "branch work" git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \ 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. # Switch back to master, delete the branch.
git checkout master git checkout master
......
...@@ -21,7 +21,7 @@ setup_gitsvn ...@@ -21,7 +21,7 @@ setup_gitsvn
git add test; git commit -q -m "branch work" git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \ 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 git config rietveld.server localhost:10000
...@@ -32,7 +32,7 @@ setup_gitsvn ...@@ -32,7 +32,7 @@ setup_gitsvn
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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" \ test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'" "$GIT_CL_STATUS | grep -q 'Issue number'"
...@@ -46,7 +46,7 @@ setup_gitsvn ...@@ -46,7 +46,7 @@ setup_gitsvn
$URL/edit $URL/edit
test_expect_success "git-cl dcommits ok" \ test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f" "$GIT_CL dcommit -f --no-oauth2"
git checkout -q master git checkout -q master
git svn -q rebase >/dev/null 2>&1 git svn -q rebase >/dev/null 2>&1
......
...@@ -96,7 +96,6 @@ class TestGitCl(TestCase): ...@@ -96,7 +96,6 @@ class TestGitCl(TestCase):
self.mock(git_cl.upload, 'RealMain', self.fail) self.mock(git_cl.upload, 'RealMain', self.fail)
self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock) self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock) 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. # It's important to reset settings to not have inter-tests interference.
git_cl.settings = None git_cl.settings = None
...@@ -171,13 +170,13 @@ class TestGitCl(TestCase): ...@@ -171,13 +170,13 @@ class TestGitCl(TestCase):
((['get_or_create_merge_base', 'master', 'master'],), ((['get_or_create_merge_base', 'master', 'master'],),
'fake_ancestor_sha'), 'fake_ancestor_sha'),
((['git', 'config', 'gerrit.host'],), ''), ((['git', 'config', 'gerrit.host'],), ''),
((['git', 'config', 'branch.master.rietveldissue'],), ''),
] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [ ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
((['git', 'rev-parse', '--show-cdup'],), ''), ((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'rev-parse', 'HEAD'],), '12345'), ((['git', 'rev-parse', 'HEAD'],), '12345'),
((['git', 'diff', '--name-status', '--no-renames', '-r', ((['git', 'diff', '--name-status', '--no-renames', '-r',
'fake_ancestor_sha...', '.'],), 'fake_ancestor_sha...', '.'],),
'M\t.gitignore\n'), 'M\t.gitignore\n'),
((['git', 'config', 'branch.master.rietveldissue'],), ''),
((['git', 'config', 'branch.master.rietveldpatchset'],), ((['git', 'config', 'branch.master.rietveldpatchset'],),
''), ''),
((['git', 'log', '--pretty=format:%s%n%n%b', ((['git', 'log', '--pretty=format:%s%n%n%b',
......
...@@ -30,16 +30,16 @@ END ...@@ -30,16 +30,16 @@ END
git add OWNERS PRESUBMIT.py ; git commit -q -m "add OWNERS" git add OWNERS PRESUBMIT.py ; git commit -q -m "add OWNERS"
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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" \ test_expect_success "git-cl status has a suggested reviewer" \
"$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'" "$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'"
test_expect_failure "git-cl dcommit fails w/ missing LGTM" \ 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" \ 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=$? SUCCESS=$?
......
...@@ -24,7 +24,7 @@ setup_gitsvn ...@@ -24,7 +24,7 @@ setup_gitsvn
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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" \ test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'" "$GIT_CL_STATUS | grep -q 'Issue number'"
...@@ -33,7 +33,7 @@ setup_gitsvn ...@@ -33,7 +33,7 @@ setup_gitsvn
git checkout -q -b test2 master git checkout -q -b test2 master
test_expect_success "$GIT_CL patch $ISSUE" test_expect_success "$GIT_CL patch $ISSUE --no-oauth2"
) )
SUCCESS=$? SUCCESS=$?
......
...@@ -28,7 +28,7 @@ _EOF ...@@ -28,7 +28,7 @@ _EOF
TBR=foo" TBR=foo"
test_expect_success "dcommitted code" \ 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" \ test_expect_success "post-cl-dcommit hook executed" \
"git symbolic-ref HEAD | grep -q COMMITTED" "git symbolic-ref HEAD | grep -q COMMITTED"
......
...@@ -21,7 +21,7 @@ setup_gitgit ...@@ -21,7 +21,7 @@ setup_gitgit
git add test; git commit -q -m "branch work" git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \ 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 git config rietveld.server localhost:10000
...@@ -31,7 +31,7 @@ setup_gitgit ...@@ -31,7 +31,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload. # Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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" \ test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'" "$GIT_CL_STATUS | grep -q 'Issue number'"
...@@ -48,7 +48,7 @@ setup_gitgit ...@@ -48,7 +48,7 @@ setup_gitgit
"curl -s $($GIT_CL_STATUS --field=url) | grep 'URL:[[:space:]]*[^<]' | grep -q '@master'" "curl -s $($GIT_CL_STATUS --field=url) | grep 'URL:[[:space:]]*[^<]' | grep -q '@master'"
test_expect_success "git-cl land ok" \ 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 checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1 git pull -q > /dev/null 2>&1
......
...@@ -21,7 +21,7 @@ setup_gitgit ...@@ -21,7 +21,7 @@ setup_gitgit
git add test; git commit -q -m "branch work" git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \ 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 git config rietveld.server localhost:10000
...@@ -31,7 +31,7 @@ setup_gitgit ...@@ -31,7 +31,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload. # Prevent the editor from coming up when you upload.
export EDITOR=$(which true) export EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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'" grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \ test_expect_success "git-cl status now knows the issue" \
...@@ -41,13 +41,13 @@ setup_gitgit ...@@ -41,13 +41,13 @@ setup_gitgit
# Should contain 'branch work' x 2. # Should contain 'branch work' x 2.
test_expect_success "git-cl status has the right description for the log" \ 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 ] "$GIT_CL_STATUS --field desc | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
test_expect_success "git-cl status has the right subject from message" \ test_expect_success "git-cl status has the right subject from message" \
"$GIT_CL_STATUS --field desc | \ "$GIT_CL_STATUS --field desc | \
[ $( egrep -q '^test$' --byte-offset) | grep '^0:' ] [ $( egrep -q '^test$' --byte-offset) | grep '^0:' ]
test_expect_success "git-cl push ok" \ 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 checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1 git pull -q > /dev/null 2>&1
......
...@@ -24,7 +24,7 @@ setup_gitsvn ...@@ -24,7 +24,7 @@ setup_gitsvn
git commit -q -m "renamed" git commit -q -m "renamed"
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \ 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. # Look at the uploaded patch and verify it is a rename patch.
echo "Rename test not fully implemented yet. :(" echo "Rename test not fully implemented yet. :("
......
...@@ -34,7 +34,8 @@ setup_gitgit ...@@ -34,7 +34,8 @@ setup_gitgit
# Try to upload the change to an unresolvable hostname; git-cl should fail. # Try to upload the change to an unresolvable hostname; git-cl should fail.
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
git config rietveld.server bogus.example.com:80 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. # Check that the change's description was saved.
test_expect_success "description was backed up" \ test_expect_success "description was backed up" \
......
...@@ -28,9 +28,9 @@ setup_gitsvn ...@@ -28,9 +28,9 @@ setup_gitsvn
git add test; git commit -q -m "branch work" git add test; git commit -q -m "branch work"
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \ 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" \ test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f" "$GIT_CL dcommit -f --no-oauth2"
) )
SUCCESS=$? SUCCESS=$?
......
...@@ -27,7 +27,7 @@ TBR=foo" ...@@ -27,7 +27,7 @@ TBR=foo"
git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs` git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs`
test_expect_success "dcommitted code" \ test_expect_success "dcommitted code" \
"$GIT_CL dcommit -f --bypass-hooks -m 'dcommit'" "$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
cd .. cd ..
......
...@@ -24,7 +24,7 @@ setup_gitgit ...@@ -24,7 +24,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload. # Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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=$? SUCCESS=$?
......
...@@ -23,7 +23,7 @@ setup_gitgit ...@@ -23,7 +23,7 @@ setup_gitgit
# Prevent the editor from coming up when you upload. # Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true) export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \ 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" \ test_expect_failure "description shouldn't contain unrelated commits" \
"$GIT_CL_STATUS | grep -q 'second commit'" "$GIT_CL_STATUS | grep -q 'second commit'"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment