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: follow Vasily's suggestions Created Jan. 15, 2017, 10:46 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 if opts.get('change'):
62 opts['title'] = repo[opts['change']].description() 62 description = repo[opts['change']].description()
63 else:
64 description = ui.prompt('New review title: ', '')
Wladimir Palant 2017/01/16 10:11:43 The logic change here will have the effect that th
Vasily Kuznetsov 2017/01/16 10:46:07 Yes, that's right. I also missed this case when su
Wladimir Palant 2017/01/16 21:50:50 This isn't the right thing to do either. We should
Vasily Kuznetsov 2017/01/16 22:39:05 My thinking was that it's quite unlikely that some
Wladimir Palant 2017/01/17 10:30:17 It's not impossible however - typically the data c
63 if not opts.get('title'): 65 if not opts.get('title'):
64 opts['title'] = ui.prompt('New review title: ', '') 66 # Drop everything but the first line of description in title
67 opts['title'] = description.rstrip().split('\n')[0]
65 if not opts['title'].strip(): 68 if not opts['title'].strip():
66 raise error.Abort('No review title given.') 69 raise error.Abort('No review title given.')
67 70
68 if not opts.get('message'): 71 if not opts.get('message'):
69 opts['message'] = opts['title'] 72 opts['message'] = description
70 73
71 path = (ui.config('paths', 'default-push') 74 path = (ui.config('paths', 'default-push')
72 or ui.config('paths', 'default') 75 or ui.config('paths', 'default')
73 or '') 76 or '')
74 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) 77 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path)
75 if match: 78 if match:
76 opts['base_url'] = 'https://' + match.group(1) 79 opts['base_url'] = 'https://' + match.group(1)
77 80
78 # Make sure there is at least one reviewer 81 # Make sure there is at least one reviewer
79 if not opts.get('reviewers'): 82 if not opts.get('reviewers'):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 </body> 159 </body>
157 </html> 160 </html>
158 ''' % port 161 ''' % port
159 162
160 # Run the upload tool 163 # Run the upload tool
161 issue, patchset = scope['RealMain']([upload_path] + args) 164 issue, patchset = scope['RealMain']([upload_path] + args)
162 165
163 # Wait for the page to check in and retrieve issue URL 166 # Wait for the page to check in and retrieve issue URL
164 if server: 167 if server:
165 server.handle_request() 168 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