Commit Graph

20531 Commits

Author SHA1 Message Date
Lucas Moscovicz
ba7cfe4ed4 revset: changed revsets to use spanset
Performance Benchmarking:

$ hg perfrevset "first(all())"
! wall 0.304936 comb 0.300000 user 0.280000 sys 0.020000 (best of 33)

$ ./hg perfrevset "first(all())"
! wall 0.175640 comb 0.180000 user 0.160000 sys 0.020000 (best of 56)
2014-02-03 10:15:15 -08:00
Lucas Moscovicz
6e0e0d512b revset: changed spanset to take a repo argument
This way, we can have by default the length of the repo as the end argument
and less code has to be aware of hidden revisions.
2014-02-18 11:38:03 -08:00
Matt Mackall
0122021cb0 journal: report parsing errors on recover/rollback (issue4172) 2014-02-17 14:49:56 -06:00
Matt Mackall
13868fbdf3 tests: backout c12b14874aad pid check 2014-02-15 22:09:32 -06:00
Lucas Moscovicz
4961b39b44 revset: changed spanset implementation to take hidden revisions into account
Hidden revisions are now excluded from the spanset.
Now this doesn't break for people using changeset evolution.
2014-02-10 17:38:43 -08:00
Durham Goode
2d869e6a8e template: add 'current' to scope during {bookmarks % ...}
This adds the keyword 'current' to the template scope when processing a
bookmark list. The 'current' keyword resolves to the name of the currently
active bookmark in the repo. This allows us to apply special labels to the
current bookmark to distinguish it (especially in the case where there are
multiple bookmarks on the same commit).

Example: "{bookmarks % '{bookmark}{ifeq(bookmark, current, \"*\")} '}"

Results in a space separated list of bookmarks where the current bookmark has
an asterix.
2014-02-11 21:40:33 -08:00
Durham Goode
f8aca20bcb template: add revset() template function
Adds a template function that executes a revset and returns the list of
revisions as the result. It has the signature 'revset(query [, args...])'. The
args are optional and are applied to the query string using the standard
python string.format(args) pattern. This allows things like:
'{revset("parents({0})", rev)}' to produce the parents of each individual
commit in the log output.  If no args are specified, the revset result is
cached for the duration of the templater; so it's better to not use args if
performance is a concern.

By itself, revset() can be used to print commit parents, print the common
ancestor of a commit with the main branch, etc.

It can be used with the ifcontains() function to do things like
'{ifcontains(rev, revset('.'), label(...), ...)}' to color the working copy
parent, to color certain branches, to color draft commits, etc.
2014-02-11 21:04:12 -08:00
Durham Goode
cb61deed09 template: add ifcontains template function
Adds a template function with the signature 'ifcontains(item, set, then[,
else])'.  It can be used to do things like '{ifcontains('.hgignore',
file_mods, label(...), ...)}' to color commits that edit the .hgignore file.
A future patch will add the revset() function which will combine with
ifcontains to allow us to color commits if they are in the revset.
2014-02-11 21:10:00 -08:00
Pierre-Yves David
1c8096195c createmarkers: allow to pass metadata for a marker only
The `metadata` argument only allow to specify metadata for all new markers. We
extension the format of the `relations` argument to support optional metadata
argument.

The first user of this should be the evolve extension who want to store parent
information of pruned changeset in extra (until we make a second version of the
format)
2014-02-13 17:34:09 -08:00
Pierre-Yves David
098932cf2d obsstore: update create docstring to point to the coder friendly function
The `obsstore` class have a `create` method that create new obsolescence marker
from node. There is another function in the same module `createmarkers`. This
other function is higher level and automatically missing meta data (ultimately
calling the first one)

We add a new comment in the docstring of `obsstore.create` highlighting that
people writing new code probably want to use the top level one.
2014-02-13 17:33:45 -08:00
FUJIWARA Katsunori
8190c758e5 i18n: check equality of initial indentation between msgid and msgstr
Document generation by runrst in "doc" directory may succeed silently,
even though initial indentation is different between msgid and msgstr:
for example, it may be unexpected or missing indentation.

This patch adds the checker to check equality of initial indentation
between msgid and msgstr.

This checker is categorized as "warning" level, because problem
detected by this is not so serious for usual Mercurial usage.
2014-02-15 18:40:39 +09:00
FUJIWARA Katsunori
baee6a2c0f i18n: check equality of tail '::'-ness between msgid and msgstr
Document generation by runrst in "doc" directory may succeed silently,
even though there is the translated message missing tail '::'. In this
case, it uses "<blockquote>" instead of "<pre>" to surround succeeding
text block unexpectedly in generated HTML file.

This patch adds the checker to check equality of tail '::'-ness
between msgid and msgstr.

To detect also msgstr unexpectedly ending with '::', this checker
doesn't have matching regexp against msgid, and is applied on all
msgid/msgstr pairs.

This checker is categorized as "warning" level, because problem
detected by this is not so serious for usual Mercurial usage.
2014-02-15 18:40:39 +09:00
Patrick Mezard
5bf3ef6c1b run-tests: fix heredoctest for out-of-tree extensions
heredoctest.py directory must be in python path to use heredoctest (>>>) in
out-of-tree extension tests like:

  $ cd ext/tests
  $ python /some/hg/install/tests/run-tests.py test-ext.t
2014-02-15 15:28:32 +01:00
Lucas Moscovicz
3d8c71a8cc revset: added cache to lazysets
This allows __contains__ to return faster when asked for same value twice.
2014-02-04 15:31:57 -08:00
Matt Mackall
b35d905ff6 histedit: shorten new fold message
Lots of people, like Mr. Check-Code, insist on using 80-column terminals.
2014-02-15 19:12:53 -06:00
Simon Heimberg
b2a439bb78 run-tests: unnecessary globs also count as warnings
When a glob is unnecessary, now there's a diff output and 'run-tests.py -i'
works for accepting the output.
On windows, some tests which have "passed" currently (with some info lines
printed) will now be reported as "warned". (I recommend to recognize "warned"
by buildbot before applying this patch.)
2014-02-13 08:29:44 +01:00
Simon Heimberg
1e51f26c6e run-tests: report a test as warned when only missing globs
On windows, some test reported as failed will now be reported as "warned".
2014-02-13 08:27:53 +01:00
Simon Heimberg
434d0f2c98 run-tests: add possibility for test-runners to report a "warned" test result
A test result is recognized as "warned" when the test runner returns the exit
code False. (False is similar to 0, which is reporting a command has run
sucessfully.)

The only difference in display is that the failure message while running writes
"Warning:" instead of "ERROR:". The diff output is the same as when the test
fails. Runing "run-tests.py -i" asks to accept the changed result also for
tests reported as "warned".

When running tests, a "warned" test would look like this:
..
 --- xxxx\tests\test-something.t
 +++ xxxx\tests\test-something.t.err
@@ -1279,7 +1279,7 @@
   $ echo anything
   $ hg commit -S -m whatever
   committing subrepository s
-  committing subrepository s/sbs
+  committing subrepository s/sbs (glob)
   warning: something happened
   committing subrepository t
   $ echo something

Warning: xxxx\tests\test-sOMETHING.t output changed
~.s...s...s..


Reporting a test result as "warned" will be used in following patches.
2014-02-13 08:26:13 +01:00
Simon Heimberg
11e4ef2216 run-tests: separate exit code when no failed tests but warned ones
This can be used by buildbot to set the result "warnings" instead of "failed".
2014-02-13 08:17:39 +01:00
Simon Heimberg
8864ac070e run-tests: introduce 'warned' as test result
While running, a test resulting in 'warned' is shown as '~'.
Test results with state warned are listed between the skipped and the failed
tests. Example:
Skipped test-revert-flags.t: missing feature: executable bit
Skipped test-inotify-lookup.t: missing feature: inotify extension support
Warned test-something.t: output changed
Failed test-largefiles.t: output changed
Failed test-subrepo.t: output changed
# Ran 11 tests, 2 skipped, 1 warned, 2 failed.


