Commit Graph

28134 Commits

Author SHA1 Message Date
Yuya Nishihara
80951b9f1b extensions: extract function that copies function attributes to wrapper
wrapfunction() will be changed to copy these attributes. See the next patch
for details.
2016-01-09 19:45:10 +09:00
timeless
518224b17e tests: fix section description
Copy and paste error
2016-02-29 23:28:32 +00:00
Augie Fackler
d41a070262 zeroconf: import ui as uimod per test-check-module-imports 2016-03-01 13:48:25 -05:00
Gregory Szorc
ab7f7f6a19 changelog: lazy decode user (API)
This appears to show a similar speedup as the previous patch.
2016-02-27 22:34:18 -08:00
Gregory Szorc
6f651cb96b changelog: lazy decode description (API)
Currently, changelog reading decodes read values. This is wasteful
because a lot of times consumers aren't interested in some of these
values.

This patch changes description decoding to occur in changectx as
needed.

revsets reading changelog entries appear to speed up slightly:

revset #7: author(lmoscovicz)
   plain
0) 0.906329
1) 0.872653

revset #8: author(mpm)
   plain
0) 0.903478
1) 0.878037

revset #9: author(lmoscovicz) or author(mpm)
   plain
0) 1.817855
1) 1.778680

revset #10: author(mpm) or author(lmoscovicz)
   plain
0) 1.837052
1) 1.764568
2016-02-27 22:25:14 -08:00
timeless
6944befadd blackbox: optionally log event source 2016-02-11 19:38:26 +00:00
timeless
3046e843ec blackbox: remove hexfn
It was introduced as copy+paste code, but was never necessary.
2016-03-01 10:45:47 +00:00
timeless
8ffb77cabf blackbox: rewrite dirty documentation noting it is expensive 2016-03-01 10:43:52 +00:00
timeless
bc17264706 zeroconf: remove whitespace around = for named parameters 2016-03-01 09:49:38 +00:00
timeless
dc63708974 zeroconf: del is not a function 2016-03-01 09:44:32 +00:00
timeless
d663c817be zeroconf: add whitespace around operator 2016-03-01 09:48:11 +00:00
timeless
b24249e75c zeroconf: wrap long lines 2016-03-01 09:33:39 +00:00
timeless
c72c0f2737 zeroconf: drop tabs 2016-03-01 08:53:40 +00:00
timeless
d76d9e277e zeroconf: omit semicolons 2016-03-01 08:48:10 +00:00
timeless
c202bff77a zeroconf: use absolute_import 2016-03-01 08:42:46 +00:00
timeless
1f9922ecf6 zeroconf: use print function 2016-03-01 07:17:32 +00:00
liscju
7a22f98665 histedit: improve error when run on nodes with children (issue5056) 2016-02-29 15:12:26 +01:00
timeless
0c436e0682 tests: minor grammar change for check-commit 2016-03-01 11:51:46 +00:00
Gregory Szorc
bfe71a12f3 worker: document poor partitioning scheme impact
mpm isn't a fan of the existing or previous partitioning scheme. He
provided a fantastic justification for why on the mailing list.

This patch adds his words to the code so they aren't forgotten.
2016-02-27 21:43:17 -08:00
Matt Mackall
c0ab1b7cbf merge with stable 2016-02-29 17:52:17 -06:00
Gregory Szorc
9068a821f3 run-tests: fix Python 3 incompatibilities
At one point run-tests.py and test-run-tests.t worked and passed
under Python 3.5. Various changes to run-tests.py over the past
several months appear to have broken Python 3.5 compatibility.

This patch implements various fixes (all related to str/bytes type
coercion) to make run-tests.py and test-run-tests.t mostly work
again. There are still a few failures in test-run-tests.t due to
issues importing mercurial.* modules. But at least run-tests.py
seems to work under 3.5 again.
2016-02-27 21:29:42 -08:00
Gregory Szorc
cf440c3122 hghave: use print function
For Python 3 compatibility.
2016-02-27 21:19:53 -08:00
Gregory Szorc
c5114195d9 changelog: remove redundant parentheses
You don't need to surround returned tuples with parens.
2016-02-27 22:25:47 -08:00
Gregory Szorc
3774b02abb changegroup: use changelog.readfiles
We have a dedicated function to get just the list of files in
a changelog entry. Use it.

