Chromium Code Reviews

Side by Side Diff: git_cl.py

Issue 92533002: Add --open option to git cl issue. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 (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 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
11 import glob 11 import glob
12 import json 12 import json
13 import logging 13 import logging
14 import optparse 14 import optparse
15 import os 15 import os
16 import Queue 16 import Queue
17 import re 17 import re
18 import stat 18 import stat
19 import sys 19 import sys
20 import textwrap 20 import textwrap
21 import threading 21 import threading
22 import urllib2 22 import urllib2
23 import urlparse 23 import urlparse
24 import webbrowser
24 25
25 try: 26 try:
26 import readline # pylint: disable=F0401,W0611 27 import readline # pylint: disable=F0401,W0611
27 except ImportError: 28 except ImportError:
28 pass 29 pass
29 30
30 31
31 from third_party import colorama 32 from third_party import colorama
32 from third_party import upload 33 from third_party import upload
33 import breakpad # pylint: disable=W0611 34 import breakpad # pylint: disable=W0611
(...skipping 2106 matching lines...)
2140 if args: 2141 if args:
2141 # One arg means set upstream branch. 2142 # One arg means set upstream branch.
2142 RunGit(['branch', '--set-upstream', cl.GetBranch(), args[0]]) 2143 RunGit(['branch', '--set-upstream', cl.GetBranch(), args[0]])
2143 cl = Changelist() 2144 cl = Changelist()
2144 print "Upstream branch set to " + cl.GetUpstreamBranch() 2145 print "Upstream branch set to " + cl.GetUpstreamBranch()
2145 else: 2146 else:
2146 print cl.GetUpstreamBranch() 2147 print cl.GetUpstreamBranch()
2147 return 0 2148 return 0
2148 2149
2149 2150
2151 def CMDweb(parser, args):
2152 """Opens the current CL in the web browser."""
2153 _, args = parser.parse_args(args)
2154 if args:
2155 parser.error('Unrecognized args: %s' % ' '.join(args))
2156 return 0
M-A Ruel 2013/12/02 21:57:57 Remove this line since it's not needed, parser.err
Lei Zhang 2013/12/02 22:00:34 Done. I also fixed all the other instances, includ
2157
2158 issue_url = Changelist().GetIssueURL()
2159 if not issue_url:
2160 print >> sys.stderr, 'ERROR No issue to open'
2161 return 1
2162
2163 webbrowser.open(issue_url)
2164 return 0
2165
2166
2150 def CMDset_commit(parser, args): 2167 def CMDset_commit(parser, args):
2151 """Sets the commit bit to trigger the Commit Queue.""" 2168 """Sets the commit bit to trigger the Commit Queue."""
2152 _, args = parser.parse_args(args) 2169 _, args = parser.parse_args(args)
2153 if args: 2170 if args:
2154 parser.error('Unrecognized args: %s' % ' '.join(args)) 2171 parser.error('Unrecognized args: %s' % ' '.join(args))
2155 cl = Changelist() 2172 cl = Changelist()
2156 cl.SetFlag('commit', '1') 2173 cl.SetFlag('commit', '1')
2157 return 0 2174 return 0
2158 2175
2159 2176
(...skipping 173 matching lines...)
2333 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2350 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2334 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2351 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2335 2352
2336 2353
2337 if __name__ == '__main__': 2354 if __name__ == '__main__':
2338 # These affect sys.stdout so do it outside of main() to simplify mocks in 2355 # These affect sys.stdout so do it outside of main() to simplify mocks in
2339 # unit testing. 2356 # unit testing.
2340 fix_encoding.fix_encoding() 2357 fix_encoding.fix_encoding()
2341 colorama.init() 2358 colorama.init()
2342 sys.exit(main(sys.argv[1:])) 2359 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