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