Skip to content
Snippets Groups Projects
Commit 65f42beb authored by Jonas Finnemann Jensen's avatar Jonas Finnemann Jensen
Browse files

Bug 910658 - Add "qnew = -U" to defaults section in mach mercurial-setup; r=gps

DONTBUILD (NPOTB)
parent f8bc7fa7
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@
from __future__ import unicode_literals
from configobj import ConfigObj
import re
BUGZILLA_FINGERPRINT = '45:77:35:fd:6f:2c:1c:c2:90:4b:f7:b4:4d:60:c6:97:c5:5c:47:27'
......@@ -115,3 +116,30 @@ class MercurialConfig(object):
del self._c['mqext']['mqcommit']
except KeyError:
pass
def have_qnew_currentuser_default(self):
if 'defaults' not in self._c:
return False
d = self._c['defaults']
if 'qnew' not in d:
return False
argv = d['qnew'].split(' ')
for arg in argv:
if arg == '--currentuser' or re.match("-[^-]*U.*", arg):
return True
return False
def ensure_qnew_currentuser_default(self):
if self.have_qnew_currentuser_default():
return
if 'defaults' not in self._c:
self._c['defaults'] = {}
d = self._c['defaults']
if 'qnew' not in d:
d['qnew'] = '-U'
else:
d['qnew'] = '-U ' + d['qnew']
......@@ -71,6 +71,12 @@ import patches from Bugzilla using a friendly bz:// URL handler. e.g.
|hg qimport bz://123456|.
'''.strip()
QNEWCURRENTUSER_INFO = '''
The mercurial queues command |hg qnew|, which creates new patches in your patch
queue does not set patch author information by default. Author information
should be included when uploading for review.
'''.strip()
FINISHED = '''
Your Mercurial should now be properly configured and recommended extensions
should be up to date!
......@@ -204,6 +210,14 @@ class MercurialSetupWizard(object):
'default',
'Ensuring qimportbz extension is up to date...')
if not c.have_qnew_currentuser_default():
print(QNEWCURRENTUSER_INFO)
if self._prompt_yn('Would you like qnew to set patch author by '
'default'):
c.ensure_qnew_currentuser_default()
print('Configured qnew to set patch author by default.')
print('')
c.add_mozilla_host_fingerprints()
b = StringIO()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment