mercurial/context.py
changeset 35571 265cd9e19d26
parent 35400 8a0cac20a1ad
child 35580 cb0db11f392d
equal deleted inserted replaced
35570:3e3f4c03876b 35571:265cd9e19d26
    34     error,
    34     error,
    35     fileset,
    35     fileset,
    36     match as matchmod,
    36     match as matchmod,
    37     mdiff,
    37     mdiff,
    38     obsolete as obsmod,
    38     obsolete as obsmod,
       
    39     obsutil,
    39     patch,
    40     patch,
    40     pathutil,
    41     pathutil,
    41     phases,
    42     phases,
    42     pycompat,
    43     pycompat,
    43     repoview,
    44     repoview,
   431     """build an exception to be raised about a filtered changeid
   432     """build an exception to be raised about a filtered changeid
   432 
   433 
   433     This is extracted in a function to help extensions (eg: evolve) to
   434     This is extracted in a function to help extensions (eg: evolve) to
   434     experiment with various message variants."""
   435     experiment with various message variants."""
   435     if repo.filtername.startswith('visible'):
   436     if repo.filtername.startswith('visible'):
   436         msg = _("hidden revision '%s'") % changeid
   437 
       
   438         # Check if the changeset is obsolete
       
   439         unfilteredrepo = repo.unfiltered()
       
   440         ctx = unfilteredrepo[changeid]
       
   441 
       
   442         # If the changeset is obsolete, enrich the hint with the reason that
       
   443         # made this changeset not visible
       
   444         if ctx.obsolete():
       
   445             reason = obsutil._getfilteredreason(unfilteredrepo, ctx)
       
   446             msg = _("hidden revision '%s' %s") % (changeid, reason)
       
   447         else:
       
   448             msg = _("hidden revision '%s'") % changeid
       
   449 
   437         hint = _('use --hidden to access hidden revisions')
   450         hint = _('use --hidden to access hidden revisions')
       
   451 
   438         return error.FilteredRepoLookupError(msg, hint=hint)
   452         return error.FilteredRepoLookupError(msg, hint=hint)
   439     msg = _("filtered revision '%s' (not in '%s' subset)")
   453     msg = _("filtered revision '%s' (not in '%s' subset)")
   440     msg %= (changeid, repo.filtername)
   454     msg %= (changeid, repo.filtername)
   441     return error.FilteredRepoLookupError(msg)
   455     return error.FilteredRepoLookupError(msg)
   442 
   456