Commit Graph

68 Commits

Author SHA1 Message Date
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
Pierre-Yves David
2213bfcae4 revset-_descendant: rework the whole sorting and combining logic
We use the & operator to combine with subset (since this is more likely to be
optimised than filter) and we enforce the sorting of the result. Without this
enforced sorting, we may result in a different iteration order than the set
_descendent was computed from.

This reverts a bad `test-glog.t` change from 7904906883bd.

Another side effect is that `test-mq.t` shows `qparent::` including `-1` if
`qparent is -1`. This sound like a positive change.

This has good and bad impacts on the benchmarks, here is a good ones:

revset: 0::
before) wall 0.045489 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
after)  wall 0.034330 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)

revset: roots((0::) - (0::tip))
before)  wall 0.134090 comb 0.140000 user 0.140000 sys 0.000000 (best of 63)
after) wall 0.128346 comb 0.130000 user 0.130000 sys 0.000000 (best of 69)

revset: ::p1(p1(tip))::
before) wall 0.143892 comb 0.140000 user 0.140000 sys 0.000000 (best of 55)
after)  wall 0.124502 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

revset: roots((0:tip)::)
before) wall 0.204966 comb 0.200000 user 0.200000 sys 0.000000 (best of 43)
after) wall 0.184455 comb 0.180000 user 0.180000 sys 0.000000 (best of 47)

Here is a bad one:

revset: (20000::) - (20000)
before) wall 0.009592 comb 0.010000 user 0.010000 sys 0.000000 (best of 222)
after)  wall 0.029837 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
2014-10-09 09:12:54 -07:00
Durham Goode
4bf8cd87a5 log: allow patterns with -f
It's not uncommon for a user to want to run log with a pattern or directory name
on the history of their current commit.  Currently we prevent that, but
I can't think of any reason to continue blocking that.

This commit removes the restriction and allows 'hg log -f <dir/pat>'
2014-07-22 22:40:16 -07:00
Lucas Moscovicz
2794920df6 log: changed implementation to use graphlog code
Now that revsets work in a lazy way, log code can be changed to parse every
option into a revset and then evaluate it lazily.

Now expressions like

  "hg log -b default -b ."

are converted into a revset using the same code as graphlog.
2014-02-28 15:10:56 -08:00
Matt Mackall
34b49de789 diff: use second filename for --stat reporting on git patches (issue4221) 2014-04-11 16:38:55 -04:00
Cristian Zamfir
c85ed151ff hg log: solves bug regarding hg log -r 0:null (issue4039)
'hg log -r 0:null' was showing only one changeset(the '-1' one) instead of the first two changesets.
2014-03-12 10:26:48 +02:00
Martin Geisler
7316194bdf tests: don't load unnecessary graphlog extension
Since graphlog is in core, we can use 'hg log -G' instead.
2013-11-22 19:14:17 +01:00
Alexander Plavin
48936f264c revlog: fix a regression with null revision
Introduced in the patch which fixes issue3497
Part of that patch was erroneously submitted and it shouldn't be in the code
2013-04-18 16:46:09 +04:00
Alexander Plavin
829cf92d16 log: fix behavior with empty repositories (issue3497)
Make output in this special case consistent with general case one.
2013-04-17 00:29:54 +04:00
Kevin Bullock
c54ed8bf64 tests: add regression tests for another revrange edge case
These tests would've passed before 99686e12b04e and a8620592704a.
Inserting them to make sure that continues to be the case.
2013-01-23 11:55:39 -06:00
Bryan O'Sullivan
9937540784 graphmod: don't try to visit nullrev (issue3772) 2013-01-23 00:20:26 -06:00
Pierre-Yves David
e30cc15ae0 test: use obsolescence marker to test hidden
Instead of using a custom dedicated extension.
2012-12-04 15:25:22 +01:00
Pierre-Yves David
76446449c3 test: remove invalid hidden rev in graphlog test
The hidden set of revision can not have descendant outside this set.

The extension is patched to raise and exception when this happen.
2012-08-30 22:13:24 +02:00
Mads Kiilerich
59664fd950 check-code: fix check for trailing whitespace on continued lines too
The tests in test-annotate.t and test-import-git.t that relied on trailing
space in a file created by a here string is now masked by a literal 'EOL'
string that is removed.
2012-08-08 18:10:37 +02:00
Pierre-Yves David
edc2b520d9 hidden: move hiddenrevs set on the repository
This set is always accessed through the repo for now. Having this set
carried by the changelog make it complicated to:

