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

Side by Side Diff: git_cl.py

Issue 8930002: Enforce cwd for GIT functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | git_try.py » ('j') | 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 (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 import logging 10 import logging
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 self.has_issue = False 493 self.has_issue = False
494 494
495 def GetChange(self, upstream_branch, author): 495 def GetChange(self, upstream_branch, author):
496 root = RunCommand(['git', 'rev-parse', '--show-cdup']).strip() or '.' 496 root = RunCommand(['git', 'rev-parse', '--show-cdup']).strip() or '.'
497 absroot = os.path.abspath(root) 497 absroot = os.path.abspath(root)
498 498
499 # We use the sha1 of HEAD as a name of this change. 499 # We use the sha1 of HEAD as a name of this change.
500 name = RunCommand(['git', 'rev-parse', 'HEAD']).strip() 500 name = RunCommand(['git', 'rev-parse', 'HEAD']).strip()
501 # Need to pass a relative path for msysgit. 501 # Need to pass a relative path for msysgit.
502 try: 502 try:
503 files = scm.GIT.CaptureStatus([root], upstream_branch) 503 files = scm.GIT.CaptureStatus([root], '.', upstream_branch)
504 except subprocess2.CalledProcessError: 504 except subprocess2.CalledProcessError:
505 DieWithError( 505 DieWithError(
506 ('\nFailed to diff against upstream branch %s!\n\n' 506 ('\nFailed to diff against upstream branch %s!\n\n'
507 'This branch probably doesn\'t exist anymore. To reset the\n' 507 'This branch probably doesn\'t exist anymore. To reset the\n'
508 'tracking branch, please run\n' 508 'tracking branch, please run\n'
509 ' git branch --set-upstream %s trunk\n' 509 ' git branch --set-upstream %s trunk\n'
510 'replacing trunk with origin/master or the relevant branch') % 510 'replacing trunk with origin/master or the relevant branch') %
511 (upstream_branch, self.GetBranch())) 511 (upstream_branch, self.GetBranch()))
512 512
513 issue = ConvertToInteger(self.GetIssue()) 513 issue = ConvertToInteger(self.GetIssue())
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1416 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1417 1417
1418 # Not a known command. Default to help. 1418 # Not a known command. Default to help.
1419 GenUsage(parser, 'help') 1419 GenUsage(parser, 'help')
1420 return CMDhelp(parser, argv) 1420 return CMDhelp(parser, argv)
1421 1421
1422 1422
1423 if __name__ == '__main__': 1423 if __name__ == '__main__':
1424 fix_encoding.fix_encoding() 1424 fix_encoding.fix_encoding()
1425 sys.exit(main(sys.argv[1:])) 1425 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | git_try.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698