Commit Graph

1478 Commits

Author SHA1 Message Date
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
Augie Fackler
c491e8091f dockerdeb: rules to build a debian package using docker
Currently only supports jessie (current stable), but other version
should be trivial.
2015-05-06 13:15:39 -04:00
Augie Fackler
fa666b3b8a packaging: extract packagelib for common code from builddeb and buildrpm 2015-05-07 10:28:58 -04:00
Augie Fackler
c2c147fe7a builddeb: new script for building a deb package
Future work will allow us to use docker to build debs.

Right now this doesn't install any config files. I plan to do that as
a followup, but getting something basic and working checked in seems
like more of a priority than getting everything done in one big step.

This also does not create a source deb yet. I haven't looked into that
process.

Note that this declares incompatibility with the `mercurial-common`
package. It's typical for debian packages to be split between
architecture-independent bits and native bits, meaning the python bits
downstream live in mercurial-common and the c extension bits live in
mercurial. We don't do that because we want to (ideally) give users a
single deb file to install.
2015-05-06 13:13:54 -04:00
Augie Fackler
7471f2bb40 dockerlib: fix initcontainer for boot2docker users
This allows me to build rpm packages using boot2docker on my Mac. It's
probably a very fragile hack, but it seems to work well enough for now
that I felt it was worth sharing.
2015-05-06 14:36:17 -04:00
Augie Fackler
53739e0ce5 dockerlib: extract initcontainer() method
This helps contain all the logic around creating containers.
2015-05-06 10:45:51 -04:00
Augie Fackler
563404e413 dockerlib: start extracting common functions for setting up docker
I'm about to start interacting with docker for Debian packaging too,
so it's time to centralize this so that any bugfixes I figure out
apply to both codepaths.
2015-05-06 10:45:07 -04:00
Pierre-Yves David
77c097ded9 revset: narrow the subset using smartset operation in roots()
We were manually creating a base with explicit subset testing. We should let
smartset magic happen and optimise that logic if needed.

benchmark show some massive speedup when "parents set" is huge and "subset" is
small.

revset: 42:68 and roots(42:tip)
0) wall 0.011322 comb 0.010000 user 0.010000 sys 0.000000 (best of 161)
1) wall 0.002282 comb 0.010000 user 0.010000 sys 0.000000 (best of 1082)

Minor speedup in simple case (were fullreposet helps)

revset: roots(0::tip)
0) wall 0.095688 comb 0.100000 user 0.100000 sys 0.000000 (best of 85)
1) wall 0.084448 comb 0.080000 user 0.080000 sys 0.000000 (best of 95)

revset: roots((0:tip)::)
0) wall 0.146752 comb 0.140000 user 0.140000 sys 0.000000 (best of 58)
1) wall 0.143538 comb 0.140000 user 0.140000 sys 0.000000 (best of 59)

And small overhead then the "parents set" is fairly complicated (transforming it
into a revset once and for all appears to be faster).

revset: roots((tip~100::) - (tip~100::tip))
0) wall 0.004652 comb 0.010000 user 0.010000 sys 0.000000 (best of 544)
1) wall 0.004878 comb 0.010000 user 0.010000 sys 0.000000 (best of 479)

revset: roots((0::) - (0::tip))
0) wall 0.146587 comb 0.150000 user 0.150000 sys 0.000000 (best of 53)
1) wall 0.157192 comb 0.160000 user 0.160000 sys 0.000000 (best of 53)

revset: first(roots((0::) - (0::tip)))
0) wall 0.152924 comb 0.150000 user 0.150000 sys 0.000000 (best of 57)
1) wall 0.153192 comb 0.160000 user 0.160000 sys 0.000000 (best of 55)
2014-10-11 01:17:40 -07:00
Pascal Quantin
ad2d500d14 win32: remove cacert.pem file from Inno Setup installer
Duplicate the modification done in 38f1dfe18752 for wix installer
so that CA certificates loading works fine with Python 2.7.9+.
2015-04-23 21:23:13 +02:00
Yuya Nishihara
6093d4a115 wix: remove cacert.pem from Windows distribution
It should not be included in the Windows installers because it prevents
loading CA certificates from the system store on Python 2.7.9, implemented
by b572b9736ab0. The msi packages bundles Python 2.7.9, so cacert.pem is no
longer necessary.

