Commit Graph

26383 Commits

Author SHA1 Message Date
Pierre-Yves David
2aa8064fde bundle2: rename error exception class for unsupported feature
The original name explicitly mention "Part", however it is also used outside of
parts related feature. We rename from 'UnsupportedPartError' to
'BundleUnknownFeatureError' to fix this.
2015-09-23 11:44:52 -07:00
Pierre-Yves David
496ebe3ecb changegroup: use a different compression key for BZ in HG10
For "space saving", bundle1 "strip" the first two bytes of the BZ stream since
they always are 'BZ'. So the current code boostrap the uncompressor with 'BZ'.
This hack is impractical in more generic case so we move it in a dedicated
"decompression".
2015-09-23 11:33:30 -07:00
Anton Shestakov
22d1cd552d monoblue: provide links to branches, tags and bookmarks by name
This is adapted from 635285e0a942, that was added to paper for 3.5 release.

It adds another way to refer to branches, tags and bookmarks in urls: by name.
It's still possible to navigate to a specific changeset hash, but now you can
get more descriptive urls straight from /summary page, for example.

branchentry template (and so the whole branches table on /summary and
/branches) lost the column that had a plain changeset hash, because tags and
bookmarks don't have this column and also because there is already a way to
address branch by its changeset hash (changeset link just next to it). Maybe we
can instead bring this column with a plain changeset hash to tags and
bookmarks, but this, more terse, new look feels fine.
2015-09-26 17:24:12 +08:00
Anton Shestakov
c3abc3de29 gitweb: provide links to branches, tags and bookmarks by name
This is adapted from 635285e0a942, that was added to paper for 3.5 release.

It adds another way to refer to branches, tags and bookmarks in urls: by name.
It's still possible to navigate to a specific changeset hash, but now you can
get more descriptive urls straight from /summary page, for example.

branchentry template (and so the whole branches table on /summary and
/branches) lost the column that had a plain changeset hash, because tags and
bookmarks don't have this column and also because there is already a way to
address branch by its changeset hash (changeset link just next to it). Maybe we
can instead bring this column with a plain changeset hash to tags and
bookmarks, but this, more terse, new look feels fine.
2015-09-26 17:15:58 +08:00
timeless@mozdev.org
2993615080 cmdutil: remove HG: prefix from translation strings 2015-09-25 03:44:15 -04:00
timeless@mozdev.org
1e8c71dffb i18n-zh_CN: annotate broken HG: translations 2015-09-25 03:47:48 -04:00
Siddharth Agarwal
4a04cef0a1 lock: recognize parent locks while acquiring
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. This patch enables the logic introduced in previous
patches.
2015-09-24 22:07:55 -07:00
Siddharth Agarwal
e60aaeccf1 test-lock.py: fix testing for forks
The earlier test worked only because the held count went up to 2, so the first
release brought it down to 1. Making a copy of the lock fixes that issue.
2015-09-24 22:00:51 -07:00
Siddharth Agarwal
1d157c4b16 test-lock.py: allow PID to be changed in test state
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
2015-09-24 20:40:00 -07:00
Siddharth Agarwal
e006a50c9b test-lock.py: add a lock wrapper that allows faking the PID
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
2015-09-24 20:22:59 -07:00
Siddharth Agarwal
066d0055bc lock: add a wrapper to os.getpid() to make testing easier
This will allow us to fake locks across processes more easily.
2015-09-24 21:26:37 -07:00
Siddharth Agarwal
14584f8c1d test-lock.py: move temp dir generation to testcase
In upcoming patches we'll want to create multiple test state objects with a
common test directory.
2015-09-24 19:52:34 -07:00
Siddharth Agarwal
abec122d89 test-lock.py: copy-edit assertions about file existing
Before: expected lock to exists but actually did not exists
After:  expected lock to exist but actually did not exist
2015-09-24 17:33:13 -07:00
Gregory Szorc
4b88c2e0ff revlog: don't flush data file after every added revision
The current behavior of revlogs is to flush the data file when writing
data to it. Tracing system calls revealed that changegroup processing
incurred numerous write(2) calls for values much smaller than the
default buffer size (Python defaults to 4096, but it can be adjusted
based on detected block size at run time by CPython).

