diff -r 7bbc4e113e5f -r abf91c4f9608 mercurial/branchmap.py --- a/mercurial/branchmap.py Sun Sep 03 21:17:25 2017 +0900 +++ b/mercurial/branchmap.py Thu Aug 31 18:24:08 2017 +0300 @@ -211,10 +211,13 @@ Raise KeyError for unknown branch.''' return self._branchtip(self[branch])[0] + def iteropen(self, nodes): + return (n for n in nodes if n not in self._closednodes) + def branchheads(self, branch, closed=False): heads = self[branch] if not closed: - heads = [h for h in heads if h not in self._closednodes] + heads = list(self.iteropen(heads)) return heads def iterbranches(self):