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

Side by Side Diff: git_cl/git_cl.py

Issue 6172003: Update the index in SendUpstream before tree check.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 9 years, 11 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/python 1 #!/usr/bin/python
2 # git-cl -- a git-command for integrating reviews on Rietveld 2 # git-cl -- a git-command for integrating reviews on Rietveld
3 # Copyright (C) 2008 Evan Martin <martine@danga.com> 3 # Copyright (C) 2008 Evan Martin <martine@danga.com>
4 4
5 import errno 5 import errno
6 import logging 6 import logging
7 import optparse 7 import optparse
8 import os 8 import os
9 import re 9 import re
10 import subprocess 10 import subprocess
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 "even without uploading for review") 852 "even without uploading for review")
853 (options, args) = parser.parse_args(args) 853 (options, args) = parser.parse_args(args)
854 cl = Changelist() 854 cl = Changelist()
855 855
856 if not args or cmd == 'push': 856 if not args or cmd == 'push':
857 # Default to merging against our best guess of the upstream branch. 857 # Default to merging against our best guess of the upstream branch.
858 args = [cl.GetUpstreamBranch()] 858 args = [cl.GetUpstreamBranch()]
859 859
860 base_branch = args[0] 860 base_branch = args[0]
861 861
862 # Make sure index is up-to-date before running diff-index.
863 RunGit(['update-index', '--refresh', '-q'], error_ok=True)
862 if RunGit(['diff-index', 'HEAD']): 864 if RunGit(['diff-index', 'HEAD']):
863 print 'Cannot %s with a dirty tree. You must commit locally first.' % cmd 865 print 'Cannot %s with a dirty tree. You must commit locally first.' % cmd
864 return 1 866 return 1
865 867
866 # This rev-list syntax means "show all commits not in my branch that 868 # This rev-list syntax means "show all commits not in my branch that
867 # are in base_branch". 869 # are in base_branch".
868 upstream_commits = RunGit(['rev-list', '^' + cl.GetBranchRef(), 870 upstream_commits = RunGit(['rev-list', '^' + cl.GetBranchRef(),
869 base_branch]).splitlines() 871 base_branch]).splitlines()
870 if upstream_commits: 872 if upstream_commits:
871 print ('Base branch "%s" has %d commits ' 873 print ('Base branch "%s" has %d commits '
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1247 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1246 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 1248 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
1247 1249
1248 # Not a known command. Default to help. 1250 # Not a known command. Default to help.
1249 GenUsage(parser, 'help') 1251 GenUsage(parser, 'help')
1250 return CMDhelp(parser, argv) 1252 return CMDhelp(parser, argv)
1251 1253
1252 1254
1253 if __name__ == '__main__': 1255 if __name__ == '__main__':
1254 sys.exit(main(sys.argv[1:])) 1256 sys.exit(main(sys.argv[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