memctx: calculate manifest more efficiently

Before this patch, "memctx._manifest" updates all entries in the
(parent) manifest. But this is inefficiency, because almost all files
may be clean in that context.

On the other hand, just updating entries for changed "files" specified
at construction causes unexpected abortion, when there is at least one
newly removed file (see issue4470 for detail).

To calculate manifest more efficiently, this patch replaces
"pman.iteritems()" for the loop by "self._status.modified" to avoid
updating entries for clean or removed files

Examination of removal is also omitted, because removed files aren't
treated in this loop (= "self[f]" returns not None always).

--HG--
extra : rebase_source : 5928bca1e780a154c8554ad2ad2573882967cb89
extra : amend_source : 8c98d4fe8e1421707d59f319a2603551960fa6ae
memctx: remove redundant test for issue4470 from test-commit.t

Because:

  - the test to avoid regression for issue4470 was already added to
    test-commit-amend.t by previous patch

    It is also a part of test series about manifest calculation issues
    of memctx in test-commit-amend.t.

  - this is the only test using "commit --amend" in test-commit.t

--HG--
extra : rebase_source : cf4a7600412575168ebbb2226d7b8a080ae9fab7
namespaces: add template name of a namespace

The template name property will be used in upcoming patches to automatically
generate a template keyword. For example, given a namespace called 'babars', we
will automatically generate a template keyword 'babar' such that we can use it
in the following way,

$ hg log -r . -T '{babars % "King: {babar}\n"}'

--HG--
extra : rebase_source : 5687eb4c3523d1e60dd5a48863dd14b05664ac52
namespaces: add method to get template name of namespace

This patch adds the public api for getting the template name of a namespace so
that the next patch can use it to generate a template keyword automatically.

--HG--
extra : rebase_source : 46ed12f9b8c2506e394c3a784da958da4ea7ae99
namespaces: add nodemap property

This patch adds a node-to-name map property to the namespace. This is necessary
because we cannot simply invert the name-to-node map because we do not assume
the name-to-node map to be unique (for example, consider named branches: many
nodes have one branch name).

The node-to-name is helpful in log commands where we are already iterating over
a set of nodes and want to display some kind of naming information to the user.

--HG--
extra : rebase_source : 6c8dadf6e5716ad4feba7b4e8beb95f8aa4c59ea
namespaces: add names method to return list of names for a given node

In the previous patch, we added a node-to-name map property. This patch just
exposes that interface to the api.

--HG--
extra : rebase_source : bb479de5ccfc02ecaa4ebe47fe011dc8fe036a66
templatekw: add helper method to generate a template keyword for a namespace

This marks our second feature of the namespace api: automatic template keyword.
This patch adds a method that takes in a namespace and uses the node-to-name
map to output the list of names.

--HG--
extra : rebase_source : cb483982d60794702a253233bf99576089a852a2
namespaces: generate template keyword when registering a namespace

For any namespace, we generate a template keyword. For example, given a
namespace 'babar', we automatically have the ability to use it in a template:

hg log -r . -T '{babars % "King: {babar}\n"}'

Furthermore, we only generate this keyword for a namespace if one doesn't
already exist. This is necessary for 'branches' and 'bookmarks' since both of
those have concepts of 'current' (something outside the namespace api) and also
allows extensions to override default behavior if desired.

--HG--
extra : rebase_source : 830a990b9d8da60e2e0d65c8d7ae687cf0aa57a2
templatekw: remove unneeded showtags

Now that we have the machinery of namespaces in-place, we use that instead of
hand-rolling our own template function.

Note, this can only be used for tags because both branches and bookmarks have
special case logic for 'default' and the current bookmark (which is something
outside the namespace api for now).

--HG--
extra : rebase_source : 7605d6b24dfda90a98b76f18c61382e26d6bd5a3
test: fix typo in test-help.t

--HG--
extra : rebase_source : dce9e00c747cf2e552611eac3a74ab982ee35807
highlight: ignore Unicode's extra linebreaks (issue4291)

Unicode and Python's unicode.splitlines() treat several extra legacy
ASCII codepoints as linebreaks, even though the vast bulk of computing
and Python's own str.splitlines() do not. Rather than introduce line
numbering confusion, we filter them out when highlighting.

--HG--
extra : rebase_source : 5422200d36eb19424d4b4e9c303857f3840d593d