mercurial/context.py
changeset 35571 265cd9e19d26
parent 35400 8a0cac20a1ad
child 35580 cb0db11f392d
--- a/mercurial/context.py	Fri Dec 29 03:37:36 2017 +0530
+++ b/mercurial/context.py	Fri Jan 05 09:12:08 2018 +0100
@@ -36,6 +36,7 @@
     match as matchmod,
     mdiff,
     obsolete as obsmod,
+    obsutil,
     patch,
     pathutil,
     phases,
@@ -433,8 +434,21 @@
     This is extracted in a function to help extensions (eg: evolve) to
     experiment with various message variants."""
     if repo.filtername.startswith('visible'):
-        msg = _("hidden revision '%s'") % changeid
+
+        # Check if the changeset is obsolete
+        unfilteredrepo = repo.unfiltered()
+        ctx = unfilteredrepo[changeid]
+
+        # If the changeset is obsolete, enrich the hint with the reason that
+        # made this changeset not visible
+        if ctx.obsolete():
+            reason = obsutil._getfilteredreason(unfilteredrepo, ctx)
+            msg = _("hidden revision '%s' %s") % (changeid, reason)
+        else:
+            msg = _("hidden revision '%s'") % changeid
+
         hint = _('use --hidden to access hidden revisions')
+
         return error.FilteredRepoLookupError(msg, hint=hint)
     msg = _("filtered revision '%s' (not in '%s' subset)")
     msg %= (changeid, repo.filtername)