Backed out changeset 7c9264a028c0
2015-04-23 22:44:46 +09:00
FUJIWARA Katsunori
a87fdf93f3 check-code: check os.path.join(*, '') not working correctly with Python 2.7.9
Since Python 2.7.9, "os.path.join(path, '')" doesn't append "os.sep"
for UNC path (see issue4557 for detail).
2015-04-22 23:38:55 +09:00
Mads Kiilerich
8561ae6b39 rpms: create missing builds dir if it doesn't exist 2015-04-14 23:51:02 -04:00
Mads Kiilerich
ea7df88985 rpms: for packages with their own python, put it in /opt/python-hg
This is more compliant with the FHS and Fedora packaging guidelines.
2015-04-14 23:44:03 -04:00
Pierre-Yves David
812e82cf4f check-commit: be more picky about detection of wrong bug tag
The check-commit script search for "bug" withing bracket and ask people to use
(issueXXXX) instead. The test was too wide and matching any "(+b+u+g"sequence.
2015-04-12 14:54:53 -04:00
Matt Harbison
6a81772054 import-checker: force 'fcntl', 'grp', 'pwd', and 'termios' to stdlib modules
These are Unix only, and caused these additional warnings on Windows if they
aren't hardcoded as stdlib:

  mercurial/posix.py mixed imports
     stdlib:    errno, getpass, os, socket, stat, sys, tempfile
     relative:  grp, pwd, unicodedata
  mercurial/posix.py mixed imports
     stdlib:    re
     relative:  fcntl
  mercurial/posix.py mixed imports
     stdlib:    array
     relative:  termios

Additionally, this was missing on Windows:

  mercurial/crecord.py mixed imports
     stdlib:    fcntl, termios
     relative:  curses


https://docs.python.org/2/library/fcntl.html
https://docs.python.org/2/library/grp.html
https://docs.python.org/2/library/pwd.html
https://docs.python.org/2/library/termios.html
2015-04-08 22:31:50 -04:00
Matt Harbison
8fffff85bf import-checker: allow *.pyd based stdlib modules
These are Windows dlls, and eliminate the following import check diffs that are
not on Unix:

  mercurial/changegroup.py mixed imports
     stdlib:    os, struct, tempfile, zlib
     relative:  bz2
  mercurial/encoding.py mixed imports
     stdlib:    locale, os
     relative:  unicodedata
2015-04-08 22:23:51 -04:00
Siddharth Agarwal
6a367ef5be perf: make measuring foldmap perf work again
Rev 54727f222a91 split the foldmap into two, but I forgot to update perf for
the changes.
2015-04-02 19:13:50 -07:00
Andrew Shadura
506304a170 hgk: display committer name when set by hg-git 2015-04-03 22:44:25 +02:00
Andrew Shadura
d79f0dfc20 hgk: use switch instead of a less efficient if/elseif/if 2015-03-29 19:15:04 +02:00
Andrew Shadura
a5a999d5cb hgk: set distinct fill and outline colour for non-public and obsolete changesets 2015-03-29 19:12:08 +02:00
Andrew Shadura
e8540303c1 hgk: show secret changesets differently (shape and label) 2015-03-29 18:44:53 +02:00
Andrew Shadura
ff15132c27 hgk: remove no longer needed debug-rev-parse command 2015-03-28 21:33:47 +01:00
Andrew Shadura
48d9f0deb1 hgk: remove no longer needed debug-config command 2015-03-28 21:24:57 +01:00
Andrew Shadura
d0e9f81098 hgk: display obsolete changesets in darkgrey 2015-03-28 20:05:01 +01:00
Andrew Shadura
c509289c81 hgk: pass --hidden switch to hg subprocesses when needed 2015-03-28 19:36:21 +01:00
Matt Mackall
526b5a1fd1 import-checker: rotatecycle is actually the canonical cycle key
So refactor to drop cyclekey().
2015-03-28 00:08:26 -05:00
Matt Mackall
99e8245cd5 import-checker: make search algorithm non-recursive breadth-first
Breadth-first allows finding the shortest cycle including the starting
module. This lets us terminate our search early when we've discovered
shorter paths already. This gives a tremendous speed-up to the
cycle-finding portion of the test, dropping total runtime from 39s to
3s.
2015-03-27 23:52:23 -05:00
Matt Mackall
aa337c67fe import-checker: drop set() from cyclekey() 2015-03-27 19:27:19 -05:00
Matt Mackall
1f89d532b3 import-checker: drop duplicate element from cycle
This will allow optimizing cyclekey creation
2015-03-27 19:25:40 -05:00
Matt Mackall
407d8470d0 import-checker: fix rotatecycle
It was duplicating the last element sometimes.
2015-03-27 18:50:39 -05:00
Laurent Charignon
76fa3c9194 check-code: in C code, prevent space before closing parenthesis 2015-03-24 12:52:53 -07:00
Pierre-Yves David
b9dce14212 contrib: remove the now useless lock-checker.py extension
This feature is in core now, and we do not keep backward compability for
contrib.
2015-03-10 21:25:11 -07:00
Matt Harbison
4849cf877e check-code: enforce the usage of 'seq.py' instead of 'seq' 2015-03-17 21:48:34 -04:00
Matt Mackall
bbeea83192 perf: add methods for timing changeset file list reading 2015-03-18 12:03:44 -05:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Matt Mackall
37e98d0538 check-code: allow disabling msys path check 2015-03-05 13:21:57 -06:00
Jesus Cea
60d6ae885a copyright: update to 2015
Many files and translations have an outdated copyright date.
Change that to the correct "2005-2015" dates.
2015-03-02 14:52:04 +01:00
Eric Sumner
13daa0c8fd check-commit: check capitalization in summary lines
At the moment, check-commit will complain about the topic being capitalized,
but not the summary that comes after it.  This diff corrects that deficiency.
2015-02-05 14:09:08 -08:00
Mads Kiilerich
031d0b9afc osx: patch .pax.gz files in pkg bundles so they extract as root (issue4081)
The packages has to be installed by root but they would be installed
insecurely, owned by the uid of the unprivileged user that made the package.
The local user with that uid could thus write to /usr/local/bin/hg .

bdist_mpkg calls out to pax to create the package, but pax do apparently not
have the power to control what it is writing.

Instead, patch the pax files and set their uid fields to 0 before they are
wrapped in a dmg.
2015-01-23 06:28:28 +01:00
FUJIWARA Katsunori
0ef76b45c5 check-code.py: avoid warning against "reverting subrepo ..." lines
Before this patch, "reverting subrepo subrepo/path" lines in *.t test
files require "(glob)", because such lines are recognized as
"reverting path/to/managed/file" by "check-code.py".

On the other hand, "(glob)" for such "reverting ..." line is
recognized as useless by "runt-tests.py", because subrepo paths shown
in such lines are always normalized by "util.pconvert". And this
causes "no result code from test" warning.

As a preparation for discarding "(glob)" from such lines in subsequent
patch, this patch avoids warning against them, by adding negative
lookahead assertion "(?!subrepo )" to the regexp.
2015-01-22 00:10:26 +09:00
FUJIWARA Katsunori
6fd4318051 hg.bat: return exit code explicitly for indirect invocation
When "hg.bat" is invoked via interactive shell "cmd.exe" on Windows,
it can store own exit code into ERRORLEVEL correctly, regardless of
explicit "exit" statement in it: "cmd.exe" seems to hold ERRORLEVEL
updated by the last command in the batch file (= "python hg", in
"hg.bat" case).

On the other hand, "hg.bat" is invoked indirectly via
"subprocess.Popen" (e.g. shell alias, hooks, hgclient and so on), the
parent process always receives exit code 0 from spawned "hg.bat":
batch files on Windows seem not to be really spawned like as shell
scripts on UNIX, but to be executed in the "cmd.exe" process.

This patch returns exit code explicitly for indirect invocation.

"/b" should be specified for "exit" to prevent "cmd.exe" from being
terminated when "hg.bat" is invoked interactively from it.
2015-01-22 00:07:06 +09:00
Mads Kiilerich
509ce58a92 osx: update "Read Me" "Important Information" text in the package installer
Nothing fancy here, just making the text less specific and less wrong by not
mentioning OS X version and Python versions and wrong URLs.
2015-01-21 05:01:01 +01:00
Mads Kiilerich
e8c3de8b41 docker: support Fedora 21 2014-11-02 02:36:47 +01:00
Mads Kiilerich
a678d2511e rpm: make Python 2.7.9 the default Python to include in rpms for EL 5
Use the new and more TLS support in Python 2.7.9.
2015-01-16 04:26:40 +01:00
Mads Kiilerich
bb43dcc3a8 contrib: make Python 2.7.9 the default in Makefile.python
We should utilize (and test) the big API changes and new TLS functionality in
Python 2.7.9 whenever possible.
2015-01-16 04:26:25 +01:00
Angel Ezquerra
6e49f7def8 localrepo: remove all external users of localrepo.sopener
This change touches every module in which repository.sopener was being used, and
changes it for the equivalent repository.svfs.

It should now be possible to remove localrepo.sopener.
2015-01-11 00:25:54 +01:00
Augie Fackler
d7a053040f Makefile.python: try curl if wget fails
Macs ship with curl and not wget, so this is a nice little tweak for
folks testing on OS X.
2015-01-13 14:15:08 -05:00
Matt Mackall
465be7563f perf: add a configurable sleep on startup
This is intended to counteract power management by giving a consistent
idle period before test runs.
2015-01-10 21:13:10 -06:00
Mike Edgar
3171ae0735 synthrepo: new filenames must not also be new directories, and vice-versa
When generating many new files into a set of many possible new directories,
there is the possibility that the same path is chosen as both file and
directory. How likely this is depends on the size of the dictionary used,
the generated directory structure and the number of generated files.
2014-12-12 17:42:14 +00:00
Sean Farley
dc331facee debugnamecomplete: rename from debuglabelcomplete
Now that we have decided on the use of 'name' instead of 'label' we rename this
function accordingly.

The old method 'debuglabelcomplete' has been left as a deprecated command so
that current scripts don't break.
2014-10-17 13:41:29 -07:00
Matt Harbison
3c47e94de7 commit: propagate --addremove to subrepos if -S is specified (issue3759)
The recursive addremove operation occurs completely before the first subrepo is
committed.  Only hg subrepos support the addremove operation at the moment- svn
and git subrepos will warn and abort the commit.
2014-11-24 22:27:49 -05:00
Matt Harbison
9e4d7cc2d3 scmutil: pass a matcher to scmutil.addremove() instead of a list of patterns
This will make it easier to support subrepository operations.
2014-11-09 19:57:02 -05:00
Pierre-Yves David
a2ff033417 perf: add a perfloadmarkers command
It is used to benchmark the obsstore initialization time.
2014-11-20 16:27:55 -08:00
Gregory Szorc
ca2488737b docker: add Docker files for running an Apache mod_wsgi server
I frequently find myself wanting to run hgweb in a production-like
environment, with a real HTTP server and multiple WSGI workers.

This patch introduces a Docker environment for running Mercurial
under Apache + mod_wsgi. With just a few command executions, it is
possible to spin up a Docker container running hgweb.

The container is tailored for Mercurial developers wanting to run
Mercurial from a source checkout. It is **not** meant to be something
suitable for production use.

The container provides a default hgweb environment with an empty
repository that allows pushes. You can thus start a container and push
your favorite repository there for quick testing.

The container is designed to allow customizations. Users can provide
their own hgweb configurations and mount existing directories containing
repositories into the container.

The behavior of the container and how to control things is documented in
the README.rst file.
2014-11-11 20:32:10 -08:00
Pierre-Yves David
53a1a60278 transaction: pass a vfs map to the transaction
The goal is to allow access to file outside ofthe store directory from the
transaction. The obvious target are the `bookmarks` file. But we can envision
usage for cache too.