The test result "warned" will be used in later patches.
2014-02-13 08:14:54 +01:00
Simon Heimberg
9463ba6189 run-tests: handle sys.exit in main function 2014-02-13 08:02:06 +01:00
Simon Heimberg
073dd453ab run-tests: remove unnecessary variable initialisation
ret is always set before it is used, so remove ret = 0
2014-02-13 07:29:28 +01:00
Adrian Zgorzałek
4f40289598 histedit: clarify description of fold command
N and (N-1) didn't add any information to description of fold.
More useful is refering to the commit list as it is displayed in editor.
2014-02-13 18:05:35 -08:00
Mads Kiilerich
8c0ff878d1 discovery: make "note: unsynced remote changes!" less serious than a warning
This situation is not necessarily a problem and do not deserve a warning. It is
just some information that can guide the user in understanding what is going
on.

Making it 'debug' would usually not give the hint when it is relevant so we
make it a 'status' message.
2014-02-07 17:24:12 +01:00
Mads Kiilerich
303021da0b discovery: improve "note: unsynced remote changes!" warning
This message frequently caused confusion. "unsynced" is not a well established
user-facing concept in Mercurial and the message was not very specific or
helpful.

Instead, show a message like:
  remote has heads on branch 'default' that are not known locally: 6c0482d977a3

This message will also (when relevant) be shown before aborting on "push
creates new remote head".

A similar (but actually very different) message was addressed in cbd5a12a601a.
2014-02-06 02:19:38 +01:00
Pierre-Yves David
aa3270ed1f import: move tryone closure in cmdutil
We extract the `tryone` function into the `cmdutil` module. A lot of the command
context have to be passed to the utility function, but having and explicit
declaration will allow extension to wrap it. This will allows use to make
changeset evolution related experiment in dedicated extension.

Improving the API of this function is noble goal but outside of the scope of
this patches.
2014-02-11 16:52:36 -08:00
Siddharth Agarwal
2c51509bb0 revset: optimize missing ancestor expressions
A missing ancestor expression is any expression of the form (::x - ::y) or
equivalent. Such expressions are remarkably common, and so far have involved
multiple walks down the DAG, followed by a set difference operation.

With this patch, such expressions will be transformed into uses of the fast
algorithm at ancestor.missingancestor.

For a repository with over 600,000 revisions, perfrevset for '::tip - ::-10000'
returns:

Before: ! wall 3.999575 comb 4.000000 user 3.910000 sys 0.090000 (best of 3)
After:  ! wall 0.132423 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)
2014-02-13 14:04:47 -08:00
Siddharth Agarwal
2a56880ad4 revset: add an undocumented _missingancestors function
This will be used in an upcoming patch to optimize expressions of the form
(::x - ::y).
2014-02-13 13:54:45 -08:00
Siddharth Agarwal
bf7fddd84c commands.debugrevspec: add an option to print the optimized expression tree
This will be used in an upcoming patch to test that the optimizer works.
2014-02-13 13:52:45 -08:00
Simon Heimberg
2c8f3e258b tests: killdaemons.py for windows distinguishes access violation and terminated
To distinguish between access violaition (process belonging to another user)
and a terminated process, PROCESS_QUERY_INFORMATION must be enabled. But
TerminateProcess still raises error 5 in both cases. Therefore check before if
the process has already terminated.
2014-02-12 16:09:18 +01:00
Simon Heimberg
ad307f52ea tests: killdaemons.py for checks reason when getting no process handle 2014-02-12 15:38:59 +01:00
Simon Heimberg
700d7ff53a tests: killdaemons.py for windows waits for killed process to terminate
After kill, wait for the process to terminate. When it does not in time,
write a debug message similar as in other os. But no 2nd forceful attempt
is done.
2014-01-17 21:13:20 +01:00
Simon Heimberg
b0d67373c0 tests: kill for windows in killdaemons.py checks return values
The return values of the windll calls are checked and when an error is
indicated, it is raised. The handle is still closed properly.
2014-01-17 21:13:08 +01:00
Matt Mackall
05f4273a32 merge with crew 2014-02-13 15:33:24 -06:00
Thomas Arendsen Hein
efdcaf3f31 merge with stable 2014-02-13 13:08:50 +01:00
Pierre-Yves David
3f17a93498 pull: move changeset pulling in its own function
pull: move changeset pulling in its own function

