Commit Graph

36 Commits

Author SHA1 Message Date
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
Patrick Mezard
0d86e86816 test-glog.t: use printrevset extension to trace rewritten revsets
Using "hg log -G --print-revset" prints the revset generated by graphlog and
exits. This helps debugging and writing shorter tests.

It has been suggested to handle these tests with doctests. I think the
extension approach is better because:
- It tests the actual parameter set passed to graphlog.revset(), not what we
  expect it to be. 'branch' and 'only-branch' are currently distinct options
  but nothing prevents fancyopts to grow a notion of option aliasing one day,
  where both options would be merged before reaching the command.
- It can be used as debug output interleaved with real log calls.

v2:
- Use a test extension instead of a global deprecated new option
2012-02-22 12:30:14 +01:00
Patrick Mezard
ebc1f0434a graphlog: always sort revisions topologically
The grapher cannot really handled revisions if they are not emitted in
topological order. The previous 'reverse()' revset was not enough to achieve
that and was replaced by an explicit sort call for simplicity. The --limit
option is now also handled as usual with cmdutil.loglimit() instead of a
'limit' revset.
2011-05-01 15:51:52 +02:00
Patrick Mezard
399c49e7c9 graphlog: take the union of --rev specs instead of the intersection 2011-05-01 15:51:48 +02:00
Patrick Mezard
6386b88096 graphmod: correctly emit nodes with more than 2 predecessors
The grandparent() function was returning only the closest predecessor of a
missing parent while it must return all of them to display a correct ancestry
graph.
2011-05-01 15:51:46 +02:00
Patrick Mezard
57542c9154 graphlog: log -G --follow file does not work, forbid it
We do not have revsets to follow file history.
2011-04-30 19:42:00 +02:00
Patrick Mezard
305ae5565a graphlog: fix log -G --prune
follow() revset really means '::.' while we want something based on the passed
argument. Also, ancestors() revset does not include the parent revisions.
2011-04-30 19:42:00 +02:00
Patrick Mezard
3c82515646 graphlog: escape log -G single value option arguments 2011-04-30 19:42:00 +02:00
Patrick Mezard
eec16f919e graphlog: fix log -G --removed
Current version was mispelled and processed like a valued argument.
2011-04-30 19:42:00 +02:00
Patrick Mezard
caf334a147 graphlog: fix log -G option types when translating to revset
For instance, --keyword is a multiple value option while it was processed as a
single value option.
2011-04-30 19:42:00 +02:00
Alexander Solovyov
f4250e8e9c graphlog: make use of graphmod's revset support 2011-04-23 15:04:15 +02:00
Alexander Solovyov
517dbf068d graphmod: use revsets internally
Thanks for the idea and most of the implementation to Klaus Koch

Backs revisions() and filerevs() with DAG walker which can iterate through
arbitrary list of revisions instead of strict one by one iteration from start to
stop. When a gap occurs in a revisions (i.e. in file log), the next topological
parent within the revset is searched and the connection to it is printed in the
ascii graph.

File graph can draw sometimes more connections than previous version, because
graph is produced according to the revset, not according to a file's filelog.

In case the graph contains several branches where the left parent is null, the
graphs for each are printed sequentially, not in parallel as it was a case
earlier (see for example the graph for README in hg-dev).
2011-03-13 15:53:38 +01:00
Klaus Koch
b52874b751 graphlog: give meaningful error if more than one file is given 2011-03-13 15:04:13 +01:00
Nicolas Dumazet
74d80b6b4f graphmod: safer code when a changeset has two identical parents
While this situation should never under normal use, some real
life repos sometimes contain such changesets (older hg versions,
broken rebases, etc...)

hgweb was displaying an "Internal error" in this case, and graphlog
displayed a redundant branch all the way to null: it does not cost us
much to just ignore this extra parent when constructing the DAG.
2010-11-08 22:45:56 +09:00
Kevin Bullock
15da3ac7f2 pull: silence spurious 'requesting all changes' message
When issuing `hg pull -r REV` in a repo with no common ancestor with the
remote repo, the message 'requesting all changes' is printed, even though only
the changese that are ancestors of REV are actually requested. This can be
confusing for users (see
http://www.selenic.com/pipermail/mercurial/2010-October/035508.html).

This silences the message if (and only if) the '-r' option was passed.
2010-10-20 17:38:21 -05:00
Mads Kiilerich
edf2794bd1 graphlog: style with header and footer (issue2395)
The glog command didn't emit header and footer from the style, as demonstrated
by "hg glog --style xml". Asciiart combined with xml markup hardly makes sense,
but header and footer might however be useful for adding for example html pre
tags around the graph.
2010-09-28 02:58:00 +02:00
Martin Geisler
3d112b3042 tests: added a short description to issue numbers
Many tests already had a short line to describe what IssueXXX is
about. I find that quite useful when reading a test.
2010-09-24 10:13:49 +02:00
Matt Mackall
ac660e9f65 tests: cleanup exit code handling in unified tests 2010-09-21 16:00:02 -05:00
Adrian Buehlmann
4cdbf9aebe tests: unify test-glog 2010-08-20 18:26:20 +02:00