Commit Graph

32995 Commits

Author SHA1 Message Date
Pierre-Yves David
719387c7c7 obsutil: move 'allsuccessors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:36:20 +02:00
Pierre-Yves David
2f0989dab7 obsutil: move 'allprecursors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 01:31:18 +02:00
Pierre-Yves David
8b519349e8 obsutil: move 'exclusivemarkers' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 01:11:56 +02:00
Pierre-Yves David
04205af86b obsutil: move 'successorssets' to the new modules
We have a new 'obsutil' module now. We move this high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:03:01 +02:00
Adam Simpkins
7b7dd183b0 tests: fix variable name regular expression in _genrestoreenv()
Update the code to correctly anchor the expression on the end of the name, to
require that the entire name match this expression.  It was already anchored at
the start by using re.match(), but this does not anchor it at the end.
2017-06-29 11:29:19 -07:00
Martin von Zweigbergk
3ce6c1796d merge with stable 2017-06-29 15:21:52 -07:00
Pierre-Yves David
240af74d9c pushrace: avoid crash on bare push when using concurrent push mode
If the remote is empty, we do now bother computing head changes and the
'pushbranchmap' attribute stays at None.

We now handle and tests this case.
2017-06-28 17:41:25 +02:00
Pierre-Yves David
133a01a035 rebase: also test abort from pretxnclose error
Different hooks will have different properties so we cover more hooks to catch
further regressions.
2017-06-27 18:13:10 +02:00
Pierre-Yves David
8561b85a7e rebase: reinforce testing around precommit hook interrupting a rebase
Different hooks will have different properties so we cover more hooks to catch
further regression.
2017-06-27 18:10:55 +02:00
Pierre-Yves David
d9644794db rebase: provides test case for (issue5610)
The 4.2 release introduces a regression regarding the behavior of rebase with
some hook failures. We add the tests from the bug report from Henrik Stuart to
our test base to prevent further regression on this.
2017-06-27 17:45:58 +02:00
Pierre-Yves David
17353b92ba rebase: backed out changeset 507f16f4aa51 (issue5610)
Having a single transaction for rebase means the whole transaction gets rolled back
on error. To work around this a small hack has been added to detect merge
conflict and commit the work done so far before exiting. This hack works because
there is nothing transaction related going on during the merge phase.

However, if a hook blocks the rebase to create a changeset, it is too late to commit the
work done in the transaction before the problematic changeset was created. This
leads to the whole rebase so far being rolled back. Losing merge resolution and
other work in the process. (note: rebase state will be fully lost too).

Since issue5610 is a pretty serious regression and the next stable release is a
couple day away, we are taking the backout route until we can figure out
something better to do.
2017-06-27 17:40:24 +02:00
Pierre-Yves David
70672e4541 rebase: backed out changeset 4bc0c14fb501
In the process of fixing issue5610 in 4.2.2, we are trying to backout
507f16f4aa51. This changeset is making changes that depend on 507f16f4aa51,
so we need to back it out first.

Since issue5610 is pretty serious regression and the next stable release is a
couple of days away, we are taking the backout route until we can figure out
something better to do.
2017-06-27 17:39:55 +02:00
Gregory Szorc
800ebdc7ca show: config option to register aliases for views
As part of using `hg show` in my daily workflow, I've found it slightly
annoying to have to type full view names, complete with a space. I've
locally registered an alias for "swork = show work."

I think others will have this same complaint and could benefit from
some automation to streamline the creation of aliases. So, this
commit introduces a config option that allows `hg show` views to be
automatically aliased using a given prefix. e.g. a value of "s"
will automatically register "swork" and "sbookmarks." Multiple
values can be given for ultimate flexibility. This arguably isn't
needed now. But since we don't register aliases if there will be
a collision and we're bound to have a collision, it makes sense to
allow multiple prefixes so specific views can avoid collisions by
using different prefixes.
2017-06-25 22:20:37 -07:00
Anton Shestakov
a666e891cf make: add Debian 9 (Stretch) docker target 2017-06-23 13:33:41 +08:00
Anton Shestakov
5f2a285fbe make: templatize Debian build target a la 7766b31dd141 2017-06-23 13:08:46 +08:00
Anton Shestakov
d3bb529590 make: add Ubuntu Zesty docker targets (.deb and ppa)
Zesty Zapus was released on 2017-04-13 and will be supported until 2018-01.
2017-06-23 12:04:12 +08:00
Anton Shestakov
51ae08ed10 docker: install less as a build-time dependency in deb-based distros
It's needed since 99d9c6aa0389, otherwise dpkg-checkbuilddeps errors out.
2017-06-23 10:05:01 +08:00
Pierre-Yves David
1b59e168fe eol: fix 'error' parameter name in the commitctx wrapper
Since its introduction in c7ec460797a9, the parameter has always been name
"error". Yet the eol extension have been using 'haserror' as the argument name,
breaking extensions with subclass passing 'error' as a keyword argument.
2017-06-23 13:22:04 +02:00
Pierre-Yves David
f83c410836 eol: import 'error' as 'errormod'
We need the 'error' name available to fix another bug, so we rename the imported
module.
2017-06-23 13:24:45 +02:00
Pierre-Yves David
69222bbf87 blackbox: use a human readable version of the default
Now that the default value is also converted we can use a human readable version
for it. This will be useful if we start to automatically display the default
config value in various place.
2017-06-18 20:49:08 +02:00
Pierre-Yves David
050ba47e1c configitems: register 'blackbox.maxsize' as an example of 'configbytes'
This exercise the default value handling in 'configbytes'.
2017-06-17 13:21:06 +02:00
Pierre-Yves David
85f9bed0b5 blackbox: minor code reordering
The version declaration should come first in my opinion. This will help gather
the command table with the config table.
2017-06-17 13:41:28 +02:00
Pierre-Yves David
6b9d408177 configitems: add a devel warning for extensions items overiding core one
We do not want such case to pass silently. In the future we'll likely have
useful tool for an extension to alter the existing definition in core.
2017-06-18 19:52:54 +02:00
Pierre-Yves David
1dab0bbe74 configitems: add an official API for extensions to register config item
Extensions can have a 'configtable' mapping and use
'registrar.configitem(table)' to retrieve the registration function.

