Commit Graph

113 Commits

Author SHA1 Message Date
Patrick Mezard
3fd83b5b68 hggettext: handle i18nfunctions declaration for docstrings translations 2010-10-24 12:52:37 +02:00
Patrick Mezard
c832c42c0c revsets: generate predicate help dynamically 2010-10-23 19:21:51 +02:00
Martin Geisler
3ef0b64b6f revset: add translator comments to i18n strings 2010-10-23 14:59:19 +02:00
Wagner Bruna
d4398837df revset: disable subset optimization for parents() and children() (issue2437)
For the boolean operators, the subset optimization works by calculating
the cheaper argument first, and passing the subset to the second
argument to restrict the revision domain. This works well for filtering
predicates.

But parents() don't work like a filter: it may return revisions outside the
specified set. So, combining it with boolean operators may easily yield
incorrect results. For instance, for the following revision graph:

0 -- 1

the expression '0 and parents(1)' should evaluate as follows:

0 and parents(1) ->
0 and 0 ->
0

But since [0] is passed to parents() as a subset, we get instead:

0 and parents(1 and 0) ->
0 and parents([]) ->
0 and [] ->
[]

This also affects children(), p1() and p2(), for the same reasons.
Predicates that call these (like heads()) are also affected.

We work around this issue by ignoring the subset when propagating
the call inside those predicates.
2010-10-15 03:30:38 -03:00
Benoit Boissinot
d7dc2daaa0 revset: use 'requires' instead of 'wants' in error message 2010-10-16 18:50:53 +02:00
Augie Fackler
0e09df5a9e revset id(): fix error text to say "id wants..." instead of "rev wants..." 2010-10-12 23:33:43 -05:00
Augie Fackler
5fe5470142 revset: add id() and rev() to allow explicitly referring to changes by hash or rev 2010-10-11 09:44:19 -05:00
Augie Fackler
4a386faa07 revset: rename tagged() to tag() and allow it to take an optional tag name 2010-10-10 12:41:36 -05:00
Matt Mackall
67a62aa820 revset: lower precedence of minus infix (issue2361) 2010-10-07 11:45:17 -05:00
Henrik Stuart
e96bfa211b merge with stable 2010-10-05 20:25:51 +02:00
Adrian Buehlmann
5fa66b2722 revset: fix #branch in urls for outgoing()
hg log -r 'outgoing(..)' ignored #branch in some cases.
This patch fixes it.

The cases where it misbehaved are now covered by the added
test-revset-outgoing.t
2010-10-05 11:34:13 +02:00
Brodie Rao
04db466f58 revset: handle re.compile() errors in grep()
Raise error.ParseError instead of allowing re.error to bubble up.
2010-09-17 10:21:02 -05:00
Brodie Rao
2104af5ee2 revset: support raw string literals
This adds support for r'...' and r"..." as string literals. Strings
with the "r" prefix will not have their escape characters interpreted.

This is especially useful for grep(), where, with regular string
literals, \number is interpreted as an octal escape code, and \b is
interpreted as the backspace character (\x08).
2010-09-24 15:36:53 -05:00
Matt Mackall
51b3b09c8f backout most of 26e0b9a8ce0d 2010-09-24 12:46:54 -05:00
Brodie Rao
7362459729 cleanup: use x in (a, b) instead of x == a or x == b 2010-09-23 00:02:31 -05:00
Matt Mackall
fc9b3fe966 revsets: reduce cost of outgoing in the optimizer 2010-09-20 16:40:36 -05:00
Martin Geisler
989dda555a merge with stable 2010-09-20 15:42:58 +02:00
Martin Geisler
80db87965d Consistently import foo as foomod when foo to avoid shadowing
This is in the style of 1aaceccaf1dc.
2010-08-30 14:38:24 +02:00
Wagner Bruna
64365a9e84 revset: predicate to avoid lookup errors
A query like

head() and (descendants("bad") and not descendants("fix"))

(testing if repo heads are affected by a bug) will abort with a
RepoLookupError if either badrev or fixrev aren't found inside
the repository, which is not very informative.

The new predicate returns an empty set for lookup errors, so

head() and (descendants(present("bad")) and not descendants(present("fix")))

will behave as wanted even if those revisions are not found.
2010-08-13 13:11:41 -03:00
Martin Geisler
ec0bf03276 Merge with stable 2010-08-15 18:13:46 +02:00
Wagner Bruna
a056b85166 revset: fix outgoing argument handling 2010-08-12 20:54:34 -03:00
Matt Mackall
4e44d8a129 revset: fix ancestor subset handling (issue2298) 2010-07-22 08:17:38 -05:00
Nicolas Dumazet
5ab42d56dc revset: add min function 2010-07-30 10:07:46 +09:00
Matt Mackall
63b3d97fcf revset: make negate work for sort specs 2010-06-30 17:44:36 -05:00
Matt Mackall
d4380e872d revset: deal with empty sets in range endpoints
(spotted by Julian Cowley <julian@lava.net>)
2010-06-28 11:07:27 -05:00
Julian Cowley
dde4582c77 revset: remove debugging leftover 2010-06-25 01:27:25 -10:00
Matt Mackall
ca34f1b48d revset: fix up contains/getstring when no args passed 2010-06-19 13:00:08 -05:00
Matt Mackall
e5e3827657 revset: allow extended characters in symbols 2010-06-19 12:22:35 -05:00
Matt Mackall
188c0aac63 revset: nicer exception for empty queries 2010-06-18 17:34:13 -05:00
Martin Geisler
cebeb8aea1 revset: all your error messages are belong to _ 2010-06-18 21:31:19 +02:00
Georg Brandl
072ab526a7 revset: fix call to ctx.extra() in closed() 2010-06-13 23:25:27 +02:00
Matt Mackall
ef2640cd30 revset: improve filter argument handling 2010-06-11 15:30:12 -05:00
Dirkjan Ochtman
cb25b6f79d cleanups: unused variables 2010-06-08 09:30:33 +02:00
Dirkjan Ochtman
cf1de649bd move discovery methods from localrepo into new discovery module 2010-06-07 18:35:54 +02:00
Matt Mackall
420e7ec722 revset: delay import of hg to avoid start-up import loops 2010-06-05 09:58:02 -05:00
Matt Mackall
a963622643 revset: raise ParseError exceptions 2010-06-04 20:57:52 -05:00
Matt Mackall
fd94af4829 revset: sort the predicate list 2010-06-04 10:27:23 -05:00
Matt Mackall
4fb1269ccb revset: fix - handling in the optimizer 2010-06-04 10:26:55 -05:00
Matt Mackall
db01b4c21d revset: fix up tests 2010-06-03 20:32:41 -05:00
Matt Mackall
8b6cd36757 revset: add tagged predicate 2010-06-03 17:39:40 -05:00
Matt Mackall
485a62ae68 revset: optimize the parse tree directly
Rather than dynamically optimize in methods, we pre-optimize the parse tree
directly. This also lets us do some substitution on some of the
symbols like - and ::.
2010-06-03 17:39:34 -05:00
Matt Mackall
96ee2ad35a revset: add support for prefix and suffix versions of : and :: 2010-06-02 14:07:46 -05:00
Matt Mackall
c3f24aa62b revset: introduce revset core 2010-06-01 11:18:57 -05:00
Peter Arrenbrecht
d4abc4d642 discovery: resurrect findoutgoing as findcommonoutgoing for extension hooks
discovery.findoutgoing used to be a useful hook for extensions like
hgsubversion. This patch reintroduces this version of findcommonincoming
which is meant to be used when computing outgoing changesets.
2011-05-06 14:44:18 +02:00
Mads Kiilerich
6cadc46456 revset: avoid over-aggresive optimizations of non-filtering functions (issue2549)
When limit, last, min and max were evaluated they worked on a reduced set in the
wrong way. Now they work on an unrestricted set (the whole repo) and get
limited later on.
2011-05-01 17:35:05 +02:00
Alexander Solovyov
2f6ab6bf04 revset aliases 2011-04-30 18:30:14 +02:00
Peter Arrenbrecht
b867e650e6 discovery: drop findoutgoing and simplify findcommonincoming's api
This is a long desired cleanup and paves the way for new discovery.
To specify subsets for bundling changes, all code should use the heads
of the desired subset ("heads") and the heads of the common subset
("common") to be excluded from the bundled set. These can be used
revlog.findmissing instead of revlog.nodesbetween.

