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

Unified Diff: drover.py

Issue 12111002: Add support for svn paths in the revert (removes need for .properties file). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: drover.py
===================================================================
--- drover.py (revision 179378)
+++ drover.py (working copy)
@@ -169,7 +169,7 @@
else:
return False
-def checkoutRevision(url, revision, branch_url, revert=False):
+def checkoutRevision(url, revision, branch_url, revert=False, pop=True):
files_info = getFileInfo(url, revision)
paths = getBestMergePaths2(files_info, revision)
export_map = getBestExportPathsMap2(files_info, revision)
@@ -194,7 +194,15 @@
print "Exclude new directory " + path
continue
subpaths = path.split('/')
- subpaths.pop(0)
+ #In the normal case, where no url override is specified and it's just
+ # chromium source, it's necessary to remove the 'trunk' from the filepath,
+ # since in the checkout we include 'trunk' or 'branch/\d+'.
+ #
+ # However, when a url is specified we want to preserve that because it's
+ # a part of the filepath and necessary for path operations on svn (because
+ # frankly, we are checking out the correct top level, and not hacking it).
+ if pop:
+ subpaths.pop(0)
base = ''
for subpath in subpaths:
base += '/' + subpath
@@ -516,6 +524,9 @@
url = BRANCH_URL.replace("$branch", options.branch)
elif options.merge and options.sbranch:
url = BRANCH_URL.replace("$branch", options.sbranch)
+ elif options.revert and options.url:
+ url = options.url
+ file_pattern_ = r"[ ]+([MADUC])[ ]+((/.*)/(.*))"
else:
url = TRUNK_URL
@@ -563,7 +574,8 @@
action = "Revert"
if options.branch:
url = BRANCH_URL.replace("$branch", options.branch)
- checkoutRevision(url, revision, url, True)
+ pop_em = not options.url
+ checkoutRevision(url, revision, url, True, pop_em)
revertRevision(url, revision)
revertExportRevision(url, revision)
@@ -647,6 +659,8 @@
help='Revision to revert')
option_parser.add_option('-w', '--workdir',
help='subdir to use for the revert')
+ option_parser.add_option('-u', '--url',
+ help='svn url to use for the revert')
option_parser.add_option('-a', '--auditor',
help='overrides the author for reviewer')
option_parser.add_option('', '--revertbot', action='store_true',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698