We keep passing a main opener explicitly because a lot of code rely on this
default opener. The main opener (operating on store) is using an empty key ''.
2014-10-17 20:49:39 -07:00
Mike Edgar
536f09de36 synthrepo: when adding files, ensure new path is not a directory 2014-10-20 14:20:43 -04:00
Mike Edgar
b7b380cf6e synthrepo: synthesized dates must be positive, fit in 32-bit signed ints 2014-10-20 13:59:13 -04:00
Pascal Quantin
dc313786c5 win32: remove Mercurial.ini file from Inno Setup installer (issue4435) 2014-11-04 21:54:27 +01:00
Pascal Quantin
ece10c0d99 win32: fix win32 installers generation
61f674b4b466 introduced a typo preventing a proper generation of the
installers. Also remove ConcatenateFiles() function as it is no more
required.
2014-11-04 21:35:49 +01:00
Pierre-Yves David
1154bfe337 perf: use a formatter for output
We use a `formatter` object in the perf extensions. This allow the use of
formatted output like json. To avoid adding logic to create a formatter and pass
it around to the timer function in every command, we add a `gettimer` function
in charge of returning a `timer` function as simple as before but embedding an
appropriate formatter.

This new `gettimer` function also return the formatter as it needs to be
explicitly closed at the end of the command.

example output:


  $ hg --config ui.formatjson=True perfvolatilesets visible obsolete
  [
   {
    "comb": 0.02,
    "count": 126,
    "sys": 0.0,
    "title": "obsolete",
    "user": 0.02,
    "wall": 0.0199398994446
   },
   {
    "comb": 0.02,
    "count": 117,
    "sys": 0.0,
    "title": "visible",
    "user": 0.02,
    "wall": 0.0250301361084
   }
  ]
2014-11-04 10:40:06 +00:00
Mads Kiilerich
79172c85c8 config: move mergetools configuration from contrib to default configuration
The merge tool configuration is an essential part of a good initial user
experience. 'make osx' installers and direct 'make' installation did not have
merge tool configuration. Now they have.

Note: The installer fixes for windows have been done blindly and might require
additional changes.
2014-10-19 03:22:23 +02:00
Mads Kiilerich
ef7acfd93a contrib: buildrpm checking of md5 checksums of downloaded Python and Docutils 2014-10-18 21:48:38 +02:00
Mads Kiilerich
262c34851d contrib: update build defaults to latest Python and docutils versions
Use Python 2.7.8 and Docutils 0.12 for Makefile.python and buildrpm (CentOS 5
rpms).
2014-11-02 16:39:02 +01:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
Matt Mackall
1dfcf35d21 test-revert.t: fix wc check-code false positive 2014-11-03 11:06:51 -06:00
Mads Kiilerich
e41b8f78e4 buildrpm: fix use of invalid $PLATFORM in mercurial.repo 2014-11-01 20:00:00 +01:00
Jordi Gutiérrez Hermoso
d3b97d5baf doc: change 'revision or range' to 'revision or revset'
The phrase "revision or range" comes from a pre-revset era. Since the
documentation for ranges now is under the revset docs, and as a
helpful hint nudging users towards revsets, I think it's better to say
"revision or revset"
2014-10-24 13:50:00 -04:00
Mads Kiilerich
b7b83cd1eb docker: use official centos5 image
I guess it didn't exist when centos5 support was introduced.
2014-10-16 17:44:37 +02:00
Mads Kiilerich
79c175d696 docker: add centos7 target for CentOS / Red Hat 7 support 2014-10-16 17:44:14 +02:00
Yuya Nishihara
be8d33d42a test-commandserver: add connector for unix domain socket server
The next patch will introduce --cmdserver unix.
2014-09-27 19:18:20 +09:00
Yuya Nishihara
ec858daa54 test-commandserver: allow check() to make connection in different way
The next patch will add connector for 'unix' mode server.
2014-09-27 23:14:26 +09:00
Yuya Nishihara
3f66387706 test-commandserver: remove unused repopath argument from check()
Instead of repopath, check() will receive connect() function as argument.
It will allow to connect to server of different mode.
2014-09-27 22:39:01 +09:00
FUJIWARA Katsunori
e916da76f7 import-checker: check modules for pure Python build correctly
Before this patch, "import-checker.py" just replaces "/" in specified
filenames by ".". This makes modules for pure Python build belong to
"mercurial.pure" package, and prevents "import-checker.py" from
correctly checking about cyclic dependency in them.

