[PATCH 3 of 4] histedit: mention histedit-last-edit.txt on abort
Augie Fackler
raf at durin42.com
Wed Dec 2 09:12:25 CST 2015
On Wed, Dec 02, 2015 at 02:13:35AM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1449043656 0
> # Wed Dec 02 08:07:36 2015 +0000
> # Node ID 6c1a9a53f7c441b4ef68b7e891249539c702b2ae
> # Parent 97b0c60ab14023b65afdaa0563c8efbea6da66a8
> histedit: mention histedit-last-edit.txt on abort
Queued patches 1,3,4 with a commit message tweak on 4 and
s/instructions/rules/ in this patch (to keep the noun consistent).
I'll respond to patch 2 now with some bikeshedding.
>
> Users may spend a lot of effort writing histedit rules,
> getting an abort without being told they can recover their work
> is very frustrating.
>
> Avoid that by telling them where to find their work.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -779,6 +779,10 @@
> state.wlock = repo.wlock()
> state.lock = repo.lock()
> _histedit(ui, repo, state, *freeargs, **opts)
> + except error.Abort:
> + if repo.vfs.exists('histedit-last-edit.txt'):
> + ui.warn(_('warning: histedit instructions saved to: .hg/histedit-last-edit.txt\n'))
> + raise
> finally:
> release(state.lock, state.wlock)
>
> @@ -907,6 +911,8 @@
> cmdutil.checkunfinished(repo)
> cmdutil.bailifchanged(repo)
>
> + if repo.vfs.exists('histedit-last-edit.txt'):
> + repo.vfs.unlink('histedit-last-edit.txt')
> topmost, empty = repo.dirstate.parents()
> if outg:
> if freeargs:
> diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
> --- a/tests/test-histedit-edit.t
> +++ b/tests/test-histedit-edit.t
> @@ -460,8 +460,24 @@
> 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> reverting a
> 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
> + warning: histedit instructions saved to: .hg/histedit-last-edit.txt
> abort: cannot fold into public change 18aa70c8ad22
> [255]
> + $ cat .hg/histedit-last-edit.txt
> + fold 0012be4a27ea 2 extend a
> +
> + # Edit history between 0012be4a27ea and 0012be4a27ea
> + #
> + # Commits are listed from least to most recent
> + #
> + # Commands:
> + # p, fold = use commit
> + # e, edit = use commit, but stop for amending
> + # f, fold = use commit, but combine it with the one above
> + # r, roll = like fold, but discard this commit's description
> + # d, drop = remove commit from history
> + # m, mess = edit commit message without changing commit content
> + #
> TODO: this abort shouldn't be required, but it is for now to leave the repo in
> a clean state.
> $ hg histedit --abort
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list