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

Side by Side Diff: git_rebase_update.py

Issue 1182713002: Only chdir in rebase-update if there's a directory to go back to. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 5
6 """ 6 """
7 Tool to update all branches to have the latest changes from their upstreams. 7 Tool to update all branches to have the latest changes from their upstreams.
8 """ 8 """
9 9
10 import argparse 10 import argparse
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 git.run('checkout', return_branch) 264 git.run('checkout', return_branch)
265 git.thaw() 265 git.thaw()
266 else: 266 else:
267 root_branch = git.root() 267 root_branch = git.root()
268 if return_branch != 'HEAD': 268 if return_branch != 'HEAD':
269 print ( 269 print (
270 "%r was merged with its parent, checking out %r instead." 270 "%r was merged with its parent, checking out %r instead."
271 % (return_branch, root_branch) 271 % (return_branch, root_branch)
272 ) 272 )
273 git.run('checkout', root_branch) 273 git.run('checkout', root_branch)
274 os.chdir(return_workdir) 274 if return_workdir:
275 os.chdir(return_workdir)
275 git.set_config(STARTING_BRANCH_KEY, '') 276 git.set_config(STARTING_BRANCH_KEY, '')
276 git.set_config(STARTING_WORKDIR_KEY, '') 277 git.set_config(STARTING_WORKDIR_KEY, '')
277 278
278 return retcode 279 return retcode
279 280
280 281
281 if __name__ == '__main__': # pragma: no cover 282 if __name__ == '__main__': # pragma: no cover
282 try: 283 try:
283 sys.exit(main()) 284 sys.exit(main())
284 except KeyboardInterrupt: 285 except KeyboardInterrupt:
285 sys.stderr.write('interrupted\n') 286 sys.stderr.write('interrupted\n')
286 sys.exit(1) 287 sys.exit(1)
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