This revision was automatically updated to reflect the committed changes. Closed by commit rHG0e0daf46a30c: visibility: make the filtered message translatable (authored by lothiraldan, committed by ).
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1852?vs=4801&id=4805 REVISION DETAIL https://phab.mercurial-scm.org/D1852 AFFECTED FILES mercurial/context.py mercurial/obsutil.py CHANGE DETAILS diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -865,33 +865,42 @@ return "".join(line) -def _getfilteredreason(unfilteredrepo, ctx): + +filteredmsgtable = { + "pruned": _("hidden revision '%s' is pruned"), + "diverged": _("hidden revision '%s' has diverged"), + "superseded": _("hidden revision '%s' was rewritten as: %s"), + "superseded_split": _("hidden revision '%s' was split as: %s"), + "superseded_split_several": _("hidden revision '%s' was split as: %s and " + "%d more"), +} + +def _getfilteredreason(unfilteredrepo, changeid, ctx): """return a human-friendly string on why a obsolete changeset is hidden """ successors = successorssets(unfilteredrepo, ctx.node()) fate = _getobsfate(successors) # Be more precise in case the revision is superseded if fate == 'pruned': - reason = _('is pruned') + return filteredmsgtable['pruned'] % changeid elif fate == 'diverged': - reason = _('has diverged') + return filteredmsgtable['diverged'] % changeid elif fate == 'superseded': - reason = _("was rewritten as: %s") % nodemod.short(successors[0][0]) + single_successor = nodemod.short(successors[0][0]) + return filteredmsgtable['superseded'] % (changeid, single_successor) elif fate == 'superseded_split': succs = [] for node_id in successors[0]: succs.append(nodemod.short(node_id)) if len(succs) <= 2: - reason = _("was split as: %s") % ", ".join(succs) + fmtsuccs = ', '.join(succs) + return filteredmsgtable['superseded_split'] % (changeid, fmtsuccs) else: - firstsuccessors = ", ".join(succs[:2]) + firstsuccessors = ', '.join(succs[:2]) remainingnumber = len(succs) - 2 - args = (firstsuccessors, remainingnumber) - successorsmsg = _("%s and %d more") % args - reason = _("was split as: %s") % successorsmsg - - return reason + args = (changeid, firstsuccessors, remainingnumber) + return filteredmsgtable['superseded_split_several'] % args diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -442,8 +442,7 @@ # If the changeset is obsolete, enrich the message with the reason # that made this changeset not visible if ctx.obsolete(): - reason = obsutil._getfilteredreason(unfilteredrepo, ctx) - msg = _("hidden revision '%s' %s") % (changeid, reason) + msg = obsutil._getfilteredreason(unfilteredrepo, changeid, ctx) else: msg = _("hidden revision '%s'") % changeid To: lothiraldan, #hg-reviewers, yuja Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel