Siddharth Agarwal <sid0@fb.com> [Mon, 06 Apr 2015 10:46:44 -0700] rev 24624
dirs._addpath: don't mutate Python strings after exposing them (issue4589)
One of the rules of Python strings is that they're immutable. dirs._addpath
breaks this assumption for performance, which is fine as long as it is done
safely -- once a string is no longer internal-only it shouldn't be mutated.
Unfortunately, we weren't being safe here -- we were mutating 'key' even after
adding it to a dictionary.
This only really affects other C code that reads strings, so it's somewhat hard
to write a test for this without poking into the internal representation of the
string via ctypes or similar. There is currently no C code that reads the
output of the string, but there will likely be some soon as the bug indicates.
There's no significant difference in performance.
Bryan O'Sullivan <bryano@fb.com> [Mon, 06 Apr 2015 08:23:27 -0700] rev 24623
parsers: check for memory allocation overflows more carefully
André Sintzoff <andre.sintzoff@gmail.com> [Sat, 04 Apr 2015 11:27:15 +0200] rev 24622
parsers.c: avoid implicit conversion loses integer precision warning
This warning is raised by Apple LLVM version 6.0 (clang-600.0.57)
(based on LLVM 3.5svn) and was introduced in 670aaee7931c
Martin von Zweigbergk <martinvonz@google.com> [Sat, 04 Apr 2015 21:54:12 -0700] rev 24621
dirstate.walk: don't report same file stat multiple times
dirstate.walk() generates pairs of filename and a stat-like
object. After "hg mv foo Foo", it generates one pair for "foo" and one
for "Foo", as it should. However, on case-insensitive file systems,
when it tries to stat to get the disk state as well, it gets the same
stat result for both names. This confuses at least
scmutil._interestingfiles(), making it think that "foo" was forgotten
rather than removed. That, in turn, makes "hg addremove" add "foo"
back, resulting in both cases in the dirstate, as reported in
issue4590.
This change only takes care of the "if unknown" branch. A similar fix
should perhaps be applied to the other branch.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 14:41:18 -0700] rev 24620
repoview: avoid processing the same rev twice in _getstatichidden
If a rev had multiple children, it would be added to the heap multiple times. We
now ensure it is added only once.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 14:37:52 -0700] rev 24619
repoview: skip public parent earlier in _getstatichidden
Public changeset have nothing to offer regarding hidden changeset. Lets not add
them to the heap at all.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 14:36:05 -0700] rev 24618
repoview: directly skip public head in _getstatichidden
Public heads have nothing to offer regarding hidden stuff, let's skip them.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 14:35:53 -0700] rev 24617
repoview: simplify process in _getstatichidden
Since all children are processed before their parents, we can apply the following algorithm:
For each rev (descending order):
* If I'm still hidden, no children will block me,
* If I'm not hidden, I must remove my parent from the hidden set,
This allows us to dynamically change the set of 'hidden' revisions, dropping the
need for the 'actuallyhidden' dictionary and the 'blocked' boolean in the queue.
As before, we start iterating from all heads and stop at the first public
changesets. This ensures the hidden computation is 'O(not public())' instead of
'O(len(min(not public()):))'.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 14:16:50 -0700] rev 24616
repoview: use a heap in _getstatichidden
Since we want to process all non-public changesets from top to bottom, a heap
seems more appropriate. This will ensure any revision is processed after all
its children, opening the way to code simplification.
Pierre-Yves David <pierre-yves.david@fb.com> [Fri, 03 Apr 2015 13:58:12 -0700] rev 24615
repoview: update documentation of _getstatichidden
In 2f7cb6e6acdd, the function name, role and return was changed. But the
documentation was not. This fixes it.
Yuya Nishihara <yuya@tcha.org> [Sat, 04 Apr 2015 14:56:18 +0900] rev 24614
ssl: resolve symlink before checking for Apple python executable (issue4588)
test-https.t was broken at 07fafcd4bc74 if /usr/bin/pythonX.Y is used on
Mac OS X.
If python executable is not named as "python", run-tests.py creates a symlink
and hghave uses it. On the other hand, the installed hg executable knows the
real path to the system Python. Therefore, there was an inconsistency that
hghave said it was not an Apple python but hg knew it was.
Augie Fackler <augie@google.com> [Fri, 03 Apr 2015 18:19:24 -0400] rev 24613
test-subrepo-recursion: fix output on non-hardlink systems
There's a slight bug present where a topic doesn't get closed when it should.
This isn't a regression, so I've made a note in the test file.
Augie Fackler <augie@google.com> [Fri, 03 Apr 2015 23:12:21 -0400] rev 24612
test-subrepo-recursion: set progress.changedelay really high
This avoids subtopics from showing up, which were introduced by my recent
change that added progress bars to hardlink clones in some cases.
Augie Fackler <augie@google.com> [Fri, 03 Apr 2015 18:10:12 -0400] rev 24611
test-clone: fix test expectations on systems without hardlinks
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:44:33 -0700] rev 24610
dirstate: use parsers.make_file_foldmap when available
This is a significant performance win on large repositories. perffilefoldmap:
On Linux/gcc, on a test repo with over 500,000 files:
before: wall 0.605021 comb 0.600000 user 0.560000 sys 0.040000 (best of 17)
after: wall 0.280530 comb 0.280000 user 0.250000 sys 0.030000 (best of 35)
On Mac OS X/clang, on a real-world repo with over 200,000 files:
before: wall 0.281103 comb 0.280000 user 0.260000 sys 0.020000 (best of 34)
after: wall 0.133622 comb 0.140000 user 0.120000 sys 0.020000 (best of 65)
This visibly impacts status times on case-insensitive file systems. On the Mac
OS X repo, status goes from 3.64 seconds to 3.50.
With the third-party hgwatchman extension [1], 'hg status' on the same repo
goes from 0.80 seconds to 0.65.
[1] https://bitbucket.org/facebook/hgwatchman
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 23:32:27 -0700] rev 24609
parsers: add a C function to create a file foldmap
This is a hot path on case-insensitive filesystems -- it's guaranteed to be
called every time 'hg status' is run.
This is significantly faster than the equivalent Python code: see the following
patch for numbers.
Siddharth Agarwal <sid0@fb.com> [Thu, 02 Apr 2015 19:17:32 -0700] rev 24608
util.h: define an enum for normcase specs
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
Siddharth Agarwal <sid0@fb.com> [Thu, 02 Apr 2015 19:13:50 -0700] rev 24607
perf: make measuring foldmap perf work again
Rev 25c1d3ca5ff6 split the foldmap into two, but I forgot to update perf for
the changes.
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 23:22:03 -0700] rev 24606
parsers._asciitransform: also accept a fallback function
This function will be used in upcoming patches to provide a C implementation of
the function to generate the foldmap.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:38:56 -0700] rev 24605
util: add normcase spec and fallback
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
Andrew Shadura <andrew@shadura.me> [Fri, 03 Apr 2015 22:44:25 +0200] rev 24604
hgk: display committer name when set by hg-git
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 20:16:35 +0900] rev 24603
jsonchangeset: set manifest node to "null" for workingctx
Unlike changeset_printer, it does not hide the manifest field because JSON
output will be parsed by machine where explicit "null" will be more useful
than nothing.
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 20:15:40 +0900] rev 24602
jsonchangeset: set rev and node to "null" for workingctx
Yuya Nishihara <yuya@tcha.org> [Fri, 03 Apr 2015 21:36:39 +0900] rev 24601
templater: tell hggettext to collect help of template functions
Martin von Zweigbergk <martinvonz@google.com> [Tue, 10 Mar 2015 09:57:42 -0700] rev 24600
treemanifest: disable readdelta optimization
When tree manifests are stored with one revlog per directory and
loaded lazily, it's unclear how much readdelta will help. If only a
few files change, then only a small part of the full manifest will be
loaded, and the delta chains should also be shorter for tree
manifests. Therefore, let's disable readdelta for tree manifests for
now.
Laurent Charignon <lcharignon@fb.com> [Mon, 30 Mar 2015 15:38:24 -0700] rev 24599
phases: make two functions private for phase computation
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:31:41 -0700] rev 24598
windows: define normcase spec and fallback
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:30:41 -0700] rev 24597
encoding.upper: factor out fallback code
This will be used as the fallback function on Windows.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:29:22 -0700] rev 24596
cygwin: define normcase spec and fallback
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
The Cygwin normcase behavior is more complicated than just a simple lowercasing
or uppercasing. That's why we specify 'other'.
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 23:30:19 -0700] rev 24595
darwin: define normcase spec and fallback
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:26:07 -0700] rev 24594
posix: define normcase spec and fallback
These will be used in upcoming patches to efficiently create a dirstate
foldmap.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 00:21:10 -0700] rev 24593
encoding: define an enum that specifies what normcase does to ASCII strings
For C code we don't want to pay the cost of calling into a Python function for
the common case of ASCII filenames. However, while on most POSIX platforms we
normalize filenames by lowercasing them, on Windows we uppercase them. We
define an enum here indicating the direction that filenames should be
normalized as. Some platforms (notably Cygwin) have more complicated
normalization behavior -- we add a case for that too.
In upcoming patches we'll also define a fallback function that is called if the
string has non-ASCII bytes.
This enum will be replicated in the C code to make foldmaps. There's
unfortunately no nice way to avoid that -- we can't have encoding import
parsers because of import cycles. One way might be to have parsers import
encoding, but accessing Python modules from C code is just awkward.
The name 'normcasespecs' was chosen to indicate that this is merely an integer
that specifies a behavior, not a function. The name was pluralized since in
upcoming patches we'll introduce 'normcasespec' which will be one of these
values.
Matt Mackall <mpm@selenic.com> [Thu, 02 Apr 2015 16:51:00 -0500] rev 24592
merge with stable
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 01 Apr 2015 22:24:03 -0700] rev 24591
json: implement {help} template
We should consider add HTML rendering of the RST into the response as a
follow-up. I attempted to do this, but there was an empty array
returned by the rstdoc() template function. Not sure what's going on.
Will deal with it later.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 01 Apr 2015 22:16:05 -0700] rev 24590
json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 01 Apr 2015 22:04:03 -0700] rev 24589
json: implement {manifest} template
Property naming was borrowed from `hg files -Tjson`.
We omit branch because, again, representation of branches in this
template is wonky.
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 31 Mar 2015 22:53:48 -0700] rev 24588
json: implement {shortlog} and {changelog} templates
These are the same dispatch function under the hood. The only difference
is the default number of entries to render and the template to use. So
it makes sense to use a shared template.
Format for {changelistentry} is similar to {changeset}. However, there
are differences to argument names and their values preventing us from
(easily) using the same template. (Perhaps there is room to consolidate
the templates as a follow-up.)
We're currently not recording some data in {changelistentry} that exists
in {changeset}. This includes the branch name. This should be added in
a follow-up. For now, something is better than nothing.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 01 Apr 2015 20:23:58 -0700] rev 24587
help: populate template functions via docstrings
We do this for revsets, template keywrods, and template filters. Now we
do it for template functions as well.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 01 Apr 2015 20:19:43 -0700] rev 24586
templater: add consistent docstrings to functions
The content of "hg help templating" is largely derived from docstrings
on functions providing functionality. Template functions are the long
holdout.
Prepare for generating them dynamically by defining docstrings for all
template functions.
There are numerous ways these docs could be improved. Right now, the
help output simply shows function names and arguments. So literally
any accurate data is better than what is there now.
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 17:33:22 +0900] rev 24585
changeset_printer: hide manifest node for workingctx
Because workingctx has no manifest, it makes sense to hide "manifest:" row
completely.
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 20:01:30 +0900] rev 24584
changeset_printer: display p1rev:p1node with "+" suffix for workingctx
Still templater can't handle workingctx, which will be fixed later.
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 17:29:48 +0900] rev 24583
changeset_printer: handle workingctx in _meaningful_parentrevs()
Yuya Nishihara <yuya@tcha.org> [Sat, 14 Mar 2015 19:38:59 +0900] rev 24582
scmutil: add function to help handling workingctx in arithmetic operation
It's unfortunate that workingctx revision is None, which doesn't work well in
arithmetic operation or comparison. This function is trivial but will be used
in several places.
Mathias De Maré <mathias.demare@gmail.com> [Thu, 02 Apr 2015 08:18:33 +0200] rev 24581
tests: handle deleted .hg directory (git 2.2.0 and higher) (issue4585)
In git 2.2.0 and higher, removing files and directories is changed:
removing an object that does not exist returns success rather than failure.
As a result, even though .hg/hgrc does not exist, success is returned
and the .hg/ directory is removed.
To handle this correctly, use 'rm -rf' to allow successful removing
for all git versions.
The exact changeset where this was introduced in git:
1054af7d04aef64378d69a0496b45cdbf6a0bef2
wrapper.c: remove/unlink_or_warn: simplify, treat ENOENT as success
Yuya Nishihara <yuya@tcha.org> [Thu, 02 Apr 2015 21:29:05 +0900] rev 24580
hgweb: resurrect <span> tag on diffline to fix rendering in monoblue style
It was removed at 606a3bf82e30 as a useless tag, but it is necessary to
apply "div.diff pre span" style.
http://selenic.com/repo/hg/rev/606a3bf82e30?style=monoblue
Matt Mackall <mpm@selenic.com> [Wed, 01 Apr 2015 20:38:36 -0500] rev 24579
merge with stable
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 15:22:09 -0700] rev 24578
encoding: use parsers.asciiupper when available
This is used on Windows and Cygwin, and the gains from this are expected to be
similar to what was seen in 80f2b63dd83a.
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 13:46:21 -0700] rev 24577
parsers: introduce an asciiupper function
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 10:28:17 -0700] rev 24576
parsers: make _asciilower a generic _asciitransform function
We can now pass in whatever table we like. For example, an upcoming patch will
introduce asciiupper.
Siddharth Agarwal <sid0@fb.com> [Wed, 01 Apr 2015 13:58:51 -0700] rev 24575
parsers._asciilower: use an explicit return object
No functional change, but this will make upcoming patches cleaner.
Siddharth Agarwal <sid0@fb.com> [Tue, 31 Mar 2015 10:25:29 -0700] rev 24574
parsers: factor out most of asciilower into an internal function
We're going to reuse this in upcoming patches.
The change to Py_ssize_t is necessary because parsers.c doesn't define
PY_SSIZE_T_CLEAN. That macro changes the behavior of PyArg_ParseTuple but not
PyBytes_GET_SIZE.
Martin von Zweigbergk <martinvonz@google.com> [Tue, 31 Mar 2015 14:01:33 -0700] rev 24573
manifestv2: add support for writing new manifest format
If .hg/requires has 'manifestv2', the manifest will be written using
the new format.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 27 Mar 2015 22:26:41 -0700] rev 24572
manifestv2: add support for reading new manifest format
The new manifest format is designed to be smaller, in particular to
produce smaller deltas. It stores hashes in binary and puts the hash
on a new line (for smaller deltas). It also uses stem compression to
save space for long paths. The format has room for metadata, but
that's there only for future-proofing. The parser thus accepts any
metadata and throws it away. For more information, see
http://mercurial.selenic.com/wiki/ManifestV2Plan.
The current manifest format doesn't allow an empty filename, so we use
an empty filename on the first line to tell a manifest of the new
format from the old. Since we still never write manifests in the new
format, the added code is unused, but it is tested by
test-manifest.py.
Martin von Zweigbergk <martinvonz@google.com> [Tue, 31 Mar 2015 22:45:45 -0700] rev 24571
manifestv2: set requires at repo creation time
While it should be safe to switch to the new manifest format on an
existing repo, let's keep it simple for now and make the configuration
have any effect only at repo creation time. If the configuration is
enabled then (at repo creation), we add an entry to requires and read
that instead of the configuration from then on.
Martin von Zweigbergk <martinvonz@google.com> [Tue, 31 Mar 2015 15:06:55 -0700] rev 24570
test-manifest: extract constants for binary hashes
The binary hashes are used quite frequently, so let's extract
constants for them so we don't have to repeat binascii.unhexlify() so
often.
Martin von Zweigbergk <martinvonz@google.com> [Tue, 31 Mar 2015 14:46:05 -0700] rev 24569
test-manifest: create constant for empty manifest
For symmetry with manifest v2, once we add that, let's extract a
constant for the empty v1 manifest.
Yuya Nishihara <yuya@tcha.org> [Mon, 30 Mar 2015 23:25:55 +0900] rev 24568
patchbomb: factor out scmutil.revrange() calls
This allows us to access the calculated revs in patchbomb() function.
Yuya Nishihara <yuya@tcha.org> [Tue, 31 Mar 2015 00:52:17 +0900] rev 24567
patchbomb: return outgoing revs as a smartset
This helps to factor out scmutil.revrange() calls from _getpatches() and
_getoutgoing(). In future patches, a smartset will be passed to _getpatches().
Yuya Nishihara <yuya@tcha.org> [Mon, 30 Mar 2015 23:54:29 +0900] rev 24566
templatefilters: add "upper" and "lower" for case conversion
Typically it will be used in patchbomb's flag template, which will be
implemented by future patches.
Durham Goode <durham@fb.com> [Wed, 01 Apr 2015 12:50:10 -0700] rev 24565
repoview: improve compute staticblockers perf
Previously we would compute the repoview's static blockers by finding all the
children of hidden commits that were not hidden. This was O(number of commits
since first hidden change) since 'children' requires walking every commit from
tip until the first hidden change.
The new algorithm walks all heads down until it sees a public commit. This makes
the computation O(number of draft) commits, which is much faster in large
repositories with a large number of commits and a low number of drafts.
On a large repo with 1000+ obsolete markers and the earliest draft commit around
tip~200000, this improves computehidden perf by 200x (2s to 0.01s).