Commit Graph

28097 Commits

Author SHA1 Message Date
Augie Fackler
6f39190369 pager: add tests
We've never had tests for pager, and I want to start experimenting
with ways to clean up the implementation and make it a bit more
graceful.
2016-02-28 22:13:47 -05:00
Matt Harbison
3652c17658 tests: flag Windows specific lines about background closing as optional 2016-02-29 01:01:20 -05:00
Matt Harbison
f0863290ab run-tests: defer leftover (?) cleanup until after all output is exhausted
Previously, after matching a single line, any contiguous subsequent lines ending
with (?) would be added to the output and removed from the expected output.
This is a problem if the subsequent test output would have matched the consumed
(?) line, because it kept the optional line and then added a duplicate without
the (?) [1].  Instead, wait until there is nothing more to match before handling
the leftovers.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-February/080197.html
2016-02-28 23:21:28 -05:00
Matt Harbison
14f6ca56b3 test-run-tests: pad the failure test to preserve the run order
Test size seems to dictate the order in which the tests are run, and the next
patch will add to test-success.t.
2016-02-28 23:16:30 -05:00
Matt Mackall
75ceec976e changelog: backed out changeset 4ef1c9b76e22 2016-03-02 16:05:30 -06:00
Matt Mackall
b4737e5b27 changelog: backed out changeset 9f92d143bdd2
We want to avoid leaking UTF-8 to main body of code wherever possible.
2016-03-02 12:46:54 -06:00
Yuya Nishihara
e4227925aa dispatch: store norepo/optionalrepo/inferrepo attributes in function (API)
This can eliminate import cycles and ugly push/pop of global variables at
_checkshellalias(). Attributes of aliascmd are directly accessible.

Because norepo/optionalrepo/inferrepo lists aren't populated, extensions
examining them no longer work. That's why this patch removes these lists
to signal the API incompatibility.

This breaks 3rd-party extensions that are yet to be ported to @command
decorator.
2016-01-01 22:16:25 +09:00
Yuya Nishihara
ef3218aaaf extensions: copy extra __dict__ of original function
Future patches will make @command decorator set properties such as "norepo" to
a function object. This patch makes sure these properties never be lost by
wrapcommand() or wrapfunction().

This change won't be crazy as the standard functools.wraps() copies __dict__.
2016-01-09 20:04:03 +09:00
Yuya Nishihara
783b9a6384 extensions: copy attributes to wrapper by wrapfunction()
Before this patch, new partial function "wrap" had no useful docstring. It
makes sense to copy __doc__ and __module__ as we do for wrapcommand().
2016-01-09 19:52:55 +09:00
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
Matt Mackall
9661ec8b8c merge with i18n 2016-02-29 17:44:00 -06:00
FUJIWARA Katsunori
27b5df55d8 i18n-ja: synchronized with 03346da08322 2016-02-29 22:52:29 +09: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
Pierre-Yves David
afc2550500 revert: properly revert to ancestor of p2 during merge (issue5052)
During merge, added (from one perspective) file can be reported as "modified".
To work around that, revert was testing if modified file were present in the
parent manifest and marking them as "added" in this case. However, we should be
checking against the target revision manifest instead. Otherwise see file as
"newly added" even if they exist in the target revision.

That revert behavior regressed in 3657ae7519b7.
2016-02-23 11:41:47 +01:00
Yuya Nishihara
5b1b6151af log: fix order of revisions filtered by multiple OR options (issue5100)
This is the simplest workaround for the issue of the ordering of revset, which
is that the expression "x or y" takes over the ordering specified by the input
set (or the left-hand-side expression.) For example, the following expression

  A & (x | y)

will be evaluated as if

  (A & x) | (A & y)

That's wrong because revset has ordering. I'm going to fix this problem in
the revset module, but that wouldn't fit to stable. So, this patch just works
around the common log cases.

Since this change might have some impact on performance, it is enabled only
if the expression built from log options has ' or ' operation.
2016-02-15 22:46:07 +09:00
Gregory Szorc
038daf0c4c demandimport: add _imp to ignore list
Mozilla is seeing an issue with demand importing of _imp
failing in pkg_resources/__init__.py:fixup_namespace_packages.
It strangely only reproduces when using a modern version of
setuptools/pip in certain scenarios. Adding _imp to the demand import
ignore list seems to make the problem go away.
2016-02-25 22:35:11 -08:00
Pierre-Yves David
c93d28cfa7 unionrepo: properly handle hidden linkrev in revlog (issue5070)
The unionrepository have to do some special magic to handle linkrev of the
unioned filerev and manifestrev. That logic was done from a repoview and
obsolescence marker affecting bundled changeset could lead to a crash. We now
ensure we operate on unfiltered repository.
2016-02-22 23:36:04 +01:00
Pierre-Yves David
55efb3cd6d bundlerepo: properly handle hidden linkrev in manifestlog (issue4945)
The bundlerepository have to do some special magic to handle linkrev of the
bundled manifest. That logic was done from a repoview and obsolescence marker
affecting bundled changeset could lead to a crash. We now ensure we operate on
unfiltered repository.
2016-02-22 23:34:54 +01:00
Pierre-Yves David
7443f70cc2 bundlerepo: properly handle hidden linkrev in filelog (issue4945)
The bundlerepository have to do some special magic to handle linkrev of the
bundlerepo filerev. That logic was done from a repoview and obsolescence marker
affecting bundled changeset could lead to a crash. We now ensure we operate on
unfiltered repository.
2016-02-22 18:35:40 +01: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