diff mercurial/localrepo.py @ 17834:743d04dd48ec

push: refuse to push bumped changeset This applies the same logic as used for `obsolete` and `unstable` changesets. Refuse to push them without force. We'll probably want to factor this logic with two new functions `pctx.troubled()` and `ctx.troubles()`. But I'm waiting for the third "trouble" to make it into core.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 19 Oct 2012 00:50:12 +0200
parents 0c1185f6ddd7
children 526081552f3d
line wrap: on
line diff
--- a/mercurial/localrepo.py	Fri Oct 19 00:46:39 2012 +0200
+++ b/mercurial/localrepo.py	Fri Oct 19 00:50:12 2012 +0200
@@ -1872,6 +1872,7 @@
                             # this message are here for 80 char limit reason
                             mso = _("push includes obsolete changeset: %s!")
                             msu = _("push includes unstable changeset: %s!")
+                            msb = _("push includes bumped changeset: %s!")
                             # If we are to push if there is at least one
                             # obsolete or unstable changeset in missing, at
                             # least one of the missinghead will be obsolete or
@@ -1882,6 +1883,8 @@
                                     raise util.Abort(_(mso) % ctx)
                                 elif ctx.unstable():
                                     raise util.Abort(_(msu) % ctx)
+                                elif ctx.bumped():
+                                    raise util.Abort(_(msb) % ctx)
                         discovery.checkheads(self, remote, outgoing,
                                              remoteheads, newbranch,
                                              bool(inc))