Show More
@@ -249,18 +249,18 b' def revset(pats, opts):' | |||||
249 | """Return revset str built of revisions, log options and file patterns. |
|
249 | """Return revset str built of revisions, log options and file patterns. | |
250 | """ |
|
250 | """ | |
251 | opt2revset = { |
|
251 | opt2revset = { | |
252 |
'follow': ( |
|
252 | 'follow': ('follow()', None), | |
253 |
'no_merges': ( |
|
253 | 'no_merges': ('not merge()', None), | |
254 |
'only_merges': ( |
|
254 | 'only_merges': ('merge()', None), | |
255 |
'removed': ( |
|
255 | 'removed': ('removes("*")', None), | |
256 |
'date': ( |
|
256 | 'date': ('date($)', None), | |
257 |
'branch': ( |
|
257 | 'branch': ('branch($)', ' and '), | |
258 |
'exclude': ( |
|
258 | 'exclude': ('not file($)', ' and '), | |
259 |
'include': ( |
|
259 | 'include': ('file($)', ' and '), | |
260 |
'keyword': ( |
|
260 | 'keyword': ('keyword($)', ' and '), | |
261 |
'only_branch': ( |
|
261 | 'only_branch': ('branch($)', ' and '), | |
262 |
'prune': ( |
|
262 | 'prune': ('not ($ or ancestors($))', ' and '), | |
263 |
'user': ( |
|
263 | 'user': ('user($)', ' and '), | |
264 | } |
|
264 | } | |
265 | optrevset = [] |
|
265 | optrevset = [] | |
266 | revset = [] |
|
266 | revset = [] | |
@@ -272,15 +272,16 b' def revset(pats, opts):' | |||||
272 | revset.extend(val) |
|
272 | revset.extend(val) | |
273 | if op not in opt2revset: |
|
273 | if op not in opt2revset: | |
274 | continue |
|
274 | continue | |
275 |
|
|
275 | revop, andor = opt2revset[op] | |
276 | revop = revop.replace('$', '%(val)r') |
|
276 | if '$' not in revop: | |
277 | if arity == 0: |
|
|||
278 | optrevset.append(revop) |
|
277 | optrevset.append(revop) | |
279 | elif arity == 1: |
|
|||
280 | optrevset.append(revop % {'val': val}) |
|
|||
281 | else: |
|
278 | else: | |
282 | for f in val: |
|
279 | revop = revop.replace('$', '%(val)r') | |
283 | optrevset.append(revop % {'val': f}) |
|
280 | if not isinstance(val, list): | |
|
281 | expr = revop % {'val': val} | |||
|
282 | else: | |||
|
283 | expr = '(' + andor.join((revop % {'val': v}) for v in val) + ')' | |||
|
284 | optrevset.append(expr) | |||
284 |
|
285 | |||
285 | for path in pats: |
|
286 | for path in pats: | |
286 | optrevset.append('file(%r)' % path) |
|
287 | optrevset.append('file(%r)' % path) |
@@ -1419,7 +1419,7 b' Test log -G options' | |||||
1419 | abort: unknown revision 'something nice'! |
|
1419 | abort: unknown revision 'something nice'! | |
1420 | [255] |
|
1420 | [255] | |
1421 | $ hg log -G --print-revset -k 'something' -k 'nice' |
|
1421 | $ hg log -G --print-revset -k 'something' -k 'nice' | |
1422 | ('group', ('and', ('func', ('symbol', 'keyword'), ('string', 'something')), ('func', ('symbol', 'keyword'), ('string', 'nice')))) |
|
1422 | ('group', ('group', ('and', ('func', ('symbol', 'keyword'), ('string', 'something')), ('func', ('symbol', 'keyword'), ('string', 'nice'))))) | |
1423 | $ hg log -G --only-branch 'something nice' |
|
1423 | $ hg log -G --only-branch 'something nice' | |
1424 | abort: unknown revision 'something nice'! |
|
1424 | abort: unknown revision 'something nice'! | |
1425 | [255] |
|
1425 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now