revert: add support for reverting subrepos

Reverting a subrepo is done by updating it to the revision that is selected on
the parent repo .hgsubstate file.

* ISSUES/TODO:

- reverting added and removed subrepos is not supported yet.
- reverting subrepos is only supported if the --no-backup flag is used (this
limitation will be removed on another patch).
- The behavior of the --all flag has been changed. It now reverts subrepos as
well. Note that this may lead to data loss if the user has a dirty subrepo.
revert: add support for reverting subrepos without --no-backup and/or --all

When a subrepo is reverted but --no-backup is not set, call revert on the
subrepo that is being reverted prior to updating it to the revision specified
in the parent repo's .hgsubstate file.

The --all flag is passed down to the subrepo when it is being reverted. If the
--all flag is not set, all files that are modified on the subrepo will be
reverted.
graphlog: implement --hidden

--HG--
extra : rebase_source : 902144c1c42f1664fd99b7c5829d310b8e8f24b7
graphlog: add all log options to glog command

glog and log -G should be equivalent.

--HG--
extra : rebase_source : 53457ed872d1098e97a8e763fb9a319e1e64270e
graphlog: reduce duplication in --follow code

--HG--
extra : rebase_source : c5198bab1040eeacd852dd0f932e8c3f7e2ed294
graphlog: fix --follow FILE and relative paths

The situation is complicated because filelog() revset uses a match object in
relpath mode while follow() revset interprets the filename as a manifest entry.

--HG--
extra : rebase_source : 2453a047fcd9746624853239af8222ff55ae9200
revlog: fix partial revision() docstring (from d7d64b89a65c)

--HG--
extra : rebase_source : 0f07ff8be0bdfc40c6c7cde69b9640512d7f9f5b
scmutil: fix systemrcpath regression introduced in f5dd179bfa4a

Changeset f5dd179bfa4a introduced a 'root' path component to look for
hgrc files, which is used both as an absolute path and a path relative
to the <install-root>.
The latter one was broken since 'root' was set to an absolute location
and the subsequent os.path.join discarded the <install-root> path prefix.

--HG--
extra : rebase_source : 36e6e9b789ef872dc5e12db8de2fd2367c401b7e
util.h: replace ntohl/htonl with get/putbe32

--HG--
extra : rebase_source : aece38ca1d5f96a3e6428b4d1b9d2a6dae9d47e7
pure: quiesce build warnings

The following patch fixes the following warning when building pure:
package init file 'mercurial/pure/__init__.py' not found (or not a regular file)

--HG--
extra : rebase_source : d0f33050f758a92bfc223a0e1e190899488de657
largefiles: fix cat for largefiles (issue3352)

This is a fix to largefiles so that 'hg cat' will work correctly when a
largefile is specified.

As per discussion on Issue 3352:

1) The file will be printed regardless if it is binary or large.
2) The file is downloaded if it is not readily available (not found in
   the system cache), so that it can be printed.  If the download fails,
   then we abort.
repair: fix missing import

introduced by: b5c0c7d0f83fe56240ce7a919581f1cbff4f5ee5
localrepo: do not complain about missing journal files
plan9: finalize documentation for next release
fileset: add "subrepo" fileset symbol

This new fileset symbol returns a list of subrepos whose paths match a given
pattern. If the argument has no pattern type set, an exact
match is performed.

If no argument is passed, return a list of all subrepos.
revset: make matching keyword not match summary when matching for description
revset: speedup matching() by stopping the match early if a field does not match

Rather than getting all the fields that are being matches from every revision
and then comparing them to those of the target revision, compare each field one
by one and stop the match as soon as there is a match failure.

This can greatly reduce the match time when matching multiple fields.
The impact on match time when matching a single field seems negligible
(according to my measurements).
revset: speedup matching() by first matching fields that take less time to
match

This patch sorts the fields that are passed to the matching function so that it
always starts by matching those fields that take less time to match.

Not all fields take the same amount of time to match. I've done several
measurements running the following command:

hg --time log -r "matching(1, field)"

on the mercurial repository, and where 'field' was each one of the fields
accepted by match. In order to avoid the print overhead (which could be
different for different fields, given the different number of matches) I used a
modified version of the matching() function which always returns no matches.

These tests showed that different fields take wildly different amounts of time
to match. Particulary the substate field takes up to 25 seconds to match on my
machine, compared to the 0.3 seconds that takes to match the phase field or the
2 seconds (approx) that takes to match most fields. With this patch, matching
both the phase and the substate of a revision takes the same amount of time as
matching the phase.

The field match order introduced by this patch is as follows:

phase, parents, user, date, branch, summary, files, description, substate

An extra nice thing about this patch is that it makes the match time stable.
tests: add tests for matching keyword

This adds a couple of tests for the revset "matching" keyword:

1. Test that the 2nd parameter is optional
2. Test that all the 1st argument can be a revset and that all the supported
fields of the 2nd argument work.
hgweb: add hook for remapping repository path into virtual paths

Extensions such as largefiles can use this to remap files so they
appear in the same location as they do in the user's working copy.