[PATCH 6 of 6 V2] obsolete: refuse to push divergent changeset
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Thu Dec 13 14:51:53 UTC 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1352510360 -3600
# Node ID b23bfdeeac0afc31c5cc942326e3ec263682669b
# Parent 9e67354122fb75431540389c35c50ba35690d9e2
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.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1916,10 +1916,11 @@ class localrepository(object):
if unfi.obsstore:
# 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!")
+ 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
# unstable. So checking heads only is ok
for node in outgoing.missingheads:
@@ -1928,10 +1929,12 @@ class localrepository(object):
raise util.Abort(mso % ctx)
elif ctx.unstable():
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))
# create a changegroup from local
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
@@ -82,10 +82,20 @@ A_1 have two direct and divergent succes
392fd25390da
392fd25390da
$ 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 ..
indirect divergence with known changeset
-------------------------------------------
More information about the Mercurial-devel
mailing list