##// END OF EJS Templates
context: stop catching RepoLookupError from namespace.singlenode()...
context: stop catching RepoLookupError from namespace.singlenode() As pointed out by Yuya, the RepoLookupError was there for catching errors from repo.branchtip(). However, since 885c0290f7d5 (localrepo: add ignoremissing parameter to branchtip, 2014-10-16), that should no longer happen. I think it should now be an error if a namespace raises a RepoLookupError, so we propagate the exception up and and make it easy to fix, rather than trying to interpret the changeid as nodeid prefix and raise a general "unknown revision '...'" error. I also don't think we should catch FilteredLookupError and LookupError from the changelog.rev() call, for the same reason as above: If a namespace returns a node that doesn't exist, we should provide a more helpful exception than "unknown revision '...'". Differential Revision: https://phab.mercurial-scm.org/D3145

File last commit:

r35906:c8e2d6ed default
r37409:3198d5a2 default
Show More
test-log-exthook.t
60 lines | 1.5 KiB | text/troff | Tads3Lexer
/ tests / test-log-exthook.t
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 Test hg log changeset printer external hook
-------------------------------------------
$ cat > $TESTTMP/logexthook.py <<EOF
Augie Fackler
tests: update test-log-exthook to pass our import checker
r33966 > from __future__ import absolute_import
> from mercurial import (
> commands,
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 > logcmdutil,
Augie Fackler
tests: update test-log-exthook to pass our import checker
r33966 > repair,
> )
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 > def rot13description(self, ctx):
> summary = "summary".encode('rot13')
> description = ctx.description().strip().splitlines()[0].encode('rot13')
> self.ui.write("%s: %s\n" % (summary, description))
> def reposetup(ui, repo):
Yuya Nishihara
cmdutil: drop aliases for logcmdutil functions (API)...
r35906 > logcmdutil.changesetprinter._exthook = rot13description
Boris Feld
log: add an extension hook-point in changeset_printer...
r33155 > EOF
Prepare the repository
$ hg init empty
$ cd empty
$ touch ROOT
$ hg commit -A -m "Root" ROOT
$ touch a b c
$ hg commit -A -m "Add A, B, C" a b c
Check the log
$ hg log --config extensions.t=$TESTTMP/logexthook.py
changeset: 1:70fc82b23320
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Nqq N, O, P
summary: Add A, B, C
changeset: 0:b00443a54871
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Ebbg
summary: Root
Check that exthook is working with graph log too
$ hg log -G --config extensions.t=$TESTTMP/logexthook.py
@ changeset: 1:70fc82b23320
| tag: tip
| user: test
| date: Thu Jan 01 00:00:00 1970 +0000
| fhzznel: Nqq N, O, P
| summary: Add A, B, C
|
o changeset: 0:b00443a54871
user: test
date: Thu Jan 01 00:00:00 1970 +0000
fhzznel: Ebbg
summary: Root