[PATCH 3 of 3] obsolete: factorise troubles detection during push
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Mon Dec 17 08:41:19 CST 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355754115 -3600
# Node ID cf9a7e096a42dd13e6a34ddd5d730f231a946c3e
# Parent 5eca666b0078061addf65b5f431207db21839ebd
obsolete: factorise troubles detection during push
The use of the two methods introduced earlier allows a factorisation of the
push code preventing push of troubled changeset.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1914,27 +1914,23 @@ class localrepository(object):
# if self.obsstore == False --> no obsolete
# then, save the iteration
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!")
+ mst = "push includes %s 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:
ctx = unfi[node]
if ctx.obsolete():
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)
+ elif ctx.troubled():
+ raise util.Abort(_(mst)
+ % (ctx.troubles()[0],
+ ctx))
discovery.checkheads(unfi, remote, outgoing,
remoteheads, newbranch,
bool(inc))
# create a changegroup from local
More information about the Mercurial-devel
mailing list