Commit Graph

1623 Commits

Author SHA1 Message Date
timeless
149f294053 check-commit: fix summary length regexp 2016-01-07 03:58:40 +00:00
Gregory Szorc
ddc771a1b2 debugshell: disable demand importer when importing debugger
For reasons I can't explain (but likely have something to do with a
combination of __import__ inferring default values for arguments and
the demand importer mechanism further assuming defaults), the demand
importer isn't playing well with IPython. Without this patch, we get
a failure "ValueError: Attempted relative import in non-package" when
attempting to import "IPython." The stack has numerous demandimport
calls on it and adding "IPython" to the exclude list in demandimport
isn't enough to make the problem go away, which means the issue is
likely somewhere in the bowells of IPython. It's easier to just disable
the demand importer when importing the debugger.
2016-01-11 18:16:38 -08:00
Matt Mackall
3ace626aa9 check-code: allow only-whitespace lines in tests
These turn out to be necessary to embed diffs with blank lines in test
input. So we now complain about whitespace following a character.
2016-01-08 12:35:02 -06:00
Matt Mackall
9b87c36795 check-commit: try to curb bad commit summary keywords
The goal of commit summary keywords is to help us sort, categorize,
and filter our voluminous commits for our release notes in a way
that's helpful and meaningful to end users. Lately, there have been a
huge number of "keywords" that are neither words nor particularly key.

This patch tries to discourage that by narrowing the allowed
characters to alphanumeric. In particular, it doesn't allow "."
(method, function names, and file extensions) and "/" (filenames). It
also gives a short reminder of what a keyword ought to be.
2015-12-10 12:56:23 -06:00
Urs Rau
e104ebf4e7 installer: add windows application version number to inno installer script
This addition to the inno installer script means that the windows uninstaller
registry key “DisplayVersion" is set to the application version number and
will show in Add/Remove Programs.
2016-01-07 12:49:26 +00:00
Matt Harbison
59bfa8869d wix: add help for current internal topics
This makes the changes in 68b7b759ebff and 71a3703364df available on Windows.

I'm not setup to make the installer, so someone with experience in this area
should probably give it a look.  In looking around to try to figure out how to
build the installer, it looks like the Makefile may need an update to $DOCFILES.
2015-12-17 21:24:08 -05:00
Matt Mackall
82e0719648 merge with stable 2016-01-07 17:51:54 -06:00
Mathias De Maré
efbe4fff46 dockerrpm: fix CentOS 5 RPMs (issue4977)
The older rpmbuild in CentOS 5 fails if some of the output directories
have not been created yet. This change results in creating those directories.
2016-01-04 21:21:59 +01:00
Mathias De Maré
148961a2eb dockerlib: short form for non-unique uid/gid for CentOS 5 compat (issue4977)
CentOS 5 does not support '--non-unique', but does support the short '-o'.
2015-12-07 17:39:31 +01:00
Pierre-Yves David
888da26260 docker: match more version of 'hg docker version' (issue4967)
My version of docker (1.8.3) have a different formating for 'docker version'
that broke the build script. We make the version matching more generic in to
work with both version.
2015-11-24 18:13:25 -08:00
Gregory Szorc
f5985dcd63 revlog: return offset from _chunkraw()
A subsequent patch will refactor _chunks() and the calculation of the
offset will no longer occur in that function. Prepare by returning the
offset from _chunkraw().
2016-01-05 19:51:51 -08:00
timeless
b863202251 check-code: enforce strict spacing around assignment 2015-12-31 17:41:59 +00:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
Yuya Nishihara
79f9ed4511 import-checker: list package directory as stdlib module
Before this patch, a directory containing __init__.py wasn't counted as a
module and __init__.pyc was listed as foo.bar.__init__ module.
2015-12-27 23:37:14 +09:00
Yuya Nishihara
40d0bc65ac import-checker: normalize directory separator to get module name on Windows
It didn't work if a path contains "\\". Therefore, ctypes.util couldn't be
found on Windows.
2015-12-27 23:48:19 +09:00
Anton Shestakov
169417da80 dockerlib: allow non-unique uid and gid of $DBUILDUSER (issue4657)
There are make targets for building mercurial packages for various
distributions using docker. One of the preparation steps before building is to
create inside the docker image a user with the same uid/gid as the current user
on the host system, so that the resulting files have appropriate
ownership/permissions.

It's possible to run `make docker-<distro>` as a user with uid or gid that is
already present in a vanilla docker container of that distibution. For example,
issue4657 is about failing to build fedora packages as a user with uid=999 and
gid=999 because these ids are already used in fedora, and groupadd fails.
useradd would fail too, if the flow ever got to it (and there was a user with
such uid already).

A straightforward (maybe too much) way to fix this is to allow non-unique uid
and gid for the new user and group that get created inside the image. I'm not
sure of the implications of this, but marmoute encouraged me to try and send
this patch for stable.
2015-11-08 01:10:52 +08:00
Steve Borho
e04f287b5a wix: style-coal.css has been renamed 2015-11-09 09:41:20 -06:00
Augie Fackler
75a732a6ac packaging: rework version detection and declaration (issue4912)
Previously the -rc in our rc tags got dropped, meaning that those
packages looked newer to the packaging system than the later release
build. This rectifies the issue, though some damage may already have
been done on 3.6-rc builds.

I'm mostly cargo-culting the RPM version format - there don't appear
to be rules for RPM about how to handle this. Hopefully an RPM
enthusiast can fix up what I've done as a followup.
2015-10-26 14:19:37 -04:00
timeless
f10778ca64 check-code: allow argument passing py2.6ism
this backs out dead48a12ce0, because Python2.5 support was dropped
2015-10-15 17:28:26 -04:00
timeless
ed8b59f668 win32: drop reference to python2.5 2015-10-15 17:19:11 -04:00
Ryan McElroy
20c45a5f3d editmerge: dequote other use of $ED
We want to support editors with parameters, eg EDITOR="vim -O" or whatever.
So remove the quotes from around $ED and assume that the editor variable is
properly escaped already.
2015-10-19 21:36:12 -07:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
timeless
76f10d8d74 check-code: block non-portable pipe-and 2015-10-15 20:36:12 -04:00
Ryan McElroy
ea5dcaa5fa editmerge: properly quote variables
Previously, files with spaces would break editmerge.
2015-10-17 15:48:14 -07:00
FUJIWARA Katsunori
106983607a dirstate: make dirstate.write() callers pass transaction object to it
Now, 'dirstate.write(tr)' delays writing in-memory changes out, if a
transaction is running.

This may cause treating this revision as "the first bad one" at
bisecting in some cases using external hook process inside transaction
scope, because some external hooks and editor process are still
invoked without HG_PENDING and pending changes aren't visible to them.

'dirstate.write()' callers below in localrepo.py explicitly use 'None'
as 'tr', because they can assume that no transaction is running:

  - just before starting transaction
  - at closing transaction, or
  - at unlocking wlock
2015-10-17 01:15:34 +09:00
Christian Delahousse
c021a178a2 contrib: make editmerge look for merge markers at the beginning of the line
This fix adds a caret to the start of the regex looking for merge markers. This
avoids the issue arises when you've real merge conflicts in a file that tests
for the existance of merge markers in test output. Editmerge will not open on
the fake/tested merge markers because they'll be indented in.
2015-10-16 15:01:42 -07:00
Laurent Charignon
ffd341931d dirstate: add test for non-normal set consistency
This adds a test extension to check that the non-normal set contains the
expected entries. It wraps several methods of the dirstate to check that
the non-normal set has the correct values before and after the call. The
extension lives in contrib so that paranoid developers can easily
enable it to make sure that the non-normal set is consistent across more
complex operations than the included tests.
2015-12-21 16:26:44 -08:00
timeless
8dd6ee4d9a check-code: improve test-check-code error diffs
Whenever check-code finds something wrong, the diffs it
generated were fairly hard to read.

The problem is that check-code before this change
would list files that were white listed using
no- check- code but without a glob marker.

Whereas, the test-check-code.t expected output has
no-che?k-code (glob) in order to avoid having itself
flagged as a file to skip.

Thus, in addition to any lines relating to things you
did wrong, all of the white-listed files are listed as
changed.

There is no reason for things to be this painful.

This change makes the output from check-code.py match
the expected output in test-check-code.t
2015-12-24 19:32:14 +00:00
Danek Duvall
7653e06efa tests: Solaris diff -U also emits "No differences encountered"
This came up before, but the tests in check-code.py don't find -U (only -u)
and they don't work when the diff is inside a shell function.  This fixes
the offending tests and beefs up check-code.py.
2015-12-27 15:24:48 -08:00
Bryan O'Sullivan
7cd156ddd3 perf: close transaction in perffncachewrite
This fixes a bug, and brings CPython behaviour on this test into
line with PyPy.
2015-12-27 23:55:54 +09:00
Gregory Szorc
02bc128123 import-checker: force 'logging' to stdlib module
Not sure why this isn't getting picked up. Perhaps we're not handling
stdlib paths that have sub-modules? Something to investigate for another
day...
2015-12-23 12:27:24 -08:00
Matt Harbison
0cdbeb7bf0 import-checker: force 'ctype.util' to stdlib module
Not having this caused warnings on Windows:

  mercurial/pure/osutil.py:12: stdlib import follows local import: os
  mercurial/pure/osutil.py:13: stdlib import follows local import: socket
  mercurial/pure/osutil.py:14: stdlib import follows local import: stat
  mercurial/pure/osutil.py:15: stdlib import follows local import: sys
2015-12-22 21:47:40 -05:00
timeless
5f0b7179f1 mercurial.spec: remove execute bit 2015-12-22 10:58:47 +00:00
timeless
06572aab33 contrib: add execute bit for fixpax.py 2015-12-22 07:58:44 +00:00
timeless
f8d658c413 contrib: add execute bit for check-py3-compat.py 2015-12-22 07:58:21 +00:00
Gregory Szorc
517d3d4815 perf: make start revision configurable for perfrevlog
This will help isolate performance characteristics of delta chains.
2015-12-20 19:56:23 -08:00
Gregory Szorc
e8cdc56137 perf: use standard arguments for perfrevlog
We have a convention of using -c|-m|FILE elsewhere for reading from
revlogs. Use it for `hg perfrevlog`.

While I was here, I also added a docstring to document what this
command does, as "perfrevlog" is ambiguous.
2015-12-20 19:45:55 -08: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
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
Pascal Quantin
edc138619b win32: add internals help topics to Inno Setup installer 2015-12-17 19:33:44 +01:00
Matt Mackall
bfb407a6ed wix: add missing template 2015-12-16 17:17:12 -06:00
Matt Harbison
ac7fc5b232 perf: adjust perfstartup() for Windows
The /dev/null redirect was causing the following error:

  The system cannot find the path specified.

Adjusting HGRCPATH as part of the command line causes the system to try to
execute 'HGRCPATH'.
2015-12-13 18:13:44 -05:00
Augie Fackler
a84cc516e7 merge: restate calculateupdates in terms of a matcher
Once we get a matcher down into manifestmerge, we can make narrowhg
work more easily and potentially let manifest.match().diff() do less
work in manifestmerge.
2015-12-14 20:37:41 -05:00
Gregory Szorc
164cea475f contrib: ignore empty files in check-py3-compat.py 2015-12-12 13:27:31 -05:00
timeless
279ca50a3d check-config: handle multiline config 2015-12-08 08:21:46 +00:00
timeless
73dbe2bc47 check-config: escape period in regexp for inline comments 2015-12-08 08:36:00 +00:00
timeless
80e1115762 check-config: allow numbers in configs
p4...
2015-12-08 09:09:01 +00:00
timeless
98fb00321c check-config: recognize convert style documentation 2015-12-08 09:22:53 +00:00
timeless
e91c29104b perf: perfrevlog optimize for perf.stub 2015-12-04 19:05:56 +00:00
timeless
0da8511b85 perf: add getlen
getlen will return 1 if perf.stub
2015-12-04 19:05:32 +00:00
timeless
04f03f3aeb perf: add optional rev for perflog and perftemplating 2015-12-04 18:08:50 +00:00
timeless
05d63c41ee perf: perfparents honor config perf.parentscount 2015-12-04 18:18:07 +00:00
timeless
c9727daf48 perf: offer perf.stub to only run one loop 2015-12-04 17:41:30 +00:00
timeless
aa0ea59703 perf: improve grammar of gettimer comment 2015-12-04 17:41:02 +00:00
Gregory Szorc
da7e434856 perf: add perflrucachedict command
It measures time to construct, perform gets, sets, or mixed mode
operations on a cache of configurable size with variable numbers of
operations.
2015-12-06 17:07:50 -08:00
Gregory Szorc
61de06ecc1 tests: add test for Python 3 compatibility
Python 3 is inevitable. There have been incremental movements towards
converting the code base to be Python 3 compatible. Unfortunately, we
don't have any tests that look for Python 3 compatibility. This patch
changes that.

We introduce a check-py3-compat.py script whose role is to verify
Python 3 compatibility of the files passed in. We add a test that
calls this script with all .py files from the source checkout.

The script currently only verifies that absolute_import and
print_function are used. These are the low hanging fruits for Python
compatbility. Over time, we can include more checks, including
verifying we're able to load each Python file with Python 3. You
have to start somewhere.

Accepting this patch means that all new .py files must have
absolute_import and print_function (if "print" is used) to avoid
a new warning about Python 3 incompatibility. We've already
converted several files to use absolute_import and print_function
is in the same boat, so I don't think this is such a radical
proposition.
2015-12-06 22:39:12 -08:00
Matt Mackall
0fe2dfc303 merge with stable 2015-12-07 18:06:13 -06:00
Yuya Nishihara
934b9df7b4 import-checker: tell which symbol causes "direct symbol import"
This would be sometimes useful to understand why import-checker.py complains
about it.
2015-12-06 14:28:35 +09:00
Yuya Nishihara
b16ffd4ab4 import-checker: allow absolute imports of sub modules from local packages
Before this patch, import-checker.py didn't know if a name in ImportFrom
statement are module or not. Therefore, it complained the following example
did "direct symbol import from mercurial".

  # hgext/foo.py
  from mercurial import hg

This patch reuses the dict of local modules to filter out sub-module names.
2015-12-06 14:18:19 +09:00
Yuya Nishihara
758ac06b0b contrib: disable SSLv3_method() to build old Python with recent libssl
Because OpenSSL is compiled without SSLv3 support on Debian sid, Python 2.6.9
can't be built without this hack. Python 2.7 is patched appropriately, but
2.6 isn't.

http://bugs.python.org/issue22935
2015-11-07 16:31:04 +09:00
Anton Shestakov
11e3a4574b builddeb: read default distribution and codename from lsb_release
This makes `make deb` place packages into a more appropriately named directory
instead of just "debian-unknown".
2015-11-25 18:07:33 +08:00
Anton Shestakov
68c6668d13 builddeb: remove unused --debbuilddir option
Looks like it was never used and after d43cf24ee602 it can be removed.
2015-11-25 15:26:03 +08:00
Anton Shestakov
b61eeae0ab builddeb: add --distid option to specify Distributor ID
This allows builddeb to handle distributions that are not Debian.

Distributor ID is reported by lsb_release --id, and in case of builddeb it's
usually Debian or Ubuntu.
2015-11-25 15:15:03 +08:00
Anton Shestakov
b5106c63ef builddeb: rename --release option to --codename
Debian and Ubuntu releases have both codenames and traditional version numbers.
An entire "branch" of releases is referred to by its codename, and version
numbers (e.g. 8.2, 14.04.3) are used to address individual releases.

Since we use codenames for building .deb packages, let's call the option and
the variable appropriately.
2015-11-25 14:59:43 +08:00
Pierre-Yves David
f954beb8e9 check-commit: remove confusion between summary line and other headers
The pull url header can easily grow over 80 chars. The check-commit script was
confusing this with a too long summary line. We update the regular expression to
not match other header.
2015-11-06 17:27:42 -05:00
timeless
6706ae14fe contrib/perf: perfparents handle filtered repos 2015-11-24 21:36:20 +00:00
timeless
0706103b1f contrib/perf: perfparents handle tiny repos
refuse to run if there are not enough commits
2015-11-24 20:54:14 +00:00
timeless
d5fb95573c contrib/perf: fix perfmergecalculate
merge.calculateupdates requires an array of ancestors and followcopies
2015-11-24 21:44:16 +00:00
timeless
1781386673 contrib/perf: fix perffncachewrite
fncache.write requires a transaction (and thus a lock)
2015-11-24 22:01:11 +00:00
timeless
73fa098081 contrib/perf: omit duplicated function 2015-11-24 20:05:15 +00:00
timeless
87b00f7ab0 contrib/perf: name functions to match decorators 2015-11-24 20:08:21 +00:00
Gregory Szorc
8577d931d0 revsetbenchmarks: support benchmarking changectx loading
Many revset consumers construct changectx instances for each returned
result. Add support for benchmarking this to our revset benchmark
script.

In the future, we might want to have some kind of special syntax in
the parsed revset files to engage this mode automatically. This would
enable us to load changectxs for revsets that do that in the code and
would more accurately benchmark what's actually happening. For now,
running all revsets with or without changectxs is sufficient.
2015-11-21 15:43:04 -08:00
Gregory Szorc
86b206e002 perf: support obtaining contexts from perfrevset
Previously, perfrevset called repo.revs(), which only returns integer
revisions. Many revset consumers call repo.set(), which returns
changectx instances. Or they obtain a context manually later.

Since obtaining changectx instances when evaluating revsets is common,
this patch adds support for benchmarking this use case.

While we added an if conditional for every benchmark loop, it
doesn't appear to matter since revset evaluation dwarfs the cost
of a single if.
2015-11-21 15:39:18 -08:00
Yuya Nishihara
86b18c8c85 import-checker: allow symbol imports from hgweb.common and .request
This seems the convention of hgweb.
2015-11-01 13:55:21 +09:00
Matt Mackall
fd472e2570 perf: un-bitrot perfstatus 2015-11-19 15:02:27 -06:00
Mads Kiilerich
1f01797b63 contrib: offer Python 2.7.10 2015-10-15 21:36:47 +02:00
Mads Kiilerich
e2a51cd4a4 contrib: drop Python < 2.6 from Makefile.python 2015-10-15 21:35:49 +02:00
Augie Fackler
d2b9a17e64 debian: install bash completion as hg and not mercurial (issue4900) 2015-10-14 14:53:15 -04:00
Pierre-Yves David
4b641b8c22 check-code: detect and ban 'util.Abort'
We have seen the light, please use the new way.
2015-10-08 12:53:09 -07:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05: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
Augie Fackler
3514fe79a6 debian: include bash completions in mercurial-common 2015-09-22 14:47:18 -04:00
Augie Fackler
859b1bace0 debian: install hgk as part of mercurial-common (issue4829)
Leaving the hgk binary in /usr/bin causes some lintian warnings, and
downstream packages poke it in /usr/share/mercurial, so we'll just
stash it in there. Rather than patch hgk.py as part of the Mercurial
install, just drop a config file in /etc/mercurial/hgrc.d that points
to the installed hgk.
2015-09-22 14:32:17 -04:00
Augie Fackler
ca65b8e235 debian: install config files as part of mercurial-common
Future patches will start putting config files in /etc/mercurial/,
this just installs them.
2015-09-22 14:14:05 -04:00
Augie Fackler
e285b749d8 debian: configuration so that cacerts is properly loaded
This will be included in the mercurial-common package in a followup
patch.
2015-09-22 14:31:17 -04:00
Augie Fackler
1c78c614e7 debian: install hg-ssh to /usr/bin just like downstream 2015-09-22 14:13:07 -04:00
Augie Fackler
0dd6c0c729 import-checker: use modern .endswith for multiple suffixes
Suggested by Anton Shestakov <engored@ya.ru> on the list. Thanks!
2015-09-10 09:52:17 -04:00
timeless@mozdev.org
0c786bcfc9 import-checker: accept .pyc and .pyo files (issue4812)
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin

$ ls '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6'/BaseHTTPServer.py*
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.pyc
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/BaseHTTPServer.pyo
2015-09-02 16:07:35 -04:00
Augie Fackler
ad2436c3e6 debian: switch to using debhelper and dh_python2 to build debs
This is a much larger commit than I'd like, but I honestly don't see a
good way to break it up and leave things working. Summary:

We now use debian/rules with debhelper to build our debs. This is much
more standard, and means we use dh_python2 to do things like handle
leaving .pyc files out of the built debs.

The resulting package is split into mercurial and mercurial-common,
with the former being the hg stub and all the native .sos, and the
latter being basically everything else.

builddeb and dockerdeb are updated to use the new system. The old way
(using dpkg by hand) breaks with the above changes because
debian/control no longer contains a version string (that's now guessed
from the phony changelog.)

Tests are updated to assert that the right files end up in the right
debs.
2015-08-26 10:59:09 -04:00
Kevin Bullock
b6e3c6c99e vagrant: update to official Debian 8.1 base box
Debian now rolls their own official Vagrant base boxes, so use that. At
the same time, we're updating from Debian 7.4 (wheezy) to 8.1 (jessie),
and switching from 32-bit to 64-bit (Debian does not provide 32-bit base
boxes).
2015-09-02 11:52:24 -05:00
Augie Fackler
a0cdbf43ee buildrpm: mkdir -p two needed directories (issue4779)
Without this, building RPMs can fail.
2015-09-01 14:41:41 -04:00
Matt Mackall
58b892a1cb merge with stable 2015-09-01 17:09:00 -05:00
Matt Harbison
ad95ba730e wix: avoid an abort with 'hg help -k foo'
Previously:

 $ /c/Program\ Files/Mercurial/hg help -k merge-tools
 abort: No such file or directory: c:\Program Files\Mercurial\help\scripting.txt

The Inno installer seems OK, but the TortoiseHg required the same fix.  That got
queued with an additional change of 'helpFolder.guid' in guids.wxi (probably by
Steve).  I'm not sure if that is necessary here too.
2015-09-01 11:39:08 -04:00
Matt Mackall
6a7c5c9f3d contrib: add showstack extension
This allows getting a Python stack trace at any time on Unix by
hitting Ctrl-\ (or Ctrl-T on BSDs). Useful for debugging mysterious
hangs on the fly. Sample output:

$ hg log -k nosuchmessage
^\
  File "/home/mpm/hg/mercurial/revset.py", line 3089, in _iterfilter
    if cond(x):
  File "/home/mpm/hg/mercurial/util.py", line 415, in f
    cache[arg] = func(arg)
  File "/home/mpm/hg/mercurial/revset.py", line 1215, in matches
    for t in c.files() + [c.user(), c.description()])
  File "/home/mpm/hg/mercurial/context.py", line 525, in files
    return self._changeset[3]
  File "/home/mpm/hg/mercurial/util.py", line 531, in __get__
    result = self.func(obj)
  File "/home/mpm/hg/mercurial/context.py", line 498, in _changeset
    return self._repo.changelog.read(self.rev())
  File "/home/mpm/hg/mercurial/changelog.py", line 338, in read
    text = self.revision(node)
  File "/home/mpm/hg/mercurial/revlog.py", line 1092, in revision
    bins = self._chunks(chain)
  File "/home/mpm/hg/mercurial/revlog.py", line 1013, in _chunks
    ladd(decompress(buffer(data, chunkstart - offset, chunklength)))
  File "/home/mpm/hg/mercurial/revlog.py", line 91, in decompress
    return _decompress(bin)
