Commits

Pierre-Yves David committed 52b5e14

obsolete: enforce pdiff and pstatus alias in the extension

Comments (0)

Files changed (4)

 ### 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

hgext/obsolete.py

 
 
 #####################################################################
-### 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()

tests/test-amend.t

   $ 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

tests/test-evolve.t

 
 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