# HG changeset patch # User Pierre-Yves David # Date 1344357998 -7200 # Node ID 52b5e14c63d537ed75905ebce4773cfddc832825 # Parent aedb6b8ace866436950c530d6a8d08c733eedd1a obsolete: enforce pdiff and pstatus alias in the extension diff --git a/enable.sh b/enable.sh --- a/enable.sh +++ b/enable.sh @@ -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 diff --git a/hgext/obsolete.py b/hgext/obsolete.py --- a/hgext/obsolete.py +++ b/hgext/obsolete.py @@ -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() diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -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 diff --git a/tests/test-evolve.t b/tests/test-evolve.t --- a/tests/test-evolve.t +++ b/tests/test-evolve.t @@ -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