Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: hgreview.py

Issue 29371804: Noissue - [hgreview] Only use first line of commit message as review title (Closed) Base URL: https://hg.adblockplus.org/codingtools/
Patch Set: Remove unnecessary condition Created July 18, 2017, 1:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between 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 import BaseHTTPServer 1 import BaseHTTPServer
2 import os 2 import os
3 import re 3 import re
4 import socket 4 import socket
5 import sys 5 import sys
6 import urllib 6 import urllib
7 7
8 from mercurial import cmdutil, error 8 from mercurial import cmdutil, error
9 9
10 SERVER = 'https://codereview.adblockplus.org' 10 SERVER = 'https://codereview.adblockplus.org'
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if opts.get('change'): 51 if opts.get('change'):
52 rev = repo[opts['change']] 52 rev = repo[opts['change']]
53 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)]) 53 args.extend(['--rev', '{}:{}'.format(rev.parents()[0], rev)])
54 elif opts.get('revision'): 54 elif opts.get('revision'):
55 args.extend(['--rev', opts['revision']]) 55 args.extend(['--rev', opts['revision']])
56 else: 56 else:
57 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.') 57 raise error.Abort('What should be reviewed? Either --revision or --chang e is required.')
58 58
59 if not opts.get('issue'): 59 if not opts.get('issue'):
60 # New issue, make sure title and message are set 60 # New issue, make sure title and message are set
61 if not opts.get('title') and opts.get('change'): 61 fulltitle = None
62 opts['title'] = repo[opts['change']].description() 62
63 if not opts.get('title'): 63 if not opts.get('title') and not opts.get('change'):
64 opts['title'] = ui.prompt('New review title: ', '') 64 opts['title'] = ui.prompt('New review title: ', '')
65 elif not opts.get('title'):
66 fulltitle = repo[opts['change']].description()
67 opts['title'] = fulltitle.rstrip().split('\n')[0]
68
65 if not opts['title'].strip(): 69 if not opts['title'].strip():
66 raise error.Abort('No review title given.') 70 raise error.Abort('No review title given.')
67 71
68 if not opts.get('message'): 72 if not opts.get('message'):
69 opts['message'] = opts['title'] 73 opts['message'] = fulltitle or opts['title']
70 74
71 path = (ui.config('paths', 'default-push') 75 path = (ui.config('paths', 'default-push')
72 or ui.config('paths', 'default') 76 or ui.config('paths', 'default')
73 or '') 77 or '')
74 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) 78 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path)
75 if match: 79 if match:
76 opts['base_url'] = 'https://' + match.group(1) 80 opts['base_url'] = 'https://' + match.group(1)
77 81
78 # Make sure there is at least one reviewer 82 # Make sure there is at least one reviewer
79 if not opts.get('reviewers'): 83 if not opts.get('reviewers'):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 </body> 160 </body>
157 </html> 161 </html>
158 ''' % port 162 ''' % port
159 163
160 # Run the upload tool 164 # Run the upload tool
161 issue, patchset = scope['RealMain']([upload_path] + args) 165 issue, patchset = scope['RealMain']([upload_path] + args)
162 166
163 # Wait for the page to check in and retrieve issue URL 167 # Wait for the page to check in and retrieve issue URL
164 if server: 168 if server:
165 server.handle_request() 169 server.handle_request()
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