Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 9663:4164a17e7126
log: tidy up some filter tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 29 Oct 2009 17:07:54 -0500 |
parents | f3d60543924f |
children | 1de5ebfa5585 |
comparison
equal
deleted
inserted
replaced
9662:f3d60543924f | 9663:4164a17e7126 |
---|---|
2033 | 2033 |
2034 df = False | 2034 df = False |
2035 if opts["date"]: | 2035 if opts["date"]: |
2036 df = util.matchdate(opts["date"]) | 2036 df = util.matchdate(opts["date"]) |
2037 | 2037 |
2038 only_branches = opts.get('only_branch') | |
2039 | |
2040 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) | 2038 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) |
2041 def prep(ctx, fns): | 2039 def prep(ctx, fns): |
2042 rev = ctx.rev() | 2040 rev = ctx.rev() |
2043 parents = [p for p in repo.changelog.parentrevs(rev) | 2041 parents = [p for p in repo.changelog.parentrevs(rev) |
2044 if p != nullrev] | 2042 if p != nullrev] |
2045 if opts.get('no_merges') and len(parents) == 2: | 2043 if opts.get('no_merges') and len(parents) == 2: |
2046 return | 2044 return |
2047 if opts.get('only_merges') and len(parents) != 2: | 2045 if opts.get('only_merges') and len(parents) != 2: |
2048 return | 2046 return |
2049 if only_branches and ctx.branch() not in only_branches: | 2047 if opts.get('only_branch') and ctx.branch() not in opts['only_branch']: |
2050 return | 2048 return |
2051 if df and not df(ctx.date()[0]): | 2049 if df and not df(ctx.date()[0]): |
2052 return | 2050 return |
2053 | 2051 if opts['user'] and not [k for k in opts['user'] if k in ctx.user()]: |
2052 return | |
2054 if opts.get('keyword'): | 2053 if opts.get('keyword'): |
2055 miss = 0 | |
2056 for k in [kw.lower() for kw in opts['keyword']]: | 2054 for k in [kw.lower() for kw in opts['keyword']]: |
2057 if not (k in ctx.user().lower() or | 2055 if (k in ctx.user().lower() or |
2058 k in ctx.description().lower() or | 2056 k in ctx.description().lower() or |
2059 k in " ".join(ctx.files()).lower()): | 2057 k in " ".join(ctx.files()).lower()): |
2060 miss = 1 | |
2061 break | 2058 break |
2062 if miss: | 2059 else: |
2063 return | |
2064 | |
2065 if opts['user']: | |
2066 if not [k for k in opts['user'] if k in ctx.user()]: | |
2067 return | 2060 return |
2068 | 2061 |
2069 copies = [] | 2062 copies = [] |
2070 if opts.get('copies') and rev: | 2063 if opts.get('copies') and rev: |
2071 for fn in ctx.files(): | 2064 for fn in ctx.files(): |