----
2015-08-28 16:59:31 -05:00
Augie Fackler
bf1f880a9e builddeb: rework how output dir and platform are specified
This makes it possible to write tests for both builddeb and dockerdeb
that actually build .debs and then sanity check the contents.
2015-08-25 00:02:44 -04:00
Pascal Quantin
6d8e263df2 win32: update Inno Setup script after the changes done in f8c357b94e74 2015-07-19 18:11:18 +02:00
timeless@mozdev.org
52eae47139 spelling: behaviour -> behavior 2015-08-28 10:53:55 -04:00
Augie Fackler
2b6b27af56 builddeb: actually run make when building the deb (issue4778)
As of this change, we no longer produce broken debs, but I've already
got followups written that will produce much more standard-looking
packages and test the resulting packages.
2015-08-24 23:58:32 -04:00
Matt Mackall
e6644982a8 perf: mark experimental option presleep 2015-07-18 14:16:36 -05:00
Matt Mackall
39dd2c2b5a check-config: don't continue prematurely
The early check for section headers like ^``foo`` was missing actual
options like ^``foo.bar``.
2015-07-18 14:16:07 -05:00
Augie Fackler
bbff421b33 import-checker: ensure multiprocessing is treated as from stdlib
On my linux machines multiprocessing appears to defeat the logic in
import-checker to detect stdlib modules. Since we now only use
versions of Python which ship with multiprocessing, let's just
whitelist the module.
2015-08-24 10:09:00 -04:00
Yuya Nishihara
da13a040c4 revsetbenchmarks: run make after update so that C extensions are built 2015-08-15 17:50:59 +09:00
Yuya Nishihara
7ae2e7fc0b import-checker: reset context to verify convention in function scope
I got the following error by rewriting hgweb/webcommands.py to use
absolute_import. It is false-positive because the import line appears in
"help" function:

  hgweb/webcommands.py:1297: higher-level import should come first: mercurial

This patch makes the import checker aware of the function scope and apply
rules recursively.
2015-11-01 17:42:03 +09:00
Yuya Nishihara
e8375646e9 import-checker: allow import of child modules from package root
I got the following error by rewriting hgweb/__init__.py to use
absolute_import, which is obviously wrong:

  Import cycle: mercurial.hgweb.__init__ -> mercurial.hgweb.__init__

"from foo import bar" should not make a cycle if "foo" is a package and
if "bar" is a module or a package. On the other hand, it should be detected
as a cycle if "bar" is a non-module name. Both cases are doc-tested already,
so this patch does not add new doctest.
2015-11-01 00:37:22 +09:00
Yuya Nishihara
b21d72c284 import-checker: include lineno in warning message
This makes it easy to look for imports in function scope.
2015-11-01 15:46:06 +09:00
Yuya Nishihara
1455104bd2 import-checker: extract function to generate a formatted warning
This is the stub to embed lineno. See the next patch for details.
2015-11-01 15:39:25 +09:00
Yuya Nishihara
297152f7e3 import-checker: make it executable for convenience 2015-11-01 13:53:05 +09:00
Anton Shestakov
60499c65e3 bash_completion: add -p|--patch|--stat support for shelve 2015-11-10 19:52:30 +08:00
Matt Mackall
9b5bba3207 check-config: add config option checker
This script scans files for lines that look like either ui.config
usage or config variable documentation. It then ensures:

- ui.config calls for each option agree on types and defaults
- every option appears to be mentioned in documentation

It doesn't complain about devel/experimental options and allows
marking options that are not intended to be public.

Since we haven't been able to come up with a good scheme for
documenting config options at point of use, this will help close the
loop of making sure all options that should be documented are.
2015-06-25 17:34:53 -05:00
Yuya Nishihara
879585e8e1 import-checker: exclude mercurial packages installed into the system path
If mercurial was installed into a directory other than the site-packages,
test-module-imports.t failed as 'mercurial.node' was listed in stdlib_modules:

  testpackage/latesymbolimport.py relative import of stdlib module

Instead, we should exclude our packages explicitly.
2015-07-04 10:56:37 +09:00
Yuya Nishihara
cfcee215a8 import-checker: recurse into subtree of sys.path only if __init__.py exists
We can't assume that the site-packages is the only directory that has Python
files but is not handled as a package. For example, we have dist-packages
directory on Debian.
2015-07-04 10:54:03 +09:00
FUJIWARA Katsunori
4bae7bb820 import-checker.py: exit with code 0 if no error is detected
Before this patch, `import-checker.py` exits with non-0 code, if no
error is detected. This is unusual as Unix command.

This change may be a one of preparations for issue4677, because this
can avoid extra explanation about unusual exit code of
`import-checker.py` for third party tool developers.
2015-07-03 06:56:03 +09:00
Gregory Szorc
5fe42b2975 import-checker: establish modern import convention
We introduce a new convention for declaring imports and enforce it via
the import checker script.

The new convention is only active when absolute imports are used, which is
currently nowhere. Keying off "from __future__ import absolute_import" to
engage the new import convention seems like the easiest solution. It is
also beneficial for Mercurial to use this mode because it means less work
and ambiguity for the importer and potentially better performance due to
fewer stat() system calls because the importer won't look for modules in
relative paths unless explicitly asked.