- initialize it, computing hidden set may involve revset call
- lazy compute it, (1) only the changelog can detect someone access it,
                   (2) only the repo have enought knowledge to compute it.

In later version I expect he changelog to apply filtering itself and the set to
be carried by changelog again.
2012-07-16 17:44:46 +02:00
Patrick Mezard
2d4a0ad972 graphlog: extract revset/support functions into cmdutil 2012-07-14 18:55:21 +02:00
Mads Kiilerich
c60c80f534 graphlog: don't truncate template value at last \n
Most uses of templates requires a trailing newline to get vertical output.

Graphlog with a template without trailing newline did however not just create
horisontal output like other commands would but truncated the output at the
last \n. Template values without any \n were ignored completely.

Graphlog will now only eat one trailing newline before it lets the flow of the
graph add the necessary vertical space.
2012-07-06 00:30:18 +02:00
Mads Kiilerich
db42f91a88 tests: convert some 'hghave no-outer-repo' to #if
In some places we instead use 'hg init' to create a well-known outer repo
without any special extensions or other config settings.
2012-06-20 23:41:21 +02:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Mads Kiilerich
8a7b2bbc7f tests: hide diff -u saying 'No differences encountered' on solaris 2012-04-23 01:39:26 +02:00
Patrick Mezard
aa91736f8f graphlog: fix --follow FILE and relative paths
The situation is complicated because filelog() revset uses a match object in
relpath mode while follow() revset interprets the filename as a manifest entry.
2012-04-14 11:27:11 +02:00
Patrick Mezard
923d3cc5c3 graphlog: implement --hidden 2012-04-14 10:30:38 +02:00
Patrick Mezard
00224d1ac6 graphlog: correctly handle calls in subdirectories 2012-04-11 11:32:00 +02:00
Patrick Mezard
a07861a2e3 graphlog: fix --follow-first --rev combinations
This solves a similar problem than the previous --follow/--rev patch. This time
we need changelog.ancestors()/descendants() filtering on first parent.
Duplicating the code looked better than introducing keyword arguments. Besides,
the ancestors() version was already implemented in follow() revset.
2012-04-11 11:25:34 +02:00
Patrick Mezard
50ca715022 graphlog: fix --follow --rev combinations
The previous behaviour of --follow was really a subset of what is really
happening in log command:
- If --rev is not passed, default to '.:0'
- Resolve --rev into a revision list "revs"
- Set the starting revision to revs[0]
- If revs[1] > revs[0] keep descendants(revs[0]) in revs, otherwise keep
  ancestors.
2012-04-11 11:22:40 +02:00
Patrick Mezard
d269778e3e graphlog: support changeset identifiers in --branch 2012-04-11 11:17:26 +02:00
Patrick Mezard
d282c91c89 graphlog: refactor revset() to return revisions
When --follow and --rev are passed, --follow actual behaviour depends on the
input revision sequence defined by --rev. If --rev is not passed, the default
revision sequence depends on the presence of --follow. It means the revision
sequence generation is part of log logic and must be wrapped. The issue
described above is fixed in following patches.
2012-04-11 11:07:30 +02:00
Patrick Mezard
c3cb584665 graphlog: handle old-style --rev values
--rev options cannot be merged into a single revset because we do not know if
they are valid revset or old-style revision specifications, like 'foo-bar'
tags. Instead, a base revision set is generated with scmutil.revrange() then
filtered with the revset built from log options. It also fixes incorrect or
hostile expressions passed in --rev.
2012-03-29 22:42:03 +02:00
Patrick Mezard
ac1ed61cb2 test-glog: pretty print revset expressions 2012-03-29 17:13:23 +02:00
Patrick Mezard
f3d3c12a18 graphlog: apply file filters --patch/--stat output
When passing --patch/--stat, file filters have to be applied to generate the
correct diff or stat output:
- Without --follow, the static match object can be reused
- With --follow, the files displayed at revision X are the ancestors of
  selected files at parent revision. To do this, we reproduce the ancestry
  calculations done by --follow, lazily.

test-glog.t changes show that --patch output is not satisfying because renames
are reported as copies. This can probably be fixed by:

- Without --follow: compute files to display, look for renames sources and
  extend the matcher to include them.
- With --follow: detect .path() transitions between parent/child filectx,
  filter them using the linked changectx .removed() field and extend fcache
  with them.
