obsolete: refuse to push divergent changeset
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Sat, 10 Nov 2012 02:19:20 +0100
changeset 18073 e411fd79ca69
parent 18072 03604f46d48a
child 18074 8c9a52492d42
obsolete: refuse to push divergent changeset As other troubles `unstable` and `bumped`. Followup patches may simplify the push code with unification of "obsolescence troubles" handling.
mercurial/localrepo.py
tests/test-obsolete-divergent.t
--- a/mercurial/localrepo.py	Wed Dec 12 03:20:49 2012 +0100
+++ b/mercurial/localrepo.py	Sat Nov 10 02:19:20 2012 +0100
@@ -1918,6 +1918,7 @@
                             mso = _("push includes obsolete changeset: %s!")
                             msu = _("push includes unstable changeset: %s!")
                             msb = _("push includes bumped changeset: %s!")
+                            msd = _("push includes divergent 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
@@ -1930,6 +1931,8 @@
                                     raise util.Abort(msu % ctx)
                                 elif ctx.bumped():
                                     raise util.Abort(msb % ctx)
+                                elif ctx.divergent():
+                                    raise util.Abort(msd % ctx)
                         discovery.checkheads(unfi, remote, outgoing,
                                              remoteheads, newbranch,
                                              bool(inc))
--- a/tests/test-obsolete-divergent.t	Wed Dec 12 03:20:49 2012 +0100
+++ b/tests/test-obsolete-divergent.t	Sat Nov 10 02:19:20 2012 +0100
@@ -84,6 +84,16 @@
   $ hg log -r 'divergent()'
   2:82623d38b9ba A_1
   3:392fd25390da A_2
+
+check that mercurial refuse to push
+
+  $ hg init ../other
+  $ hg push ../other
+  pushing to ../other
+  searching for changes
+  abort: push includes divergent changeset: 82623d38b9ba!
+  [255]
+
   $ cd ..