Commit Graph

1392 Commits

Author SHA1 Message Date
Yuya Nishihara
5ddbe8ee34 check-code: ban use of '[[ ]]' in tests 2015-06-16 23:06:30 +09:00
Pierre-Yves David
a58cb283b6 revsetbenchmarks: also display tag when printing a revision
This is usually more useful information than the commit message.
2015-06-10 17:33:57 -07:00
Pierre-Yves David
86d12c3327 revsetbenchmarks: clean up revsets that achieved with default variants
We remove revset making use of min and max as this is covered by the variants.
We could use variant for roots too, but it is not in the default so keep it
here.
2014-10-27 13:40:12 +01:00
Pierre-Yves David
4bf2a1c663 revsetbenchmarks: use combination variants in default set
Now that we have them, let's make use of them.
2015-06-09 23:49:07 -07:00
Pierre-Yves David
1a88814277 revsetbenchmarks: support combining variants with "+"
We need more advanced variants in some cases. For example, "The last
rev of the sorted version".

We introduce a syntax for this: `reverse+last` means `last(reverse(REVSET))`.
2015-06-09 23:45:34 -07:00
Pierre-Yves David
6f731a872c revsetbenchmarks: use many more variants by default
So far the variants feature was introduced, but not used by
default. We now use a set of basic variants by default.
2015-06-09 21:10:44 -07:00
Pierre-Yves David
3e785ae2da revsetbenchmarks: display even more compact timing result
We now use an 8 char display for timing (from 10), we add some logic to drop
precision if the number grows too large (as we do not care about sub-0 digit
in this case). This allow to pack more variants in a single screen.
2015-06-09 21:20:54 -07:00
Pierre-Yves David
abd025e2f3 revsetbenchmarks: allow running multiple variants per revset
The current benchmarks were only testing the whole iteration. This is suboptimal
because some changes are meaningful for things like first result, minimum or
sorting.

We introduce a "variants" feature that let you systematically add some variants
to all revsets tested.

A typical variants value would be 'plain,min,last,sort'. When testing 'all()' it
will also provide testing for:
- all()
- min(all())
- last(all())
- sort(sort)

and output:

   plain         min            last           sort
0) 0.034568      0.037857       0.000074       0.034238
1) 0.011358  32% 0.020181  53%  0.000080 108%  0.011405  33%

Using revsets (who hit the API) instead of the internal API add some overhead,
but the overhead should be the same everywhere so it still allow comparison.
This is is more simple to implement and allows comparison with older versions
who do not have the same API.
2014-10-27 11:59:39 +01:00
Pierre-Yves David
dd891bab9c revsetbenchmarks: display relative change when meaningful
If the time difference is more than 5% from the previous run, we'll display
relative information. This makes it much simpler to spot performance changes in
a sea of benchmarks.
2015-06-09 21:30:04 -07:00
Pierre-Yves David
c7c66491f5 revsetbenchmarks: improve revision printing
We now print the revision number and short hash inline. As a result we drop the
crappy list printing.
2015-06-09 18:53:04 -07:00
Pierre-Yves David
e5f0537065 revsetbenchmarks: hide most timing under a --verbose flag
We mostly only care about total time. Dropping this output give us some room to
display more useful information (like percentage different) in future
changesets.
2015-06-09 18:40:06 -07:00
Pierre-Yves David
f130bcfaa1 revsetbenchmarks: drop outdated comment
We are no longer testing against system mercurial for quite some time.
2015-06-09 18:32:47 -07:00
Pierre-Yves David
d6c409833b revsetbenchmarks: fix argument parsing
The file doc was saying something, the code was doing something else, the
argument validation was doing a third thing.

Doc and behavior now comply with the argument defined in the code.
2015-06-09 18:39:55 -07:00
Pierre-Yves David
3f8df9e038 revsetbenchmarks: use a more compact output format with a header
We change the output from:

  revset #0: draft()
  0) wall 0.011989 comb 0.010000 user 0.000000 sys 0.010000 (best of 177)
  1) wall 0.012226 comb 0.010000 user 0.000000 sys 0.010000 (best of 193)
  2) wall 0.011838 comb 0.020000 user 0.000000 sys 0.020000 (best of 208)

to:

  revset #0: draft()
       wall       comb       user       sys       count
  0)   0.012028   0.010000   0.000000   0.010000    170
  1)   0.012218   0.010000   0.000000   0.010000    157
  2)   0.012622   0.010000   0.000000   0.010000    189

This opens the road to more useful output.
2015-06-09 17:15:48 -07:00
Augie Fackler
ada9978856 revsetbenchmarks: clarify comment based on irc discussion 2015-06-12 16:42:07 -04:00
Pierre-Yves David
59a81fd7b3 revsetbenchmarks: ensure all indexes have the same width
This avoids an alignment glitch.
2015-06-11 10:55:02 -07:00
Pierre-Yves David
1cc4521b8c revsetbenchmarks: factor out result output into a function
This will make update of the output easier.
2015-06-09 16:57:18 -07:00
Pierre-Yves David
db08ff2e74 revsetbenchmarks: parse perfrevset output into actual number
We cannot just ask perfrevset to provide debug output because we usually want
to compare output from old version of Mercurial that do not support it. So, we
are using a regular expression.

