D6582: abort: added support for histedit

2019-07-10 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHGdb5560c07a28: abort: added support for histedit (authored 
by taapas1128).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6582?vs=15834&id=15848#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15834&id=15848

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable obsolete
@@ -522,7 +531,13 @@
   (hg histedit --continue to resume)
   [1]
 
-  $ hg histedit --abort
+#if abortcommand
+when in dry-run mode
+  $ hg abort --dry-run
+  histedit in progress, will be aborted
+#endif
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable extension used by this test
@@ -44,7 +53,7 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
@@ -66,5 +75,6 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
 Test argument handling and various data parsing
 ==
 
@@ -47,8 +56,9 @@
   $ hg histedit --continue
   abort: no histedit in progress
   [255]
-  $ hg histedit --abort
-  abort: no histedit in progress
+  $ hg abort
+  abort: no histedit in progress (abortflag !)
+  abort: no operation in progress (abortcommand !)
   [255]
 
 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -358,7 +368,7 @@
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
-  $ hg histedit --abort
+  $ hg abort
   warning: encountered an exception during histedit --abort; the repository 
may not have been completely cleaned up
   abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows 
!)
   abort: $ENOENT$: '$TESTTMP/foo/.hg/strip-backup/*-histedit.hg' (glob) 
(no-windows !)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1919,6 +1919,14 @@
 finally:
 state.clear()
 
+def hgaborthistedit(ui, repo):
+state = histeditstate(repo)
+nobackup = not ui.configbool('rewrite', 'backup-bundle')
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
+_aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
 state.read()
 if not rules:
@@ -2314,5 +2322,5 @@
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
 statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
-continueflag=True)
+continueflag=True, abortfunc=hgaborthistedit)
 



To: taapas1128, durin42, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-10 Thread pulkit (Pulkit Goyal)
This revision is now accepted and ready to land.
pulkit added inline comments.
pulkit accepted this revision.

INLINE COMMENTS

> test-histedit-no-backup.t:63
>  Enable config option:
> +
>$ cat >>$HGRCPATH 

D6582: abort: added support for histedit

2019-07-09 Thread taapas1128 (Taapas Agrawal)
taapas1128 edited the summary of this revision.
taapas1128 updated this revision to Diff 15834.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15807&id=15834

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable obsolete
@@ -522,7 +531,13 @@
   (hg histedit --continue to resume)
   [1]
 
-  $ hg histedit --abort
+#if abortcommand
+when in dry-run mode
+  $ hg abort --dry-run
+  histedit in progress, will be aborted
+#endif
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable extension used by this test
@@ -44,13 +53,14 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
 
 Test when `backup-bundle` config option is not enabled
 Enable config option:
+
   $ cat >>$HGRCPATH < [rewrite]
   > backup-bundle = False
@@ -66,5 +76,6 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
 Test argument handling and various data parsing
 ==
 
@@ -47,8 +56,9 @@
   $ hg histedit --continue
   abort: no histedit in progress
   [255]
-  $ hg histedit --abort
-  abort: no histedit in progress
+  $ hg abort
+  abort: no histedit in progress (abortflag !)
+  abort: no operation in progress (abortcommand !)
   [255]
 
 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -358,7 +368,7 @@
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
-  $ hg histedit --abort
+  $ hg abort
   warning: encountered an exception during histedit --abort; the repository 
may not have been completely cleaned up
   abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows 
!)
   abort: $ENOENT$: '$TESTTMP/foo/.hg/strip-backup/*-histedit.hg' (glob) 
(no-windows !)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1919,6 +1919,14 @@
 finally:
 state.clear()
 
+def hgaborthistedit(ui, repo):
+state = histeditstate(repo)
+nobackup = not ui.configbool('rewrite', 'backup-bundle')
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
+_aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
 state.read()
 if not rules:
@@ -2314,5 +2322,5 @@
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
 statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
-continueflag=True)
-
+continueflag=True, abortfunc=hgaborthistedit)
+