This fixes an actual bug exposed by the change in test-bundle-r.t
where we try to bundle a changeset while specifying that said changeset
is to be assumed already present in the target. This used to still
bundle the changeset. It no longer does. This is similar to the bugs
fixed by the recent switch to heads/common for incoming/pull.
2011-04-30 17:21:37 +02:00
Kevin Gessner
ee9623e8dc revset: add missing whitespace 2011-04-30 18:25:45 +02:00
Kevin Gessner
c6374d2d98 revset: add ^ and ~ operators from parentrevspec extension
^ (Nth parent) and ~ (Nth first ancestor) are infix operators that match
certain ancestors of the set:

  set^0
  the set

  set^1 (also available as set^)
  the first parent of every changeset in set

  set^2
  the second parent of every changeset in set

  set~0
  the set

  set~1
  the first ancestor (i.e. the first parent) of every changeset in set

  set~2
  the second ancestor (i.e. first parent of first parent) of every changeset
  in set

  set~N
  the Nth ancestor (following first parents only) of every changeset in set;
  set~N is equivalent to set^1^1..., with ^1 repeated N times.
2011-04-30 17:43:04 +02:00
Matt Mackall
d1ce6e070f revsets: add a last function
last(set, n) = reverser(limit(reverse(set), n))
2011-04-30 10:56:43 -05:00
Brodie Rao
9c3a456083 revset: fix undefined name ParseError 2011-04-30 06:58:22 -07:00
Idan Kamara
cb694c6958 revset: optimize stringset when subset == entire repo
if range(len(repo)) is passed to stringset and x is a valid rev
(checked before) then x is guaranteed to be in subset, we can check
for that by comparing the lengths of the sets
2011-04-15 20:07:44 +03:00
Augie Fackler
52f8941398 revsets: preserve ordering with the or operator
This is valuable because now revsets like 'bookmarks() or tip' will
always show tip after bookmarks unless tip was itself a bookmark. This
is a somewhat contrived example, but this behavior is useful for
"where am I" type aliases that use log and revsets.
2011-04-13 12:30:41 -05:00
Idan Kamara
05b035daf6 revset: rearrange code so functions are sorted alphabetically 2011-04-08 17:47:58 +03:00
Idan Kamara
32b6eeef14 revset: abort when tag or bookmark doesn't exist 2011-04-07 19:24:16 +03:00
Idan Kamara
35ad577c17 revset: replace for-loop with list comprehension 2011-04-07 16:20:40 +03:00
Matt Mackall
a8dd64dcb0 misc: replace .parents()[0] with p1() 2011-04-04 16:21:59 -05:00
Matt Mackall
8bd04923bb revset: teach optimizer that closed is slowish 2011-04-04 14:21:54 -05:00
Matt Mackall
49184b9450 # User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1289564504 -3600
# Node ID b75264c15cc888cf38c3c7b8f619801e3c2589c7
# Parent  89b2e5d940f669e590096c6be70eee61c9172fff
revsets: overload the branch() revset to also take a branch name.

This should only change semantics in the specific case of a tag/branch
conflict where the tag wasn't done on the branch with the same
name. Previously, branch(whatever) would resolve to the branch of the
tag in that case, whereas now it will resolve to the branch of the
name. The previous behaviour, while documented, seemed very
counter-intuitive to me.

An alternate approach would be to introduce a new revset such as
branchname() or namedbranch(). While this would retain backwards
compatibility, the distinction between it and branch() would not be
readily apparent to users. The most intuitive behaviour would be to
have branch(x) require 'x' to be a branch name, and something like
branchof(x) or samebranch(x) do what branch(x) currently
does. Unfortunately, our backwards compatibility guarantees prevent us
from doing that.

Please note that while 'hg tag' guards against shadowing a branch, 'hg
branch' does not. Besides, even if it did, that wouldn't solve the
issue of conversions with such tags and branches...
2011-03-23 19:28:16 -05:00
Markus F.X.J. Oberhumer
489871ea69 revset: fix a number of highly dubious continue statements
This patch definitely needs a review and would also benefit from
some new testsuite entries.
2011-03-16 23:54:55 +01:00
Bernhard Leiner
baf797018e revset: report a parse error if a revset is not parsed completely (issue2654) 2011-03-16 23:09:14 +01:00
Benoit Boissinot
544721ef7a revset: add a revset command to get bisect state. 2011-03-12 18:48:30 +01:00
Patrick Mezard
d297dd65c7 help: extract items doc generation function 2011-03-12 12:46:31 +01:00