Show More
@@ -1183,17 +1183,24 b' class localrepository(repo.repository):' | |||||
1183 | return [n for (r, n) in sorted(heads)] |
|
1183 | return [n for (r, n) in sorted(heads)] | |
1184 |
|
1184 | |||
1185 | def branchheads(self, branch=None, start=None, closed=False): |
|
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 | if branch is None: |
|
1193 | if branch is None: | |
1187 | branch = self[None].branch() |
|
1194 | branch = self[None].branch() | |
1188 | branches = self.branchmap() |
|
1195 | branches = self.branchmap() | |
1189 | if branch not in branches: |
|
1196 | if branch not in branches: | |
1190 | return [] |
|
1197 | return [] | |
1191 | bheads = branches[branch] |
|
|||
1192 | # the cache returns heads ordered lowest to highest |
|
1198 | # the cache returns heads ordered lowest to highest | |
1193 |
bheads |
|
1199 | bheads = list(reversed(branches[branch])) | |
1194 | if start is not None: |
|
1200 | if start is not None: | |
1195 | # filter out the heads that cannot be reached from startrev |
|
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 | if not closed: |
|
1204 | if not closed: | |
1198 | bheads = [h for h in bheads if |
|
1205 | bheads = [h for h in bheads if | |
1199 | ('close' not in self.changelog.read(h)[5])] |
|
1206 | ('close' not in self.changelog.read(h)[5])] |
@@ -68,8 +68,8 b' 0' | |||||
68 | 3: Adding b branch head 1 |
|
68 | 3: Adding b branch head 1 | |
69 | 0 |
|
69 | 0 | |
70 | ------- |
|
70 | ------- | |
|
71 | 6: Merging b branch head 2 and b branch head 3 | |||
71 | 3: Adding b branch head 1 |
|
72 | 3: Adding b branch head 1 | |
72 | 6: Merging b branch head 2 and b branch head 3 |
|
|||
73 | 0 |
|
73 | 0 | |
74 | ------- |
|
74 | ------- | |
75 | no changes on branch b containing . are reachable from 7 |
|
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