Mercurial > hg
changeset 14132:7d3bd0640262
graphlog: take the union of --rev specs instead of the intersection
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 01 May 2011 15:51:48 +0200 |
parents | 03e1c2d35c6a |
children | 28085b82f801 |
files | hgext/graphlog.py tests/test-glog.t |
diffstat | 2 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/graphlog.py Sun May 01 15:51:46 2011 +0200 +++ b/hgext/graphlog.py Sun May 01 15:51:48 2011 +0200 @@ -257,6 +257,7 @@ 'prune': (2, 'not ($ or ancestors($))'), 'user': (2, 'user($)'), } + optrevset = [] revset = [] for op, val in opts.iteritems(): if not val: @@ -269,17 +270,24 @@ arity, revop = opt2revset[op] revop = revop.replace('$', '%(val)r') if arity == 0: - revset.append(revop) + optrevset.append(revop) elif arity == 1: - revset.append(revop % {'val': val}) + optrevset.append(revop % {'val': val}) else: for f in val: - revset.append(revop % {'val': f}) + optrevset.append(revop % {'val': f}) for path in pats: - revset.append('file(%r)' % path) + optrevset.append('file(%r)' % path) - revset = ' and '.join(revset) or 'all()' + if revset or optrevset: + if revset: + revset = ['(' + ' or '.join(revset) + ')'] + if optrevset: + revset.append('(' + ' and '.join(optrevset) + ')') + revset = ' and '.join(revset) + else: + revset = 'all()' # we want reverted revset to build graph revset = 'reverse(%s)' % revset if opts['limit']:
--- a/tests/test-glog.t Sun May 01 15:51:46 2011 +0200 +++ b/tests/test-glog.t Sun May 01 15:51:48 2011 +0200 @@ -1319,12 +1319,13 @@ file(File) + limit + -ra:b, b < tip: $ hg glog -l1 -r32:34 -r 'file("a")' - o changeset: 34:fea3ac5810e0 - | parent: 32:d06dffa21a31 - | user: test - | date: Thu Jan 01 00:00:34 1970 +0000 - | summary: (34) head - | + o changeset: 31:621d83e11f67 + |\ parent: 21:d42a756af44d + | | parent: 30:6e11cd4b648f + | | user: test + | | date: Thu Jan 01 00:00:31 1970 +0000 + | | summary: (31) expand + | | limit(file(File) and a::b), b < tip: @@ -1453,3 +1454,11 @@ $ hg log -G --follow a abort: -G/--graph option is incompatible with --follow with file argument [255] + +Test multiple revision specifications are correctly handled + + $ hg log -G -r 27 -r 25 --branch default --template '{rev}\n' + o 25 + |\ + +---o 27 + | |