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

Unified Diff: gclient_scm.py

Issue 2560001: When running an svn update, if --force was passed on the... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 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 | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
===================================================================
--- gclient_scm.py (revision 48811)
+++ gclient_scm.py (working copy)
@@ -740,8 +740,7 @@
if not os.path.exists(checkout_path):
# We need to checkout.
command = ['checkout', url, checkout_path]
- if revision:
- command.extend(['--revision', str(revision).strip()])
+ command = self.AddAdditionalFlags(command, options, revision)
scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
return
@@ -798,8 +797,7 @@
gclient_utils.RemoveDirectory(checkout_path)
# We need to checkout.
command = ['checkout', url, checkout_path]
- if revision:
- command.extend(['--revision', str(revision).strip()])
+ command = self.AddAdditionalFlags(command, options, revision)
scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
return
@@ -812,8 +810,7 @@
return
command = ["update", checkout_path]
- if revision:
- command.extend(['--revision', str(revision).strip()])
+ command = self.AddAdditionalFlags(command, options, revision)
scm.SVN.RunAndGetFileList(options, command, self._root_dir, file_list)
def updatesingle(self, options, args, file_list):
@@ -841,8 +838,7 @@
os.makedirs(checkout_path)
command = ["export", os.path.join(self.url, filename),
os.path.join(checkout_path, filename)]
- if options.revision:
- command.extend(['--revision', str(options.revision).strip()])
+ command = self.AddAdditionalFlags(command, options, options.revision)
scm.SVN.Run(command, self._root_dir)
def revert(self, options, args, file_list):
@@ -927,3 +923,15 @@
def FullUrlForRelativeUrl(self, url):
# Find the forth '/' and strip from there. A bit hackish.
return '/'.join(self.url.split('/')[:4]) + url
+
+ def AddAdditionalFlags(self, command, options, revision):
+ """Add additional flags to command depending on what options are set.
+ command should be a list of strings that represents an svn command.
+
+ This method returns a new list to be used as a command."""
+ new_command = command[:]
+ if revision:
+ new_command.extend(['--revision', str(revision).strip()])
+ if options.force:
+ new_command.append('--force')
+ return new_command
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698