obsolete: enforce pdiff and pstatus alias in the extension
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 07 Aug 2012 18:46:38 +0200
changeset 445 52b5e14c63d5
parent 444 aedb6b8ace86
child 446 9d47474d2582
obsolete: enforce pdiff and pstatus alias in the extension
enable.sh
hgext/obsolete.py
tests/test-amend.t
tests/test-evolve.t
--- a/enable.sh	Tue Aug 07 18:26:13 2012 +0200
+++ b/enable.sh	Tue Aug 07 18:46:38 2012 +0200
@@ -35,12 +35,6 @@
 ### useful alias to check future amend result
 # equivalent to the qdiff command for mq
 
-# diff
-pdiff=diff --rev .^
-
-# status
-pstatus=status --rev .^
-
 # diff with the previous amend
 odiff=diff --rev 'limit(precursors(.),1)' --rev .
 EOF
--- a/hgext/obsolete.py	Tue Aug 07 18:26:13 2012 +0200
+++ b/hgext/obsolete.py	Tue Aug 07 18:46:38 2012 +0200
@@ -460,9 +460,16 @@
 
 
 #####################################################################
-### Additional Utilities functions                                ###
+### Additional Utilities                                          ###
 #####################################################################
 
+@eh.uisetup
+def _installalias(ui):
+    if ui.config('alias', 'pstatus', None) is None:
+        ui.setconfig('alias', 'pstatus', 'status --rev .^')
+    if ui.config('alias', 'pdiff', None) is None:
+        ui.setconfig('alias', 'pdiff', 'diff --rev .^')
+
 def _precursors(repo, s):
     """Precursor of a changeset"""
     cs = set()
--- a/tests/test-amend.t	Tue Aug 07 18:26:13 2012 +0200
+++ b/tests/test-amend.t	Tue Aug 07 18:46:38 2012 +0200
@@ -58,6 +58,17 @@
   $ echo a >> a
   $ hg ci -m changea
   $ echo a > a
+  $ hg status
+  M a
+  $ hg pstatus
+  $ hg diff
+  diff -r 2f97fe38810f a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	* +0000 (glob)
+  @@ -1,2 +1,1 @@
+   a
+  -a
+  $ hg pdiff
   $ hg ci -m reseta
   $ hg amend --change 2
   abort: no updates found
--- a/tests/test-evolve.t	Tue Aug 07 18:26:13 2012 +0200
+++ b/tests/test-evolve.t	Tue Aug 07 18:46:38 2012 +0200
@@ -212,6 +212,10 @@
 
 and **amend**::
 
+  $ hg status
+  $ hg pstatus
+  $ hg diff
+  $ hg pdiff
   $ hg amend --note "fix spelling of Zwei"
 
 The `--note` is our commit message for the *update* only. So its only purpose