This will presumably speed up changegroup application since we're
no longer decoding the entire changelog entry. But I didn't measure
the impact.
2016-02-27 23:06:05 -08:00
Pierre-Yves David
0f9abc9deb rebase: remove experimental option from 'rebase' config section
Changeset 9a4b77db854b introduced a guard against case where obsolete changesets
are included in the rebase in a way this will result in divergence (because
rebase create new successors for changeset which already have successors). In
the same go a 'rebase.allowdivergence' option was introduced to control that
behavior.

We rename this config option to 'experimental.allowdivergence' for multiple
reasons:

* First this behavior is attached to changeset evolution, a feature still
 experimental.

* Second, there was no 'rebase' section in config before we introduced this
  option. I would like to avoid proliferation of micro config section and
  therefore would like to avoid the creation of this new section just for an
  experimental feature.

* Third, this guard (warning the user about a history rewriting operation that
  will create divergence) will very likely be generalised to all history
  rewriting operations, making this not rebase specific.

* Finally, because this will likely be a general guard present a bit everywhere
  in the UI we'll likely end up with something better than a config option to
  control this behavior, so having the current config option living in
  experimental will allow us make it disappear in the future.

So we banish this config option back to the experimental section where it
belongs, killing the newly born 'rebase' config section in the process.
2016-02-27 18:02:12 +01:00
David R. MacIver
0db622903d testing: allow Hypothesis tests to disable extensions
Doing this required the introduction of a mechanism for keeping
track of more general config in the test. At present this is only
used for extensions but it could be used more widely (e.g. to
control specific extension behaviour)

This greatly simplifies the extension management logic by introducing
a general notion of config, which we maintain ourselves and pass to
HG on every invocation.

This results in significantly less error prone test generation, and
also allows us to turn extensions off as well as on.

The logic that used an environment variable to rerun the tests with
an extension disabled now just edits the test file (in a fresh copy)
to remove these --config command line flags.
2016-02-26 17:15:49 +00:00
Gregory Szorc
2ef42b9dfb keepalive: remove useless parentheses around exception type 2016-02-28 00:00:13 -08:00
Jun Wu
5b7badc1c4 chgserver: add a structure for confighash and mtimehash
confighash and mtimehash are often used together. This patch adds a simple
structure called hashstate to store them. hashstate also has a handly method
called fromui to calculate the hashes from a ui object.
2016-02-24 20:45:47 +00:00
Jun Wu
06733e6248 chgserver: add utilities to calculate mtimehash
mtimehash is designed to detect file changes. These files include:
- single file extensions (__init__.py for complex extensions)
- mercurial/__version__.py
- python (sys.executable)

mtimehash only uses stat to check files so it's fast but not 100% accurate.
However it should be good enough for our use case.

For chgserver, once mtimehash changes, the server is considered outdated
immediately and should no longer provide service.
2016-02-26 14:59:39 +00:00
Pierre-Yves David
7ba8661a7b tests: rename 'test-module-import.t' into 'test-check-module-import.t'
This test is checking our source code to ensure style and correct behavior (eg:
no cycle). Current convention is that such tests starts with 'test-check-' so we
flock this on back with the others.
2016-02-27 17:31:23 +01:00
FUJIWARA Katsunori
682ffa7011 pull: deactivate a bookmark not matching with the destination of the update
Before this patch, "hg pull -u" with a target doesn't deactivate a current
active bookmark, which doesn't match with the explicit destination of the
update, even though bare "hg update" does so.

A "target" can be provided through:
  - option --rev ANOTHER
  - option --branch ANOTHER
  - source URL#ANOTHER
2016-02-26 20:22:05 +09:00
FUJIWARA Katsunori
f00c81db76 pull: activate a bookmark matching with the destination of the update (BC)
Before this patch, "hg pull -u" with a target doesn't activate a bookmark, which
matches with the explicit destination of the update, even though bare "hg
update" does so.