Now that every necessary information is held in the `pulloperation` object, we
can finally extract the changeset pulling to it's own function.

This changeset is pure code movement only.
2014-01-31 01:39:59 -08:00
Pierre-Yves David
9f09184d30 pull: move fetch subset into the object
Tree discovey use a `fetch` variable to know what is being pulled. We move this
information in the `pulloperation` object. This make it possible to extract the
changeset pulling logic into its own function.
2014-02-11 14:51:38 -08:00
Pierre-Yves David
af185d32f5 pull: make pulled subset a propertycache of the pull object
The computation of the subset is simple operation using two useful pull
information (1) the set of common changeset before the pull (2) the set of
pulled changeset. We move this data into the `pulloperation` object since some
phase will need them. And we turn the pulled subset computation behind a
property case as multiple pull phase will need it.
2014-01-31 01:34:00 -08:00
Pierre-Yves David
ad09bf1d2b pull: move phases synchronisation in its own function
Now that every necessary information is held in the `pulloperation` object, we
can finally extract the phase synchronisation phase to it's own function.

This changeset is pure code movement only.
2014-01-31 01:25:56 -08:00
Pierre-Yves David
542abb260f pull: move pulled subset into the object
We compute the set of local changeset that were target of the pull. This is then
used by phases logic to decide which part of the history should have it phase
updated.

We move this information into the object to allow extraction of phase
synchronisation in its own function.

I expect obsolete marker exchange to use it too in the future.
2014-01-31 01:21:42 -08:00
Lucas Moscovicz
3a2188dac4 revset: added operations to spanset to duck type baseset
Added more operations which are not lazy but only used so far to duck type
baseset.
2014-02-06 15:56:25 -08:00
Lucas Moscovicz
e8f60a5520 revset: added basic operations to spanset
Added methods __add__, __sub__ and __and__ to duck type more methods in
baseset
2014-02-12 10:22:43 -08:00
Lucas Moscovicz
9ce7f8243d revset: added spanset class to represent revision ranges 2014-02-12 10:16:21 -08:00
Lucas Moscovicz
97db49c09a revset: added lazyset implementation to extra revset 2014-02-06 08:36:11 -08:00
Lucas Moscovicz
1d43685667 revset: added lazyset implementation to converted revset 2014-02-06 08:32:40 -08:00
Lucas Moscovicz
a871b2cef1 revset: added lazyset implementation to closed revset 2014-02-06 08:31:55 -08:00
Pierre-Yves David
9e5b5327f1 push: feed pulloperation object to _pullobsolete function
We now have all necessary information in the `pulloperation` object itself.
2014-01-31 01:12:35 -08:00
Pierre-Yves David
f0ae9ab368 pull: move transaction logic into the pull object
Most local change that occurs during a pull are doing within a `transaction`.
Currently this mean (1) adding new changeset (2) adding obsolescence markers. We
want the two operations to be done in the same transaction. However we do not
want to create a transaction if nothing is added to the repo. Creating an empty
transaction would drop the previous transaction data and confuse tool and people
who are still using rollback.

So the current pull code has some logic to create and handle this transaction on
demand. We are moving this logic in to the `pulloperation` object itself to
simplify this lazy creation logic through all different par of the push.

Note that, in the future, other part of pull (phases, bookmark) will probably
want to be part of the transaction too.
2014-01-31 01:04:05 -08:00
Pierre-Yves David
33b568da08 pull: move obsolescence marker exchange in the exchange module
The obsolescence marker exchange code was already extracted during a previous
cycle. We are moving the extracted functio in this module. This function will
read and write data in the `pulloperation` object and I prefer to have all core
function collaborating through this object in the same place.

This changeset is pure code movement only. Code change for direct consumption of
the `pulloperation` object will come later.
2014-01-30 17:38:41 -08:00
Pierre-Yves David
b3035d77ba pull: move force argument into pull object
One more step toward a more modular pulh function.
2014-02-01 03:49:29 -08:00