From 7753d2462576066f460f883b6b4d0d102c9d21b6 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 7 Oct 2009 17:40:24 +0000 Subject: [PATCH] Revert "Un-revert the reverted 28058, so that we get quiet again." This reverts commit 28058. BUG=24081 TEST=gclient sync without --force is not working anymore. TBR=dpranke Review URL: http://codereview.chromium.org/269006 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@28271 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient.py | 8 ++++++++ gclient_scm.py | 27 +++++++++++++-------------- gclient_utils.py | 4 ---- tests/gcl_unittest.py | 2 +- tests/gclient_scm_test.py | 16 ++++++++-------- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/gclient.py b/gclient.py index 65912f2a9..96175aa17 100755 --- a/gclient.py +++ b/gclient.py @@ -892,6 +892,7 @@ def DoCleanup(options, args): # Print out the .gclient file. This is longer than if we just printed the # client dict, but more legible, and it might contain helpful comments. print(client.ConfigContent()) + options.verbose = True return client.RunOnDeps('cleanup', args) @@ -970,6 +971,7 @@ def DoPack(options, args): # Print out the .gclient file. This is longer than if we just printed the # client dict, but more legible, and it might contain helpful comments. print(client.ConfigContent()) + options.verbose = True return client.RunOnDeps('pack', args) @@ -986,6 +988,7 @@ def DoStatus(options, args): # Print out the .gclient file. This is longer than if we just printed the # client dict, but more legible, and it might contain helpful comments. print(client.ConfigContent()) + options.verbose = True return client.RunOnDeps('status', args) @@ -1040,6 +1043,7 @@ def DoDiff(options, args): # Print out the .gclient file. This is longer than if we just printed the # client dict, but more legible, and it might contain helpful comments. print(client.ConfigContent()) + options.verbose = True return client.RunOnDeps('diff', args) @@ -1139,6 +1143,10 @@ def Main(argv): "containing the provided string")) option_parser.add_option("", "--verbose", action="store_true", default=False, help="produce additional output for diagnostics") + option_parser.add_option("", "--manually_grab_svn_rev", action="store_true", + default=False, + help="Skip svn up whenever possible by requesting " + "actual HEAD revision from the repository") option_parser.add_option("", "--head", action="store_true", default=False, help=("skips any safesync_urls specified in " "configured solutions")) diff --git a/gclient_scm.py b/gclient_scm.py index 8cf32d646..fba971cea 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -251,7 +251,7 @@ class SVNWrapper(SCMWrapper): command = ['checkout', url, checkout_path] if revision: command.extend(['--revision', str(revision)]) - RunSVNAndGetFileList(options, command, self._root_dir, file_list) + RunSVNAndGetFileList(command, self._root_dir, file_list) return # Get the existing scm url and the revision number of the current checkout. @@ -262,12 +262,12 @@ class SVNWrapper(SCMWrapper): "and try again." % checkout_path) - # Retrieve the current HEAD version because svn is slow at null updates. - if not revision: - from_info_live = CaptureSVNInfo(from_info['URL'], '.') - revision = str(from_info_live['Revision']) - rev_str = ' at %s' % revision - forced_revision = True + if options.manually_grab_svn_rev: + # Retrieve the current HEAD version because svn is slow at null updates. + if not revision: + from_info_live = CaptureSVNInfo(from_info['URL'], '.') + revision = str(from_info_live['Revision']) + rev_str = ' at %s' % revision if from_info['URL'] != components[0]: to_info = CaptureSVNInfo(url, '.') @@ -309,7 +309,7 @@ class SVNWrapper(SCMWrapper): command = ['checkout', url, checkout_path] if revision: command.extend(['--revision', str(revision)]) - RunSVNAndGetFileList(options, command, self._root_dir, file_list) + RunSVNAndGetFileList(command, self._root_dir, file_list) return @@ -323,7 +323,7 @@ class SVNWrapper(SCMWrapper): command = ["update", checkout_path] if revision: command.extend(['--revision', str(revision)]) - RunSVNAndGetFileList(options, command, self._root_dir, file_list) + RunSVNAndGetFileList(command, self._root_dir, file_list) def revert(self, options, args, file_list): """Reverts local modifications. Subversion specific. @@ -374,7 +374,7 @@ class SVNWrapper(SCMWrapper): try: # svn revert is so broken we don't even use it. Using # "svn up --revision BASE" achieve the same effect. - RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'], path, + RunSVNAndGetFileList(['update', '--revision', 'BASE'], path, file_list) except OSError, e: # Maybe the directory disapeared meanwhile. We don't want it to throw an @@ -396,7 +396,7 @@ class SVNWrapper(SCMWrapper): % (' '.join(command), path)) # There's no file list to retrieve. else: - RunSVNAndGetFileList(options, command, path, file_list) + RunSVNAndGetFileList(command, path, file_list) def pack(self, options, args, file_list): """Generates a patch file which can be applied to the root of the @@ -546,7 +546,7 @@ def CaptureSVN(args, in_directory=None, print_error=True): stderr=stderr).communicate()[0] -def RunSVNAndGetFileList(options, args, in_directory, file_list): +def RunSVNAndGetFileList(args, in_directory, file_list): """Runs svn checkout, update, or status, output to stdout. The first item in args must be either "checkout", "update", or "status". @@ -556,7 +556,6 @@ def RunSVNAndGetFileList(options, args, in_directory, file_list): sys.stdout as in RunSVN. Args: - options: command line options to gclient args: A sequence of command line parameters to be passed to svn. in_directory: The directory where svn is to be run. @@ -596,7 +595,7 @@ def RunSVNAndGetFileList(options, args, in_directory, file_list): RunSVNAndFilterOutput(args, in_directory, - options.verbose, + True, True, CaptureMatchingLines) diff --git a/gclient_utils.py b/gclient_utils.py index ec475f3d4..464419fb0 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -215,10 +215,6 @@ def SubprocessCallAndFilter(command, while in_byte: if in_byte != "\r": if print_stdout: - if not print_messages: - print("\n________ running \'%s\' in \'%s\'" - % (' '.join(command), in_directory)) - print_messages = True sys.stdout.write(in_byte) if in_byte != "\n": in_line += in_byte diff --git a/tests/gcl_unittest.py b/tests/gcl_unittest.py index 2bd37a9f0..bf73d917c 100755 --- a/tests/gcl_unittest.py +++ b/tests/gcl_unittest.py @@ -49,7 +49,7 @@ class GclUnittest(GclTestsBase): 'GetChangelistInfoFile', 'GetCodeReviewSetting', 'GetEditor', 'GetFilesNotInCL', 'GetInfoDir', 'GetIssueDescription', 'GetModifiedFiles', 'GetRepositoryRoot', - 'GetSVNFileProperty', 'Help', 'IsSVNMoved', + 'GetSVNFileProperty', 'Help', 'IGNORE_PATHS', 'IsSVNMoved', 'Lint', 'LoadChangelistInfoForMultiple', 'MISSING_TEST_MSG', 'Opened', 'OptionallyDoPresubmitChecks', 'PresubmitCL', 'ReadFile', 'REPOSITORY_ROOT', 'RunShell', diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 2f4bde5c9..5a5237aab 100644 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -96,7 +96,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): # Checkout. gclient.os.path.exists(base_path).AndReturn(False) files_list = self.mox.CreateMockAnything() - gclient_scm.RunSVNAndGetFileList(options, ['checkout', self.url, base_path], + gclient_scm.RunSVNAndGetFileList(['checkout', self.url, base_path], self.root_dir, files_list) self.mox.ReplayAll() @@ -109,7 +109,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): base_path = os.path.join(self.root_dir, self.relpath) gclient.os.path.isdir(base_path).AndReturn(True) gclient_scm.CaptureSVNStatus(base_path).AndReturn([]) - gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'], + gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path, mox.IgnoreArg()) self.mox.ReplayAll() @@ -135,7 +135,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): gclient_scm.os.path.exists(file_path2).AndReturn(True) gclient_scm.os.path.isfile(file_path2).AndReturn(True) gclient_scm.os.remove(file_path2) - gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'], + gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path, mox.IgnoreArg()) print(os.path.join(base_path, 'a')) print(os.path.join(base_path, 'b')) @@ -161,7 +161,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): gclient_scm.os.path.isdir(file_path).AndReturn(True) gclient_utils.RemoveDirectory(file_path) file_list1 = [] - gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'], + gclient_scm.RunSVNAndGetFileList(['update', '--revision', 'BASE'], base_path, mox.IgnoreArg()) self.mox.ReplayAll() @@ -174,7 +174,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): options = self.Options(verbose=True) base_path = os.path.join(self.root_dir, self.relpath) gclient.os.path.isdir(base_path).AndReturn(True) - gclient_scm.RunSVNAndGetFileList(options, ['status'] + self.args, base_path, + gclient_scm.RunSVNAndGetFileList(['status'] + self.args, base_path, []).AndReturn(None) self.mox.ReplayAll() @@ -198,7 +198,7 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): # Checkout. gclient.os.path.exists(base_path).AndReturn(False) files_list = self.mox.CreateMockAnything() - gclient_scm.RunSVNAndGetFileList(options, ['checkout', self.url, base_path], + gclient_scm.RunSVNAndGetFileList(['checkout', self.url, base_path], self.root_dir, files_list) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, @@ -227,8 +227,8 @@ class SVNWrapperTestCase(gclient_test.GClientBaseTestCase): if options.manually_grab_svn_rev: additional_args = ['--revision', str(file_info['Revision'])] files_list = [] - gclient_scm.RunSVNAndGetFileList(options, - ['update', base_path] + additional_args, self.root_dir, files_list) + gclient_scm.RunSVNAndGetFileList(['update', base_path] + additional_args, + self.root_dir, files_list) self.mox.ReplayAll() scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,