The reason we flush revlogs is so readers have all data available.
For example, the current code in revlog.py will re-open the revlog
file (instead of seeking an existing file handle) to read the text
of a revision. This happens when starting a new delta chain when
adding several revisions from changegroups, for example. Yes, this
is likely sub-optimal (we should probably be sharing file descriptors
between readers and writers to avoid the flushing and associated
overhead of re-opening files).

While flushing revlogs is necessary, it appears all callers are
diligent about flushing files before a read is performed (see
buildtext() in _addrevision()), making the flush in
_writeentry() redundant and unncessary. So, we remove it. In practice,
this means we incur a write(2) a) when the buffer is full (typically
4096 bytes) b) when a new delta chain is created rather than after
every added revision. This applies to every revlog, but by volume
it mostly impacts filelogs.

Removing the redundant flush from _writeentry() significantly
reduces the number of write(2) calls during changegroup processing on
my Linux machine. When applying a changegroup of the hg repo based on
my local repo, the total number of write(2) calls during application
of the mercurial/localrepo.py revlogs dropped from 1,320 to 217 with
this patch applied. Total I/O related system calls dropped from 1,577
to 474.

When unbundling a mozilla-central gzipped bundle (264,403 changesets
with 1,492,215 changes to 222,507 files), total write(2) calls
dropped from 1,252,881 to 827,106 and total system calls dropped from
3,601,259 to 3,178,636 - a reduction of 425,775!

While the system call reduction is significant, it appears
to have no impact on wall time on my Linux and Windows machines. Still,
fewer syscalls is fewer syscalls. Surely this can't hurt. If nothing
else, it makes examining remaining system call usage simpler and opens
the door to experimenting with the performance impact of different
buffer sizes.
2015-09-26 21:43:13 -07:00
Gregory Szorc
5b6556c143 revlog: use existing file handle when reading during _addrevision
_addrevision() may need to read from revlogs as part of computing
deltas. Previously, we would flush existing file handles and open
a new, short-lived file handle to perform the reading.

If we have an existing file handle, it seems logical to reuse it
for reading instead of opening a new file handle. This patch
makes that the new behavior.

After this patch, revlog files are only reopened when adding
revisions if the revlog is switched from inline to non-inline.

On Linux when unbundling a bundle of the mozilla-central repo, this
patch has the following impact on system call counts:

Call     Before     After       Delta
write    827,639    673,390   -154,249
open     700,103    684,089    -16,014
read      74,489     74,489          0
fstat    493,924    461,896    -32,028
close    249,131    233,117    -16,014
stat     242,001    242,001          0
lstat     18,676     18,676          0
lseek     20,268     20,268          0
ioctl     14,652     13,173     -1,479
TOTAL  3,180,758  2,930,679   -250,079

It's worth noting that many of the open() calls fail due to missing
files. That's why there are many more open() calls than close().

Despite the significant system call reduction, this change does not
seem to have a significant performance impact on Linux.

On Windows 10 (not a VM, on a SSD), this patch appears to reduce
unbundle time for mozilla-central from ~960s to ~920s. This isn't
as significant as I was hoping. But a decrease it is nonetheless.
Still, Windows unbundle performance is still >2x slower than Linux.

Despite the lack of significant gains, fewer system calls is fewer
system calls. If nothing else, this will narrow the focus of potential
areas to optimize in the future.
2015-09-27 16:08:18 -07:00
Gregory Szorc
4f8cd71a6f revlog: always open revlogs for reading and appending
An upcoming patch will teach revlogs to use the existing file
handle to read revision data instead of opening a new file handle
just for quick reads. For this to work, files must be opened for
reading as well.

This patch is merely cosmetic: there are no behavior changes.
2015-09-27 15:59:19 -07:00
Gregory Szorc
574108c7d9 revlog: support using an existing file handle when reading revlogs
Currently, the low-level revlog reading code always opens a new file
handle. In some key scenarios, the revlog is already opened and an
existing file handle could be used to read. This patch paves the
road to that by teaching various revlog reading functions to accept
an optional existing file handle to read from.
2015-09-27 15:48:35 -07:00
Gregory Szorc
106b00c51d revlog: add docstring for checkinlinesize()
The name is deceptive: it does more than just "check." Add a docstring
to clarify what's going on.
2015-09-27 15:31:50 -07:00
Gregory Szorc
93ad4e38a3 windows: insert file positioning call between reads and writes
fopen() and fdopen() have a unique-to-Windows requirement that
transitions between read and write operations in files opened
in modes r+, w+, and a+ perform a file positioning call
(fsetpos, fseek, or rewind) in between. While the MSDN docs don't
say what will happen if this is not done, observations reveal
that Python raises an IOError with errno 0. Furthermore, I
/think/ this behavior isn't deterministic. But I can reproduce
it reliably with subsequent patches applied that open revlogs
in a+ mode and perform both reads and writes.