To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread taapas1128 (Taapas Agrawal)
taapas1128 edited the summary of this revision.
taapas1128 updated this revision to Diff 15807.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15782&id=15807

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable obsolete
@@ -522,7 +531,13 @@
   (hg histedit --continue to resume)
   [1]
 
-  $ hg histedit --abort
+#if abortcommand
+when in dry-run mode
+  $ hg abort --dry-run
+  histedit in progress, will be aborted
+#endif
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable extension used by this test
@@ -44,13 +53,14 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
 
 Test when `backup-bundle` config option is not enabled
 Enable config option:
+
   $ cat >>$HGRCPATH < [rewrite]
   > backup-bundle = False
@@ -66,5 +76,6 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
 Test argument handling and various data parsing
 ==
 
@@ -47,8 +56,9 @@
   $ hg histedit --continue
   abort: no histedit in progress
   [255]
-  $ hg histedit --abort
-  abort: no histedit in progress
+  $ hg abort
+  abort: no histedit in progress (abortflag !)
+  abort: no operation in progress (abortcommand !)
   [255]
 
 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -358,7 +368,7 @@
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
-  $ hg histedit --abort
+  $ hg abort
   warning: encountered an exception during histedit --abort; the repository 
may not have been completely cleaned up
   abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows 
!)
   abort: $ENOENT$: '$TESTTMP/foo/.hg/strip-backup/*-histedit.hg' (glob) 
(no-windows !)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1919,6 +1919,14 @@
 finally:
 state.clear()
 
+def hgaborthistedit(ui, repo, **opts):
+state = histeditstate(repo)
+nobackup = not ui.configbool('rewrite', 'backup-bundle')
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
+_aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
 state.read()
 if not rules:
@@ -2314,5 +2322,5 @@
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
 statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
-continueflag=True)
-
+continueflag=True, abortfunc=hgaborthistedit)
+



To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In D6582#96537 , @taapas1128 
wrote:
  
  > Okay I will do that. So should I remove `--no-backup` flag altogether from 
this series of patches because none of the commands support `--no-backup` then.
  
  Yes please remove. Also it will be nice if you fold all the abort related 
patches into one except D6608 .

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread taapas1128 (Taapas Agrawal)
taapas1128 added a comment.


  Okay I will do that. So should I remove `--no-backup` flag altogether from 
this series of patches because none of the commands support `--no-backup` then.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In D6582#96533 , @taapas1128 
wrote:
  
  > @pulkit Yeah I know that but look at D3965 
. histedit once did support `--no-backup` 
flag. It was dropped off for a different reason.
  
  Yeah, so we should respect the config option and not re-introduce the flag.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread taapas1128 (Taapas Agrawal)
taapas1128 added a comment.


  @pulkit Yeah I know that but look at D3965 
. histedit once did support `--no-backup` 
flag. It was dropped off for a different reason.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-08 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Looking closely, the backup value comes from reading 
`ui.configbool('rewrite', 'backup-bundle')` instead of a `--no-backup` flag. It 
means we can get rid of the --backup flag to `hg abort` as there exists no such 
flag for histedit.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-06 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15782.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15769&id=15782

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable obsolete
@@ -522,7 +531,17 @@
   (hg histedit --continue to resume)
   [1]
 
-  $ hg histedit --abort
+#if abortcommand
+when in dry-run mode
+  $ hg abort --dry-run
+  histedit in progress, will be aborted
+
+when dry-run mode is used with no backup
+  $ hg abort --dry-run --no-backup
+  histedit in progress, will be aborted
+#endif
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable extension used by this test
@@ -44,17 +53,19 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
 
 Test when `backup-bundle` config option is not enabled
 Enable config option:
+#if abortflag
   $ cat >>$HGRCPATH < [rewrite]
   > backup-bundle = False
   > EOF
+#endif
 
   $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
   > pick 36b4bdd91f5b 0 one
@@ -66,5 +77,10 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
+#if abortflag
   $ hg histedit --abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+#else
+  $ hg abort --no-backup
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+#endif
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
 Test argument handling and various data parsing
 ==
 