(/we now have \d problems/).
2015-06-09 16:48:29 -07:00
Pierre-Yves David
bb398f89a5 revsetbenchmarks: improve error output in case of failure
This helps with diagnostics.
2015-06-09 15:58:48 -07:00
Pierre-Yves David
d9d7ac3a22 revsetbenchmarks: extract call to mercurial into a function
This is a gratuitous change to make the code easier to look at.
2015-06-09 15:49:14 -07:00
Pierre-Yves David
a4580cc28e perf: support -T for every perf commands
We are already building a formatter, we can now pass it options the official
way.
2015-06-09 15:18:47 -07:00
Steve Borho
a761baa73e wix: move library.zip and all *.pyd into a lib/ folder
This makes the root install folder (on Windows) nice and tidy. The
only files left in the root folder are:

hg.exe
python27.dll
COPYING.rtf
ReadMe.html

the last of which was probably out-of-date 7 years ago
2015-06-03 14:31:19 -05:00
Gregory Szorc
61c827dff1 check-commit: make foo_bar naming regexp less greedy
\s is equivalent to the character class [ \t\n\r\f\v]. Using \s+ in
a regular expression against input with multiple lines may match across
multiple lines.

For the regexp in question, "\+\s+" would match "+\n " and similar
sequences, leading to false positives for functions that were included
in diff context, after a modified hunk.
2015-05-31 17:41:35 -07:00
Matt Mackall
2a25c01621 check-code: reintroduce str.format() ban for 3.x porting
In their infinite wisdom, the Python maintainers stripped bytes of its
% and format() methods for 3.x. They've now added % back to 3.5, but
format() is still missing. Since we don't have any particular need for
it, we should keep avoiding it.
2015-05-19 08:41:04 -05:00
Pierre-Yves David
cb4db56d2a check-code: drop ban of 'val if cond else otherval' construct
We now have access to this horrible but less bad than
'cond and val or otherval' syntax.
2015-05-18 16:18:18 -05:00
Pierre-Yves David
624cc99b09 check-code: drop the 'format' built-in
I'm not clear what it is doing, but one who knows what it is about can now make
use of it.
2015-05-18 16:11:44 -05:00
Pierre-Yves David
b59fc6f804 check-code: drop ban of str.format
After discussion with Augie and Matt, we are fine with it being introduced in
the code base.
2015-05-18 16:09:05 -05:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Pierre-Yves David
d5a6426866 check-code: drop ban of BaseException
Lets go back to the basic. It is available in Python 2.6.
2015-05-18 13:20:19 -05:00
Pierre-Yves David
2d3ab51ced check-code: drop the yield inside try/finally ban
This is now possible with Python 2.6.
2015-05-18 12:56:59 -05:00
FUJIWARA Katsunori
d90834b5cb import-checker: don't treat modules as relative one if not found
The previous patch ensures all module names are recorded in `imports`
as absolute names, so we no longer need to treat modules as ones
imported relatively from the target source if they appear to not be
from the stdlib.
2015-05-18 02:52:58 +09:00
FUJIWARA Katsunori
8a7efd627d import-checker: make imported_modules yield absolute dotted_name_of_path
This patch makes `imported_modules()` always yield absolute
`dotted_name_of_path()`-ed name by strict detection with
`fromlocal()`.

This change improves circular detection in some points:

  - locally defined modules, of which name collides against one of
    standard library, can be examined correctly

    For example, circular import related to `commands` is overlooked
    before this patch.

  - names not useful for circular detection are ignored

    Names below are also yielded before this patch:

      - module names of standard library (= not locally defined one)
      - non-module names (e.g. `node.nullid` of `from node import nullid`)

    These redundant names decrease performance of circular detection.

    For example, with files at 13dc86d189c9, average loops per file in
    `checkmod()` is reduced from 165 to 109.

  - `__init__` can be handled correctly in `checkmod()`

    For example, current implementation has problems below:

      - `from xxx import yyy` doesn't recognize `xxx.__init__` as imported

      - `xxx.__init__` imported via `import xxx` is treated as `xxx`,
        and circular detection is aborted, because `key` of such
        module name is not `xxx` but `xxx.__init__`

  - it is easy to enhance for `from . import xxx` style or so (in the
    future)

    Module name detection in `imported_modules()` can use information
    in `ast.ImportFrom` fully.

It is assumed that all locally defined modules are correctly specified
to `import-checker.py` at once.

