Commit Graph

27273 Commits

Author SHA1 Message Date
Gregory Szorc
4b6a93ce1c scmposix: use absolute_import 2015-12-21 21:24:49 -08:00
Gregory Szorc
4602d8f855 scmutil: use absolute_import 2015-12-21 21:23:43 -08:00
Gregory Szorc
2895e45846 scmwindows: use absolute_import 2015-12-21 21:21:09 -08:00
Gregory Szorc
dfef101207 store: use absolute_import 2015-12-21 21:19:57 -08:00
Gregory Szorc
68a8e8f9f4 help: use absolute_import 2015-12-21 21:33:27 -08:00
Matt Harbison
767b7626b1 test-commit-interactive: updates for the no-execbit case
This goes with b0f02d371155 and 862e38e6beed.
2015-12-21 20:29:32 -05:00
Matt Harbison
996ae5279d test-fileset: conditionalize output with symlink 2015-12-21 20:18:06 -05:00
timeless
a433b637d1 commands: the first word of each note should be capital or hg 2015-12-22 02:24:16 +00:00
Gregory Szorc
054a9bb83f revlog: avoid string slice when decompressing u* chunks
Revlog chunks can be stored uncompressed. If the first byte of the
raw data is \0, we store the data as is. Else we prefix it with 'u'.

Before, we performed a string slice to strip out the 'u' prefix.
With this patch, we use a buffer to avoid an extra memory copy and
associated garbage collection overhead.

I was unable to verify any performance impact of this patch. For both
mozilla-central and the hg repos, the number of manifest revisions
with 'u' prefixes is very small - under 1%. So this change likely
isn't called enough to have an impact on manifest reading. However,
the reasoning behind this change is solid, so it should be safe.
2015-12-20 16:00:27 -08:00
Yuya Nishihara
bece6296b6 osutil: implement pure version of recvfds() for PyPy
This is less portable than the C version, but PyPy can't load CPython
extensions. So for now, this will be used on PyPy.

I've tested it on Linux amd64 and Mac OS X.
2015-12-17 23:53:09 +09:00
Yuya Nishihara
1172aa7cd7 osutil: implement recvmsg() of SCM_RIGHTS for chg command server
It will be used to attach client's stdio files to a background chg command
server.

The socket module of Python 2.x doesn't provide recvmsg(). This could be
implemented by using ctypes, but it would be less portable than the C version
because the handling of socket ancillary data heavily depends on preprocessor.
Also, some length fields are wrongly typed in the Linux kernel.
2015-12-17 23:41:46 +09:00
Matt Mackall
a8248afde0 cleanup: back out performance hacks amended into previous commit 2015-12-21 14:52:18 -06:00
timeless
777dbfe303 commands: consistently indent notes 3 spaces
most notes have 3 spaces for indentation, these had 2...
2015-12-18 06:33:48 +00:00
Gregory Szorc
9f75546b76 perf: add perfrevlogrevision
As part of investigating performance improvements to revlog reading,
I needed a mechanism to measure every part of revlog reading so I knew
where time was spent and how effective optimizations were.

This patch implements a perf command for benchmarking the various
stages of reading a single revlog revision.

When executed against a manifest revision at the end of a 30,000+
long delta chain in mozilla-central, the command demonstrates that
~80% of time is spent in zlib decompression.
2015-12-20 18:38:21 -08:00
Gregory Szorc
d83e377daa commands: use revlog._deltachain in debugdeltachain
We have a nice API now. Use it.

This does mean we introduce an extra index lookup for each revision.
Considering this is a debug command, the overhead should be acceptable.
We could add the chain size to revlog._deltachain(). However, that
feels like avoidable overhead.
2015-12-20 19:02:02 -08:00
Gregory Szorc
46245e3fe8 revlog: refactor delta chain computation into own function
This code is already written in multiple locations.

While this code needs to be fast and extracting it to its own function
adds overhead, code paths reading delta chains typically read,
decompress, and do binary patching on revlog data from the delta chain.
This other work (especially zlib decompression) almost certainly
accounts for a lot more time than the overhead of introducing a Python
function call. So I'm not worried about the performance impact of this
change.
2015-12-20 18:56:05 -08:00
Gregory Szorc
179b25b04a perf: call clearcaches() in perfmanifest
The old code only partially cleared the caches. Now that we have a
comprehensive method for wiping all caches, let's call it.

