Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/namespaces.py @ 23775:885c0290f7d5
localrepo: add ignoremissing parameter to branchtip
Previously, in the namespaces api, the only caller of branchtip was singlenode
which happened to raise the same exception that branchtip raised: KeyError.
This is a minor change but will allow upcoming patches to use repo.branchtip to
not raise an exception if a branch doesn't exist. After that, it will be
possible for extensions to use the namespace api in a stable way.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Thu, 16 Oct 2014 21:49:28 -0700 |
parents | b9537ee87961 |
children | 9f48242929a9 |
comparison
equal
deleted
inserted
replaced
23774:b9537ee87961 | 23775:885c0290f7d5 |
---|---|
39 lambda repo, name: repo.nodetags(name)) | 39 lambda repo, name: repo.nodetags(name)) |
40 self.addnamespace(n) | 40 self.addnamespace(n) |
41 | 41 |
42 n = ns("branches", "branch", | 42 n = ns("branches", "branch", |
43 lambda repo: repo.branchmap().keys(), | 43 lambda repo: repo.branchmap().keys(), |
44 lambda repo, name: tolist(repo.branchtip(name)), | 44 lambda repo, name: tolist(repo.branchtip(name, True)), |
45 lambda repo, node: [repo[node].branch()]) | 45 lambda repo, node: [repo[node].branch()]) |
46 self.addnamespace(n) | 46 self.addnamespace(n) |
47 | 47 |
48 def __getitem__(self, namespace): | 48 def __getitem__(self, namespace): |
49 """returns the namespace object""" | 49 """returns the namespace object""" |