Strictly speaking, when `from foo.bar.baz import module1` imports
`foo.bar.baz.module1` module, current `imported_modules()` yields only
`foo.bar.baz.__init__`, even though also `foo.__init__` and
`foo.bar.__init__` should be yielded to detect circular import
exactly.

But this limitation is reasonable one for improvement in this patch,
because current `__init__` files in Mercurial seems to be implemented
carefully.
2015-05-18 02:52:55 +09:00
FUJIWARA Katsunori
1576f26d69 import-checker: add utility to examine what module is imported easily
`fromlocalfunc()` uses:

  - `modulename` (of the target source) to compose absolute module
    name imported relatively from it

    It is assumed that `modulename` is an `dotted_name_of_path()`-ed
    source file, which may have `.__init__` at the end of it.

    This assumption makes composing `prefix` of relative name easy.

  - `localmods` to examine whether there is a locally defined (=
    Mercurial specific) module matching against the specified name

    It is assumed that module names not existing in `localmods` are
    ones of Python standard library.
2015-05-18 02:50:22 +09:00
Augie Fackler
82d20c6721 check-code: un-ban __builtins__.all now that we're on 2.6 2015-05-16 14:34:04 -04:00
Augie Fackler
8135f8f3bf check-code: un-ban any() now that we're on 2.6 2015-05-16 14:31:03 -04:00
Pierre-Yves David
5c28bef986 check-code: lift the ban on 'next()'
'next' is supported by Python2.6 the new lowest version supported by Mercurial.
2015-05-17 17:47:42 -07:00
Pierre-Yves David
a800edc31c check-code: drop the 'isdisjoint' ban
'isdisjoint' is available in Python 2.6. The new lowest supported version.
2015-05-17 17:45:47 -07:00
Pierre-Yves David
b126ceafed check-code: fix the error message about 'class foo():'
Using 'classs foo():' result in old style object instead of new style object. We
do not want old style object so this check is unrelated to 2.4.
2015-05-17 17:40:26 -07:00
Pierre-Yves David
2e89aa0615 check-code: remove the check for os.path.relpath
This is available in Python2.6 the new default supported release.
2015-05-17 17:36:26 -07:00
Augie Fackler
6d36eeacda check-commit: print limit when user has a too-long summary 2015-05-18 11:36:33 -04:00
Pierre-Yves David
175fe35444 hg-ssh: reject push earlier (on pretxnopen)
We now have a lock triggered for any transaction. We use it to ensure no-read
are made in read-only mode. We need more that just "no changegroup is added",
since bundle2 allows for more than just changegroup to be exchanged.  We still
protect pushkey as it may write data without opening a transaction.
2015-05-10 04:39:11 -07:00
Matt Mackall
d4d62e93d0 check-code: drop try/except/finally check 2015-05-15 09:54:35 -05:00
FUJIWARA Katsunori
f1f8b5966c import-checker: loop to get list of locally defined modules at first
This is a preparation for subsequent patches, which expect that all
locally defined (= mercurial specific) modules are already known
before examinations.

Looping twice for specified modules is a little redundant, but
reasonable cost for improvement in subsequent patches.
2015-05-14 01:49:10 +09:00
FUJIWARA Katsunori
0f658fb502 import-checker: add xargs like mode
Before this patch, "import-check.py" is invoked via "xargs" in
"test-module-imports.t", but it doesn't ensure that
"import-checker.py" is certainly invoked with all mercurial specific
files at once.

"xargs" may invoke specified command multiple times with part of
arguments given from stdin: according to "xargs(1)" man page, this
dividing arguments is system-dependent.

This patch adds "xargs" like mode to "import-checker.py".

This can ensure that "import-checker.py" is certainly invoked with all
mercurial specific files at once in "test-module-imports.t". This is
assumed by subsequent patches.
2015-05-14 01:49:10 +09:00
Pierre-Yves David
62621af660 check-code: allow with statements
We dropped python 2.4 compatibility.
2015-05-13 11:49:38 -07:00
Pierre-Yves David
93a4853f4a check-code: allow 'Except EClass as variable:'
Python 2.4 compatibility has been dropped.
2015-05-13 11:41:17 -07:00
Pierre-Yves David
46186d5bf4 check-code: allow print and exec as a function
This is required to move forward on python3 compatibility.
2015-05-13 11:39:48 -07:00
Matt Harbison
904c26befb check-code: drop the python 2.5 warning for os.path.relpath()
There's plenty of other cleanup to do in here, but this specific one is used in
the next patch.
2015-05-11 22:47:01 -04:00
Pierre-Yves David
6c9620984d rpm.spec: bump python dependency to 2.6
We are about to drop 2.4 requirement in Mercurial's setup.py, we bump rpm
dependency first for the sake of smaller changeset. Clean up of the spec file
can come after the dependency is actually dropped.
2015-05-08 23:28:33 -07:00
Steve Borho
2e42c75141 wix: add new json templates folder to MSI installers 2015-05-09 16:06:04 -05:00