This patch discards "pure" component from fully qualified name of such
modules.

To avoid discarding "pure" from the module name of standard libraries
unexpectedly, this patch allows "dotted_name_of_path" to discard
"pure" only from Mercurial specific modules, which are specified via
command line arguments.
2014-10-17 02:07:05 +09:00
FUJIWARA Katsunori
3bd1cfb5ca import-checker: treat "from mercurial import XXXX" style correctly
Before this patch, "import-checker.py" assumes that the name of
Mercurial module recognized by "imported_modules" doesn't have package
part: for example, "util".

This is reason why "import-checker.py" always builds fully qualified
module name up relatively, if the given module doesn't belong to
standard Python library.

But in fact, modules imported in "from mercurial import XXXX" style
already have fully qualified name: for example, "mercurial.util"
module imported by "mercurial.parsers" is treated as
"mercurial.mercurial.util" because of building module name up
relatively.

This prevents "import-checker.py" from correctly checking about cyclic
dependency in them.

This patch avoids building module name up relatively, also if module
name starts with "mercurial.", to treat modules imported in "from
mercurial import XXXX" style correctly.
2014-10-17 02:07:05 +09:00
Siddharth Agarwal
6a0b47b797 perf: add a way to measure the perf of constructing the foldmap
Constructing the foldmap is a necessary part of operations like 'hg status' on
OS X. This command allows us to measure the perf of constructing it.
2014-10-03 19:58:26 -07:00
Mike Edgar
b638017ffe contrib/synthrepo: walk a repo's directory structure during analysis
Augments the analyze command to additionally walk the repo's current
directory structure (or of any directory tree), counting how many files
appear in which paths. This data is saved in the repo model to be used
by synthesize, for creating an initial commit with many files.

This change is aimed at developing, testing and measuring scaling
improvements when importing/converting a large repository to mercurial.
2014-09-12 22:07:23 -04:00
Mike Edgar
d923fc04a6 contrib/synthrepo: generate initial repo contents using directory shape model
Augments the synthesize command to use an additional parameter to the analyzed
repo model: the number of files in each directory at a given snapshot. Before
synthesizing history, an arbitrary number of files will be generated in a
distribution matching the analyzed directory structure.

Intended for developing, testing and measuring scaling improvements when
importing/converting a large repository to Mercurial.
2014-09-12 22:04:29 -04:00
Andrew Shadura
e7903979d4 hgk: define bookmark colour explicitly, as Tk 8.6 has changed their meaning 2014-09-28 13:27:40 +02:00
Yuya Nishihara
03d7086901 test-commandserver: make runcommand message bolder
It seems ' runcommand' is difficult to distinguish from command output.
'*** runcommand' is slightly better.
2014-09-28 17:21:38 +09:00
Yuya Nishihara
095547c625 test-commandserver: remove redundant banner output
Since test output was inlined, "testing <func>" message should no longer
be necessary.
2014-09-28 16:59:30 +09:00
Yuya Nishihara
1d33f9598f test-commandserver: split helper functions to new hgclient module
This prepares for porting test-commandserver.py to .t test.

Though command-server test needs many Python codes, .t test will be more
readable than .py test thanks to inlined output.
2014-09-28 13:31:16 +09:00
Pierre-Yves David
e1494119f1 revsetbenchmark: add a rebase-related revset to the benchmark list 2014-09-23 17:12:27 -07:00
Pierre-Yves David
a74e4ee649 revsetbenchmark: allow comments ('#' prefix) in the revset input 2014-09-23 17:09:19 -07:00
Pierre-Yves David
250b8754d7 revsetbenchmark: make it clear that revsets may be read from stdin 2014-09-23 17:08:49 -07:00
Mike Edgar
919b082a9b contrib/synthrepo: pass options to ctx.diff as kwargs, not a dict 2014-09-12 21:38:52 -04:00
Mike Edgar
6431a1d631 contrib/synthrepo: only generate 2 parents if model contains merges
If `hg analyze` is run on a revision set which contains no merges, then
`hg synthesize` will raise IndexError trying to select from p2distance,
which will be empty.
2014-09-12 17:43:37 -04:00
Mads Kiilerich
d45e42f05e contrib: add OS X p4merge to mergetools.hgrc 2014-08-27 16:39:44 +02:00
Gregory Szorc
34df9cb908 revsetbenchmarks: add an additional roots() benchmark
The existing roots(x - y) revset only considered the most recent 100
revisions. This was a good start. But expanding it to the full history
of the repository can dramatically increase execution time and thus
constitutes a useful benchmark.
2014-09-07 11:33:22 -07:00
Durham Goode
ce250e375a revset: lower weight for _intlist function
The histedit command uses a revset like:

(_intlist('1234\x001235')) and merge()

Previously the optimizer gave a weight of 1.5 to the _intlist side (1 for the
function, 0.5 for the string) which caused it to process the merge() side first.
This caused it to evaluate merge against every commit in the repo, which took
2.5 seconds on a large repo.

I changed the weight of _intlist to 0, since it's a trivial calculation, which
makes it process intlist first, which makes merge apply only to the revs in the
list. Which makes the revset take 0.15 seconds now. Cutting off 2.4 seconds off
our histedit performance.

>From the revset benchmark:
revset #25: (_intlist('20000\x0020001')) and merge()
0) obsolete feature not enabled but 54243 markers found!
! wall 0.036767 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.000198 comb 0.000000 user 0.000000 sys 0.000000 (best of 9084)
2014-09-12 14:21:18 -07:00
Durham Goode
79319b785d revset: make parents() O(number of parents)
Strip executes a revset like this:

max(parents(_intlist('1234\x001235')) - _intlist('1234\x001235'))

Previously the parents() revset would do 'subset & parents' which iterates over
each item in the subset and checks if it's in parents.  subset is usually the
entire repo (a spanset) so this takes a while.

Reversing the parameters to be 'parents & subset' means the operation becomes
O(number of parents) instead of O(size of repo). It also means the result gets
evaluated immediately (since parents isn't a lazy set), but I think this is a
win in most scenarios.

This shaves 0.3 seconds off strip (amend/histedit/rebase/etc) for large repositories.

revset #0: parents(20000)
0) obsolete feature not enabled but 54243 markers found!
! wall 0.006256 comb 0.010000 user 0.010000 sys 0.000000 (best of 289)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.000391 comb 0.000000 user 0.000000 sys 0.000000 (best of 4323)
2014-09-12 15:00:51 -07:00
Durham Goode
9d2bd7f0b2 revset: make descendants() lazier
Previously descendants() would force the provided subset to become a set.  In
the case of revsets like '(%ld::) - (%ld)' (as used by histedit) this would
force the '- (%ld)' set to be evaluated, which produced a set containing every
commit in the repo (except %ld). This takes 0.6s on large repos.

This changes descendants to trust the subset to implement __contains__
efficiently, which improves the above revset to 0.16s. Shaving 0.4 seconds off
of histedit.

revset #27: (20000::) - (20000)
0) obsolete feature not enabled but 54243 markers found!
! wall 0.023640 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.019589 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)

This commit removes the final revset related perf hotspot from histedit.
Combined with the previous two patches, they shave a little over 3 seconds off
histedit on large repos.
2014-09-12 16:21:13 -07:00
Yuya Nishihara
6684fe223e check-code: look for misuse of __bool__ 2014-09-17 00:28:37 +09:00
Mike Edgar
97e4932db0 contrib/synthrepo: return None to delete files on commit, don't raise IOError
The internal commit API was changed in 2eef89bfd70d to expect None from the
filectx function when a file is to be deleted, not an IOError. This change
keeps synthrepo up-to-date.
2014-09-15 16:07:54 -04:00
Steve Borho
44742e8431 wix: contrib/sample.hgrc is no more 2014-09-15 09:36:12 -05:00
Mads Kiilerich
0cfacaa1bd dockerrpm: create a yum/dnf repo from the generated rpms
This gives "PPA" functionality where users easily can stay uptodate with latest
nightly build.
2014-08-31 13:41:09 +02:00
Mads Kiilerich
eff8053e22 docker: add CentOS 5
There is no official CentOS 5 docker template so we use one from saltstack.
2014-05-15 01:48:37 +02:00
Mads Kiilerich
b06c2984ad docker: use stable tags for fedora and centos
A moving target is rarely useful.
2014-08-31 13:41:09 +02:00
Mads Kiilerich
13ebf84a6d dockerrpm: prepare source outside docker and just run rpmbuild inside docker
Simplifies the rpm build process.