Once all files are converted to use absolute import, we can refactor
this code to again only have a single import convention and we can
require use of absolute import in the style checker.

The rules for the new convention are documented in the docstring of the
added function. Tests have been added to test-module-imports.t. Some
tests are sensitive to newlines and source column position, which makes
docstring testing difficult and/or impossible.
2015-06-28 12:46:34 -07:00
Gregory Szorc
1553443b44 import-checker: establish new function for verifying import conventions
A future patch will formalize the modern import convention. In
preparation for that, introduce a new wrapper function that will invoke
the proper function.
2015-06-28 12:28:48 -07:00
Gregory Szorc
1159e64c84 import-checker: resolve relative imports
"from . import X" will produce an ImportFrom ast node with .module =
None. This resulted in a run-time error from attempting to concatenate
None with a str.

Another problem with relative imports is that the prefix may be dynamic
based on the "level" attribute of the import. e.g. "from ." has level 1
and "from .." has level 2.

We teach the "fromlocal" function how to cope with relative imports.
Where appropriate, the consumer passes in the level so relative module
names may be resolved properly.
2015-06-28 09:36:58 -07:00
Gregory Szorc
7a107e3b4a check-code: detect legacy exception syntax
We just rewrote all files to use modern exception syntax. Ban the old
form.

This will detect the "except type, instance" and
"except (type1, type2), instance" forms.
2015-06-23 22:20:01 -07:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Gregory Szorc
82ea02abcf check-code: detect legacy octal syntax
Now that we have mass rewriting all files to use the modern octal
syntax, detect and ban the legacy syntax, which is no longer supported
in Python 3.
2015-06-23 22:38:21 -07:00
Pierre-Yves David
9c4de6ba91 revset: improves time complexity of 'roots(xxx)'
The canonical way of doing 'roots(X)' is 'X - children(X)'. This is what the
implementation used to be. However, computing children is expensive because it
is unbounded. Any changesets in the repository may be a children of '0' so you
have to look at all changesets in the repository to compute children(0).
Moreover the current revsets implementation for children is not lazy, leading to
bad performance when fetching the first result.


There is a more restricted algorithm to compute roots:

    roots(X) = [r for r in X if not parents(r) & X]

This achieve the same result while only looking for parent/children relation in
the X set itself, making the algorithm 'O(len(X))' membership operation.
Another advantages is that it turns the check into a simple filter, preserving
all laziness property of the underlying revsets.

The speed is very significant and some laziness is restored.

-) revset without 'roots(...)' to compare to base line
0) before this change
1) after this change

revset #0: roots((tip~100::) - (tip~100::tip))
   plain         min           last
-) 0.001082      0.000993      0.000790
0) 0.001366      0.001385      0.001339
1) 0.001257  92% 0.001028  74% 0.000821  61%

revset #1: roots((0::) - (0::tip))
   plain         min           last
-) 0.134551      0.144682      0.068453
0) 0.161822      0.171786      0.157683
1) 0.137583  85% 0.146204  85% 0.070012  44%

revset #2: roots(tip~100:)
   plain         min           first         last
-) 0.000219      0.000225      0.000231      0.000229
0) 0.000513      0.000529      0.000507      0.000539
1) 0.000463  90% 0.000269  50% 0.000267  52% 0.000463  85%

revset #3: roots(:42)
   plain         min           first         last
-) 0.000119      0.000146      0.000146      0.000146
0) 0.000231      0.000254      0.000253      0.000260
1) 0.000216  93% 0.000186  73% 0.000184  72% 0.000244  93%

revset #4: roots(not public())
   plain         min           first
-) 0.000478      0.000502      0.000504
0) 0.000611      0.000639      0.000634
1) 0.000604      0.000560  87% 0.000558

revset #5: roots((0:tip)::)
   plain         min           max           first         last
-) 0.057795      0.004905      0.058260      0.004908      0.038812
0) 0.132845      0.118931      0.130306      0.114280      0.127742
1) 0.111659  84% 0.005023   4% 0.111658  85% 0.005022   4% 0.092490  72%

revset #6: roots(0::tip)
   plain         min           max           first         last
-) 0.032971      0.033947      0.033460      0.032350      0.033125
0) 0.083671      0.081953      0.084074      0.080364      0.086069
1) 0.074720  89% 0.035547  43% 0.077025  91% 0.033729  41% 0.083197

revset #7: 42:68 and roots(42:tip)
   plain         min           max           first         last
-) 0.006827      0.000251      0.006830      0.000254      0.006771
0) 0.000337      0.000353      0.000366      0.000350      0.000366
1) 0.000318  94% 0.000297  84% 0.000353      0.000293  83% 0.000351

revset #8: roots(0:tip)
   plain         min           max           first         last
