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

Side by Side Diff: git_cl.py

Issue 15898005: presubmit: Call 'git diff' once per change instead of once per file (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix unit test on Windows. Created 7 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
« no previous file with comments | « no previous file | patch.py » ('j') | presubmit_support.py » ('J')
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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 json 10 import json
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 # We use the sha1 of HEAD as a name of this change. 689 # We use the sha1 of HEAD as a name of this change.
690 name = RunCommand(['git', '--no-pager', 'rev-parse', 'HEAD']).strip() 690 name = RunCommand(['git', '--no-pager', 'rev-parse', 'HEAD']).strip()
691 # Need to pass a relative path for msysgit. 691 # Need to pass a relative path for msysgit.
692 try: 692 try:
693 files = scm.GIT.CaptureStatus([root], '.', upstream_branch) 693 files = scm.GIT.CaptureStatus([root], '.', upstream_branch)
694 except subprocess2.CalledProcessError: 694 except subprocess2.CalledProcessError:
695 DieWithError( 695 DieWithError(
696 ('\nFailed to diff against upstream branch %s!\n\n' 696 ('\nFailed to diff against upstream branch %s!\n\n'
697 'This branch probably doesn\'t exist anymore. To reset the\n' 697 'This branch probably doesn\'t exist anymore. To reset the\n'
698 'tracking branch, please run\n' 698 'tracking branch, please run\n'
699 ' git branch --set-upstream %s trunk\n' 699 ' git branch --set-upstream-to=trunk\n'
700 'replacing trunk with origin/master or the relevant branch') % 700 'replacing trunk with origin/master or the relevant branch') %
701 (upstream_branch, self.GetBranch())) 701 (upstream_branch))
702 702
703 issue = self.GetIssue() 703 issue = self.GetIssue()
704 patchset = self.GetPatchset() 704 patchset = self.GetPatchset()
705 if issue: 705 if issue:
706 description = self.GetDescription() 706 description = self.GetDescription()
707 else: 707 else:
708 # If the change was never uploaded, use the log messages of all commits 708 # If the change was never uploaded, use the log messages of all commits
709 # up to the branch point, as git cl upload will prefill the description 709 # up to the branch point, as git cl upload will prefill the description
710 # with these log messages. 710 # with these log messages.
711 description = RunCommand(['git', '--no-pager', 711 description = RunCommand(['git', '--no-pager',
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 GenUsage(parser, 'help') 2096 GenUsage(parser, 'help')
2097 return CMDhelp(parser, argv) 2097 return CMDhelp(parser, argv)
2098 2098
2099 2099
2100 if __name__ == '__main__': 2100 if __name__ == '__main__':
2101 # These affect sys.stdout so do it outside of main() to simplify mocks in 2101 # These affect sys.stdout so do it outside of main() to simplify mocks in
2102 # unit testing. 2102 # unit testing.
2103 fix_encoding.fix_encoding() 2103 fix_encoding.fix_encoding()
2104 colorama.init() 2104 colorama.init()
2105 sys.exit(main(sys.argv[1:])) 2105 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | patch.py » ('j') | presubmit_support.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698