This appears to introduce a marginal regression in `hg perfmanifest`
on mozilla-central. This is good because the new result is more
accurate since caches aren't being used.
2015-12-20 17:57:44 -08:00
Gregory Szorc
ad1f138bcd manifest: implement clearcaches()
The manifest implements its own caches in addition to revlog's. Extend
the base clearcaches() to wipe these as well.
2015-12-20 19:31:46 -08:00
Gregory Szorc
cf051c1737 revlog: make clearcaches() more effective
clearcaches() was added several years ago in 1e47437a1ca7 as part
of implementing a perf command. Since revlog instances have many caches
and since the spirit of this mostly unused method is to facilitate
performance testing, I think it's appropriate for all the revlog's
caches to get cleared when it is called.
2015-12-20 17:48:20 -08:00
FUJIWARA Katsunori
2cb14bf8f0 fileset: detect unintentional existing() invocation at runtime
A fileset predicate can invoke 'matchctx.existing()' successfully,
even if it isn't marked as "existing caller". It is aborted only in
some corner cases: e.g. there were one deleted file in the working
directory (see 2c5c0790cbcc for detail).

This patch makes 'matchctx.existing()' invocation abort if not
'_existingenabled', which is true only while "existing caller"
running.

After this changes, non-"existing caller" predicate function is
aborted immediately, whenever it invokes 'matchctx.existing()'. This
prevent developer from forgetting to mark a predicate as "existing
caller".

BTW, unintentional 'matchctx.status()' invocation can be detected
easily without any additional trick like this patch, because it
returns 'None' if a predicate isn't marked as "status caller", and
referring field (e.g. '.modified') of it is always aborted.
2015-12-21 22:31:16 +09:00
FUJIWARA Katsunori
cde1d3d500 fileset: use set instead of list to mark predicates for efficiency (API)
This reduces cost of examining whether given predicate calls
'matchctx.status()' or 'matchctx.existing()' in 'getfileset()' at
runtime.

This kind of examination is used also in subsequent patch, which
detects unintentional 'matchctx.existing()' invocation per each
predicate evaluation.
2015-12-21 22:31:16 +09:00
FUJIWARA Katsunori
90eaf4bbec fileset: use decorator to mark a predicate as "existing caller"
This can localize changes for adding (or removing) an "existing
caller" predicate function in source code.
2015-12-21 22:31:16 +09:00
FUJIWARA Katsunori
c965a4dbaa fileset: use decorator to mark a predicate as "status caller"
Before this patch, predicates calling 'matchctx.status()' are listed
up by immediate list value in 'getfileset()'.

This prevents 3rd party extensions from adding specific predicate
calling 'matchctx.status()'.

This uses decorator to mark a predicate as "status caller".

This can also localize changes for adding (or removing) a "status
caller" predicate function in source code.
2015-12-21 22:31:16 +09:00
FUJIWARA Katsunori
a8588195a6 fileset: use decorator to mark a function as fileset predicate
Using decorator can localize changes for adding (or removing) a
fileset predicate function in source code.

It is also useful to pick predicates up for specific purpose. For
example, subsequent patches marks predicates as "call status" or "use
existing" via decorator.

To avoid (1) redundancy between "predicate name" and (the beginning
of) help document, and (2) accidental typo of help document, this
patch also makes decorator put predicate declration into the beginning
of help.
2015-12-21 22:31:16 +09:00
FUJIWARA Katsunori
655c371178 fileset: treat encoding and eol as the predicate calling _existing
Before this patch, predicate function 'encoding' and 'eol' aren't
listed up in '_existingcallers', even though they invoke 'existing()'.

This causes unexpected failure of these predicate, if there is a
(manually) deleted file in the working directory.

2c5c0790cbcc and 12b403664548 seem to overlook putting already
existing 'encoding' or newly introduced 'eol' into '_existingcallers'.

This patch also changes order of fileset "eol(unix)" output in test,
because "existing caller" predicates show "A(dded)" files before
"C(lean)" ones.
2015-12-21 22:31:16 +09:00
timeless
32124ab7e3 rebase: mention conflict in documentation instead of merge 2015-12-18 18:32:15 +00:00
timeless
a11d42f514 rebase: simplify documentation about heads 2015-12-18 18:31:45 +00:00
timeless
99e9c1b2d0 rebase: simplify documentation about --keep
Also include a warning about bookmarks
2015-12-18 18:22:03 +00:00
timeless
30016e92bc rebase: simplify documentation about selecting commits to rebase 2015-12-18 18:24:41 +00:00
timeless
16c4277abb rebase: simplify documentation about public commits
add reference to graft
2015-12-18 18:06:43 +00:00
Matt Mackall
13d86f9294 verify: clean up weird error/warning lists
Nested functions in Python are not able to assign to variables in the
outer scope without something like the list trick because assignments
refer to the inner scope. So, we formerly used a list to give an
object to assign into.

