Gregory Szorc <gregory.szorc@gmail.com> [Mon, 25 May 2015 13:10:38 -0700] rev 26063
worker: use multiprocessing to find cpu count
The multiprocessing package was added in Python 2.6.
The implementation of worker.countcpus() is very similar to
multiprocessing.cpu_count(). Ditch our one-off code.
multiprocessing does result in a number of imports. However,
the lazy importer ensures that we don't import anything until
cpu_count() is called. Furthermore, if we are doing something
with multiple cores, chances are the time of that operation
will dwarf the import time, so module bloat isn't a concern
here.
Augie Fackler <augie@google.com> [Mon, 24 Aug 2015 10:09:00 -0400] rev 26062
import-checker: ensure multiprocessing is treated as from stdlib
On my linux machines multiprocessing appears to defeat the logic in
import-checker to detect stdlib modules. Since we now only use
versions of Python which ship with multiprocessing, let's just
whitelist the module.
Pierre-Yves David <pierre-yves.david@fb.com> [Thu, 20 Aug 2015 17:23:21 -0700] rev 26061
reachableroots: use baseset lazy sorting
smartset sorting is lazy (so faster in some case) and better (informs that the
set is sorted allowing some optimisation). So we rely on it directly.
Some test output are updated because we now have more information (ordering).
Pierre-Yves David <pierre-yves.david@fb.com> [Thu, 20 Aug 2015 17:19:56 -0700] rev 26060
baseset: keep the input set around
Baseset needs a list to operate, but will convert that list back to a set for
membership testing. It seems a bit silly to convert the set into a list to
convert it back afterward.
Yuya Nishihara <yuya@tcha.org> [Sun, 16 Aug 2015 09:30:37 +0900] rev 26059
reachableroots: unroll loop that checks if one of parents is reachable
The difference is small, but fewer loops should be better in general:
revset #0: 0::tip
0) 0.001609
1) 0.001510 93%
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Aug 2015 19:38:03 +0900] rev 26058
reachableroots: handle error of PyList_Append()
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 07 Aug 2015 22:39:47 -0700] rev 26057
commands.push: use paths API
ui.path instances now collect most of the data used by commands.push().
Move away from ui.expandpath() and call ui.paths.getpath() to get a
path instance.
Some "pushing to" output was dropped as one test demonstrates. I believe
the dropped message was redundant with the error message and the change
to be acceptable.
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 08 Aug 2015 00:16:02 -0700] rev 26056
ui: move URL and path detection into path API
ui.expandpath() has code for recognizing URLs or local filesystem
paths. Our goal is to use ``path`` class instances everywhere a path
is represented.
Changing ui.expandpath() to return path instances is a lot of work.
Our goal is to slowly marginalize it by moving logic into the paths
API and to convert callers to the paths API.
Many callers of ui.expandpath() pass in a value that could be a
local filesystem path or URI. We move the detection of these strings
from ui.expandpath() to paths.getpath() and path.__init__(). To do
this properly in a way that is compatible with future callers, we
need to parse the "#branch" syntax out of locations. This is a bit
complicated, but it is necessary.
The code for URL parsing is essentially a copy of hg.parseurl().
Once all consumers are speaking the paths API, it is likely that
this function won't be called any more and it can be deleted.
Yuya Nishihara <yuya@tcha.org> [Fri, 14 Aug 2015 15:52:19 +0900] rev 26055
reachableroots: return list of revisions instead of set
Now we don't need a set of reachable revisions, and the caller wants a sorted
list of revisions, so constructing a set is just a waste of time.
revset #0: 0::tip
2) 0.002536
3) 0.001598 63%
PyList_New() should set an appropriate exception on error, so we don't need
to call PyErr_NoMemory() manually.
This patch lacks error handling of PyList_Append() as it was before for
PySet_Add(). It should be fixed later.
Yuya Nishihara <yuya@tcha.org> [Fri, 14 Aug 2015 15:49:11 +0900] rev 26054
reachableroots: use internal "revstates" array to test if rev is reachable
This is faster than using PySet_Contains().
revset #0: 0::tip
1) 0.003678
2) 0.002536 68%
Yuya Nishihara <yuya@tcha.org> [Fri, 14 Aug 2015 15:43:29 +0900] rev 26053
reachableroots: use internal "revstates" array to test if rev is a root
The main goal of this patch series is to reduce the use of PyXxx() function
that is likely to require ugly error handling and inc/decref. Plus, this is
faster than using PySet_Contains().
revset #0: 0::tip
0) 0.004168
1) 0.003678 88%
This patch ignores out-of-range roots as they are in the pure implementation.
Because reachable sets are calculated from heads, and out-of-range heads raise
IndexError, we can just take out-of-range roots as unreachable. Otherwise,
the test of "hg log -Gr '. + wdir()'" would fail.
"heads" argument is changed to a list. Should we have to rename the C function
as its signature is changed?
Augie Fackler <augie@google.com> [Tue, 18 Aug 2015 16:40:10 -0400] rev 26052
parsers: set exception when there's too little string data to extract parents
Previously we were returning NULL from this function without actually
setting up an exception. This fixes that problem, which was detected
with cpychecker.
Augie Fackler <augie@google.com> [Tue, 18 Aug 2015 16:39:26 -0400] rev 26051
parsers: drop spurious check of readlen value
We're about to check if len < 40 after assigning readlen to len, which
means that if len < 40 we'll still abort, but I'm about to add a
sensible exception to that failure, so let's just discard this useless
check.
Augie Fackler <augie@google.com> [Tue, 18 Aug 2015 16:32:41 -0400] rev 26050
pathencode: check result of .digest() method in sha1hash
Without this it was theoretically possible .digest() would fail and
return NULL but we wouldn't notice. Detected with cpychecker.
Augie Fackler <augie@google.com> [Tue, 18 Aug 2015 16:43:26 -0400] rev 26049
parsers: correctly decref normed value after PyDict_SetItem
Previously we were leaving this PyObject* with a refcount that was one
too high. Detected with cpychecker.