This behave in the same way as the other way for extensions to register new
items (commands, colors, etc).
2017-06-17 13:48:20 +02:00
Pierre-Yves David
2305d6b487 configitems: extract the logic to build a registrar on any configtable
Having the logic available independently from the mapping used is a necessary
step toward extensions support.
2017-06-17 13:38:53 +02:00
Pierre-Yves David
3e0bfc6abf obsolete: skip 'changectx' usage in unstable computation
We simplify the unstable computation code, skipping the expensive creation of
changectx object. We focus on efficient set operation and revnumber centric
functions.

In my mercurial development repository, this provides a 3x speedup to the
function:

  before: 5.319 ms
  after:  1.844 ms

repo details:

  total changesets:       40886
  obsolete changesets:     7756
  mutable (not obsolete):   293
  unstable:                  30
2017-06-19 01:08:11 +02:00
Pierre-Yves David
be7de168fe obsolete: provide a small function to retrieve all mutable revisions
More obsolescence related algorithm focus on the mutable revision. We provide a
tiny utility function to make it easy to access this set.
2017-06-18 22:38:11 +02:00
Siddharth Agarwal
218f4e2803 bundle2: add debug info about the number of stream params
Seems like the %i was never substituted.
2017-06-27 14:38:00 -07:00
Siddharth Agarwal
1920cf0324 bundle2: add some debugging information to the not-a-bundle error
I found this useful while trying to debug wireproto-related issues.
2017-06-27 14:30:55 -07:00
Adam Simpkins
738cc44d4e tests: more completely restore the environment in syshgenv
Update the syshgenv function to attempt to completely restore the original
environment, rather than only updating a few specific variables.  run_tests.py
now generates a shell script that can be used to restore the original
environment, and syshgenv sources it.

This is a bit more complicated than the previous code, but should do a better
job of running the system hg in the correct environment.

I've tested it on Linux using python 2.x, but let me know if it causes issues
in other environments.  I'm not terribly familiar with how the tests get run on
Windows, for instance, and how the environment needs to be updated there.
2017-06-28 12:23:22 -07:00
Jun Wu
4418dcadb3 tests: do not use system hg if it does not have "files" command
Ancient hg does not have "hg files" so test-check-*.t will fail with
"unknown command 'files'":

  $ hg files
  hg: unknown command 'files'
  $ hg --version
  Mercurial Distributed SCM (version 2.6.2)

Test "hg files" and give up using syshg if it does not have "files" command.
2017-06-28 13:45:51 -07:00
Adam Simpkins
f7ebee7cc9 setup: fix runcmd() usage on darwin
Fix one invocation of runcmd() that was missed in the recent change to
make runcmd() also return the process exit status.
2017-06-28 10:50:37 -07:00
Pulkit Goyal
2150fb394e py3: update the python3-whitelist with new tests which pass on Python 3
We have now 34 tests passing on Python 3.
2017-06-27 21:16:08 +05:30
Jun Wu
d6d4c8725e setup: fix localhgenv
It should return env as a dict instead of None.
2017-06-28 06:49:01 -07:00
Adam Simpkins
55a457de69 tests: use the system hg for examining the local repository
Most test scripts use "hg" to interact with a temporary test repository.
However a few tests also want to run hg commands to interact with the local
repository containing the mercurial source code.  Notably, many of the
test-check-* tests want to check local files and commit messages.

These tests were previously using the version of hg being tested to query the
source repository.  However, this will fail if the source repository requires
extensions or other settings not supported by the version of mercurial being
tested.  The source repository was typically initially cloned using the system
hg installation, so we should use the system hg installation to query it.

There was already a helpers-testrepo.sh script designed to help cope with
different requirements for the source repository versus the test repositories.
However, it only handled the evolve extension.  This new behavior works with
any extensions that are different between the system installation and the test
installation.
2017-06-27 17:24:31 -07:00
Adam Simpkins
b5772c6bc4 tests: save the original PATH and PYTHONPATH variables
When running the tests, define ORIG_PATH and ORIG_PYTHONPATH environment
variables that contain the original contents of PATH and PYTHONPATH, before
they were modified by run-tests.py

This will make it possible for tests to refer to the original contents of these
variables if necessary.  In particular, this is necessary for invoking the
correct version of hg for examining the local repository (the mercurial
repository itself, not the temporary test repositories).  Various tests examine
the local repository to check the file lists and contents of commit messages.
2017-06-27 17:24:31 -07:00
Adam Simpkins
03e07a8e3b setup: prefer using the system hg to interact with the local repository
Add a findhg() function that tries to be smarter about figuring out how to run
hg for examining the local repository.  It first tries running "hg" from the
user's PATH, with the default HGRCPATH settings intact, but with HGPLAIN
enabled.  This will generally use the same version of mercurial and the same
settings used to originally clone the repository, and should have a higher
chance of working successfully than trying to run the hg script from the local
repository.  If that fails findhg() falls back to the existing behavior of
running the local hg script.
2017-06-27 16:15:32 -07:00
Adam Simpkins
6ae0f95e37 setup: replace runhg() with an hgcommand helper class
Replace the runhg() function with an hgcommand helper class.  hgcommand has as
run() function similar to runhg(), but no longer requires the caller to pass in
the exact path to python and the hg script, and the environment settings for
invoking hg.

For now this diff contains no behavior changes, but in the future this will
make it easier for the hgcommand helper class to more intelligently figure out
the proper way to invoke hg.
2017-06-27 16:15:32 -07:00
Adam Simpkins
5be8308b27 setup: move environment computation into a helper function
Add a helper function to compute the environment used for invoking mercurial,
rather than doing this computation entirely at global scope.  This will make it
easier to do some subsequent refactoring.
2017-06-26 11:31:30 -07:00
Adam Simpkins
f8d4797904 setup: update runcmd() to also return the exit status
Update the runcmd() helper function so it also returns the process exit status.
This allows callers to more definitively determine if a command failed, rather
than testing only for the presence of data on stderr.

I don't expect this to have any behavioral changes for now: the commands
invoked by setup generally should print data on stderr if and only if they
failed.
2017-06-26 11:31:30 -07:00
Adam Simpkins
1234fecf66 setup: fail if we cannot determine the version number
If running hg fails, exit the setup script unsuccessfully, rather than
proceeding to use a bogus version of "+0-".  Using an invalid version number
causes various tests to fail later.  Failing early makes it easier to identify
the source of the problem.

It is currently easy for setup.py to fail this way since it sets HGRCPTH to the
empty string before running "hg", which may often disable extensions necessary
to interact with the local repository.
2017-06-26 11:31:30 -07:00
Yuya Nishihara
9b58e92dbe smartset: fix generatorset.last() to not return the first element (issue5609) 2017-06-27 23:50:22 +09:00
Jun Wu
d15f755cab strip: respect the backup option in stripcallback
The backup option was mistakenly ignored. It should be respected.

Thanks Martin von Zweigbergk for finding this out!
2017-06-26 21:11:02 -07:00
Pulkit Goyal
f6911d2833 py3: use pycompat.bytestr() to convert str to bytes 2017-06-26 23:58:27 +05:30
Pulkit Goyal
f7889ef073 py3: pass the memoryview object into bytes() to get the value 2017-06-26 23:57:49 +05:30
Pulkit Goyal
971c41225c py3: use pycompat.bytestr instead of str 2017-06-26 17:23:10 +05:30
Pulkit Goyal
0d776078c8 py3: use '%d' to convert integers to bytes 2017-06-26 17:22:45 +05:30
Pulkit Goyal
bfb91c2ff5 py3: slice over bytes to prevent getting it's ascii value 2017-06-25 08:36:51 +05:30
Pulkit Goyal
5cabeba9d4 py3: use pycompat.strkwargs() to convert kwargs keys to str 2017-06-27 00:23:32 +05:30
Pulkit Goyal
cd9c4a1e24 py3: use r'' to prevent the addition of b'' by transformer
There are cases in opts handling in debugcommands.py where we don't need to
convert opts keys back to bytes as there are some handful cases and no other
function using opts value. Using r'', we prevent the transformer to add
a b'' which will keep the value str.
2017-06-27 00:15:56 +05:30