Commit 92bec4f5 authored by agable's avatar agable Committed by Commit bot

Delete gcl, drover, and trychange

These tools are relatively standalone, and only ever worked for SVN.
Removing these is a good start to removing other SVN support code.

R=maruel@chromium.org
BUG=475321

Review-Url: https://codereview.chromium.org/2269413002
parent 12fa6ff6
# This file is used by gcl to get repository specific information. # This file is used by git cl to get repository specific information.
CODE_REVIEW_SERVER: codereview.chromium.org CODE_REVIEW_SERVER: codereview.chromium.org
CC_LIST: chromium-reviews@chromium.org CC_LIST: chromium-reviews@chromium.org
VIEW_VC: https://chromium.googlesource.com/chromium/tools/depot_tools/+/ VIEW_VC: https://chromium.googlesource.com/chromium/tools/depot_tools/+/
......
#!/usr/bin/env bash
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script will try to sync the bootstrap directories and then defer control.
base_dir=$(dirname "$0")
# Use the batch file as an entry point if on cygwin.
if [ "${OSTYPE}" = "cygwin" -a "${TERM}" != "xterm" ]; then
${base_dir}/drover.bat "$@"
exit
fi
# We're on POSIX (not cygwin). We can now safely look for svn checkout.
if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "${base_dir}/.svn" ]
then
# Update the bootstrap directory to stay up-to-date with the latest
# depot_tools.
svn -q up "${base_dir}"
fi
PYTHONDONTWRITEBYTECODE=1 exec python "${base_dir}/drover.py" "$@"
@echo off
:: Copyright (c) 2009 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
setlocal
set PATH=%~dp0svn;%PATH%
set PYTHONDONTWRITEBYTECODE=1
call python "%~dp0drover.py" %*
This diff is collapsed.
#!/usr/bin/env bash
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/gcl.py" "$@"
@echo off
setlocal
:: This is required with cygwin only.
PATH=%~dp0;%PATH%
set PYTHONDONTWRITEBYTECODE=1
call python "%~dp0gcl.py" %*
This diff is collapsed.
...@@ -1056,7 +1056,7 @@ class ExecutionQueue(object): ...@@ -1056,7 +1056,7 @@ class ExecutionQueue(object):
work_queue.ready_cond.release() work_queue.ready_cond.release()
def GetEditor(git, git_editor=None): def GetEditor(git_editor=None):
"""Returns the most plausible editor to use. """Returns the most plausible editor to use.
In order of preference: In order of preference:
...@@ -1068,14 +1068,8 @@ def GetEditor(git, git_editor=None): ...@@ -1068,14 +1068,8 @@ def GetEditor(git, git_editor=None):
In the case of git-cl, this matches git's behaviour, except that it does not In the case of git-cl, this matches git's behaviour, except that it does not
include dumb terminal detection. include dumb terminal detection.
In the case of gcl, this matches svn's behaviour, except that it does not
accept a command-line flag or check the editor-cmd configuration variable.
""" """
if git:
editor = os.environ.get('GIT_EDITOR') or git_editor editor = os.environ.get('GIT_EDITOR') or git_editor
else:
editor = os.environ.get('SVN_EDITOR')
if not editor: if not editor:
editor = os.environ.get('VISUAL') editor = os.environ.get('VISUAL')
if not editor: if not editor:
...@@ -1105,7 +1099,7 @@ def RunEditor(content, git, git_editor=None): ...@@ -1105,7 +1099,7 @@ def RunEditor(content, git, git_editor=None):
fileobj.close() fileobj.close()
try: try:
editor = GetEditor(git, git_editor=git_editor) editor = GetEditor(git_editor=git_editor)
if not editor: if not editor:
return None return None
cmd = '%s %s' % (editor, filename) cmd = '%s %s' % (editor, filename)
......
...@@ -1025,7 +1025,7 @@ class Changelist(object): ...@@ -1025,7 +1025,7 @@ class Changelist(object):
def GetCCList(self): def GetCCList(self):
"""Return the users cc'd on this CL. """Return the users cc'd on this CL.
Return is a string suitable for passing to gcl with the --cc flag. Return is a string suitable for passing to git cl with the --cc flag.
""" """
if self.cc is None: if self.cc is None:
base_cc = settings.GetDefaultCCList() base_cc = settings.GetDefaultCCList()
......
...@@ -1009,32 +1009,6 @@ class SvnChange(Change): ...@@ -1009,32 +1009,6 @@ class SvnChange(Change):
scm = 'svn' scm = 'svn'
_changelists = None _changelists = None
def _GetChangeLists(self):
"""Get all change lists."""
if self._changelists == None:
previous_cwd = os.getcwd()
os.chdir(self.RepositoryRoot())
# Need to import here to avoid circular dependency.
import gcl
self._changelists = gcl.GetModifiedFiles()
os.chdir(previous_cwd)
return self._changelists
def GetAllModifiedFiles(self):
"""Get all modified files."""
changelists = self._GetChangeLists()
all_modified_files = []
for cl in changelists.values():
all_modified_files.extend(
[os.path.join(self.RepositoryRoot(), f[1]) for f in cl])
return all_modified_files
def GetModifiedFiles(self):
"""Get modified files in the current CL."""
changelists = self._GetChangeLists()
return [os.path.join(self.RepositoryRoot(), f[1])
for f in changelists[self.Name()]]
def AllFiles(self, root=None): def AllFiles(self, root=None):
"""List all files under source control in the repo.""" """List all files under source control in the repo."""
root = root or self.RepositoryRoot() root = root or self.RepositoryRoot()
...@@ -1413,7 +1387,7 @@ class PresubmitExecuter(object): ...@@ -1413,7 +1387,7 @@ class PresubmitExecuter(object):
""" """
Args: Args:
change: The Change object. change: The Change object.
committing: True if 'gcl commit' is running, False if 'gcl upload' is. committing: True if 'git cl land' is running, False if 'git cl upload' is.
rietveld_obj: rietveld.Rietveld client object. rietveld_obj: rietveld.Rietveld client object.
gerrit_obj: provides basic Gerrit codereview functionality. gerrit_obj: provides basic Gerrit codereview functionality.
dry_run: if true, some Checks will be skipped. dry_run: if true, some Checks will be skipped.
...@@ -1500,7 +1474,7 @@ def DoPresubmitChecks(change, ...@@ -1500,7 +1474,7 @@ def DoPresubmitChecks(change,
Args: Args:
change: The Change object. change: The Change object.
committing: True if 'gcl commit' is running, False if 'gcl upload' is. committing: True if 'git cl land' is running, False if 'git cl upload' is.
verbose: Prints debug info. verbose: Prints debug info.
output_stream: A stream to write output from presubmit tests to. output_stream: A stream to write output from presubmit tests to.
input_stream: A stream to read input from the user. input_stream: A stream to read input from the user.
......
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for trychange.py."""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from testing_support.super_mox import SuperMoxTestBase
import subprocess2
import trychange
class TryChangeTestsBase(SuperMoxTestBase):
"""Setups and tear downs the mocks but doesn't test anything as-is."""
def setUp(self):
SuperMoxTestBase.setUp(self)
self.mox.StubOutWithMock(subprocess2, 'communicate')
self.mox.StubOutWithMock(trychange, 'RunGit')
self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture')
self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff')
self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot')
self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail')
self.mox.StubOutWithMock(trychange.scm.GIT, 'GetPatchName')
self.mox.StubOutWithMock(trychange.scm.GIT, 'GetUpstreamBranch')
self.mox.StubOutWithMock(trychange.scm.SVN, 'GenerateDiff')
self.mox.StubOutWithMock(trychange.scm.SVN, 'GetCheckoutRoot')
self.mox.StubOutWithMock(trychange.scm.SVN, 'GetEmail')
self.fake_root = self.Dir()
self.expected_files = ['foo.txt', 'bar.txt']
self.options = trychange.optparse.Values()
self.options.files = self.expected_files
self.options.diff = None
self.options.name = None
self.options.email = None
self.options.exclude = []
class TryChangeUnittest(TryChangeTestsBase):
"""General trychange.py tests."""
def testMembersChanged(self):
members = [
'DieWithError', 'EPILOG', 'Escape', 'GIT', 'GIT_PATCH_DIR_BASENAME',
'GetMungedDiff', 'GuessVCS', 'GIT_BRANCH_FILE',
'HELP_STRING', 'Error', 'InvalidScript', 'NoTryServerAccess',
'OptionParser', 'PrintSuccess',
'RunCommand', 'RunGit', 'SCM', 'SVN', 'TryChange', 'USAGE', 'contextlib',
'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils',
'gerrit_util', 'gen_parser',
'getpass', 'itertools', 'json', 'logging', 'optparse', 'os', 'posixpath',
're', 'scm', 'shutil', 'subprocess2', 'sys', 'tempfile', 'urllib',
'urllib2', 'urlparse']
# If this test fails, you should add the relevant test.
self.compareMembers(trychange, members)
class TryChangeSimpleTest(unittest.TestCase):
# Doesn't require supermox to run.
def test_flags(self):
cmd = [
'--bot', 'bot1,bot2',
'--testfilter', 'test1',
'--testfilter', 'test2',
'--user', 'joe',
'--email', 'joe@example.com',
]
options, args = trychange.gen_parser(None).parse_args(cmd)
self.assertEquals([], args)
# pylint: disable=W0212
bot_spec = trychange._ParseBotList(options.bot, options.testfilter)
if options.testfilter:
bot_spec = trychange._ApplyTestFilter(options.testfilter, bot_spec)
values = trychange._ParseSendChangeOptions(bot_spec, options)
self.assertEquals(
[
('user', 'joe'),
('name', None),
('email', 'joe@example.com'),
('bot', 'bot1:test1,test2'),
('bot', 'bot2:test1,test2'),
],
values)
def test_flags_bad_combination(self):
cmd = [
'--bot', 'bot1:test1',
'--testfilter', 'test2',
]
options, args = trychange.gen_parser(None).parse_args(cmd)
self.assertEquals([], args)
try:
# pylint: disable=W0212
trychange._ParseBotList(options.bot, options.testfilter)
self.fail()
except ValueError:
pass
class SVNUnittest(TryChangeTestsBase):
"""trychange.SVN tests."""
def testMembersChanged(self):
members = [
'AutomagicalSettings', 'CaptureStatus', 'GetCodeReviewSetting',
'ReadRootFile', 'GenerateDiff', 'GetFileNames', 'files', 'file_tuples',
]
# If this test fails, you should add the relevant test.
self.compareMembers(trychange.SVN, members)
def testBasic(self):
# pylint: disable=E1103
trychange.os.path.abspath(self.fake_root).AndReturn(self.fake_root)
trychange.scm.SVN.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root)
trychange.scm.SVN.GenerateDiff(['foo.txt', 'bar.txt'],
self.fake_root,
full_move=True,
revision=None).AndReturn('A diff')
trychange.scm.SVN.GetEmail(self.fake_root).AndReturn('georges@example.com')
self.mox.ReplayAll()
svn = trychange.SVN(self.options, self.fake_root, self.options.files)
self.assertEqual(svn.GetFileNames(), self.expected_files)
self.assertEqual(svn.checkout_root, self.fake_root)
self.assertEqual(svn.GenerateDiff(), 'A diff')
class GITUnittest(TryChangeTestsBase):
"""trychange.GIT tests."""
def testMembersChanged(self):
members = [
'AutomagicalSettings', 'CaptureStatus', 'GetCodeReviewSetting',
'ReadRootFile', 'GenerateDiff', 'GetFileNames', 'files', 'file_tuples',
]
# If this test fails, you should add the relevant test.
self.compareMembers(trychange.GIT, members)
def testBasic(self):
# pylint: disable=E1103
trychange.os.path.abspath(self.fake_root).AndReturn(self.fake_root)
trychange.scm.GIT.GetCheckoutRoot(self.fake_root).AndReturn(self.fake_root)
trychange.scm.GIT.GetUpstreamBranch(self.fake_root).AndReturn('somewhere')
trychange.RunGit(['diff-index', 'HEAD'])
trychange.scm.GIT.GenerateDiff(self.fake_root,
full_move=True,
files=['foo.txt', 'bar.txt'],
branch='somewhere').AndReturn('A diff')
trychange.scm.GIT.GetPatchName(self.fake_root).AndReturn('bleh-1233')
trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com')
self.mox.ReplayAll()
git = trychange.GIT(self.options, self.fake_root, self.options.files)
self.assertEqual(git.GetFileNames(), self.expected_files)
self.assertEqual(git.checkout_root, self.fake_root)
self.assertEqual(git.GenerateDiff(), 'A diff')
if __name__ == '__main__':
unittest.main()
This diff is collapsed.
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