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

Unified Diff: apply_issue.py

Issue 6904152: Complete apply_issue.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 8 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 | checkout.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apply_issue.py
diff --git a/apply_issue.py b/apply_issue.py
index a012648b1d4f3596adfd08b6cb08a8956a65fc42..72b5298c18a9fbe4a4833f1d4969d0607ba56bce 100755
--- a/apply_issue.py
+++ b/apply_issue.py
@@ -8,11 +8,15 @@
import logging
import optparse
+import os
import sys
import breakpad # pylint: disable=W0611
+
+import checkout
import fix_encoding
import rietveld
+import scm
def main():
@@ -26,12 +30,11 @@ def main():
parser.add_option(
'-r',
'--root_dir',
- action='store',
+ default=os.getcwd(),
help='Root directory to apply the patch')
parser.add_option(
'-s',
'--server',
- action='store',
default='http://codereview.chromium.org',
help='Rietveld server')
options, args = parser.parse_args()
@@ -53,7 +56,21 @@ def main():
options.patchset = obj.get_issue_properties(
options.issue, False)['patchsets'][-1]
logging.info('Using patchset %d' % options.patchset)
- obj.get_patch(options.issue, options.patchset)
+ # Download the patch.
+ patchset = obj.get_patch(options.issue, options.patchset)
+
+ scm_type = scm.determine_scm(options.root_dir)
Dirk Pranke 2011/05/02 20:32:05 Nit ... seems like this block could be turned into
+ if scm_type == 'svn':
+ scm_obj = checkout.SvnCheckout(options.root_dir, None, None, None, None)
+ elif scm_type == 'git':
+ scm_obj = checkout.GitCheckoutBase(options.root_dir, None, None)
+ elif scm_type == None:
+ scm_obj = checkout.RawCheckout(options.root_dir, None)
+ else:
+ parser.error('Couldn\'t determine the scm')
+
+ # Apply the patch.
+ scm_obj.apply_patch(patchset)
return 0
« no previous file with comments | « no previous file | checkout.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698