Now that error and warning are object members, the [0] hack is no
longer needed.
2015-12-20 16:33:44 -06:00
timeless
78ff92a147 diff: clarify comparison as first parent 2015-12-18 18:52:25 +00:00
timeless
4d95bd2b9d histedit: add progress support 2015-12-18 06:19:22 +00:00
Yuya Nishihara
ca75b0a3eb verify: remove unreachable code to reraise KeyboardInterrupt
KeyboardInterrupt should never be caught as it doesn't inherit Exception in
Python 2.5 or later. And if it was, "interrupted" would be printed twice.

https://docs.python.org/2.7/library/exceptions.html#exception-hierarchy
2015-12-20 18:38:21 +09:00
Matt Mackall
c90437b804 merge with stable 2015-12-20 16:34:54 -06:00
Martin von Zweigbergk
0a6dbcd4ad revlog: fix bad indentation (replace tab by space) 2015-12-18 20:54:41 -08:00
Durham Goode
1f8eab7615 verify: move exc() function onto class
This is part of an effort to make verify more modular so extensions can hook
into it.
2015-12-18 16:42:39 -08:00
Durham Goode
43f6f64559 verify: move err() to be a class function
This is part of an effort to make it easier for extensions to hook into verify.
2015-12-18 16:42:39 -08:00
Durham Goode
fc349ab32f verify: move warn() to a class level function
This is part of the effort to make verify more modular so extensions can hook
into it more easily.
2015-12-18 16:42:39 -08:00
Durham Goode
37c5c70102 verify: move fncachewarned up to a class variable
This is part of making verify more modular so hooks can extend it.
2015-12-18 16:42:39 -08:00
Durham Goode
81530280b2 verify: move widely used variables into class members
This will allow us to start moving some of the nested functions inside verify()
out onto the class.

This will allow extensions to hook into verify more easily.
2015-12-18 16:42:39 -08:00
Durham Goode
21a5133eda verify: move verify logic into a class
In order to allow extensions to hook into the verification logic more easily, we
need to refactor it into multiple functions. The first step is to move it to a
class so the shared state can be more easily accessed.
2015-12-18 16:42:39 -08:00
Matt Harbison
85a68ab949 test-install: perform the wix checking on wdir() instead of "."
This allows catching problems before they are committed.
2015-12-17 21:18:02 -05:00
Laurent Charignon
5e7ee9a128 log: speed up hg log <file|folder>
This patch makes hg log <file|folder> faster by using changelog.readfiles
instead of changelog.read.
On our large repos for hg log <file|folder> -l5 operations that were taking:
- ~8s I see a 25% improvement
- ~15s, I see a 35% improvement
For recently modified folder/file, the difference is negligible as we don't
have to consider many revisions.
2015-12-18 12:54:45 -08:00
Laurent Charignon
be5dd01ee1 changelog: add a new method to get files modified by a changeset
This patch adds a new method "readfiles" to get the files modified by a
changeset. It extracts some logic from "read" to only return the files modified
by a changeset as efficiently as possible. This is used in the next patch to
speed up hg log <file|folder>
2015-12-18 13:45:55 -08:00
Gregory Szorc
2632a8c77a revlog: seek to end of file before writing (issue4943)
Revlogs were recently refactored to open file handles in "a+" and use a
persistent file handle for reading and writing. This drastically
reduced the number of file handles being opened.

Unfortunately, it appears that some versions of Solaris lose the file
offset when performing a write after the handle has been seeked.

The simplest workaround is to seek to EOF on files opened in a+ mode
before writing to them, which is what this patch does.

Ideally, this code would exist in the vfs layer. However, this would
require creating a proxy class for file objects in order to provide a
custom implementation of write(). This would add overhead. Since
revlogs are the only files we open in a+ mode, the one-off workaround
in revlog.py should be sufficient.

This patch appears to have little to no impact on performance on my
Linux machine.
2015-12-17 17:16:02 -08:00
Matt Harbison
3cab7ba2f7 tests: convert directory separators to '/' for MSYS in test-check-py-compat
This is the same fix as ca24c20a1c94.
2015-12-16 17:22:37 -05:00
Matt Harbison
6d5700eb1f tests: make pwd URL compatible on Windows in test-default-push
Without this, the test fails with:

  $ hg -q commit -A -m 'add pushurl'
  abort: file:// URLs can only refer to localhost
  $ hg push
  abort: file:// URLs can only refer to localhost

The variable $PWD causes check-code to complain, so avoid that.
2015-12-16 17:17:36 -05:00
Matt Harbison
3d1b5ddf9f windows: correct the import of win32
This module is relative, and was overlooked when converting to absolute_import
in 8474b52419b8.
2015-12-16 13:33:43 -05:00
Pascal Quantin
edc138619b win32: add internals help topics to Inno Setup installer 2015-12-17 19:33:44 +01:00