Show More
@@ -223,34 +223,38 b' def check_unsupported_flags(opts):' | |||||
223 | def revset(pats, opts): |
|
223 | def revset(pats, opts): | |
224 | """Return revset str built of revisions, log options and file patterns. |
|
224 | """Return revset str built of revisions, log options and file patterns. | |
225 | """ |
|
225 | """ | |
226 | opt2revset = dict(only_merges='merge()', |
|
226 | opt2revset = { | |
227 | only_branch='branch($)', |
|
227 | 'follow': (0, 'follow()'), | |
228 |
|
|
228 | 'no_merges': (0, 'not merge()'), | |
229 | include='file($)', |
|
229 | 'only_merges': (0, 'merge()'), | |
230 | exclude='not file($)', |
|
230 | 'removed': (0, 'removes("*")'), | |
231 | prune='not ($ or ancestors($))', |
|
231 | 'date': (1, 'date($)'), | |
232 | user='user($)', |
|
232 | 'branch': (2, 'branch($)'), | |
233 | branch='branch($)', |
|
233 | 'exclude': (2, 'not file($)'), | |
234 | keyword='keyword($)', |
|
234 | 'include': (2, 'file($)'), | |
235 | follow='follow()', |
|
235 | 'keyword': (2, 'keyword($)'), | |
236 | removed='removes("*")') |
|
236 | 'only_branch': (2, 'branch($)'), | |
237 | opt2revset = dict((k, v.replace('$', '%(val)r')) |
|
237 | 'prune': (2, 'not ($ or ancestors($))'), | |
238 | for k,v in opt2revset.iteritems()) |
|
238 | 'user': (2, 'user($)'), | |
|
239 | } | |||
239 | revset = [] |
|
240 | revset = [] | |
240 | for op, val in opts.iteritems(): |
|
241 | for op, val in opts.iteritems(): | |
241 | if not val: |
|
242 | if not val: | |
242 | continue |
|
243 | continue | |
243 | revop = opt2revset.get(op, op) |
|
244 | if op == 'rev': | |
244 | if op in ('follow', 'only_merges', 'no_merges', 'removed'): |
|
245 | # Already a revset | |
245 |
revset. |
|
246 | revset.extend(val) | |
246 |
|
|
247 | if op not in opt2revset: | |
247 | revset.append('%s(%r)' % (revop, val)) |
|
248 | continue | |
248 | elif op in ('include', 'exclude', 'user', 'branch', 'keyword', |
|
249 | arity, revop = opt2revset[op] | |
249 | 'prune', 'only_branch'): |
|
250 | revop = revop.replace('$', '%(val)r') | |
|
251 | if arity == 0: | |||
|
252 | revset.append(revop) | |||
|
253 | elif arity == 1: | |||
|
254 | revset.append(revop % {'val': val}) | |||
|
255 | else: | |||
250 | for f in val: |
|
256 | for f in val: | |
251 | revset.append(revop % {'val': f}) |
|
257 | revset.append(revop % {'val': f}) | |
252 | elif op == 'rev': |
|
|||
253 | revset.extend(val) |
|
|||
254 |
|
258 | |||
255 | for path in pats: |
|
259 | for path in pats: | |
256 | revset.append('file(%r)' % path) |
|
260 | revset.append('file(%r)' % path) |
General Comments 0
You need to be logged in to leave comments.
Login now