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.
This commit is contained in:
Pierre-Yves David 2012-11-10 02:19:20 +01:00
parent 38afff41e0
commit 2038eca723
2 changed files with 13 additions and 0 deletions

View File

@ -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))

View File

@ -84,6 +84,16 @@ A_1 have two direct and divergent successors A_1 and A_1
$ 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 ..