Commits

Pierre-Yves David  committed fded4d9 Merge

merge with stable improvement

  • Participants
  • Parent commits 1f8f8dd, f17a0f8
  • Branches default

Comments (0)

Files changed (2)

File hgext/evolve.py

     try:
         wlock = repo.wlock()
         try:
+            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:
-                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

   $ 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]
+
+
+(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
   | |/
   | x  1:568a468b60fc@default(draft) a nifty feature
   |/
-  @  0:e55e0562ee93@default(draft) base
+  @  0:e55e0562ee93@default(public) base
   
   $ hg debugobsolete
   524e478d4811d405c8771e4c441de4483bdf8b33 f8111a076f0975cbecb336e2bd3411be22b673fb 0 {'date': '* *', 'user': 'test'} (glob)