comparison mercurial/commands.py @ 10960:ca739acf1a98

commands: add more robust support for 'hg log -b' (issue2078) Fixes issue2078 and adds tests to cover various 'hg log -b' uses. This change adds a localrepo.lookupbranch(key, remote=None) function. This will look up the branch of the revision with the given key. The algorithm works like this: * If a remote repo is given and KEY is the name of a branch in that repo, return KEY. * If no remote repo is given and KEY is the name of a branch in the local repo object, return KEY. * Otherwise look up the revision with the identifier KEY in the local repo and return its branch. This change also makes 'hg log -b' use this new functionality and adds a few tests for it.
author Steve Losh <steve@stevelosh.com>
date Mon, 12 Apr 2010 19:33:25 -0400
parents 021d5ac3bec0
children 8d5f5122a732
comparison
equal deleted inserted replaced
10959:d1f4657f55e4 10960:ca739acf1a98
2158 df = False 2158 df = False
2159 if opts["date"]: 2159 if opts["date"]:
2160 df = util.matchdate(opts["date"]) 2160 df = util.matchdate(opts["date"])
2161 2161
2162 opts['branch'] += opts.get('only_branch') 2162 opts['branch'] += opts.get('only_branch')
2163 opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']]
2163 2164
2164 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) 2165 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
2165 def prep(ctx, fns): 2166 def prep(ctx, fns):
2166 rev = ctx.rev() 2167 rev = ctx.rev()
2167 parents = [p for p in repo.changelog.parentrevs(rev) 2168 parents = [p for p in repo.changelog.parentrevs(rev)