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

Unified Diff: checkout.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
« apply_issue.py ('K') | « apply_issue.py ('k') | no next file » | 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 38c269abe1d05e41bdc2fffb8807882a578d164d..d4db42c2ac4c8a8d9a3c1638d33df95735fe1e9e 100644
--- a/checkout.py
+++ b/checkout.py
@@ -62,11 +62,13 @@ class CheckoutBase(object):
def __init__(self, root_dir, project_name):
self.root_dir = root_dir
self.project_name = project_name
- self.project_path = os.path.join(self.root_dir, self.project_name)
+ if self.project_name is None:
+ self.project_path = self.root_dir
+ else:
+ self.project_path = os.path.join(self.root_dir, self.project_name)
# Only used for logging purposes.
self._last_seen_revision = None
assert self.root_dir
- assert self.project_name
assert self.project_path
def get_settings(self, key):
@@ -229,10 +231,10 @@ class SvnCheckout(CheckoutBase, SvnMixIn):
self.commit_pwd = commit_pwd
self.svn_url = svn_url
assert bool(self.commit_user) >= bool(self.commit_pwd)
- assert self.svn_url
def prepare(self):
# Will checkout if the directory is not present.
+ assert self.svn_url
if not os.path.isdir(self.project_path):
logging.info('Checking out %s in %s' %
(self.project_name, self.project_path))
@@ -346,13 +348,13 @@ class GitCheckoutBase(CheckoutBase):
self.remote = 'origin'
self.remote_branch = remote_branch
self.working_branch = 'working_branch'
- assert self.remote_branch
def prepare(self):
"""Resets the git repository in a clean state.
Checks it out if not present and deletes the working branch.
"""
+ assert self.remote_branch
assert os.path.isdir(self.project_path)
self._check_call_git(['reset', '--hard', '--quiet'])
branches, active = self._branches()
@@ -372,9 +374,10 @@ class GitCheckoutBase(CheckoutBase):
post_processor = post_processor or []
# It this throws, the checkout is corrupted. Maybe worth deleting it and
# trying again?
- self._check_call_git(
- ['checkout', '-b', self.working_branch,
- '%s/%s' % (self.remote, self.remote_branch), '--quiet'])
+ if self.remote_branch:
+ self._check_call_git(
+ ['checkout', '-b', self.working_branch,
+ '%s/%s' % (self.remote, self.remote_branch), '--quiet'])
for p in patches:
try:
stdout = ''
« apply_issue.py ('K') | « apply_issue.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698