Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(450)

Side by Side Diff: git-cl

Issue 1671043: Call git update-index --refresh in git-cl
Patch Set: Created 15 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« 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 getpass 5 import getpass
6 import optparse 6 import optparse
7 import os 7 import os
8 import re 8 import re
9 import readline 9 import readline
10 import subprocess 10 import subprocess
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 if not os.path.exists(hook): 596 if not os.path.exists(hook):
597 return 597 return
598 return RunCommand([hook, upstream_branch], error_ok=error_ok, 598 return RunCommand([hook, upstream_branch], error_ok=error_ok,
599 redirect_stdout=False) 599 redirect_stdout=False)
600 600
601 601
602 def CMDpresubmit(parser, args): 602 def CMDpresubmit(parser, args):
603 """run presubmit tests on the current changelist""" 603 """run presubmit tests on the current changelist"""
604 (options, args) = parser.parse_args(args) 604 (options, args) = parser.parse_args(args)
605 605
606 if RunGit(['diff-index', 'HEAD']): 606 if RunGit(['diff-index', 'HEAD']):
evan 2010/06/24 01:11:11 this one too i think
thakis 2010/06/24 01:14:34 Done.
607 print 'Cannot presubmit with a dirty tree. You must commit locally first.' 607 print 'Cannot presubmit with a dirty tree. You must commit locally first.'
608 return 1 608 return 1
609 609
610 if args: 610 if args:
611 base_branch = args[0] 611 base_branch = args[0]
612 else: 612 else:
613 # Default to diffing against the "upstream" branch. 613 # Default to diffing against the "upstream" branch.
614 cl = Changelist() 614 cl = Changelist()
615 base_branch = cl.GetUpstreamBranch() 615 base_branch = cl.GetUpstreamBranch()
616 616
(...skipping 13 matching lines...) Expand all
630 parser.add_option('-m', dest='message', help='message for patch') 630 parser.add_option('-m', dest='message', help='message for patch')
631 parser.add_option('-r', '--reviewers', 631 parser.add_option('-r', '--reviewers',
632 help='reviewer email addresses') 632 help='reviewer email addresses')
633 parser.add_option('--send-mail', action='store_true', 633 parser.add_option('--send-mail', action='store_true',
634 help='send email to reviewer immediately') 634 help='send email to reviewer immediately')
635 parser.add_option("--emulate_svn_auto_props", action="store_true", 635 parser.add_option("--emulate_svn_auto_props", action="store_true",
636 dest="emulate_svn_auto_props", 636 dest="emulate_svn_auto_props",
637 help="Emulate Subversion's auto properties feature.") 637 help="Emulate Subversion's auto properties feature.")
638 (options, args) = parser.parse_args(args) 638 (options, args) = parser.parse_args(args)
639 639
640 # Make sure index is up-to-date before running diff-index.
641 RunGit(['update-index', '--refresh', '-q'], error_ok=True)
640 if RunGit(['diff-index', 'HEAD']): 642 if RunGit(['diff-index', 'HEAD']):
641 print 'Cannot upload with a dirty tree. You must commit locally first.' 643 print 'Cannot upload with a dirty tree. You must commit locally first.'
642 return 1 644 return 1
643 645
644 cl = Changelist() 646 cl = Changelist()
645 if args: 647 if args:
646 base_branch = args[0] 648 base_branch = args[0]
647 else: 649 else:
648 # Default to diffing against the "upstream" branch. 650 # Default to diffing against the "upstream" branch.
649 base_branch = cl.GetUpstreamBranch() 651 base_branch = cl.GetUpstreamBranch()
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 # "fix" the usage and the description now that we know the subcommand. 1068 # "fix" the usage and the description now that we know the subcommand.
1067 GenUsage(parser, argv[0]) 1069 GenUsage(parser, argv[0])
1068 return command(parser, argv[1:]) 1070 return command(parser, argv[1:])
1069 # Not a known command. Default to help. 1071 # Not a known command. Default to help.
1070 GenUsage(parser, 'help') 1072 GenUsage(parser, 'help')
1071 return CMDhelp(parser, argv) 1073 return CMDhelp(parser, argv)
1072 1074
1073 1075
1074 if __name__ == '__main__': 1076 if __name__ == '__main__':
1075 sys.exit(main(sys.argv[1:])) 1077 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
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b