Show More
@@ -1287,12 +1287,12 b' def heads(ui, repo, **opts):' | |||||
1287 | are the usual targets for update and merge operations. |
|
1287 | are the usual targets for update and merge operations. | |
1288 | """ |
|
1288 | """ | |
1289 | if opts['rev']: |
|
1289 | if opts['rev']: | |
1290 | heads = repo.heads(repo.lookup(rev)) |
|
1290 | heads = repo.heads(repo.lookup(opts['rev'])) | |
1291 | else: |
|
1291 | else: | |
1292 | heads = repo.heads() |
|
1292 | heads = repo.heads() | |
1293 | br = None |
|
1293 | br = None | |
1294 | if opts['branches']: |
|
1294 | if opts['branches']: | |
1295 |
br = repo.branchlookup( |
|
1295 | br = repo.branchlookup(heads) | |
1296 | for n in heads: |
|
1296 | for n in heads: | |
1297 | show_changeset(ui, repo, changenode=n, brinfo=br) |
|
1297 | show_changeset(ui, repo, changenode=n, brinfo=br) | |
1298 |
|
1298 | |||
@@ -2241,7 +2241,7 b' table = {' | |||||
2241 | "heads": |
|
2241 | "heads": | |
2242 | (heads, |
|
2242 | (heads, | |
2243 | [('b', 'branches', None, _('find branch info')), |
|
2243 | [('b', 'branches', None, _('find branch info')), | |
2244 |
('r', 'rev', |
|
2244 | ('r', 'rev', "", _('show only heads which are descendants of rev'))], | |
2245 | _('hg heads [-b] [-r <rev>]')), |
|
2245 | _('hg heads [-b] [-r <rev>]')), | |
2246 | "help": (help_, [], _('hg help [COMMAND]')), |
|
2246 | "help": (help_, [], _('hg help [COMMAND]')), | |
2247 | "identify|id": (identify, [], _('hg identify')), |
|
2247 | "identify|id": (identify, [], _('hg identify')), |
@@ -613,7 +613,7 b' class localrepository:' | |||||
613 | self.dirstate.update([dest], "a") |
|
613 | self.dirstate.update([dest], "a") | |
614 | self.dirstate.copy(source, dest) |
|
614 | self.dirstate.copy(source, dest) | |
615 |
|
615 | |||
616 |
def heads(self, start= |
|
616 | def heads(self, start=None): | |
617 | heads = self.changelog.heads(start) |
|
617 | heads = self.changelog.heads(start) | |
618 | # sort the output in rev descending order |
|
618 | # sort the output in rev descending order | |
619 | heads = [(-self.changelog.rev(h), h) for h in heads] |
|
619 | heads = [(-self.changelog.rev(h), h) for h in heads] |
@@ -409,10 +409,15 b' class revlog:' | |||||
409 | assert heads |
|
409 | assert heads | |
410 | return (orderedout, roots, heads) |
|
410 | return (orderedout, roots, heads) | |
411 |
|
411 | |||
412 |
def heads(self, start= |
|
412 | def heads(self, start=None): | |
413 | """return the list of all nodes that have no children |
|
413 | """return the list of all nodes that have no children | |
414 | if start is specified, only heads that are children of |
|
414 | ||
415 | start will be returned""" |
|
415 | if start is specified, only heads that are descendants of | |
|
416 | start will be returned | |||
|
417 | ||||
|
418 | """ | |||
|
419 | if start is None: | |||
|
420 | start = nullid | |||
416 | reachable = {start: 1} |
|
421 | reachable = {start: 1} | |
417 | heads = {start: 1} |
|
422 | heads = {start: 1} | |
418 | startrev = self.rev(start) |
|
423 | startrev = self.rev(start) |
General Comments 0
You need to be logged in to leave comments.
Login now