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

Side by Side Diff: hgreview.py

Issue 29349225: Issue 4313 - hg review shouldn't fail if the repository has no URL configured (Closed)
Patch Set: Structure the code a bit better Created Aug. 16, 2016, 10:36 a.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if not opts.get('title') and opts.get('change'): 58 if not opts.get('title') and opts.get('change'):
59 opts['title'] = repo[opts['change']].description() 59 opts['title'] = repo[opts['change']].description()
60 if not opts.get('title'): 60 if not opts.get('title'):
61 opts['title'] = ui.prompt('New review title: ', '') 61 opts['title'] = ui.prompt('New review title: ', '')
62 if not opts['title'].strip(): 62 if not opts['title'].strip():
63 raise error.Abort('No review title given.') 63 raise error.Abort('No review title given.')
64 64
65 if not opts.get('message'): 65 if not opts.get('message'):
66 opts['message'] = opts['title'] 66 opts['message'] = opts['title']
67 67
68 path = ui.config('paths', 'default-push') or ui.config('paths', 'default ') 68 path = (ui.config('paths', 'default-push')
69 or ui.config('paths', 'default')
70 or '')
69 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path) 71 match = re.search(r'^(?:https://|ssh://hg@)(.*)', path)
70 if match: 72 if match:
71 opts['message'] = '{0}\n\nRepository: {1}'.format( 73 opts['message'] = '{0}\n\nRepository: {1}'.format(
72 opts['message'].strip(), 74 opts['message'].strip(),
73 match.group(1) 75 match.group(1)
74 ) 76 )
75 77
76 # Make sure there is at least one reviewer 78 # Make sure there is at least one reviewer
77 if not opts.get('reviewers'): 79 if not opts.get('reviewers'):
78 opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '') 80 opts['reviewers'] = ui.prompt('Reviewers (comma-separated): ', '')
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 </body> 151 </body>
150 </html> 152 </html>
151 ''' % port 153 ''' % port
152 154
153 # Run the upload tool 155 # Run the upload tool
154 issue, patchset = scope['RealMain']([upload_path] + args) 156 issue, patchset = scope['RealMain']([upload_path] + args)
155 157
156 # Wait for the page to check in and retrieve issue URL 158 # Wait for the page to check in and retrieve issue URL
157 if server: 159 if server:
158 server.handle_request() 160 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