-) 0.002119      0.000145      0.000147      0.000147      0.000147
0) 0.047441      0.040660      0.045662      0.040284      0.043435
1) 0.038057  80% 0.000187   0% 0.034919  76% 0.000186   0% 0.035097  80%

revset #0: roots(:42 + tip~42:)
   plain         min           max           first         last          sort
-) 0.000321      0.000317      0.000319      0.000308      0.000369      0.000343
0) 0.000772      0.000751      0.000811      0.000750      0.000802      0.000783
1) 0.000632  81% 0.000369  49% 0.000617  76% 0.000358  47% 0.000601  74% 0.000642  81%
2015-06-22 10:19:12 -07:00
Pierre-Yves David
7a8996fad4 revsetbenchmark: do not abort on failure to run a revset
Instead of aborting the whole process, we just skip entry for revset that
failed to run.
2015-06-20 16:22:10 -07:00
Yuya Nishihara
a0be3c41c2 check-commit: catch both patterns of double empty lines 2015-06-21 15:18:49 +09:00
Pierre-Yves David
0b5134f913 revsetbenchmarks: ignore empty lines
Before this change, empty lines were seen as an entry and the benchmark tried
to run benchmark for "".
2015-06-20 04:13:25 -07:00
Pierre-Yves David
da0f39bd8a revset: make use of natively-computed set for 'draft()' and 'secret()'
If the computation of a set for each phase (done in C) is available,
we use it directly instead of applying a simple filter. This give a
massive speed-up in the vast majority of cases.

On my mercurial repo with about 15000 out of 40000 draft changesets:

revset: draft()
   plain         min           first         last
0) 0.011201      0.019950      0.009844      0.000074
1) 0.000284   2% 0.000312   1% 0.000314   3% 0.000315 x4.3

Bad performance for "last" come from the handling of the 15000 elements set
(memory allocation, filtering hidden changesets (99% of it) etc. compared to
applying the filter only on a handfuld of revisions (the first draft changesets
being close of tip).

This is not seen as an issue since:

* Timing is still pretty good and in line with all the other one,
* Current user of Vanilla Mercurial will not have 1/3 of their repo draft,

This bad effect disappears when phase's set is smaller. (about 200 secrets):

revset: secret()
   plain         min           first         last
0) 0.011181      0.022228      0.010851      0.000452
1) 0.000058   0% 0.000084   0% 0.000087   0% 0.000087  19%
2015-06-10 19:18:51 -07:00
Pierre-Yves David
7dc4b61365 revset: translate node directly with changelog in 'head'
Using 'repo[X]' is much slower because it creates a 'changectx' object and goes
though multiple layers of code to do so. It is also error prone if there is
tags, bookmarks, branch or other names that could map to a node hash and take
precedence (user are wicked).

This provides a significant performance boost on repository with a lot of
heads.  Benchmark result for a repo with 1181 heads.

revset: head()
   plain         min           last          reverse
0) 0.014853      0.014371      0.014350      0.015161
1) 0.001402   9% 0.000975   6% 0.000874   6% 0.001415   9%

revset: head() - public()
   plain         min           last          reverse
0) 0.015121      0.014420      0.014560      0.015028
1) 0.001674  11% 0.001109   7% 0.000980   6% 0.001693  11%

revset: draft() and head()
   plain         min           last          reverse
0) 0.015976      0.014490      0.014214      0.015892
1) 0.002335  14% 0.001018   7% 0.000887   6% 0.002340  14%

The speed up is visible even when other more costly revset are in use

revset: head() and author("mpm")
   plain         min           last          reverse
0) 0.105419      0.090046      0.017169      0.108180
1) 0.090721  86% 0.077602  86% 0.003556  20% 0.093324  86%
2015-06-16 19:47:46 -07:00
Pierre-Yves David
9b78f27d7c contrib: clean up all-revsets.txt file
I forgot to cleanup a handful of them when I originally created the file.
2015-06-17 16:29:46 -07:00
Pierre-Yves David
916b1666b3 contrib: introduce an all-revsets.txt file
This file should gather all revsets ever thought interesting by
anyone. That way one can check the impact of a change when touching
something revset-ish. See inline comments for details.

This file have been refilled with all the entry I could automatically
find from changeset descriptions. I assume we missed some not using
'revsetbenchmarks.py' output.
2015-06-16 22:15:30 -07:00
Pierre-Yves David
e4f090319c contrib: rename revsetbenchmarks.txt to 'base-revsets.txt'
We rename the file and document its purpose. We'll be introducing another file
gathering revsets useful for benchmark of the predicate themsleves in a coming
changesets.
2015-06-16 20:36:00 -07:00
Pierre-Yves David
254ba0361d revsetbenchmarks: add main documention for the script
This allow us to document the fact we can use comment in the file listing revsets.
2015-06-16 20:24:37 -07:00
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