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.

--HG--
extra : rebase_source : f7b04b83cafc54fb8ba91e88330e5668ede7b951
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.

--HG--
extra : rebase_source : ea47ac184012afa0b4161de5a0abe6d51498bfd6
serve: tidy up indent level of repository not found message

--HG--
extra : rebase_source : 59a0ebe4e5f838dc5e3f24a77a193d9cc37ff2c1
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.
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.
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.
dispatch: handle empty IOError args

We occasionally throw bare IOError objects (especially in convert),
don't choke on them.