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

Side by Side Diff: git_drover.py

Issue 1640233002: git-drover: Correctly resolve --parent_checkout (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """git drover: A tool for merging changes to release branches.""" 5 """git drover: A tool for merging changes to release branches."""
6 6
7 import argparse 7 import argparse
8 import cPickle 8 import cPickle
9 import functools 9 import functools
10 import logging 10 import logging
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 def _create_checkout(self): 221 def _create_checkout(self):
222 """Creates a checkout to use for cherry-picking. 222 """Creates a checkout to use for cherry-picking.
223 223
224 This creates a checkout similarly to git-new-workdir. Most of the .git 224 This creates a checkout similarly to git-new-workdir. Most of the .git
225 directory is shared with the |self._parent_repo| using symlinks. This 225 directory is shared with the |self._parent_repo| using symlinks. This
226 differs from git-new-workdir in that the config is forked instead of shared. 226 differs from git-new-workdir in that the config is forked instead of shared.
227 This is so the new workdir can be a sparse checkout without affecting 227 This is so the new workdir can be a sparse checkout without affecting
228 |self._parent_repo|. 228 |self._parent_repo|.
229 """ 229 """
230 parent_git_dir = os.path.abspath(self._run_git_command( 230 parent_git_dir = os.path.join(self._parent_repo, self._run_git_command(
231 ['rev-parse', '--git-dir']).strip()) 231 ['rev-parse', '--git-dir']).strip())
232 self._workdir = tempfile.mkdtemp(prefix='drover_%s_' % self._branch) 232 self._workdir = tempfile.mkdtemp(prefix='drover_%s_' % self._branch)
233 logging.debug('Creating checkout in %s', self._workdir) 233 logging.debug('Creating checkout in %s', self._workdir)
234 git_dir = os.path.join(self._workdir, '.git') 234 git_dir = os.path.join(self._workdir, '.git')
235 git_common.make_workdir_common(parent_git_dir, git_dir, self.FILES_TO_LINK, 235 git_common.make_workdir_common(parent_git_dir, git_dir, self.FILES_TO_LINK,
236 self.FILES_TO_COPY, mk_symlink) 236 self.FILES_TO_COPY, mk_symlink)
237 self._run_git_command(['config', 'core.sparsecheckout', 'true']) 237 self._run_git_command(['config', 'core.sparsecheckout', 'true'])
238 with open(os.path.join(git_dir, 'info', 'sparse-checkout'), 'w') as f: 238 with open(os.path.join(git_dir, 'info', 'sparse-checkout'), 'w') as f:
239 f.write('/codereview.settings') 239 f.write('/codereview.settings')
240 240
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 cherry_pick_change(options.branch, options.cherry_pick, 415 cherry_pick_change(options.branch, options.cherry_pick,
416 options.parent_checkout, options.dry_run, 416 options.parent_checkout, options.dry_run,
417 options.verbose) 417 options.verbose)
418 except Error as e: 418 except Error as e:
419 print 'Error:', e.message 419 print 'Error:', e.message
420 sys.exit(128) 420 sys.exit(128)
421 421
422 422
423 if __name__ == '__main__': 423 if __name__ == '__main__':
424 main() 424 main()
OLDNEW
« 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