1. timeless
  2. mutable-history

Commits

Pierre-Yves David  committed 9f69a5e

[evolve] amend: check phase before starting the transition

We better abort before starting a useless transaction.

  • Participants
  • Parent commits 5c031e1
  • Branches stable

Comments (0)

Files changed (2)

File hgext/evolve.py

View file
  • Ignore whitespace
     try:
         wlock = repo.wlock()
         try:
+            if old.phase() == phases.public:
+                raise util.Abort(_("can not rewrite immutable changeset %s")
+                                 % old)
             tr = repo.transaction('amend')
             try:
-                if old.phase() == phases.public:
-                    raise util.Abort(_("can not rewrite immutable changeset %s")
-                                     % old)
                 oldphase = old.phase()
                 # commit current changes as update
                 # code copied from commands.commit to avoid noisy messages

File tests/test-evolve.t

View file
  • Ignore whitespace
   $ hg bookmark -i feature-A
   $ sed -i'' -e s/Eins/Un/ main-file-1
 
+(amend of public changeset denied)
+
   $ hg phase --public 0 -v
   phase changed for 1 changesets
+  $ hg amend -c 2
+  abort: cannot amend non ancestor changeset
+  [255]
+
+
   $ hg amend --note 'french looks better'
   1 new unstables changesets
   $ hg log