repoview: do not crash when localtags refers to non existing revisions
This fixes a crash that may happen when using mercurial 3.0.x.
The _gethiddenblockers function assumed that the output of tags.readlocaltags()
was a dict mapping tags to of valid nodes. However this was not necessarily the
case. When a repository had obsolete revisions and had local tag pointing to a
non existing revision was found, many mercurial commands would crash.
This revision fixes the problem by removing any tags from the output of
tags.readlocaltags() which point to invalid nodes.
We may want to add a warning when this happens (although it might be
annoying to get that warning for every command, possibly even more than once per
command).
A test for this problem has been added to test-obsolete.t. Without this fix the
test would output:
$ hg tags
abort: 00changelog.i@
3816541e5485: no node!
[255]
Instead of:
$ hg tags
tiptag 2:
3816541e5485
tip 2:
3816541e5485
visible 0:
193e9254ce7e
templater: add symbol to error
This patch makes it easier to debug writing templater functions by
telling the user exactly what was sent to the templater.
templater: introduce startswith function
This function returns a string only if it starts with a given string.
It is particularly useful when combined with splitlines and/or used with
conditionals that fail when empty strings are passed in to take action
based on the contents of a line.
templatefilter: add splitlines function
This is useful for applying changes to each line, and it's especially powerful
when used in conjunction with conditionals to modify lines based on content.
serve: inline checkrepo() that is used only when --stdio is specified
Since
e811b93f2cb1, --cmdserver is allowed to start without repository, so
checkrepo() function is meaningless.
serve: make sure to print "listening at" message immediately
If stdout is piped, status message won't be flushed until client connects to
the server and access log is written to stdout. It seems bad idea to queue
start-up banner of server process.