OLD | NEW |
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 Loading... |
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 Loading... |
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() |
OLD | NEW |