Bug 1231192 - Offer to install `hg wip`; r=smacleod

--HG--
extra : rebase_source : 4fa02af4d0f723e1ffb1a5854c4bde1204bec5d7
This commit is contained in:
Gregory Szorc 2015-12-07 13:22:49 -08:00
Родитель 3ecb03a1a8
Коммит 0fdce19cb8
2 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -224,3 +224,39 @@ class MercurialConfig(object):
del ext['bundleclone']
except KeyError:
pass
def have_wip(self):
return 'wip' in self._c.get('alias', {})
def install_wip_alias(self):
"""hg wip shows a concise view of work in progress."""
alias = self._c.setdefault('alias', {})
alias['wip'] = 'log --graph --rev=wip --template=wip'
revsetalias = self._c.setdefault('revsetalias', {})
revsetalias['wip'] = ('('
'parents(not public()) '
'or not public() '
'or . '
'or (head() and branch(default))'
') and (not obsolete() or unstable()^) '
'and not closed()')
templates = self._c.setdefault('templates', {})
templates['wip'] = ("'"
# prefix with branch name
'{label("log.branch", branches)} '
# rev:node
'{label("changeset.{phase}", rev)}'
'{label("changeset.{phase}", ":")}'
'{label("changeset.{phase}", short(node))} '
# just the username part of the author, for brevity
'{label("grep.user", author|user)}'
# tags and bookmarks
'{label("log.tag", if(tags," {tags}"))} '
'{label("log.bookmark", if(bookmarks," {bookmarks}"))}'
'\\n'
# first line of commit message
'{label(ifcontains(rev, revset("."), "desc.here"),desc|firstline)}'
"'"
)

Просмотреть файл

@ -232,6 +232,31 @@ We highly recommend you activate this extension.
Would you like to activate bundleclone
'''.strip()
WIP_INFO = '''
It is common to want a quick view of changesets that are in progress.
The ``hg wip`` command provides should a view.
Example Usage:
$ hg wip
o 4084:fcfa34d0387b dminor @
| mozreview: use repository name when displaying treeherder results (bug 1230548) r=mcote
| @ 4083:786baf6d476a gps
| | mozreview: create child review requests from batch API
| o 4082:3f100fa4a94f gps
| | mozreview: copy more read-only processing code; r?smacleod
| o 4081:939417680cbe gps
|/ mozreview: add web API to submit an entire series of commits (bug 1229468); r?smacleod
(Not shown are the colors that help denote the state each changeset
is in.)
(Relevant config options: alias.wip, revsetalias.wip, templates.wip)
Would you like to install the `hg wip` alias?
'''.strip()
FILE_PERMISSIONS_WARNING = '''
Your hgrc file is currently readable by others.
@ -380,6 +405,10 @@ class MercurialSetupWizard(object):
if hg_version >= PUSHTOTRY_MINIMUM_VERSION:
self.prompt_external_extension(c, 'push-to-try', PUSHTOTRY_INFO)
if not c.have_wip():
if self._prompt_yn(WIP_INFO):
c.install_wip_alias()
if 'mq' in c.extensions:
self.prompt_external_extension(c, 'mqext', MQEXT_INFO)