2012-02-26 17:12:15 +01:00
Patrick Mezard
24d8a81475 graphlog: fix --removed
"hg log --removed FILE" does not return changesets where FILE was removed, but
ones where FILE was changed and possibly removed. The flag is really here to
disable walkchangerevs() fast path, which cannot see file removals by scanning
filelogs.
2012-02-26 17:10:57 +01:00
Patrick Mezard
426cfb6a84 test-glog: rewrite more tests using testlog() function 2012-02-26 17:10:56 +01:00
Patrick Mezard
8d52be3d10 match: consider filesets as "anypats"
Matt suggested this on IRC, I do not think the choice is obvious, but this one
makes things simpler because while filesets are turned into a list of files
into the match objects, it would more be difficult to tell invalid files passed
in pats from those expanded from filesets.
2012-02-26 17:10:55 +01:00
Patrick Mezard
14c70f7752 graphlog: evaluate FILE/-I/-X filesets on the working dir
This subtlety is not documented yet but:
- pats/--include/--exclude filesets are evaluated against the working directory
- --rev filesets are reevaluated against every revisions
2012-02-26 17:10:51 +01:00
Patrick Mezard
51f38c7a7c graphlog: implement --copies 2012-02-26 16:56:32 +01:00
Patrick Mezard
38c46923b9 graphlog: implement --follow-first
log --graph --follow-first FILE cannot be compared with the regular version
because it never worked: --follow-first is not taken in account in
walkchangerevs() fast path and is explicitely bypassed in FILE case in
walkchangerevs() nested iterate() function.
2012-02-25 22:11:36 +01:00
Patrick Mezard
7207e784b2 graphlog: implement --follow with file arguments 2012-02-25 22:11:36 +01:00
Patrick Mezard
3d400f0559 test-glog: test multiple --prune values 2012-02-25 22:11:35 +01:00
Patrick Mezard
22a413e426 graphlog: restore FILE glob expansion on Windows
On platforms not supporting shell expansion, scmutil.match() performs glob
expansion on 'pats' arguments. But _matchfiles() revset calls match.match()
directly, bypassing this behaviour. To avoid duplicating scmutil.match(), a
secondary scmutil.matchandpats() is introduced returning both the match object
and the expanded inputs. Note the expanded pats are also needed in the fast
path, and will be used by --follow code path.
2012-02-25 22:11:34 +01:00
Patrick Mezard
b623e68723 glog: restore multiple --rev test lost in rebasing 2012-02-25 21:51:13 +01:00
Patrick Mezard
4dca114aca graphlog: paths/-I/-X handling requires a new revset
The filtering logic of match objects cannot be reproduced with the existing
revsets as it operates at changeset files level. A changeset touching "a" and
"b" is matched by "-I a -X b" but not by "file(a) and not file(b)".

To solve this, a new internal "_matchfiles(...)" revset is introduced. It works
like "file(x)" but accepts more than one argument and its arguments are
prefixed with "p:", "i:" and "x:" to be used as patterns, include patterns or
exclude patterns respectively.

The _matchfiles revset is kept private for now:
- There are probably smarter ways to pass the arguments in a user-friendly way
- A "rev:" argument is likely appear at some point to emulate log command
  behaviour with regard to filesets: they are evaluated for the parent revision
  and applied everywhere instead of being reevaluated for each revision.
2012-02-23 18:05:20 +01:00
Patrick Mezard
1b972fd9a8 graphlog: imitate log slowpath when inputs are explicit files 2012-02-23 17:55:07 +01:00
Patrick Mezard
bda40c8a55 graphlog: paths arguments must be or'ed 2012-02-23 17:54:42 +01:00
Patrick Mezard
41e01db02e graphlog: rewrite --rev like all other options 2012-02-23 11:21:30 +01:00
Patrick Mezard
ef23be02e3 graphlog: --branch and --only-branch are the same
Handling the aliasing in fancyopts would be cleaner but I do not want to make
this change for stable.
2012-02-23 11:21:04 +01:00
Patrick Mezard
7fa94e616c graphlog: multiple --keyword must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
5be7a248ec graphlog: multiple --branch must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
89b24bd8b3 graphlog: multiple --user must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
a2ea7bb50f graphlog: explicitely join multivalue parameters
This will let use override the "join" value (and/or) depending on the option
considered. The option revset arity is now deduced from the revset and the
option value type, to simplify opt2revset definition.
2012-02-22 12:30:15 +01:00