This patch introduces a proxy class for file handles opened
in r+, w+, and a+ mode on Windows. The class intercepts calls
and audits whether a file positioning function has been called
between read and write operations. If not, a dummy, no-op seek
to the current file position is performed. This appears to be
sufficient to "trick" Windows into allowing transitions between
read and writes without raising errors.
2015-09-27 18:46:53 -07:00
Yuya Nishihara
ae50cd8035 tests: suppress verbose output of svn transaction
Subversion 1.9 shows more verbose messages than 1.8 and the tests fail
because of them. These outputs are not important in our tests, so let's
suppress them by -q or grep -v.
2015-09-26 15:20:32 +09:00
Yuya Nishihara
ca46de8232 formatter: use dict.update() to set arguments passed to write functions
This isn't important, but update() is better than loop in general.
2015-09-23 21:54:47 +09:00
Yuya Nishihara
78102f8d39 formatter: verify number of arguments passed to write functions
zip() takes the shortest length, which can be a source of bug.
2015-09-23 21:51:48 +09:00
Yuya Nishihara
2843fbb322 help: unify handling of DEPRECATED/EXPERIMENTAL keywords
This fixes listexts() to exclude translated "(DEPRECATED)" marker correctly.

On the other hand, help_() doesn't need translated keywords, but I don't think
it's worth to separate untranslated keywords just for it.
2015-09-26 11:50:47 +09:00
Yuya Nishihara
dac7167e8f help: include parens in DEPRECATED/EXPERIMENTAL keywords
In some languages that have no caps, "DEPRECATED" and "deprecated" can be
translated to the same byte sequence. So it is too wild to exclude messages
by _("DEPRECATED").
2015-09-26 11:38:39 +09:00
Yuya Nishihara
4c633e1b68 help: define list of keywords that should be excluded from non-verbose output
This list will be reused by the other deprecated/experimental handling.
2015-09-26 11:25:38 +09:00
Matt Mackall
f0081b033a merge with stable 2015-09-25 23:10:47 -05:00
Jordi Gutiérrez Hermoso
cce05f8f6d phases: return zero for no-op operations (issue4751) (BC)
It is rather unhelpful to return 1 if there were no changes because
the request matches the current state of phases. So we just undo that.
2015-09-14 19:25:34 -04:00
timeless@mozdev.org
e7c8225164 help: add config.troubleshooting section at the top 2015-09-24 14:45:17 -04:00
Jordi Gutiérrez Hermoso
8a7abebe42 dispatch: don't stack trace on commands like hg .log
This used to stack trace because it raised a util.Abort which wasn't
handled in this block. We now handle it. Additionally, we error out
earlier instead of plodding on and showing the "log" entry of the
plain `hg help` output.
2015-09-25 11:16:20 -04:00
Anton Shestakov
e295b5a51b gitweb, monoblue: port highlighting linked lines from paper
This is adapted from a9c9f5ef6abf, 38b0132204f4 and 1555d017cac7.
2015-09-25 12:38:20 +08:00
Anton Shestakov
9643ca35f2 gitweb, monoblue: fix vertical align of spans in .sourcelines
Empty lines in file view could produce an inexplicable margin before the next
line (most noticeable in browsers on webkit/blink engine). That was making
empty lines seem taller than the rest.

Instead of using default vertical align, let's set it to 'top'.

This issue is actually present in paper, and only recently got into gitweb
(0609781075c1) and monoblue (b7a7757577fb). There's a bit more to it in paper,
so that will be dealt with in a future patch.

