Show More
@@ -1618,6 +1618,34 b' def cleanupnode(ui, repo, name, nodes):' | |||||
1618 | # This would reduce bundle overhead |
|
1618 | # This would reduce bundle overhead | |
1619 | repair.strip(ui, repo, c) |
|
1619 | repair.strip(ui, repo, c) | |
1620 |
|
1620 | |||
|
1621 | def safecleanupnode(ui, repo, name, nodes): | |||
|
1622 | """strip or obsolete nodes | |||
|
1623 | ||||
|
1624 | nodes could be either a set or dict which maps to replacements. | |||
|
1625 | nodes could be unknown (outside the repo). | |||
|
1626 | """ | |||
|
1627 | supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) | |||
|
1628 | if supportsmarkers: | |||
|
1629 | if util.safehasattr(nodes, 'get'): | |||
|
1630 | # nodes is a dict-like mapping | |||
|
1631 | # use unfiltered repo for successors in case they are hidden | |||
|
1632 | urepo = repo.unfiltered() | |||
|
1633 | def getmarker(prec): | |||
|
1634 | succs = tuple(urepo[n] for n in nodes.get(prec, ())) | |||
|
1635 | return (repo[prec], succs) | |||
|
1636 | else: | |||
|
1637 | # nodes is a set-like | |||
|
1638 | def getmarker(prec): | |||
|
1639 | return (repo[prec], ()) | |||
|
1640 | # sort by revision number because it sound "right" | |||
|
1641 | sortednodes = sorted([n for n in nodes if n in repo], | |||
|
1642 | key=repo.changelog.rev) | |||
|
1643 | markers = [getmarker(t) for t in sortednodes] | |||
|
1644 | if markers: | |||
|
1645 | obsolete.createmarkers(repo, markers) | |||
|
1646 | else: | |||
|
1647 | return cleanupnode(ui, repo, name, nodes) | |||
|
1648 | ||||
1621 | def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs): |
|
1649 | def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs): | |
1622 | if isinstance(nodelist, str): |
|
1650 | if isinstance(nodelist, str): | |
1623 | nodelist = [nodelist] |
|
1651 | nodelist = [nodelist] |
General Comments 0
You need to be logged in to leave comments.
Login now