A "target" can be provided through:
  - option --rev BOOKMARK
  - source URL#BOOKMARK
2016-02-26 20:22:05 +09:00
Yuya Nishihara
bcd39cd70f revset: define "pat" variable unconditionally in subrepo()
It's a source of UnboundLocalError to define and use local variables
conditionally. As getstring() always returns a str, "pat" can be initialized
to None.
2016-02-13 20:13:45 +09:00
Yuya Nishihara
1f60c51fa5 templater: abort if infinite recursion detected while compiling
In this case, a template is parsed recursively with no thunk for lazy
evaluation. This patch prevents recursion by putting a dummy of the same name
into a cache that will be referenced while parsing if there's a recursion.

  changeset = {files % changeset}\n
                       ~~~~~~~~~
                        = [(_runrecursivesymbol, 'changeset')]
2015-07-23 23:41:29 +09:00
Yuya Nishihara
554208ae8f templater: abort if infinite recursion detected while evaluation (issue4758)
It would be nice if we could detect recursion at the parsing phase, but we
can't because a template can refer to a keyword of the same name. For example,
"rev = {rev}" is valid if rev is a keyword, and we don't know if rev is a
keyword or a template while parsing.
2015-07-22 23:29:41 +09:00
Martin von Zweigbergk
d1531da666 exchange: set 'treemanifest' param on pushed changegroups too
In 7a1ccfe03f74 (treemanifests: set bundle2 part parameter indicating
treemanifest, 2016-01-08), I didn't realize I had to set the parameter
separately for getbundle and unbundle. Having the parameter there on
push allows us to push to an empty repo and have the requirements
updated correctly.
2016-01-22 16:31:50 -08:00
Laurent Charignon
f5b5bd3884 crecord: fix help bar display issue (issue5063)
Before this patch, the help bar in crecord wouldn't be printed correctly when
the terminal window didn't have enough column to display it. This patch adds
logic to make sure that the help bar message is always displayed. We use an
ellipsis when it is not possible to display the complete message.
2016-01-25 11:37:02 -08:00
Laurent Charignon
f009465327 crecord: fix typo in the help text
In the crecord help dialog, the toggle all option was wrongfully documented.
Instead of using 'a', one must use 'A' to toggle all the hunks. The crecord
header that is always displayed on the screen contains the right shortcut and
does not need to be changed.
2016-01-25 10:13:03 -08:00
Mason Malone
081f032818 subrepo: better error messages in _ensuregit
This patch improves the error messages raised when an OSError occurs, since
simply re-raising the exception can be both confusing and misleading. For
example, if "hg identify" is run inside a repository that contains a Git
subrepository and the git binary could not be found, it'll exit with the message
"abort: No such file or directory". That implies "identify" has a problem
reading the repository itself. There's no way for the user to know what the
real problem is unless they dive into the Mercurial source, which is what I
ended up doing after spending hours debugging errors while provisioning a VM
with Ansible (turns out I forgot to install Git on it).

Descriptive errors are especially important on Windows, since it's common for
Windows users to forget to set the "Path" system variable after installing Git.
2016-01-17 22:53:57 -05:00
Anton Shestakov
f6e436f317 hgweb: update canvas.width before dynamically redrawing graph (issue2683)
After 313b8d61b548 graph canvas width is decided once on the initial rendering.
However, after graph page gets scrolled down to load more, it might need more
horizontal space to draw, so it needs to resize the canvas dynamically.

The exact problem that this patch solves can be seen using:

    hg init testfork
    cd testfork
    echo 0 > foo
    hg ci -Am0
    echo 1 > foo
    hg ci -m1
    hg up 0
    echo 2 > foo
    hg ci -m2
    hg gl -T '{rev}\n'

    @  2
    |
    | o  1
    |/
    o  0

    hg serve

And then by navigating to http://127.0.0.1:8000/graph/tip?revcount=1

"revcount=1" makes sure the initial graph contains only revision 2. And because
the initial canvas width takes only that one revision into count, after the
(immediate) AJAX update revision 1 will be cut off from the graph.