Recipe to see live: preferably using a webkit/blink browser, such as chromium,
browse a file with empty lines, e.g. https://selenic.com/hg/file/3.5/README#l8
Selecting a block of text that includes empty lines will reveal white "breaks"
in the selection. Highlighted line (#l8) also shows such a break below itself.
2015-09-25 03:02:38 +08:00
timeless@mozdev.org
bbe814936e merge: fix mergestate comment 2015-09-25 00:54:20 -04:00
timeless@mozdev.org
e4c8525ba7 rebase: avoid losing branch commits with --keepbranch (issue4835) 2015-09-24 17:51:05 -04:00
Siddharth Agarwal
ce3fd41292 lock.release: do not unlink inherited locks
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. A subprocess unlinking a lock will lead to potential
corruption from other concurrent processes.
2015-09-24 16:03:26 -07:00
Siddharth Agarwal
9fe251823c lock: add a method to reacquire the lock after subprocesses exit
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.
2015-09-24 16:00:41 -07:00
Siddharth Agarwal
781395377d lock: add a method to prepare the lock for inheritance
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.
2015-09-24 10:37:13 -07:00
Siddharth Agarwal
3efac149fd lock: introduce state to keep track of inheritance
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances. In upcoming patches we will refer to this state.
2015-09-24 15:57:11 -07:00
Siddharth Agarwal
9bb5535bd0 error: add an exception to indicate lock inheritance API contract violations 2015-09-24 10:53:16 -07:00
Sean Farley
dfae17fe18 clone: check update rev for being True
In 03e658289ff6, there was an attempt to fallback to looking up the update
revision assuming it was always a rev but the documentation states:

  True means update to default rev, anything else is treated as a revision

Therefore, we should only fallback to looking up the update rev if it is not
True. This bug was found in hg-git and I couldn't think of a test that does
this in pure Mercurial since the source repository is checked for the revision
as well (and therefore gracefully falls back).
2015-09-24 15:52:11 -07:00
Sean Farley
d60ee8978f clone: fix over-indented continuation line 2015-09-24 15:47:23 -07:00
timeless@mozdev.org
776539bcbf resolve: consistently describe re-merge + unresolved 2015-09-25 03:51:46 -04:00
liscju
c4c7beba44 mercurial: add debugextensions command (issue4676)
Add debugextensions command to help users debug their extension
problems. If there are no extensions command prints nothing,
otherwise it prints names of extension modules. If quiet or
verbose option is not specified it prints(after extensions name)
last version of mercurial in which given module was tested for
non internal modules or not tested with user mercurial version.

If verbose is specified it prints following information for every
extension: extension name, import source, testedwith and buglink
information.

Extensions are printed sorted by extension name.
2015-09-10 16:53:07 +02:00
Daniel Colascione
4eefceee97 dispatch: stop warning about EPIPE in --debug mode
It seems silly for "hg --debug manifest | less" to print a scary
message after the user hits "q" in less.  hg should just exit silently
instead, since EPIPE on stdout is a perfectly reasonable result.
2015-09-24 10:15:37 +03:00
Laurent Charignon
1cb3086e23 rebase: don't rebase obsolete commit whose successor is already rebased
This patch avoids unnecessary conflicts to resolve during rebase for the users
of changeset evolution.

This patch modifies rebase to skip obsolete commits if they are being rebased on
their successors.
It introduces a new rebase state 'revprecursor' for these revisions that are
being skipped and a new message to inform the user of what is happening.
This feature is gated behind the config flag experimental.rebaseskipobsolete

When an obsolete commit is skipped, the output is:
not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
2015-09-14 17:31:48 -07:00
Pierre-Yves David
b2cac2b8b4 check-code: forbid mutable value for default argument
default value are common to all call. Using mutable value is a classical source
of bug in Python. We forbid it.

The regexp (Courtesy of Matt Mackall) is only catching such value on the first
line of a definition, but that will be good enough for now.
2015-09-24 00:34:15 -07:00
Pierre-Yves David
2dc338dc47 httpconnection: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:54:30 -07:00
Pierre-Yves David
7b5d19b0d7 transplant: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:52:21 -07:00
Pierre-Yves David
4756d21a63 mq: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs. The
underlying function already handle "None" as an option value, so we do not need
to do anything else.
2015-09-24 00:50:06 -07:00
Pierre-Yves David
a551464cdd largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:49:02 -07:00
Pierre-Yves David
ffcbdf7cc8 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:48:24 -07:00