Yuya Nishihara <yuya@tcha.org> [Wed, 31 Aug 2016 23:36:37 +0900] rev 29891
test-debugextensions: add dummy extension to make ifcontains() test more solid
If testedwith were a string, ifcontains("3.2", testedwith) would match "3.2.1".
New test added to cover that.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 01 Sep 2016 02:29:46 +0530] rev 29890
py3: remove use of *L syntax
The int in Python 3 behaves as long so no need of L's in py3.
Moreover we dont need long here.
Martin von Zweigbergk <martinvonz@google.com> [Tue, 30 Aug 2016 09:22:53 -0700] rev 29889
util: rename checkcase() to fscasesensitive() (API)
I always read the name "checkcase(path)" as "do we need to check for
case folding at this path", but it's actually (I think) meant to be
read "check if the file system cares about case at this path". I'm
clearly not the only one confused by this as the dirstate has this
property:
def _checkcase(self):
return not util.checkcase(self._join('.hg'))
Maybe we should even inverse the function and call it fscasefolding()
since that's what all callers care about?
Durham Goode <durham@fb.com> [Mon, 29 Aug 2016 17:48:14 -0700] rev 29888
manifest: call m1.load and m2.load before writing a subtree
As part of refactoring the manifest, certain test cases started failing because
writesubtrees was called with p1 and p2 manifests that had not been loaded (so
accessing m1._dirs resulted in an empty set). Let's call _load on these before
attempting to access _dirs.
This was caught by tests when future patches were applied.
Augie Fackler <augie@google.com> [Tue, 30 Aug 2016 13:13:50 -0400] rev 29887
histedit: correct output of error when 'base' is from the edit list
This was made more obvious by marmoute's recent rearrangement of this code.
Augie Fackler <augie@google.com> [Tue, 30 Aug 2016 13:33:48 -0400] rev 29886
py3: split check of pygments-using files from the rest of the tree
If we don't do this, people without pygments installed in their Python
3 environment silently stop checking test-check-py3-compat, which
isn't really what we wanted. This preserves stability of the test
output while still letting anyone with a recent-enough Python 3 run
the majority of the Python 3 compat checking test.
Yuya Nishihara <yuya@tcha.org> [Fri, 26 Aug 2016 23:38:52 +0900] rev 29885
version: change "place" field of extension to "bundled" flag
The name "place" sounds odd. We can simply expose raw boolean values instead
of switching external/internal literals.
Yuya Nishihara <yuya@tcha.org> [Sat, 27 Aug 2016 00:00:28 +0900] rev 29884
extensions: use ismoduleinternal() thoroughly
"ships-with-hg-core" would be long enough to typo.
Mark Ignacio <mignacio@fb.com> [Tue, 30 Aug 2016 09:25:00 -0700] rev 29883
lock: show more detail for new-style locks in lock waiting message (
issue4752)
Improve the lock waiting warning message by explicitly saying that a host and
process are holding the lock. This nudges confused new users in the direction
of investigating the other process instead of removing the lock.
Yuya Nishihara <yuya@tcha.org> [Mon, 29 Aug 2016 00:00:05 +0900] rev 29882
formatter: add context manager interface for convenience
And port "hg files" to test it.
As you can see, extra indent is necessary to port to this API. I don't think
we should switch every fm.formatter() call to "with" statement.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 21:06:31 +0200] rev 29881
histedit: remove now unused 'constraints' related code
Now that the one action that need different logic handle that using inheritance
and overriding, we can remove that code.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 21:00:33 +0200] rev 29880
histedt: use inheritance to override the constraints in 'base'
All actions but one actually have the same constraints when it comes to validate
the 'action.node' value. So we actually just add this code to a method that can
be overwritten in the one action where it matters.
The now unused 'contraints' related enum and class attribute will be cleaned up
in the next changeset.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:54:52 +0200] rev 29879
histedit: move constraint verification to the 'action.verify' method
Action has a method dedicated to verifying its validity. So we move code
related to constrains into that method. This requires a bit more context to the
'verify' method in the same fashion we were passing the 'prev' argument.
This is an extra step before we can simplify the constraint handling code
further.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:54:32 +0200] rev 29878
histedit: directly use node in 'verifyactions'
It does not seem useful to convert to hex: it is an extra step and they are
longer strings. So we stick to node for the logic. We only convert to short hex
for error when needed. As a nice side effect this remove the explicit constant
usage in'[12:]'. This will also help moving the code around later as we just
have to access action.node.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:42:18 +0200] rev 29877
histedit: temporarily shorten name of 'constraints' variable
An upcoming changeset will make the line where this variable is used
slightly too long. Other later changesets will clean that up further and makes
the variable unnecessary, so this is only temporary and it does seems useful to
put anything more complicate in place.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:38:37 +0200] rev 29876
histedit: drop the 'nodetoverify' local variable
We can just use 'action.node'.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:34:58 +0200] rev 29875
histedit: make 'constraints' a class attribute instead of a method
There does not seem to be a reason for this to be a method. So we initialise
the class attribute once and for all at creation time and drop the instance
method.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 26 Aug 2016 20:31:33 +0200] rev 29874
histedit: drop the 'nodetoverify' method
That method is just returning self.node and is never overridden. We just use
the attribute directly instead and get rid of the method.
This is the beginning of series to simplify and unify verification of constraints
for actions.
Yuya Nishihara <yuya@tcha.org> [Mon, 29 Aug 2016 22:59:39 +0900] rev 29873
test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Danek Duvall found that gpg-connect-agent of GnuPG 2.0 never starts gpg-agent
daemon. The 2.1 way is documented as "gpg-coonect-agent /bye" [1], which
appears to be different from the 2.0 way [2].
[1]: https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html
[2]: https://www.gnupg.org/documentation/manuals/gnupg-2.0/Invoking-GPG_002dAGENT.html
Since "gpg-agent --daemon" of GnuPG 2.1 never prints environment variables,
"eval $(gpg-agent --daemon)" would be valid only for GnuPG < 2.1, and we'll
need a different workaround for 2.0. I have no 2.0 environment, I won't
implement it.
timeless <timeless@mozdev.org> [Fri, 26 Aug 2016 00:16:51 +0000] rev 29872
rebase: properly calculate total commits to rebase (
issue5347)
Before this, predecessor commits were being included in the count
Maciej Fijalkowski <fijall@gmail.com> [Sun, 28 Aug 2016 17:51:32 -0700] rev 29871
mpatch: add setup_mpatch_cffi.py
This file got dropped when the corresponding setup.py changes were
made.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Wed, 24 Aug 2016 03:59:19 +0200] rev 29870
journal: rename on disk files to 'namejournal'
The 'journal' naming is already used by the transaction journal. Having an
unrelated group of file with such a close naming is confusing and error prone.
We rename the file used by the 'journal' extension to use 'namejournal' as the
extension track the location of various 'names'.
timeless <timeless@mozdev.org> [Thu, 25 Aug 2016 23:13:36 +0000] rev 29869
tests: guard demandimport segment of test-extension.t
timeless <timeless@mozdev.org> [Thu, 25 Aug 2016 22:03:51 +0000] rev 29868
tests: skip demandimport if disabled
demandimport and setuptools and decorator (from ironpython) and
pygments leads to lots of fail.
If demandimport is disabled we should skip testing it...
timeless <timeless@mozdev.org> [Thu, 25 Aug 2016 22:30:35 +0000] rev 29867
hghave: add demandimport checking
timeless <timeless@mozdev.org> [Thu, 25 Aug 2016 22:51:39 +0000] rev 29866
hghave: make bzr checks stricter
My bzr does not have bzrlib.revisionspec.RevisionSpec,
and thus tests were failing because convert refused to believe in bzr,
but hghave without this change thought it was available.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 19:50:21 -0700] rev 29865
help: document wire protocol commands
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 19:49:59 -0700] rev 29864
help: document wire protocol "handshake" protocol
There isn't a formal handshake protocol in the wire protocol. But
clients almost certainly need to perform particular actions before they
can communicate with a server optimally. So document what that is
so people understand what's going on at connection establishment time.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 19:48:31 -0700] rev 29863
help: document wire protocol capabilities
All capabilities from the history of the project are now documented.
timeless <timeless@mozdev.org> [Fri, 02 Sep 2016 20:15:37 +0000] rev 29862
crecord: properly handle files with No newline at eof (
issue5268)
Yes, this bug was a single character with the wrong case...
Jun Wu <quark@fb.com> [Fri, 02 Sep 2016 15:20:59 +0100] rev 29861
annotate: pre-calculate the "needed" dictionary (
issue5360)
The "needed" dict is used as a reference counter to free items in the giant
"hist" dict. However, currently it is not very accurate and can lead to
dropping "hist" items unnecessarily, for example, with the following DAG,
-3-
/ \
0--1--2--4--
The current algorithm will visit and calculate rev 1 twice, undesired. And
it tries to be smart by clearing rev 1's parents: "pcache[1] = []" at the
time hist[1] being accessed (note: hist[1] needs to be used twice, by rev 2
and rev 3). It can result in incorrect results if p1 of rev 4 deletes chunks
belonging to rev 0.
However, simply removing "needed" is not okay, because it will consume 10x
memory:
# without any change
% HGRCPATH= lrun ./hg annotate mercurial/commands.py -r d130a38 3>&2 [1]
MEMORY
49074176
CPUTIME 9.213
REALTIME 9.270
# with "needed" removed
MEMORY
637673472
CPUTIME 8.164
REALTIME 8.249
This patch moves "needed" (and "pcache") calculation to a separate DFS to
address the issue. It improves perf and fixes
issue5360 by correctly reusing
hist, while maintaining low memory usage. Some additional attempt has been
made to further reduce memory usage, like changing "pcache[f] = []" to "del
pcache[f]". Therefore the result can be both faster and lower memory usage:
# with this patch applied
MEMORY
47575040
CPUTIME 7.870
REALTIME 7.926
[1]: lrun is a lightweight sandbox built on Linux cgroup and namespace. It's
used to measure CPU and memory usage here. Source code is available at
github.com/quark-zju/lrun.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 19:47:34 -0700] rev 29860
help: document wire protocol transport protocols
The HTTP and SSH transport protocols are documented. This
includes how commands and arguments are serialized as well as
response types.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 19:46:39 -0700] rev 29859
help: internals topic for wire protocol
The Mercurial wire protocol is under-documented. This includes a lack
of source docstrings and comments as well as pages on the official
wiki.
This patch adds the beginnings of "internals" documentation on the
wire protocol.
The documentation should have nearly complete coverage on the
lower-level parts of the protocol, such as the different transport
mechanims, how commands and arguments are sent, capabilities, and,
of course, the commands themselves.
As part of writing this documentation, I discovered a number of
deficiencies in the protocol and bugs in the implementation. I've
started sending patches for some of the issues. I hope to send a lot
more.
This patch starts with the scaffolding for a new internals page.
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 15:13:56 +0900] rev 29858
grep: add formatter support
Several fields are renamed to be consistent with the annotate command, which
doesn't mean the last call for the name unification [1]. Actually, I'd rather
rename line_number to linenumber, linenum, lineno or line, but I want to
port the grep command to formatter first.
[1]: https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary
I don't have any better name for the list of matched/unmatched texts, so
they are just called as "texts".
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 14:52:06 +0900] rev 29857
grep: build list of all columns regardless of display options
These columns should always be available in JSON or template outputs. The
"change" column is excluded because it has no useful data unless --all is
specified.
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 14:23:29 +0900] rev 29856
grep: build list of columns without "grep." label prefix
Prepares for formatter support. We need field names without "grep.".
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 14:09:49 +0900] rev 29855
grep: factor out function that prints matched line with labels
Prepares for formatter support.
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 14:03:25 +0900] rev 29854
grep: refactor loop that yields matched text with label
As preparation for formatter support, this and the next patch split
linestate.__iter__() into two functions, line scanner and displayer.
New code uses regexp.search(str, pos) in place of regexp.search(substr),
which appears to fix a bug of highlighting.
Kevin Bullock <kbullock@ringworld.org> [Thu, 01 Sep 2016 14:01:43 -0500] rev 29853
Added signature for changeset
ccd436f7db6d
Kevin Bullock <kbullock@ringworld.org> [Thu, 01 Sep 2016 14:01:37 -0500] rev 29852
Added tag 3.9.1 for changeset
ccd436f7db6d
Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> [Thu, 01 Sep 2016 13:16:55 -0500] rev 29851
bundle2: localize handleoutput remote prompts
Code archaeology suggests that there was no good reason for this not to
be localized. 'remote: ' is already localized elsewhere.
Wagner Bruna <wbruna@softwareexpress.com.br> [Wed, 31 Aug 2016 13:58:33 -0300] rev 29850
i18n-pt_BR: synchronized with
a12d13eac513
liscju <piotr.listkiewicz@gmail.com> [Tue, 05 Jul 2016 09:37:07 +0200] rev 29849
files: change documentation to match its behaviour (
issue5276)
Documentation gave the usage pattern as '[OPTION]... [PATTERN]...'
when the command match given files as relpaths by default.
Matt Mackall <mpm@selenic.com> [Wed, 24 Aug 2016 17:43:45 -0700] rev 29848
templater: add template path to __base__ search
This does a fall-back check for style files or directories that are
in Mercurial's template path for user convenience.
We intentionally don't use this for the built-in coal style because we don't
want the style to mysteriously break if the working directory just
happens to have a file named "paper".
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 25 Aug 2016 19:53:14 -0700] rev 29847
bundle2: fail faster when interrupted
Before this patch, bundle2 application attempted to consume remaining
bundle2 part data when the process is interrupted (SIGINT) or when
sys.exit is called (translated into a SystemExit exception). This
meant that if one of these occurred when applying a say 1 GB
changegroup bundle2 part being downloaded over a network, it may take
Mercurial *several minutes* to terminate after a SIGINT because the
process is waiting on the network to stream megabytes of data. This is
not a great user experience and a regression from bundle1. Furthermore,
many process supervisors tend to only give processes a finite amount of
time to exit after delivering SIGINT: if processes take too long to
self-terminate, a SIGKILL is issued and Mercurial has no opportunity to
clean up. This would mean orphaned locks and transactions. Not good.
This patch changes the bundle2 application behavior to fail faster
when an interrupt or system exit is requested. It does so by not
catching BaseException (which includes KeyboardInterrupt and
SystemExit) and by explicitly checking for these conditions in
yet another handler which would also seek to the end of the current
bundle2 part on failure.
The end result of this patch is that SIGINT is now reacted to
significantly faster: the active transaction is rolled back
immediately without waiting for incoming bundle2 data to be consumed.
This restores the pre-bundle2 behavior and makes Mercurial treat
signals with the urgency they deserve.
Augie Fackler <augie@google.com> [Tue, 23 Aug 2016 16:40:08 -0400] rev 29846
blackbox: also log alias expansions
This should be extremely useful for helping users debug without having
to see their complete configuration.
Shell aliases do not get their expansion logged, because we don't look
and see if we're in a repo before we dive into the execution of a
shell alias. As a result, the ui object doesn't know where to log.
Augie Fackler <augie@google.com> [Thu, 25 Aug 2016 01:06:32 -0400] rev 29845
test-clonebundles: accept another error string here
This is what happens if you run the test in a FreeBSD Jail, rather
than "connection refused".
Augie Fackler <augie@google.com> [Thu, 25 Aug 2016 01:26:39 -0400] rev 29844
tests: guard test-archive-symlink with unziplinks check
This fixes the test on FreeBSD, where the stock unzip doesn't
understand symlinks.
Augie Fackler <augie@google.com> [Thu, 25 Aug 2016 01:25:52 -0400] rev 29843
hghave: add a check for unzip(1) that understands symlinks
unzip(1) from the FreeBSD base system does not understand symlinks, so
test-archive-symlinks is busted.
Augie Fackler <augie@google.com> [Thu, 25 Aug 2016 01:00:54 -0400] rev 29842
test-https: drop two spurious --traceback flags
These make test failures scarier than they are.
Augie Fackler <augie@google.com> [Tue, 23 Aug 2016 11:26:08 -0400] rev 29841
extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
Yuya Nishihara <yuya@tcha.org> [Thu, 25 Aug 2016 01:00:26 -0400] rev 29840
version: add formatter support
The license message isn't exported, which I don't think is useful and I
couldn't find a way to restructure it for JSON or template outputs.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Aug 2016 16:09:12 +0900] rev 29839
version: factor out mapping of internal/external labels
Prepares for formatter support, where translation should be disabled
conditionally.
Yuya Nishihara <yuya@tcha.org> [Tue, 16 Aug 2016 16:03:09 +0900] rev 29838
version: always build list of extension versions
This patch just moves "if ui.verbose:" to the inner loop, as preparation
for formatter support.
Yuya Nishihara <yuya@tcha.org> [Sun, 13 Mar 2016 19:59:39 +0900] rev 29837
formatter: add fm.nested(field) to either write or build sub items
We sometimes need to build nested items by formatter, but there was no
convenient way other than building and putting them manually by fm.data():
exts = []
for n, v in extensions:
fm.plain('%s %s\n' % (n, v))
exts.append({'name': n, 'ver': v})
fm.data(extensions=exts)
This should work for simple cases, but doing this would make it harder to
change the underlying data type for better templating support.
So this patch provides fm.nested(field), which returns new nested formatter
(or self if items aren't structured and just written to ui.) A nested formatter
stores items which will later be rendered by the parent formatter.
fn = fm.nested('extensions')
for n, v in extensions:
fn.startitem()
fn.write('name ver', '%s %s\n', n, v)
fn.end()
Nested items are directly exported to a template for now:
{extensions % "{name} {ver}\n"}
There's no {extensions} nor {join(extensions, sep)} yet. I have a plan for
them by extending fm.nested() API, but I want to revisit it after trying
out this API in the real world.
Yuya Nishihara <yuya@tcha.org> [Mon, 15 Aug 2016 13:51:14 +0900] rev 29836
formatter: factor out format*() functions to separate classes
New converter classes will be reused by a nested formatter. See the next
patch for details.
This change is also good in that the default values are defined uniquely
by the baseformatter.
Jun Wu <quark@fb.com> [Wed, 24 Aug 2016 11:24:07 +0100] rev 29835
crecord: restore SIGWINCH handler before return
Previously, the SIGWINCH handler does not get cleared and if the commit
message editor also needs SIGWINCH handling (like vim), the two SIGWINCH
handlers (the editor's, ours) will have a race. And we may erase the
editor's screen content.
This patch restores SIGWINCH handler to address the above issue.
Maciej Fijalkowski <fijall@gmail.com> [Sat, 20 Aug 2016 23:06:01 +0200] rev 29834
bdiff: implement cffi version of bdiff
Maciej Fijalkowski <fijall@gmail.com> [Thu, 28 Jul 2016 14:17:08 +0200] rev 29833
bdiff: implement cffi version of blocks
Tony Tung <tonytung@merly.org> [Fri, 19 Aug 2016 13:30:40 -0700] rev 29832
util: checknlink should remove file it creates if an exception occurs
There's no reason to leave the file behind.
Siddharth Agarwal <sid0@fb.com> [Tue, 23 Aug 2016 17:58:53 -0700] rev 29831
merge: remove files with extra actions from merge action list
See the comment for a detailed explanation why.
Even though this is a bug, I've sent it to 'default' rather than 'stable'
because it isn't triggered in any code paths in stock Mercurial, just with the
merge driver included. For the same reason I haven't included any tests here --
the merge driver is getting a new test.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 21:48:50 -0700] rev 29830
revlog: use an LRU cache for delta chain bases
Profiling using statprof revealed a hotspot during changegroup
application calculating delta chain bases on generaldelta repos.
Essentially, revlog._addrevision() was performing a lot of redundant
work tracing the delta chain as part of determining when the chain
distance was acceptable. This was most pronounced when adding
revisions to manifests, which can have delta chains thousands of
revisions long.
There was a delta chain base cache on revlogs before, but it only
captured a single revision. This was acceptable before generaldelta,
when _addrevision would build deltas from the previous revision and
thus we'd pretty much guarantee a cache hit when resolving the delta
chain base on a subsequent _addrevision call. However, it isn't
suitable for generaldelta because parent revisions aren't necessarily
the last processed revision.
This patch converts the delta chain base cache to an LRU dict cache.
The cache can hold multiple entries, so generaldelta repos have a
higher chance of getting a cache hit.
The impact of this change when processing changegroup additions is
significant. On a generaldelta conversion of the "mozilla-unified"
repo (which contains heads of the main Firefox repositories in
chronological order - this means there are lots of transitions between
heads in revlog order), this change has the following impact when
performing an `hg unbundle` of an uncompressed bundle of the repo:
before: 5:42 CPU time
after: 4:34 CPU time
Most of this time is saved when applying the changelog and manifest
revlogs:
before: 2:30 CPU time
after: 1:17 CPU time
That nearly a 50% reduction in CPU time applying changesets and
manifests!
Applying a gzipped bundle of the same repo (effectively simulating a
`hg clone` over HTTP) showed a similar speedup:
before: 5:53 CPU time
after: 4:46 CPU time
Wall time improvements were basically the same as CPU time.
I didn't measure explicitly, but it feels like most of the time
is saved when processing manifests. This makes sense, as large
manifests tend to have very long delta chains and thus benefit the
most from this cache.
So, this change effectively makes changegroup application (which is
used by `hg unbundle`, `hg clone`, `hg pull`, `hg unshelve`, and
various other commands) significantly faster when delta chains are
long (which can happen on repos with large numbers of files and thus
large manifests).
In theory, this change can result in more memory utilization. However,
we're caching a dict of ints. At most we have 200 ints + Python object
overhead per revlog. And, the cache is really only populated when
performing read-heavy operations, such as adding changegroups or
scanning an individual revlog. For memory bloat to be an issue, we'd
need to scan/read several revisions from several revlogs all while
having active references to several revlogs. I don't think there are
many operations that do this, so I don't think memory bloat from the
cache will be an issue.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 20:17:36 -0700] rev 29829
revlog: remove unused variables
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 22 Aug 2016 20:30:37 -0700] rev 29828
util: properly implement lrucachedict.get()
Before, it was returning the raw _lrucachenode instance instead of its
value.
Durham Goode <durham@fb.com> [Wed, 17 Aug 2016 13:25:13 -0700] rev 29827
manifest: change changectx to access manifest via manifestlog
This is the first place where we'll start using manifestctx instances instead of
manifestdict. This will facilitate using different manifestctx implementations
in the future.
Durham Goode <durham@fb.com> [Wed, 17 Aug 2016 13:25:13 -0700] rev 29826
manifest: use property instead of field for manifest revlog storage
The file caches we're using to avoid reloading the manifest from disk everytime
has an annoying bug that causes the in memory structure to not be reloaded if
the mtime and the size haven't changed. This causes a breakage in the tests
because the manifestlog is not being reloaded after a commit+strip operation in
mq (the mtime is the same because it all happens in the same second, and the
resulting size is the same because we add 1 and remove 1). The only reason this
doesn't affect the manifest itself is because we touch it so often that we
had already reloaded it after the commit, but before the strip.
Once the entire manifest has migrated to manifestlog, we can get rid of these
properties, since then the manifestlog will be touched after the commit, but
before the strip, as well.
Durham Goode <durham@fb.com> [Wed, 17 Aug 2016 13:25:13 -0700] rev 29825
manifest: introduce manifestlog and manifestctx classes
This is the start of a large refactoring of the manifest class. It introduces
the new manifestlog and manifestctx classes which will represent the collection
of all manifests and individual instances, respectively.
Future patches will begin to convert usages of repo.manifest to
repo.manifestlog, adding the necessary functionality to manifestlog and instance
as they are needed.
Durham Goode <durham@fb.com> [Wed, 17 Aug 2016 13:25:13 -0700] rev 29824
manifest: make manifest derive from manifestrevlog
As part of our refactoring to split the manifest concept from its storage, we
need to start moving the revlog specific parts of the manifest implementation to
a new class. This patch creates manifestrevlog and moves the fulltextcache onto
the base class.
Durham Goode <durham@fb.com> [Wed, 17 Aug 2016 13:25:13 -0700] rev 29823
manifest: break mancache into two caches
The old manifest cache cached both the inmemory representation and the raw text.
As part of the manifest refactor we want to separate the storage format from the
in memory representation, so let's split this cache into two caches.
This will let other manifest implementations participate in the in memory cache,
while allowing the revlog based implementations to still depend on the full text
caching where necessary.
Augie Fackler <augie@google.com> [Thu, 18 Aug 2016 11:32:02 -0400] rev 29822
dispatch: explicitly pass fancyopts optional arg as a keyword
I've been baffled by this a couple of times (mainly wondering if any
callers of fancyopts.fancyopts that don't use gnu=True exist), so
let's just specify this as a keyword argument to preserve sanity.
Maciej Fijalkowski <fijall@gmail.com> [Sat, 20 Aug 2016 23:05:18 +0200] rev 29821
osutil: fix the bug on OS X when we return more in listdir
The pointer arithmetic somehow got ommitted during the recent change to use
a struct.
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> [Sun, 21 Aug 2016 08:03:22 +0000] rev 29820
histedit: use samefile function from cmdutil
Replace usage of inefficient samefile function in collapse with a call to
cmdutil.samefile().
Hannes Oldenburg <hannes.christian.oldenburg@gmail.com> [Sun, 21 Aug 2016 08:00:18 +0000] rev 29819
cmdutil: extract samefile function from amend()
Yuya Nishihara <yuya@tcha.org> [Fri, 22 Apr 2016 21:32:30 +0900] rev 29818
templater: rename "right" argument of pad() function
Before, right=True meant right justify, which I think is left padding.
Yuya Nishihara <yuya@tcha.org> [Fri, 22 Apr 2016 21:29:13 +0900] rev 29817
templater: make pad() evaluate boolean argument (BC)
Otherwise it would crash if template expression was passed.
This patch unifies the way how boolean expression is evaluated, which involves
BC. Before "if(true)" and "pad(..., 'false')" were False, which are now True
since they are boolean literal and non-empty string respectively.
"func is runsymbol" is the same hack as evalstringliteral(), which is needed
for label() to take color literals.
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 16:29:22 +0900] rev 29816
templater: fix if() to not evaluate False as bool('False')
Before, False was True. This patch fixes the issue by processing True/False
transparently. The other values (including integer 0) are tested as strings
for backward compatibility, which means "if(latesttagdistance)" never be False.
Should we change the behavior of "if(0)" as well?
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 15:55:07 +0900] rev 29815
templater: make it clearer that _flatten() omits None
Gábor Stefanik <gabor.stefanik@nng.com> [Thu, 18 Aug 2016 17:25:10 +0200] rev 29814
revset: support "follow(renamed.py,
e22f4f3f06c3)" (
issue5334)
v2: fixes from review
Matt Mackall <mpm@selenic.com> [Wed, 17 Aug 2016 13:43:13 -0500] rev 29813
coal: use inheritance to derive from paper
This illustrates how much simpler this approach is, in particular the
effect of map-relative paths.
Matt Mackall <mpm@selenic.com> [Wed, 17 Aug 2016 13:40:27 -0500] rev 29812
templater: add inheritance support to style maps
We can now specify a base map file:
__base__ = path/to/map/file
That map file will be read and used to populate unset elements of the
current map. Unlike using %include, elements in the inherited class
will be read relative to that path.
This makes it much easier to make custom local tweaks to a style.
Yuya Nishihara <yuya@tcha.org> [Thu, 18 Aug 2016 18:43:48 +0900] rev 29811
killdaemons: prevent killing all user processes by bad pid file
When I was fixing the test-gpg issue, I noticed gpg-connect-agent could print
"-1" as a server pid if command was wrong. I'm not pretty sure but nobody
would want to kill their running applications by mistake.
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Aug 2016 20:56:12 +0900] rev 29810
py3: automatically glob out line numbers from check-py3-compat output
It was boring task to update the result manually.
Yuya Nishihara <yuya@tcha.org> [Wed, 17 Aug 2016 20:52:50 +0900] rev 29809
py3: have check-py3-compat require pygments to get stable result
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 09 Aug 2016 17:06:35 +0200] rev 29808
computeoutgoing: move the function from 'changegroup' to 'exchange'
Now that all users are in exchange, we can safely move the code in the
'exchange' module. This function is really about processing the argument of a
'getbundle' call, so it even makes senses to do so.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 09 Aug 2016 17:00:38 +0200] rev 29807
getchangegroup: take an 'outgoing' object as argument (API)
There is various version of this function that differ mostly by the way they
define the bundled set. The flexibility is now available in the outgoing object
itself so we move the complexity into the caller themself. This will allow use
to remove a good share of the similar function to obtains a changegroup in the
'changegroup.py' module.
An important side effect is that we stop calling 'computeoutgoing' in
'getchangegroup'. This is fine as code that needs such argument processing
is actually going through the 'exchange' module which already all this function
itself.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 09 Aug 2016 22:31:38 +0200] rev 29806
outgoing: add a 'missingroots' argument
This argument can be used instead of 'commonheads' to determine the 'outgoing'
set. We remove the outgoingbetween function as its role can now be handled by
'outgoing' itself.
I've thought of using an external function instead of making the constructor
more complicated. However, there is low hanging fruit to improve the current
code flow by storing some side products of the processing of 'missingroots'. So
in my opinion it make senses to add all this to the class.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 09 Aug 2016 15:55:44 +0200] rev 29805
outgoing: adds some default value for argument
We are about to introduce a third option to create an outgoing object:
'missingroots'. This argument will be mutually exclusive with 'commonheads' so
we implement some default value handling in preparation.
This will also help use to make more use of outgoing creation around the code
base.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Tue, 09 Aug 2016 15:26:53 +0200] rev 29804
outgoing: pass a repo object to the constructor
We are to introduce more code constructing such object in the code base. It will
be more convenient to pass a repository object, all current users already
operate at the repository level anyway. More changes to the contructor argument
are coming in later changeset.
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.