Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Jun 2017 15:20:20 +0100] rev 32790
checkheads: use 'nodemap.get' to convert nodes to revs
We are about to call 'torev' on node that might be locally missing. In this
case, 'nodemap.revs' will return None (something valid in our usecase) while
'changelog.rev' would raise an exception.
We make this change in a distinct changeset to show it does not impact the
tests.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 05 Jun 2017 15:17:47 +0100] rev 32789
checkheads: pass "ispushed" function to the obsmarkers logic
We are about to make "allfuturecommon" a set of revs instead of a set of nodes.
The function updated in this patch do not needs to know about these details so
we just pass it a 'ispushed(node)' function. This will simplify the next
changeset.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Jun 2017 12:29:29 +0100] rev 32788
profile: drop maybeprofile
It seems sufficiently simple to use "profile(enabled=X)" to not justify having
a dedicated context manager just to read the config.
(I do not have a too strong opinion about this).
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Jun 2017 12:36:07 +0100] rev 32787
profile: support --profile in alias and abbreviated version (--prof)
We now process the "--profile" a second time after alias has been processed and
the command argument fully parsed. If appropriate we enable profiling at that
time.
In these situation, the --profile will cover less than if the full --profile
flag was passed on the command line. This is better than the previous behavior
(flag ignored) and still fullfil multiple valid usecases.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Jun 2017 11:42:45 +0100] rev 32786
profile: make the contextmanager object available to the callers
This will allow calling methods on the object in the code using the context
manager.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Jun 2017 11:41:47 +0100] rev 32785
profile: introduce a knob to control if the context is actually profiling
This is a step toward allowing context where the profiling in enabled
withing the context range.
This also open the way to kill the dedicated "maybeprofile" context manager
and keep only one of 'profile' and 'maybeprofile'.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 09 Jun 2017 11:39:53 +0100] rev 32784
profile: introduce a "start" method to the profile context
The start method is doing all profiler setup and activation. It is currently
unconditionally called by '__init__' but this will be made more flexible in
later changesets.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 08 Jun 2017 01:38:48 +0100] rev 32783
profile: upgrade the "profile" context manager to a full class
So far we have been able to use a simple decorator for this. However using the
current context manager makes the scope of the profiling in dispatch
constrainted and the time frame to decide to enable profiling quite limited
(using "maybeprofile")
This is the first step toward the ability to enable the profiling from within
the profiling scope. eg::
with maybeprofiling(ui) as profiler:
...
bar.foo():
...
if options['profile']:
profiler.start()
...
fooz()
...
My target usecase is adding support for "--profile" to alias definitions with
effect. These are to be used with "profiling.output=blackbox" to gather data
about operation that get slow from time to time (eg: pull being minutes instead
of seconds from time to time).
Of course, in such case, the scope of the profiling would be smaller since
profiler would be started after running extensions 'reposetup' (and other
potentially costly logic), but these are not relevant for my target usecase
(multiple second commits, multiple tens of seconds pull).
Currently adding '--profile' to a command through alias requires to re-spin a
Mercurial binary (using "!$HG" in alias), which as a significant performance
impact, especially in context where startup performance is being worked on...
An alternative approach would be to stop using the context manager in dispatch
and move back to a try/finally setup.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 09 Jun 2017 22:15:53 -0400] rev 32782
setup: avoid linker warnings on Windows about multiple export specifications
The PyMODINIT_FUNC macro contains __declspec(dllexport), and then the build
process adds an "/EXPORT func" to the command line. The 64-bit linker flags
this [1].
Everything except zstd.c and bser.c are covered by redefining the macro in
util.h [2]. These modules aren't built with util.h in the #include path, so the
redefining hack would have to be open coded two more times.
After seeing that extra_linker_flags didn't work, I couldn't find anything
authoritative indicating why, though I did see an offhand comment on SO that
CFLAGS is also ignored on Windows. I also don't fully understand the
interaction between msvccompiler and msvc9compiler- I first subclassed the
latter, but it isn't used when building with VS2008.
I know the camelcase naming isn't the standard, but the HackedMingw32CCompiler
class above it was introduced 5 years ago (and I think the current style was
in place by then), so I assume that there's some reason for it.
[1] https://support.microsoft.com/en-us/help/835326/you-receive-an-lnk4197-error-in-the-64-bit-version-of-the-visual-c-compiler
[2] https://bugs.python.org/
issue9709#msg120859
Sean Farley <sean@farley.io> [Sat, 10 Jun 2017 16:00:18 -0700] rev 32781
memctx: always use cache for filectxfn
I don't see a downside to doing this unless I'm missing something.
Thanks to foozy for correcting my previous bad logic.