@@ -47,8 +56,9 @@
   $ hg histedit --continue
   abort: no histedit in progress
   [255]
-  $ hg histedit --abort
-  abort: no histedit in progress
+  $ hg abort
+  abort: no histedit in progress (abortflag !)
+  abort: no operation in progress (abortcommand !)
   [255]
 
 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -358,7 +368,7 @@
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
-  $ hg histedit --abort
+  $ hg abort
   warning: encountered an exception during histedit --abort; the repository 
may not have been completely cleaned up
   abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows 
!)
   abort: $ENOENT$: '$TESTTMP/foo/.hg/strip-backup/*-histedit.hg' (glob) 
(no-windows !)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1919,6 +1919,16 @@
 finally:
 state.clear()
 
+def hgaborthistedit(ui, repo, **opts):
+state = histeditstate(repo)
+nobackup = False
+if opts.get('no_backup'):
+nobackup = True
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
+_aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
 state.read()
 if not rules:
@@ -2314,5 +2324,5 @@
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
 statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
-continueflag=True)
-
+continueflag=True, abortfunc=hgaborthistedit)
+



To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel maili

D6582: abort: added support for histedit

2019-07-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15769.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15754&id=15769

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable obsolete
@@ -522,7 +531,17 @@
   (hg histedit --continue to resume)
   [1]
 
-  $ hg histedit --abort
+#if abortcommand
+when in dry-run mode
+  $ hg abort --dry-run
+  aborting histedit
+
+when dry-run mode is used with no backup
+  $ hg abort --dry-run --no-backup
+  aborting histedit
+#endif
+
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg
 
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
   $ . "$TESTDIR/histedit-helpers.sh"
 
 Enable extension used by this test
@@ -44,17 +53,19 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
-  $ hg histedit --abort
+  $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/1d8f701c7b35-cf7be322-backup.hg
   saved backup bundle to 
$TESTTMP/foo/.hg/strip-backup/5c0056670bce-b54b65d0-backup.hg
 
 Test when `backup-bundle` config option is not enabled
 Enable config option:
+#if abortflag
   $ cat >>$HGRCPATH < [rewrite]
   > backup-bundle = False
   > EOF
+#endif
 
   $ hg histedit -r '36b4bdd91f5b' --commands - << EOF
   > pick 36b4bdd91f5b 0 one
@@ -66,5 +77,10 @@
   Editing (7d5187087c79), you may commit or record as needed now.
   (hg histedit --continue to resume)
   [1]
+#if abortflag
   $ hg histedit --abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+#else
+  $ hg abort --no-backup
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+#endif
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -1,3 +1,12 @@
+#testcases abortcommand abortflag
+
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = histedit --abort
+  > EOF
+#endif
+
 Test argument handling and various data parsing
 ==
 
@@ -47,8 +56,9 @@
   $ hg histedit --continue
   abort: no histedit in progress
   [255]
-  $ hg histedit --abort
-  abort: no histedit in progress
+  $ hg abort
+  abort: no histedit in progress (abortflag !)
+  abort: no operation in progress (abortcommand !)
   [255]
 
 Run a dummy edit to make sure we get tip^^ correctly via revsingle.
@@ -358,7 +368,7 @@
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
   $ mv ../corrupt-histedit .hg/histedit-state
-  $ hg histedit --abort
+  $ hg abort
   warning: encountered an exception during histedit --abort; the repository 
