# HG changeset patch # User Oben Sonne # Date 1311017192 -7200 # Mon Jul 18 21:26:32 2011 +0200 # Node ID 832220ba4b56ef97bc204c23b8885d57d14050eb # Parent 87bb785c574fd32a84749d43732368cc15a121d1 # Parent 46c042e1e1596bd5bda69c4a7998d15b76c382cc Merge with talklittle's fork diff --git a/compass.py b/compass.py --- a/compass.py +++ b/compass.py @@ -76,6 +76,8 @@ self.repo = repo self.out_closed = not opts["hide_closed"] self.out_inactive = not opts["hide_inactive"] + self.branchtags_cached = None + self.branchtags_repo = None # all head revisions self.head_revs = _csi2rev(repo, repo.heads()) @@ -120,6 +122,13 @@ revs.remove(ctx.rev()) return revs + def branchtags(self): + """Get branch tags of the repo, using cache if available.""" + if self.repo != self.branchtags_repo: + self.branchtags_cached = self.repo.branchtags() + self.branchtags_repo = self.repo + return self.branchtags_cached + class BranchInfo(object): """Various information about a branch.""" @@ -127,7 +136,7 @@ self.name = name - self.tip_rev = _csi2rev(ri.repo, ri.repo.branchtags()[name]) + self.tip_rev = _csi2rev(ri.repo, ri.branchtags()[name]) self.head_revs = bh_revs self.head_revs_bm = [x for x in self.head_revs if x in ri.bm_revs] self.head_revs_active = [x for x in self.head_revs if x in ri.head_revs]