Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> [Tue, 16 Aug 2016 08:21:16 +0000] rev 29803
match: remove matchessubrepo method (API)
Since it is no more used in cmdutil.{files,remove} and scmutil.addremove
we remove this method.
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> [Tue, 16 Aug 2016 08:15:12 +0000] rev 29802
subrepo: cleanup of subrepo filematcher logic
Previously in the worst case we iterated the files in matcher twice and
had a method only for this, which reimplemented logic in subdirmatchers
constructor. So we replaced the method with a subdirmatcher.files() call.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 14:46:24 +0900] rev 29801
pycompat: delay loading modules registered to stub
Replacement _pycompatstub designed to be compatible with our demandimporter.
try-except is replaced by version comparison because ImportError will no longer
be raised immediately.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Aug 2016 12:35:15 +0900] rev 29800
py3: import builtin wrappers automagically by code transformer
This should be less invasive than mucking builtins.
Since tokenize.untokenize() looks start/end positions of tokens, we calculates
them from the NEWLINE token of the future import.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 12:51:21 +0900] rev 29799
py3: provide (del|get|has|set)attr wrappers that accepts bytes
These functions will be imported automagically by our code transformer.
getattr() and setattr() are widely used in our code. We wouldn't probably
want to rewrite every single call of getattr/setattr. delattr() and hasattr()
aren't that important, but they are functions of the same kind.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 12:44:13 +0900] rev 29798
py3: check python version to enable builtins hack
Future patches will add (del|get|has|set)attr wrappers.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 12:41:54 +0900] rev 29797
py3: move xrange alias next to import lines
Builtin functions should be available in compatibility code.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Aug 2016 17:15:54 +0900] rev 29796
check-code: allow assignment to hasattr variable
Yuya Nishihara <yuya@tcha.org> [Mon, 15 Aug 2016 16:07:55 +0900] rev 29795
debugobsolete: add formatter support (
issue5134)
It appears that computing index isn't cheap if --rev is specified. That's
why "index" field is available only if --index is specified.
I've named marker.flags() as "flag" because "flags" implies a list or dict
in template world.
Thanks to Piotr Listkiewicz for the initial implementation of this patch.
Yuya Nishihara <yuya@tcha.org> [Mon, 15 Aug 2016 12:58:33 +0900] rev 29794
formatter: add function to convert dict to appropriate format
This will be used to process key-value pairs by formatter. The default
field names and format are derived from the {extras} template keyword.
Tests will be added later.
Yuya Nishihara <yuya@tcha.org> [Mon, 15 Aug 2016 17:17:39 +0900] rev 29793
check-code: make dict() pattern less invasive
'foodict(x=y)' should be allowed.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 21:29:46 -0700] rev 29792
hgweb: tweak zlib chunking behavior
When doing streaming compression with zlib, zlib appears to emit chunks
with data after ~20-30kb on average is available. In other words, most
calls to compress() return an empty string. On the mozilla-unified repo,
only 48,433 of 921,167 (5.26%) of calls to compress() returned data.
In other words, we were sending hundreds of thousands of empty chunks
via a generator where they touched who knows how many frames (my guess
is millions). Filtering out the empty chunks from the generator
cuts down on overhead.
In addition, we were previously feeding 8kb chunks into zlib
compression. Since this function tends to emit *compressed* data after
20-30kb is available, it would take several calls before data was
produced. We increase the amount of data fed in at a time to 32kb.
This reduces the number of calls to compress() from 921,167 to
115,146. It also reduces the number of output chunks from 48,433 to
31,377. This does increase the average output chunk size by a little.
But I don't think this will matter in most scenarios.
The combination of these 2 changes appears to shave ~6s CPU time
or ~3% from a server serving the mozilla-unified repo.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 17:07:05 +0900] rev 29791
test-gpg: run migration of v1 secret keys beforehand
This suppresses unwanted output at "hg sign".
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 17:01:33 +0900] rev 29790
test-gpg: start gpg-agent under control of the test runner
GnuPG v2 automatically starts gpg-agent. We should kill the daemon process.
Yuya Nishihara <yuya@tcha.org> [Sun, 14 Aug 2016 16:49:47 +0900] rev 29789
test-gpg: make temporary copy of GNUPGHOME
GnuPG v2 will convert v1 secret keys and create a socket under $GNUPGHOME.
This patch makes sure no state would persist.
We no longer need to verify trustdb.gpg, which was added by
aae219a99a6e.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 15 Aug 2016 20:39:33 -0700] rev 29788
hgweb: document why we don't allow untrusted settings to control zlib
Added comment per discussion on mercurial-devel.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 18:37:24 -0700] rev 29787
hgweb: profile HTTP requests
Currently, running `hg serve --profile` doesn't yield anything useful:
when the process is terminated the profiling output displays results
from the main thread, which typically spends most of its time in
select.select(). Furthermore, it has no meaningful results from
mercurial.* modules because the threads serving HTTP requests don't
actually get profiled.
This patch teaches the hgweb wsgi applications to profile individual
requests. If profiling is enabled, the profiler kicks in after
HTTP/WSGI environment processing but before Mercurial's main request
processing.
The profile results are printed to the configured profiling output.
If running `hg serve` from a shell, they will be printed to stderr,
just before the HTTP request line is logged. If profiling to a file,
we only write a single profile to the file because the file is not
opened in append mode. We could add support for appending to files
in a future patch if someone wants it.
Per request profiling doesn't work with the statprof profiler because
internally that profiler collects samples from the thread that
*initially* requested profiling be enabled. I have plans to address
this by vendoring Facebook's customized statprof and then improving
it.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 16:03:30 -0700] rev 29786
hgweb: abstract call to hgwebdir wsgi function
The function names and behavior now matches hgweb. The reason for this
will be obvious in the next patch.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 18:28:43 -0700] rev 29785
profiling: don't error with statprof when profiling has already started
statprof.reset() asserts if profiling has already started. So don't
call if it profiling is already running.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 17:51:12 -0700] rev 29784
profiling: add a context manager that no-ops if profiling isn't enabled
And refactor dispatch.py to use it. As you can see, the resulting code
is much simpler.
I was tempted to inline _runcommand as part of writing this series.
However, a number of extensions wrap _runcommand. So keeping it around
is necessary (extensions can't easily wrap runcommand because it calls
hooks before and after command execution).
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 18:25:22 -0700] rev 29783
profiling: make profiling functions context managers (API)
This makes profiling more flexible since we can now call multiple
functions when a profiler is active. But the real reason for this
is to enable a future consumer to profile a function that returns
a generator. We can't do this from the profiling function itself
because functions can either be generators or have return values:
they can't be both. So therefore it isn't possible to have a generic
profiling function that can both consume and re-emit a generator
and return a value.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 16:35:58 -0700] rev 29782
dispatch: set profiling.enabled when profiling is enabled
We do this for other global command arguments. We don't for --profile
for reasons that are unknown to me. Probably because nobody has needed
it.
An upcoming patch will introduce a new consumer of the profiling
code. It doesn't have access to command line arguments. So let's
set the config option during argument processing.
We also remove a check for "options['profile']" because it is now
redundant.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 14 Aug 2016 16:30:44 -0700] rev 29781
profiling: move profiling code from dispatch.py (API)
Currently, profiling code lives in dispatch.py, which is a low-level
module centered around command dispatch. Furthermore, dispatch.py
imports a lot of other modules, meaning that importing dispatch.py
to get at profiling functionality would often result in a module import
cycle.
Profiling is a generic activity. It shouldn't be limited to command
dispatch. This patch moves profiling code from dispatch.py to the
new profiling.py. The low-level "run a profiler against a function"
functions have been moved verbatim. The code for determining how to
invoke the profiler has been extracted to its own function.
I decided to create a new module rather than stick this code
elsewhere (such as util.py) because util.py is already quite large.
And, I foresee this file growing larger once Facebook's profiling
enhancements get added to it.
Augie Fackler <augie@google.com> [Mon, 15 Aug 2016 12:26:02 -0400] rev 29780
merge with stable
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 13 Aug 2016 04:21:42 +0530] rev 29779
pycompat: avoid using an extra function
We have a single line function which just lowercase the letters and replaces
"_" with "". Its better to avoid that function call. Moreover we calling this
function around 33 times.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 13 Aug 2016 03:03:01 +0530] rev 29778
pycompat: remove multiple occurences of urlencode
By mistake we had two occurences of urlencode.
Augie Fackler <augie@google.com> [Fri, 12 Aug 2016 17:51:48 -0400] rev 29777
osx: stamp the hg version into the version field in the pkg
This is required for tools like https://github.com/munki/munki, and is
also more semantically correct.
Maciej Fijalkowski <fijall@gmail.com> [Thu, 28 Jul 2016 14:18:01 +0200] rev 29776
performance: disable workaround for an old bug of Python gc
Since disabling the gc does things worse for pypy and the bug was
fixed in 2.7, let's only enable it in <2.7
Simon Farnsworth <simonfar@fb.com> [Fri, 12 Aug 2016 05:56:40 -0700] rev 29775
merge: always use other, not remote, in user prompts
Now that we store and display merge labels in user prompts (not just
conflict markets), we should rely on labels to clarify the two sides of a
merge operation (hg merge, hg update, hg rebase etc).
"remote" is not a great name here, as it conflates "remote" as in "remote
server" with "remote" as in "the side of the merge that's further away". In
cases where you're merging the "wrong way" around, remote can even be the
"local" commit that you're merging with something pulled from the remote
server.
Simon Farnsworth <simonfar@fb.com> [Fri, 12 Aug 2016 06:01:42 -0700] rev 29774
merge: use labels in prompts to the user
Now that we persist the labels, we can consistently use the labels in
prompts for the user without risk of confusion. This changes a huge amount
of command output:
This means that merge prompts like:
no tool found to merge a
keep (l)ocal, take (o)ther, or leave (u)nresolved? u
and
remote changed a which local deleted
use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
become:
no tool found to merge a
keep (l)ocal [working copy], take (o)ther [destination], or leave (u)nresolved? u
and
remote [source] changed a which local [dest] deleted
use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
where "working copy" and "destination" were supplied by the command that
requested the merge as labels for conflict markers, and thus should be
human-friendly.
Mateusz Kwapich <mitrandir@fb.com> [Tue, 09 Aug 2016 09:15:46 -0700] rev 29773
journal: use the dirstate parentchange callbacks
Instead of hacking into dirstate internals let's use the callbacks
to be notified about wd parent change.
Mateusz Kwapich <mitrandir@fb.com> [Thu, 11 Aug 2016 08:00:41 -0700] rev 29772
dirstate: add callback to notify extensions about wd parent change
The journal extension had to touch the dirstate internals to be notified about
wd parent change. To make that detection cleaner and reusable let's move it core.
Now the extension can register to be notified about parent changes.
Yuya Nishihara <yuya@tcha.org> [Sat, 06 Aug 2016 20:46:53 +0900] rev 29771
revpair: do not optimize tree to check for odd-range spec
At
cc3a30ff9490, we had to optimize a parsed tree to resolve x^:y ambiguity.
Since we've moved the resolution of x^:y to parse(), we no longer have to call
optimize(). Therefore, (x:y) can be taken as a single expression, not an odd
range expression x:y.
Yuya Nishihara <yuya@tcha.org> [Sat, 06 Aug 2016 20:37:48 +0900] rev 29770
revset: also parse x^: as (x^):
Given x^:y is (x^):y, this seems sensible.
Yuya Nishihara <yuya@tcha.org> [Sat, 06 Aug 2016 20:21:00 +0900] rev 29769
revset: resolve ambiguity of x^:y before alias expansion
This is purely a parsing problem, which should be resolved before alias
expansion.
Yuya Nishihara <yuya@tcha.org> [Sat, 06 Aug 2016 19:59:28 +0900] rev 29768
revset: add test for resolution of infix/suffix ambiguity of x^:y
This is the test for
805651777188, and I'm going to fix the failure of
'x^A' where 'revsetalias.A=:y'.
Yuya Nishihara <yuya@tcha.org> [Sun, 05 Jul 2015 21:11:19 +0900] rev 29767
parser: remove unused binding parameter from suffix action
Because a suffix action never takes subsequent tokens, it should have
no binding strength nor closing character. I've tried if this value could
be used to resolve infix/suffix ambiguity of x^:y, but it appears not. So
I decided to resend this patch.
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Aug 2016 14:58:49 +0900] rev 29766
revset: fix keyword arguments to go through optimization process
Before, a keyvalue node was processed by the last catch-all condition of
_optimize(). Therefore, topo.firstbranch=expr would bypass tree rewriting
and would crash if an expr wasn't trivial.
Jun Wu <quark@fb.com> [Wed, 10 Aug 2016 16:27:33 +0100] rev 29765
extensions: add unwrapfunction to undo wrapfunction
Before this patch, we don't have a safe way to undo a wrapfunction because
other extensions may wrap the same function and calling setattr will undo
them accidentally.
This patch adds an "unwrapfunction" to address the issue. It removes the
wrapper from the wrapper chain, and re-wraps everything, which is not the
most efficient but short and easy to understand. We can revisit the code
if we have perf issues with long chains.
The "undo" feature is useful in cases like wrapping a function just in a
scope. Like, having a "select" command to interactively (using arrow keys)
select content from some output (ex. smartlog). It could wrap "ui.label" to
extract interesting texts just in the "select" command.
Jun Wu <quark@fb.com> [Wed, 10 Aug 2016 15:21:42 +0100] rev 29764
extensions: add getwrapperchain to get a list of wrappers
The getwrapperchain returns a list of wrappers + the original function, making
it easier to understand what has been wrapped by whom. For example:
In : mercurial.extensions.getwrapperchain(mercurial.dispatch, '_runcommand')
Out:
[<function hgext.pager.pagecmd>,
<function hgext.color.colorcmd>,
<function hgext.zeroconf.cleanupafterdispatch>,
<function mercurial.dispatch._runcommand>]
It will also be useful to safely unwrap a function. See the next patch.
Jun Wu <quark@fb.com> [Wed, 10 Aug 2016 15:21:42 +0100] rev 29763
extensions: set attributes to wrappers so we can trace them back
This patch adds two attributes about the original function and the unbound
wrapper. It allows us to get a chain of wrappers. See the next patch.
Jun Wu <quark@fb.com> [Wed, 10 Aug 2016 15:05:20 +0100] rev 29762
ui: drop values returned by inspect.*frame*() to avoid cycles
"f = inspect.currentframe()" instantly creates a cycle because
"f.f_locals['f']" is "f" itself.
This patch explicitly sets those frame objects to None to avoid cycles.
Jun Wu <quark@fb.com> [Tue, 09 Aug 2016 16:45:28 +0100] rev 29761
dispatch: split global error handling out so it can be reused
We may want a similar error handling at worker.py. This patch extracts the
error handling logic to "callcatch" so it can be reused.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 10 Aug 2016 04:35:44 +0530] rev 29760
py3: conditionalize _winreg import
_winreg module is renamed to winreg in python 3. Added the conditionalize
statements in the respective file because adding this in pycompat will result
in pycompat throwing error as this is a windows registry module and we have
buildbots and most of the contributors on linux.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 08 Aug 2016 23:51:11 +0530] rev 29759
py3: conditionalize the raise statement
raise E,V,T is not acceptable in Python 3, thats is conditionalized.
Moreover this will result in syntax error so we have to use exec() to
execute this. Related PEP- https://www.python.org/dev/peps/pep-3109/#id14
My implementation is motivated from the six implementation except they are
defining a new function exec_() to prevent adding an extra frame AFAIK :)
https://bitbucket.org/gutworth/six/src/
ca4580a5a648/six.py#six.py-680
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> [Tue, 09 Aug 2016 09:02:51 +0000] rev 29758
match: added matchessubrepo method to matcher
Previously there were three local implementations of this
function in cmdutil.files, cmdutil.remove and scmutil.addremove.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Aug 2016 22:06:07 -0700] rev 29757
changegroup: move branch cache debug message to proper location
Before, we logged about performing a branch cache update when we
weren't actually doing it. Fix that.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 08 Aug 2016 18:05:10 +0200] rev 29756
journal: take wlock for writting the 'shared' file
As we did for the shared extension itself, we add some locking around the write
of the 'shared' file.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Sun, 07 Aug 2016 17:15:19 +0200] rev 29755
debugbuilddag: take wlock to cover '.hg/localtags'
This debug command can write local tags. local tags are in the .hg directory and
should be covered by the 'wlock'. This is now covered.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 08 Aug 2016 17:33:45 +0200] rev 29754
fakemergerecord: take wlock to write the merge state
The merge state is supposed to be covered by the wlock. We fix the test
extensions to comply to that.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Sun, 07 Aug 2016 17:10:47 +0200] rev 29753
shared: take wlock for writting the 'shared' file
I do not see a reason why this should not be covered by the wlock.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Sun, 07 Aug 2016 17:00:45 +0200] rev 29752
mq: take wlock when 'qqueue' is doing write operations
Apparently when this command was added, the locking was forgotten. No code
changes beside the indentation from the locking context.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Tue, 09 Aug 2016 02:28:34 +0900] rev 29751
py3: make check-py3-compat.py use correct module name at loading pure modules
Before this patch, check-py3-compat.py implies unintentional ".pure"
sub-package name at loading pure modules, because module name is
composed by just replacing "/" in the path to actual ".py" file by
".".
This makes pure modules belong to "mercurial.pure" package, and
prevents them from importing a module belonging to "mercurial" package
relatively by "from . import foo" or so.
This is reason why pure modules fail to import another module
relatively only at examination by check-py3-compat.py.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Tue, 09 Aug 2016 02:28:34 +0900] rev 29750
py3: update output of check-py3-compat.py with python3
Recent work on mercurial/pure/mpatch.py made it import
mercurial.policy, and changed output of check-py3-compat.py with
python3 in test-check-py3-compat.t. But test-check-py3-compat.t isn't
yet updated.
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Aug 2016 10:06:56 +0900] rev 29749
mpatch: raise MemoryError instead of mpatchError if lalloc() failed
MemoryError is handled differently in dispatch._runcatch().
Since mpatch_errors[] isn't that useful now, I've changed it to a simple
switch statement.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 07 Aug 2016 18:09:58 -0700] rev 29748
hgweb: config option to control zlib compression level
Before this patch, the HTTP transport protocol would always zlib
compress certain responses (notably "getbundle" wire protocol commands)
at zlib compression level 6.
zlib can be a massive CPU resource sink for servers. Some server
operators may wish to reduce server-side CPU requirements while
requiring more bandwidth. This is common on corporate intranets, for
example. Others may wish to use more CPU but reduce bandwidth.
This patch introduces a config option to allow server operators
to control the zlib compression level.
On the "mozilla-unified" generaldelta repository, setting this
value to "0" (disable compression) results in server-side CPU
utilization for a `hg clone` going from ~180s to ~124s CPU time on
my i7-6700K. A level of "1" (which increases the transfer size from
~1,074 MB at level 6 to ~1,222 MB) utilizes ~132s CPU time.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 06 Aug 2016 17:04:22 -0700] rev 29747
help: don't try to render a section on sub-topics
This patch subtly changes the behavior of the parsing of "X.Y" values
to not set the "section" variable when rendering a known sub-topic.
Previously, "section" would be the same as the sub-topic name. This
required the sub-topic RST to have a section named the same as the
sub-topic name.
When I made this change, the descriptions from help.internalstable
started being rendered in command line output. This didn't look correct
to me, as it didn't match the formatting of main help pages. I
corrected this by moving the top section to help.internalstable and
changing the section levels of all the "internals" topics.
The end result is that "internals" topics now match the rendering of
main topics on both the CLI and HTML. And, "internals" topics no longer
require a main section matching the name of the topic.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 05 Aug 2016 15:01:16 +0200] rev 29746
branchmap: remove extra indent
This clean up the rest of the previous changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 05 Aug 2016 15:00:53 +0200] rev 29745
branchmap: simplify error handlind when writing rev branch cache
Now that we have a general try except, we can move the error handling from the
individual writes in it.
Code will be reindented in the next changeset to help this on readability.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 05 Aug 2016 14:57:16 +0200] rev 29744
branchmap: acquires lock before writting the rev branch cache
We now attempt to acquire a lock and write the branch cache within that lock.
This would prevent cache corruption when multiple processes try to write the cache
at the same time.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 05 Aug 2016 14:54:46 +0200] rev 29743
branchmap: preparatory indent of indent the branch rev writing code
The rev branch cache is written without a lock, we are going to fix this but we
indent the code beforehand to make the next changeset clearer.
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Aug 2016 09:47:07 +0900] rev 29742
mpatch: silence warning about maybe-uninitialized variable
It's false positive, but it wouldn't be possible for gcc to know
PyBytes_FromStringAndSize() sets PyErr_Occurred().
mercurial/mpatch_module.c:105:47: warning: 'r' may be used uninitialized
in this function [-Wmaybe-uninitialized]
PyErr_SetString(mpatch_Error, mpatch_errors[-r]);
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Aug 2016 09:40:30 +0900] rev 29741
mpatch: change lalloc() to local function
It was mistakenly made public at
b9b9f9a92481.
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Aug 2016 09:49:07 +0900] rev 29740
mpatch: remove superfluous whitespaces