may not have been completely cleaned up
   abort: $TESTTMP/foo/.hg/strip-backup/*-histedit.hg: $ENOENT$ (glob) (windows 
!)
   abort: $ENOENT$: '$TESTTMP/foo/.hg/strip-backup/*-histedit.hg' (glob) 
(no-windows !)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1919,6 +1919,18 @@
 finally:
 state.clear()
 
+def hgaborthistedit(ui, repo, **opts):
+state = histeditstate(repo)
+nobackup = False
+if opts.get('no_backup'):
+nobackup = True
+if opts.get('dry_run'):
+return 0
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
+_aborthistedit(ui, repo, state, nobackup=nobackup)
+
 def _edithisteditplan(ui, repo, state, rules):
 state.read()
 if not rules:
@@ -2314,5 +2326,5 @@
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
 statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
-continueflag=True)
-
+continueflag=True, abortfunc=hgaborthistedit)
+



To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-deve

D6582: abort: added support for histedit

2019-07-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 edited the summary of this revision.
taapas1128 updated this revision to Diff 15754.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15735&id=15754

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-abort.t

CHANGE DETAILS

diff --git a/tests/test-abort.t b/tests/test-abort.t
--- a/tests/test-abort.t
+++ b/tests/test-abort.t
@@ -3,9 +3,12 @@
   > rebase=
   > shelve=
   > mq =
+  > histedit =
   > [phases]
   > publish=False
-  > 
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
   > [alias]
   > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   > EOF
@@ -719,5 +722,257 @@
   unshelve of 'default' aborted
   $ cd ..
 
-
-
+TEST `hg abort` operation histedit
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+  $ hg init base
+  $ cd base
+
+  $ for x in a b c d e f ; do
+  > echo $x > $x
+  > hg add $x
+  > hg ci -m $x
+  > done
+
+  $ hg log --graph
+  @  5:652413bf663e (draft) f
+  |
+  o  4:e860deea161a (draft) e
+  |
+  o  3:055a42cdd887 (draft) d
+  |
+  o  2:177f92b77385 (draft) c
+  |
+  o  1:d2ae7f538514 (draft) b
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+
+  $ HGEDITOR=cat hg histedit 1
+  pick d2ae7f538514 1 b
+  pick 177f92b77385 2 c
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between d2ae7f538514 and 652413bf663e
+  #
+  # Commits are listed from least to most recent
+  #
+  # You can reorder changesets by reordering the lines
+  #
+  # Commands:
+  #
+  #  e, edit = use commit, but stop for amending
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
+  #  b, base = checkout changeset and apply further changesets from there
+  #  d, drop = remove commit from history
+  #  f, fold = use commit, but combine it with the one above
+  #  r, roll = like fold, but discard this commit's description and date
+  #
+  $ hg histedit 1 --commands - --verbose < pick 177f92b77385 2 c
+  > drop d2ae7f538514 1 b
+  > pick 055a42cdd887 3 d
+  > fold e860deea161a 4 e
+  > pick 652413bf663e 5 f
+  > EOF
+  [1]
+  $ hg log --graph --hidden
+  @  10:cacdfd884a93 (draft) f
+  |
+  o  9:59d9f330561f (draft) d
+  |
+  | x  8:b558abc46d09 (draft) fold-temp-revision e860deea161a
+  | |
+  | x  7:96e494a2d553 (draft) d
+  |/
+  o  6:b346ab9a313d (draft) c
+  |
+  | x  5:652413bf663e (draft) f
+  | |
+  | x  4:e860deea161a (draft) e
+  | |
+  | x  3:055a42cdd887 (draft) d
+  | |
+  | x  2:177f92b77385 (draft) c
+  | |
+  | x  1:d2ae7f538514 (draft) b
+  |/
+  o  0:cb9a9f314b8b (draft) a
+  
+  $ hg debugobsolete
+  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 
{cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  177f92b773850b59254aa5e923436f921b55483b 
b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  055a42cdd88768532f9cf79daa407fc8d138de9b 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  e860deea161a2f77de56603b340ebbb4536308ae 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  652413bf663ef2a641cab26574e46d5f5a64a55a 
cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 
{b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 
{96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+
+Ensure hidden revision does not prevent histedit
+-
+
+create an hidden revision
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > drop 59d9f330561f 7 d
+  > pick cacdfd884a93 8 f
+  > EOF
+  $ hg log --graph
+  @  11:c13eb81022ca (draft) f
+  |
+  o  6:b346ab9a313d (draft) c
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+check hidden revision are ignored (6 have hidden children 7 and 8)
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > pick c13eb81022ca 8 f
+  > EOF
+
+Test phases support
+===
+
+Check that histedit respect immutability
+---
+
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+
+  $ hg ph -pv '.^'
+  phase changed for 2 changesets
+  $ hg log 

D6582: abort: added support for histedit

2019-07-04 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> histedit.py:1891
> +if not state:
> +state = histeditstate(repo)
> +with repo.wlock(), repo.lock():

you need to set locks for the state too. Refer line 1685 in this file.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

To: taapas1128, durin42, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6582: abort: added support for histedit

2019-07-04 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15735.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6582?vs=15686&id=15754

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6582/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-abort.t

CHANGE DETAILS

diff --git a/tests/test-abort.t b/tests/test-abort.t
--- a/tests/test-abort.t
+++ b/tests/test-abort.t
@@ -3,9 +3,12 @@
   > rebase=
   > shelve=
   > mq =
+  > histedit =
   > [phases]
   > publish=False
-  > 
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
   > [alias]
   > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   > EOF
@@ -719,5 +722,259 @@
   unshelve of 'default' aborted
   $ cd ..
 
-
-
+TEST `hg abort` operation histedit
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+  $ hg init base
+  $ cd base
+
+  $ for x in a b c d e f ; do
+  > echo $x > $x
+  > hg add $x
+  > hg ci -m $x
+  > done
+
+  $ hg log --graph
+  @  5:652413bf663e (draft) f
+  |
+  o  4:e860deea161a (draft) e
+  |
+  o  3:055a42cdd887 (draft) d
+  |
+  o  2:177f92b77385 (draft) c
+  |
+  o  1:d2ae7f538514 (draft) b
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+
+  $ HGEDITOR=cat hg histedit 1
+  pick d2ae7f538514 1 b
+  pick 177f92b77385 2 c
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between d2ae7f538514 and 652413bf663e
+  #
+  # Commits are listed from least to most recent
+  #
+  # You can reorder changesets by reordering the lines
+  #
+  # Commands:
+  #
+  #  e, edit = use commit, but stop for amending
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
+  #  b, base = checkout changeset and apply further changesets from there
+  #  d, drop = remove commit from history
+  #  f, fold = use commit, but combine it with the one above
+  #  r, roll = like fold, but discard this commit's description and date
+  #
+  $ hg histedit 1 --commands - --verbose < pick 177f92b77385 2 c
+  > drop d2ae7f538514 1 b
+  > pick 055a42cdd887 3 d
+  > fold e860deea161a 4 e
+  > pick 652413bf663e 5 f
+  > EOF
+  [1]
+  $ hg log --graph --hidden
+  @  10:cacdfd884a93 (draft) f
+  |
+  o  9:59d9f330561f (draft) d
+  |
+  | x  8:b558abc46d09 (draft) fold-temp-revision e860deea161a
+  | |
+  | x  7:96e494a2d553 (draft) d
+  |/
+  o  6:b346ab9a313d (draft) c
+  |
+  | x  5:652413bf663e (draft) f
+  | |
+  | x  4:e860deea161a (draft) e
+  | |
+  | x  3:055a42cdd887 (draft) d
+  | |
+  | x  2:177f92b77385 (draft) c
+  | |
+  | x  1:d2ae7f538514 (draft) b
+  |/
+  o  0:cb9a9f314b8b (draft) a
+  
+  $ hg debugobsolete
+  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 
{cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  177f92b773850b59254aa5e923436f921b55483b 
b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  055a42cdd88768532f9cf79daa407fc8d138de9b 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  e860deea161a2f77de56603b340ebbb4536308ae 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  652413bf663ef2a641cab26574e46d5f5a64a55a 
cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 
{b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 
{96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+
+Ensure hidden revision does not prevent histedit
+-
+
+create an hidden revision
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > drop 59d9f330561f 7 d
+  > pick cacdfd884a93 8 f
+  > EOF
+  $ hg log --graph
+  @  11:c13eb81022ca (draft) f
+  |
+  o  6:b346ab9a313d (draft) c
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+check hidden revision are ignored (6 have hidden children 7 and 8)
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > pick c13eb81022ca 8 f
+  > EOF
+
+Test phases support
+===
+
+Check that histedit respect immutability
+---
+
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+
+  $ hg ph -pv '.^'
+  phase changed for 2 changesets
+  $ hg log -G
+  @  11:c13eb81022ca (draft) f
+  |
+  o  6:

D6582: abort: added support for histedit

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds the support for histedit in `hg abort` plan.
  `_aborthistedit()` has been modified for independent calls.
  
  Results are shown as tests.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6582

AFFECTED FILES
  hgext/histedit.py
  tests/test-abort.t

CHANGE DETAILS

diff --git a/tests/test-abort.t b/tests/test-abort.t
--- a/tests/test-abort.t
+++ b/tests/test-abort.t
@@ -3,9 +3,12 @@
   > rebase=
   > shelve=
   > mq =
+  > histedit =
   > [phases]
   > publish=False
-  > 
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
   > [alias]
   > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   > EOF
@@ -669,5 +672,233 @@
   unshelve of 'default' aborted
   $ cd ..
 
-
-
+TEST `hg abort` operation histedit
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+  $ hg init base
+  $ cd base
+
+  $ for x in a b c d e f ; do
+  > echo $x > $x
+  > hg add $x
+  > hg ci -m $x
+  > done
+
+  $ hg log --graph
+  @  5:652413bf663e (draft) f
+  |
+  o  4:e860deea161a (draft) e
+  |
+  o  3:055a42cdd887 (draft) d
+  |
+  o  2:177f92b77385 (draft) c
+  |
+  o  1:d2ae7f538514 (draft) b
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+
+  $ HGEDITOR=cat hg histedit 1
+  pick d2ae7f538514 1 b
+  pick 177f92b77385 2 c
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between d2ae7f538514 and 652413bf663e
+  #
+  # Commits are listed from least to most recent
+  #
+  # You can reorder changesets by reordering the lines
+  #
+  # Commands:
+  #
+  #  e, edit = use commit, but stop for amending
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
+  #  b, base = checkout changeset and apply further changesets from there
+  #  d, drop = remove commit from history
+  #  f, fold = use commit, but combine it with the one above
+  #  r, roll = like fold, but discard this commit's description and date
+  #
+  $ hg histedit 1 --commands - --verbose < pick 177f92b77385 2 c
+  > drop d2ae7f538514 1 b
+  > pick 055a42cdd887 3 d
+  > fold e860deea161a 4 e
+  > pick 652413bf663e 5 f
+  > EOF
+  [1]
+  $ hg log --graph --hidden
+  @  10:cacdfd884a93 (draft) f
+  |
+  o  9:59d9f330561f (draft) d
+  |
+  | x  8:b558abc46d09 (draft) fold-temp-revision e860deea161a
+  | |
+  | x  7:96e494a2d553 (draft) d
+  |/
+  o  6:b346ab9a313d (draft) c
+  |
+  | x  5:652413bf663e (draft) f
+  | |
+  | x  4:e860deea161a (draft) e
+  | |
+  | x  3:055a42cdd887 (draft) d
+  | |
+  | x  2:177f92b77385 (draft) c
+  | |
+  | x  1:d2ae7f538514 (draft) b
+  |/
+  o  0:cb9a9f314b8b (draft) a
+  
+  $ hg debugobsolete
+  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 
{cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  177f92b773850b59254aa5e923436f921b55483b 
b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  055a42cdd88768532f9cf79daa407fc8d138de9b 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  e860deea161a2f77de56603b340ebbb4536308ae 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  652413bf663ef2a641cab26574e46d5f5a64a55a 
cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 
{b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 
{96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+
+Ensure hidden revision does not prevent histedit
+-
+
+create an hidden revision
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > drop 59d9f330561f 7 d
+  > pick cacdfd884a93 8 f
+  > EOF
+  $ hg log --graph
+  @  11:c13eb81022ca (draft) f
+  |
+  o  6:b346ab9a313d (draft) c
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+check hidden revision are ignored (6 have hidden children 7 and 8)
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > pick c13eb81022ca 8 f
+  > EOF
+
+Test phases support
+===
+
+Check that histedit respect immutability
+---
+
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+