Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: gcl.py

Issue 115264: Deprecate gcl.GetSVNStatus() for gclient.CaptureSVNStatus() and fix some stat... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcl.py
===================================================================
--- gcl.py (revision 15891)
+++ gcl.py (working copy)
@@ -76,78 +76,14 @@
return output
-def GetSVNStatus(file):
- """Returns the svn 1.5 svn status emulated output.
-
- @file can be a string (one file) or a list of files."""
- command = ["svn", "status", "--xml"]
- if file is None:
- pass
- elif isinstance(file, basestring):
- command.append(file)
- else:
- command.extend(file)
-
- status_letter = {
- '': ' ',
- 'added': 'A',
- 'conflicted': 'C',
- 'deleted': 'D',
- 'ignored': 'I',
- 'missing': '!',
- 'modified': 'M',
- 'normal': ' ',
- 'replaced': 'R',
- 'unversioned': '?',
- # TODO(maruel): Find the corresponding strings for X, ~
- }
- output = RunShell(command)
- dom = gclient.ParseXML(output)
- results = []
- if dom:
- # /status/target/entry/(wc-status|commit|author|date)
- for target in dom.getElementsByTagName('target'):
- base_path = target.getAttribute('path')
- for entry in target.getElementsByTagName('entry'):
- file = entry.getAttribute('path')
- wc_status = entry.getElementsByTagName('wc-status')
- assert len(wc_status) == 1
- # Emulate svn 1.5 status ouput...
- statuses = [' ' for i in range(7)]
- # Col 0
- xml_item_status = wc_status[0].getAttribute('item')
- if xml_item_status in status_letter:
- statuses[0] = status_letter[xml_item_status]
- else:
- raise Exception('Unknown item status "%s"; please implement me!' %
- xml_item_status)
- # Col 1
- xml_props_status = wc_status[0].getAttribute('props')
- if xml_props_status == 'modified':
- statuses[1] = 'M'
- elif xml_props_status == 'conflicted':
- statuses[1] = 'C'
- elif (not xml_props_status or xml_props_status == 'none' or
- xml_props_status == 'normal'):
- pass
- else:
- raise Exception('Unknown props status "%s"; please implement me!' %
- xml_props_status)
- # Col 3
- if wc_status[0].getAttribute('copied') == 'true':
- statuses[3] = '+'
- item = (''.join(statuses), file)
- results.append(item)
- return results
-
-
def UnknownFiles(extra_args):
"""Runs svn status and prints unknown files.
Any args in |extra_args| are passed to the tool to support giving alternate
code locations.
"""
- return [item[1] for item in GetSVNStatus(extra_args) if item[0][0] == '?']
+ return [item[1] for item in gclient.CaptureSVNStatus(extra_args)
+ if item[0][0] == '?']
def GetRepositoryRoot():
@@ -488,7 +424,7 @@
if update_status:
for file in files:
filename = os.path.join(GetRepositoryRoot(), file[1])
- status_result = GetSVNStatus(filename)
+ status_result = gclient.CaptureSVNStatus(filename)
if not status_result or not status_result[0][0]:
# File has been reverted.
save = True
@@ -547,7 +483,7 @@
files_in_cl[filename] = change_info.name
# Get all the modified files.
- status_result = GetSVNStatus(None)
+ status_result = gclient.CaptureSVNStatus(None)
for line in status_result:
status = line[0]
filename = line[1]
« no previous file with comments | « no previous file | gclient.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698