Commits

Pierre-Yves David committed f17a0f8

[evolve] amend: display proper error message while trying to amend non ancestor

Comments (0)

Files changed (2)

             if old.phase() == phases.public:
                 raise util.Abort(_("can not rewrite immutable changeset %s")
                                  % old)
+            if not repo.revs('%d and (::.)', old):
+                raise error.Abort(_('cannot amend non ancestor changeset'))
             tr = repo.transaction('amend')
             try:
                 oldphase = old.phase()

tests/test-evolve.t

   [255]
 
 
+(amend of on ancestors)
+
+  $ hg amend -c 2
+  abort: cannot amend non ancestor changeset
+  [255]
+
   $ hg amend --note 'french looks better'
   1 new unstables changesets
   $ hg log