##// END OF EJS Templates
localrepo: fix bugs in branchheads and add docstring...
Sune Foldager -
r9475:c295a82a default
parent child Browse files
Show More
@@ -1183,17 +1183,24 b' class localrepository(repo.repository):'
1183 1183 return [n for (r, n) in sorted(heads)]
1184 1184
1185 1185 def branchheads(self, branch=None, start=None, closed=False):
1186 '''return a (possibly filtered) list of heads for the given branch
1187
1188 Heads are returned in topological order, from newest to oldest.
1189 If branch is None, use the dirstate branch.
1190 If start is not None, return only heads reachable from start.
1191 If closed is True, return heads that are marked as closed as well.
1192 '''
1186 1193 if branch is None:
1187 1194 branch = self[None].branch()
1188 1195 branches = self.branchmap()
1189 1196 if branch not in branches:
1190 1197 return []
1191 bheads = branches[branch]
1192 1198 # the cache returns heads ordered lowest to highest
1193 bheads.reverse()
1199 bheads = list(reversed(branches[branch]))
1194 1200 if start is not None:
1195 1201 # filter out the heads that cannot be reached from startrev
1196 bheads = self.changelog.nodesbetween([start], bheads)[2]
1202 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
1203 bheads = [h for h in bheads if h in fbheads]
1197 1204 if not closed:
1198 1205 bheads = [h for h in bheads if
1199 1206 ('close' not in self.changelog.read(h)[5])]
@@ -68,8 +68,8 b' 0'
68 68 3: Adding b branch head 1
69 69 0
70 70 -------
71 6: Merging b branch head 2 and b branch head 3
71 72 3: Adding b branch head 1
72 6: Merging b branch head 2 and b branch head 3
73 73 0
74 74 -------
75 75 no changes on branch b containing . are reachable from 7
General Comments 0
You need to be logged in to leave comments. Login now