Mercurial > evolve
changeset 2953:b9aea9e48203
commands: upgrade pdiff and pstatus to full commands
Doing so make them appears in the documentation, improving their
discoverability.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 21 Sep 2017 15:18:28 +0200 |
parents | f1bbc536602a |
children | 54f7b8fcdf3b |
files | README hgext3rd/evolve/__init__.py |
diffstat | 2 files changed, 34 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/README Thu Sep 21 14:50:55 2017 +0200 +++ b/README Thu Sep 21 15:18:28 2017 +0200 @@ -127,6 +127,7 @@ * compatibility with change in future 4.4 at this release date, * obslog/log: improve verb used to describe and evolution, * uncommit: add a --interractive option. + * pstatus/pdiff: update to full command. they now appears in the help. * stack: improve display of interleaved topic * stack: improve display of merge commit
--- a/hgext3rd/evolve/__init__.py Thu Sep 21 14:50:55 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Thu Sep 21 15:18:28 2017 +0200 @@ -458,11 +458,40 @@ ### Useful alias @eh.uisetup +def setupparentcommand(ui): + + _alias, statuscmd = cmdutil.findcmd('status', commands.table) + pstatusopts = [o for o in statuscmd[1] if o[1] != 'rev'] + + @eh.command('pstatus', pstatusopts) + def pstatus(ui, repo, *args, **kwargs): + """show status combining committed and uncommited changes + + This show the combined status of the current working copy parent commit and + the uncommitted change in the working copy itself. The status displayed + match the content of the commit that a bare :hg:`amend` will creates. + + See :hg:`help status` for details.""" + kwargs['rev'] = ['.^'] + return statuscmd[0](ui, repo, *args, **kwargs) + + _alias, diffcmd = cmdutil.findcmd('diff', commands.table) + pdiffopts = [o for o in diffcmd[1] if o[1] != 'rev'] + + @eh.command('pdiff', pdiffopts) + def pdiff(ui, repo, *args, **kwargs): + """show diff combining committed and uncommited changes + + This show the combined diff of the current working copy parent commit and + the uncommitted change in the working copy itself. The diff displayed + match the content of the commit that a bare :hg:`amend` will creates. + + See :hg:`help diff` for details.""" + kwargs['rev'] = ['.^'] + return diffcmd[0](ui, repo, *args, **kwargs) + +@eh.uisetup def _installalias(ui): - if ui.config('alias', 'pstatus', None) is None: - ui.setconfig('alias', 'pstatus', 'status --rev .^', 'evolve') - if ui.config('alias', 'pdiff', None) is None: - ui.setconfig('alias', 'pdiff', 'diff --rev .^', 'evolve') if ui.config('alias', 'odiff', None) is None: ui.setconfig('alias', 'odiff', "diff --hidden --rev 'limit(precursors(.),1)' --rev .",