# HG changeset patch # User Pierre-Yves David # Date 1356127139 -3600 # Node ID df1b37c8ae679693a0829e231d359f1dc20bb78e # Parent 5b117f82cbdb9b082ce59024193cf0a302bee105 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 -r 5b117f82cbdb -r df1b37c8ae67 mercurial/localrepo.py --- 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))