OLD | NEW |
---|---|
1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """SCM-specific utility classes.""" | 5 """SCM-specific utility classes.""" |
6 | 6 |
7 import cStringIO | 7 import cStringIO |
8 import glob | 8 import glob |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 stderr = None | 379 stderr = None |
380 if not print_error: | 380 if not print_error: |
381 stderr = subprocess.PIPE | 381 stderr = subprocess.PIPE |
382 return subprocess.Popen(c, | 382 return subprocess.Popen(c, |
383 cwd=in_directory, | 383 cwd=in_directory, |
384 shell=(sys.platform == 'win32'), | 384 shell=(sys.platform == 'win32'), |
385 stdout=subprocess.PIPE, | 385 stdout=subprocess.PIPE, |
386 stderr=stderr).communicate()[0] | 386 stderr=stderr).communicate()[0] |
387 | 387 |
388 @staticmethod | 388 @staticmethod |
389 def RunAndGetFileList(options, args, in_directory, file_list): | 389 def RunAndGetFileList(verbose, args, in_directory, file_list): |
390 """Runs svn checkout, update, or status, output to stdout. | 390 """Runs svn checkout, update, or status, output to stdout. |
391 | 391 |
392 The first item in args must be either "checkout", "update", or "status". | 392 The first item in args must be either "checkout", "update", or "status". |
393 | 393 |
394 svn's stdout is parsed to collect a list of files checked out or updated. | 394 svn's stdout is parsed to collect a list of files checked out or updated. |
395 These files are appended to file_list. svn's stdout is also printed to | 395 These files are appended to file_list. svn's stdout is also printed to |
396 sys.stdout as in Run. | 396 sys.stdout as in Run. |
397 | 397 |
398 Args: | 398 Args: |
399 options: command line options to gclient | |
400 args: A sequence of command line parameters to be passed to svn. | 399 args: A sequence of command line parameters to be passed to svn. |
nsylvain
2010/08/16 16:51:45
add verbose here?
| |
401 in_directory: The directory where svn is to be run. | 400 in_directory: The directory where svn is to be run. |
402 | 401 |
403 Raises: | 402 Raises: |
404 Error: An error occurred while running the svn command. | 403 Error: An error occurred while running the svn command. |
405 """ | 404 """ |
406 command = [SVN.COMMAND] | 405 command = [SVN.COMMAND] |
407 command.extend(args) | 406 command.extend(args) |
408 | 407 |
409 # svn update and svn checkout use the same pattern: the first three columns | 408 # svn update and svn checkout use the same pattern: the first three columns |
410 # are for file status, property status, and lock status. This is followed | 409 # are for file status, property status, and lock status. This is followed |
(...skipping 24 matching lines...) Expand all Loading... | |
435 def CaptureMatchingLines(line): | 434 def CaptureMatchingLines(line): |
436 match = compiled_pattern.search(line) | 435 match = compiled_pattern.search(line) |
437 if match: | 436 if match: |
438 file_list.append(match.group(1)) | 437 file_list.append(match.group(1)) |
439 if line.startswith('svn: '): | 438 if line.startswith('svn: '): |
440 failure.append(line) | 439 failure.append(line) |
441 | 440 |
442 try: | 441 try: |
443 SVN.RunAndFilterOutput(args, | 442 SVN.RunAndFilterOutput(args, |
444 in_directory, | 443 in_directory, |
445 options.verbose, | 444 verbose, |
446 True, | 445 True, |
447 CaptureMatchingLines) | 446 CaptureMatchingLines) |
448 except gclient_utils.Error: | 447 except gclient_utils.Error: |
449 # Subversion client is really misbehaving with Google Code. | 448 # Subversion client is really misbehaving with Google Code. |
450 if args[0] == 'checkout': | 449 if args[0] == 'checkout': |
451 # Ensure at least one file was checked out, otherwise *delete* the | 450 # Ensure at least one file was checked out, otherwise *delete* the |
452 # directory. | 451 # directory. |
453 if len(file_list) == previous_list_len: | 452 if len(file_list) == previous_list_len: |
454 for x in failure: | 453 for x in failure: |
455 if ('502 Bad Gateway' in x or | 454 if ('502 Bad Gateway' in x or |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
940 if not SVN.current_version: | 939 if not SVN.current_version: |
941 SVN.current_version = SVN.Capture(['--version']).split()[2] | 940 SVN.current_version = SVN.Capture(['--version']).split()[2] |
942 current_version_list = map(only_int, SVN.current_version.split('.')) | 941 current_version_list = map(only_int, SVN.current_version.split('.')) |
943 for min_ver in map(int, min_version.split('.')): | 942 for min_ver in map(int, min_version.split('.')): |
944 ver = current_version_list.pop(0) | 943 ver = current_version_list.pop(0) |
945 if ver < min_ver: | 944 if ver < min_ver: |
946 return (False, SVN.current_version) | 945 return (False, SVN.current_version) |
947 elif ver > min_ver: | 946 elif ver > min_ver: |
948 return (True, SVN.current_version) | 947 return (True, SVN.current_version) |
949 return (True, SVN.current_version) | 948 return (True, SVN.current_version) |
OLD | NEW |