We can safely set canvas width to the new value we get from the AJAX request
because every time graph is updated, it is completely redrawn using all the
requested nodes (in the case above it will use /graph/2?revcount=61), so the
value is guaranteed not to decrease.

P.S.: Sorry for parsing HTML with regexes, but I didn't start it.
2016-01-23 17:31:31 +08:00
Bryan O'Sullivan
95a960a422 run-tests: "fix" race condition in race condition fix
Laurent's commit 56cdfddbd2ed still suffers from a race: by the
time the "job" function tries to assign to channels[channel], that
list has been truncated to empty.  The result is that every job
thread raises an IndexError.

Earlier, I tried an approach of correctly locking channels, but
that caused run-tests to hang on KeyboardInterrupt sometimes.

This approach is strictly hackier, but seems to actually work
reliably.
2016-01-22 11:00:13 -08:00
timeless
09414997c3 rebase: restore help for rebase w/o args (issue5059)
Restoring documentation accidentally removed in 0feae227228d.
2016-01-22 20:32:47 +00:00
Martin von Zweigbergk
c28812c552 shelve: use cg3 for treemanifests
Similar to previous change, this teaches shelve to pick the right
changegroup version for repos that use treemanifests.
2016-01-19 15:37:07 -08:00
Martin von Zweigbergk
857d2206c3 repair: use cg3 for treemanifests
The newly created helper changegroup.safeversion() knows to pick
version 03 if the repo uses treemanifests, so just using that means we
pick the right changegroup version.
2016-01-19 15:38:24 -08:00
Martin von Zweigbergk
4208c8682a changegroup: introduce safeversion()
In a few places (at least repair.py and shelve.py), we want to find
the best changegroup version that we can assume users of the repo will
understand. For example, we choose version 01 by default, but if it's
a generaldelta repo, we expect clients to support version 02 anyway,
so we choose that for new bundles (for e.g. "hg strip"). Let's create
a helper for this functionality in changegroup, so we can reuse it
elsewhere later.
2016-01-19 15:32:32 -08:00
Martin von Zweigbergk
fb1b7626e4 changegroup: don't support versions 01 and 02 with treemanifests
Since it would be terribly expensive to convert between flat manifests
and treemanifests, we have decided to simply not support changegroup
version 01 and 02 with treemanifests. Therefore, let's stop announcing
that we support these versions on treemanifest repos.

Note that this means that older clients that try to clone from a
treemanifest repo will fail. What happens is that the server, after
this patch, finds that there are no common versions and raises
"ValueError: no common changegroup version". This results in "abort:
HTTP Error 500: Internal Server Error" on the client.

Before this patch, it was no better: The server would instead find
that there were directory manifest nodes to put in the changegroup 01
or 02 and raise an AssertionError on changegroup.py#668 (assert not
tmfnodes), which would also appear as a 500 to the client.
2016-01-19 14:27:18 -08:00
Laurent Charignon
bdac46ce5b run-tests: fix crash when --json and --blacklist are both used (issue5050)
This patch fixes a crash when both --json and --blacklist were given as
arguments of run-tests.py. Now, instead of crashing, we add an entry for
blacklisted tests in the json output to show that the tests were skipped.
2016-01-19 08:22:27 -08:00
Laurent Charignon
fb718d23a0 run-tests: fix race condition
Before this patch, it was possible for run-tests to crash on a race condition.
The race condition happens in the following case:
- the last test finishes and calls: done.put(None)
- the context switches to the main thread that clears the channels list
- the context switches to the last test mentioned above, it tries to access
channels[channel] and crashes
This happened to me while running run-tests.

This patch fixes the issue by clearing the channel before considering that the
test is done.
2016-01-21 12:37:12 -08:00
timeless
7c2842e773 copyright: update to 2016 2016-01-21 21:15:52 +00:00
Durham Goode
64267e6e4d transaction: abort transaction during hook exception
The new transaction context did not handle the case where an exception during
close should still call release. This cause pretxnclose hooks that failed to
cause the transaction to fail without aborting, thus requiring a hg recover.

I've added a test.
2016-01-19 15:18:21 -08:00