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

Unified Diff: checkout.py

Issue 5968005: Move patch management functions into their own file, patch.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/commit-queue
Patch Set: rebase against trunk Created 10 years 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 | patch.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: checkout.py
diff --git a/checkout.py b/checkout.py
index de911845203a39b5adbac8004b4f8178ec966fa1..cbb1f791f136fb09ff8a9c6abe1e2e4fc5f5ac78 100644
--- a/checkout.py
+++ b/checkout.py
@@ -3,6 +3,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Manages a project checkout.
+
+Includes support for svn, git-svn and git.
"""
import logging
@@ -11,6 +13,7 @@ import re
import subprocess
import tempfile
+import patch
import subprocess2
import svn_utils
@@ -62,6 +65,8 @@ class SvnCheckout(CheckoutBase):
self.commit_user = commit_user
self.commit_pwd = commit_pwd
self.svn_url = svn_url
+ assert bool(self.commit_user) == bool(self.commit_pwd)
+ assert bool(self.svn_url)
def prepare(self):
"""Creates the initial checkouts for the repo."""
@@ -74,10 +79,10 @@ class SvnCheckout(CheckoutBase):
self.commit_user,
self.commit_pwd)
- def apply_patch(self, patch):
+ def apply_patch(self, patch_data):
"""Applies a patch."""
try:
- svn_utils.apply_patch(self.project_path, patch)
+ patch.apply_patch(self.project_path, patch_data)
return True
except subprocess.CalledProcessError, e:
if e.returncode == 1:
@@ -127,12 +132,12 @@ class GitCheckoutBase(CheckoutBase):
self.check_call(['pull', self.remote, self.remote_branch])
self.call(['branch', '-D', self.working_branch])
- def apply_patch(self, patch):
+ def apply_patch(self, patch_data):
"""Applies a patch on 'working_branch'."""
self.check_call(
['checkout', '-b', self.working_branch,
'%s/%s' % (self.remote, self.remote_branch)])
- self.check_call(['apply', '--index', '-p0'], stdin=patch)
+ self.check_call(['apply', '--index', '-p0'], stdin=patch_data)
self.check_call(['commit', '-m', 'Committed patch'])
def commit(self, commit_message, user):
@@ -286,8 +291,8 @@ class ReadOnlyCheckout(object):
def get_settings(self, key):
return self.checkout.get_settings(key)
- def apply_patch(self, patch):
- return self.checkout.apply_patch(patch)
+ def apply_patch(self, patch_data):
+ return self.checkout.apply_patch(patch_data)
def commit(self, message, user):
logging.info('Would have committed for %s with message: %s' % (
« no previous file with comments | « no previous file | patch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698