Mercurial > evolve
changeset 3527:7b4d1bfb6b7d
grab: gracefully handle the case when we try to grab parent of wdir
Before this patch, we go all the way down to obsmarker creation logic and gets
an error saying that changeset cannot obsolete itself. We should be more smart
here and error out early saying we cannot grab that changeset.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 13 Mar 2018 20:44:51 +0530 |
parents | df20ddc79064 |
children | 92f1e2408fd0 |
files | hgext3rd/evolve/cmdrewrite.py tests/test-grab.t |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Sat Mar 03 23:31:46 2018 +0530 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 13 20:44:51 2018 +0530 @@ -1187,7 +1187,7 @@ origctx = repo[revs.first()] - if origctx in pctx.ancestors(): + if origctx in pctx.ancestors() or origctx.node() == pctx.node(): raise error.Abort(_("cannot grab an ancestor revision")) rewriteutil.precheck(repo, [origctx.rev()], 'grab')
--- a/tests/test-grab.t Sat Mar 03 23:31:46 2018 +0530 +++ b/tests/test-grab.t Tue Mar 13 20:44:51 2018 +0530 @@ -47,6 +47,12 @@ abort: cannot grab an ancestor revision [255] +Grabbing the working directory parent + + $ hg grab -r . + abort: cannot grab an ancestor revision + [255] + Specifying multiple revisions to grab $ hg grab 1f0dee641bb7 -r 7c3bad9141dc