376 for l in r: |
375 for l in r: |
377 l.sort() |
376 l.sort() |
378 |
377 |
379 return r |
378 return r |
380 |
379 |
381 def _filterederror(repo, changeid): |
|
382 """build an exception to be raised about a filtered changeid |
|
383 |
|
384 This is extracted in a function to help extensions (eg: evolve) to |
|
385 experiment with various message variants.""" |
|
386 if repo.filtername.startswith('visible'): |
|
387 |
|
388 # Check if the changeset is obsolete |
|
389 unfilteredrepo = repo.unfiltered() |
|
390 ctx = unfilteredrepo[changeid] |
|
391 |
|
392 # If the changeset is obsolete, enrich the message with the reason |
|
393 # that made this changeset not visible |
|
394 if ctx.obsolete(): |
|
395 msg = obsutil._getfilteredreason(repo, changeid, ctx) |
|
396 else: |
|
397 msg = _("hidden revision '%s'") % changeid |
|
398 |
|
399 hint = _('use --hidden to access hidden revisions') |
|
400 |
|
401 return error.FilteredRepoLookupError(msg, hint=hint) |
|
402 msg = _("filtered revision '%s' (not in '%s' subset)") |
|
403 msg %= (changeid, repo.filtername) |
|
404 return error.FilteredRepoLookupError(msg) |
|
405 |
|
406 class changectx(basectx): |
380 class changectx(basectx): |
407 """A changecontext object makes access to data related to a particular |
381 """A changecontext object makes access to data related to a particular |
408 changeset convenient. It represents a read-only context already present in |
382 changeset convenient. It represents a read-only context already present in |
409 the repo.""" |
383 the repo.""" |
410 def __init__(self, repo, changeid='.'): |
384 def __init__(self, repo, changeid='.'): |
499 changeid = hex(changeid) |
473 changeid = hex(changeid) |
500 except TypeError: |
474 except TypeError: |
501 pass |
475 pass |
502 except (error.FilteredIndexError, error.FilteredLookupError, |
476 except (error.FilteredIndexError, error.FilteredLookupError, |
503 error.FilteredRepoLookupError): |
477 error.FilteredRepoLookupError): |
504 raise _filterederror(repo, changeid) |
478 raise |
505 except IndexError: |
479 except IndexError: |
506 pass |
480 pass |
507 raise error.RepoLookupError( |
481 raise error.RepoLookupError( |
508 _("unknown revision '%s'") % changeid) |
482 _("unknown revision '%s'") % changeid) |
509 |
483 |