commands: upgrade pdiff and pstatus to full commands
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 21 Sep 2017 15:18:28 +0200
changeset 2953 b9aea9e48203
parent 2952 f1bbc536602a
child 2954 54f7b8fcdf3b
commands: upgrade pdiff and pstatus to full commands Doing so make them appears in the documentation, improving their discoverability.
README
hgext3rd/evolve/__init__.py
--- 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 .",