We will use platform specific rpmbuild directories and will not clean them and
will drop the explicit copy to build directory.
2014-05-30 14:14:33 +02:00
Mads Kiilerich
111ff86a5d dockerrpm: run docker build process as the current user, not as root
Docker can be run by ordinary users if they are in the docker group. The build
process would however be run as a root user, only protected by the sandboxing.
That caused problems with the shared directory where rpmbuild would be picky
about building from sources owned by less privileged users and producing files
owned by root.

Instead, add a build user with the right uid/gid to the image and run the
docker process as that user.
2014-05-30 14:14:33 +02:00
Mads Kiilerich
907b2db860 dockerrpm: better handling of specification of docker name 2014-05-30 14:14:33 +02:00
Mads Kiilerich
269cde03e7 dockerrpm: check that docker is running correctly before building 2014-05-30 14:14:33 +02:00
Mads Kiilerich
a4d490eeb3 buildrpm: introduce --rpmdir instead of using hardcoded rpmbuild dir
Used as rpm _topdir when preparing spec and source and building rpms.
2014-08-31 13:40:53 +02:00
Mads Kiilerich
adcba0a4e6 buildrpm: introduce --withpython for building rpms that includes Python 2.7 2014-05-15 01:50:11 +02:00
Mads Kiilerich
f5261c89a9 buildrpm: introduce --prepare for preparing without actually building rpms 2014-08-31 12:51:06 +02:00
Siddharth Agarwal
8432654231 fedora: remove sample.hgrc from shipped files
sample.hgrc was long obsolete and was removed in c4f6b10a363a.
2014-09-02 14:10:08 -07:00
Gregory Szorc
94580f82da revsetbenchmark: add revset with lazyset subtraction
The added revset is used by obsolescence and currently results in
recursion in __contains__ between 2 lazysets. We should have
coverage of this revset.
2014-08-30 15:17:37 +02:00
Matt Mackall
fc6de0f1aa contrib: drop obsolete sample.hgrc
This was full of bad suggestions and is obsoleted by hg config --edit.
2014-08-29 17:15:49 +02:00
Matt Mackall
108b8a7b71 contrib: drop old convert-repo script
This has been obsolete since 2007.
2014-08-29 17:14:45 +02:00
Mads Kiilerich
5d1360e0ed cleanup: make sure we always access members of imported modules
This will make sure we get import errors, even if demandimport is enabled.

This will also mute some pyflakes 'imported but unused' warnings.
2014-08-15 04:37:45 +02:00
Matt Mackall
2b52e463fe check-code: extend try/except/finally check for multiple except clauses 2014-08-14 16:39:27 -05:00
Matt Mackall
65aa1f6760 hg-test-mode: make exit code highlight work again 2014-08-12 12:53:23 -05:00
Matt Mackall
3cbc9a8820 hg-test-mode: don't highlight variables in output
This was disabling highlighting the rest of the line for $REASONS.
Instead, we only highlight when we think we're on a 'command' line.
2014-08-12 00:42:05 -05:00
Pierre-Yves David
4c3d1d5f78 check-code: allow an escape pattern to be specified for testpattern
Before this patch it was impossible to introduce a #no-xxx comment to disable a
test pattern warning.
2014-08-02 17:04:53 -07:00
Pierre-Yves David
1a25f452db check-code: capture "wc" as a word
Otherwise entries such as "wcchange" give false negative
2014-08-02 17:01:55 -07:00
Matt Mackall
e82fc40f9c hg-test-mode: colorize HGFOO and TESTFOO environment variables 2014-08-10 23:13:12 -05:00