context: call normal on the right object
dirstate.normal is the method that marks files as unchanged/normal.
Rev
20a30cd41d21 started caching dirstate.normal in order to improve
performance. However, there was an error in the patch: taking the wlock, under
some conditions depending on platform, can cause a new dirstate object to be
created. Caching dirstate.normal before calling wlock would then cause the
fixup calls below to be on the old dirstate object, effectively disappearing
into the ether.
On Unix and Unix-like OSes, the condition under which we create a new dirstate
object is 'the dirstate file has been modified since the last time we opened
it'. This happens pretty rarely, so the object is usually the same -- there's
little impact.
On Windows, the condition is 'always'. This means files in the lookup state are
never marked normal, so the bug has a serious performance impact since all the
files in the lookup state are re-read every time hg status is run.
getbundle: add a ``cg`` boolean argument to control changegroup inclusion
The ``getbundle`` function was initially design to return a changegroup bundle.
However, bundle2 allows transmitting a wide range of data. Some bundle2
requests may not include a changegroup at all.
Before this changeset, the client would request a changegroup for
``heads=[nullid]`` and receive an empty changegroup.
We introduce an official boolean parameter, ``cg``, that can be set
to false to disable changegroup generation on getbundle. A new bundle2
capability is introduced to let the client know.
wireproto: add a ``boolean`` type for getbundle parameters
This will be used to control inclusion of some parts in a bundle2.
i18n: detect UI language without POSIX-style locale variable on Windows (BC)
On Windows, it isn't common to set LANG environment variable. This patch makes
gettext honor Windows-style UI language [1] if no locale variables are set.
Because of this change, LANG=C or HGPLAIN must be set in order to disable
translation on non-English Windows.
[1]: http://msdn.microsoft.com/en-us/library/
dd374098(v=VS.85).aspx
locate: use ctx.matches instead of ctx.walk
On mozilla-central, which is around 100,000 files, best of 5:
$ hg --time locate > /dev/null
before: real 1.460 secs (user 1.140+0.000 sys 0.320+0.000)
after: real 0.620 secs (user 0.610+0.000 sys 0.020+0.000)
$ hg --time locate README > /dev/null
before: real 0.630 secs (user 0.330+0.000 sys 0.290+0.000)
after: real 0.120 secs (user 0.110+0.000 sys 0.020+0.000)
Larger repositories see correspondingly larger performance gains.
context: add a method to efficiently filter by match if possible
For non-working contexts, walk and matches do the same thing. For working
contexts, walk stats all the files and looks for unknown files, while matches
just filters the dirstate by match.
dirstate: add a method to efficiently filter by match
Current callers that require just this data call workingctx.walk, which calls
dirstate.walk, which stats all the files. Even worse, workingctx.walk looks for
unknown files, significantly slowing things down, even though callers might not
be interested in them at all.