Mercurial > hg-stable
changeset 18162:df1b37c8ae67
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.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 21 Dec 2012 22:58:59 +0100 |
parents | 5b117f82cbdb |
children | c5bd753c5bc6 |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Dec 17 15:17:54 2012 +0100 +++ b/mercurial/localrepo.py Fri Dec 21 22:58:59 2012 +0100 @@ -1816,9 +1816,11 @@ 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!" + # plain versions for i18n tool to detect them + _("push includes unstable changeset: %s!") + _("push includes bumped changeset: %s!") + _("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 @@ -1827,12 +1829,10 @@ 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))