diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1918,6 +1918,7 @@ class localrepository(object): 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 @@ class localrepository(object): 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)) diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t --- a/tests/test-obsolete-divergent.t +++ b/tests/test-obsolete-divergent.t @@ -84,6 +84,16 @@ A_1 have two direct and divergent succes $ 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 ..