comparison hgext/histedit.py @ 31637:c4dd1e7c1dab

histedit: backout changeset 2b599f5468a4 Its parent is about to be backedout so this one needs to be removed too.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sun, 26 Mar 2017 15:34:39 +0200
parents 2b599f5468a4
children 259e5dc21c1d
comparison
equal deleted inserted replaced
31636:f3b151278655 31637:c4dd1e7c1dab
1578 marks.recordchange(tr) 1578 marks.recordchange(tr)
1579 tr.close() 1579 tr.close()
1580 finally: 1580 finally:
1581 release(tr, lock) 1581 release(tr, lock)
1582 1582
1583 def cleanupnode(ui, repo, name, nodes):
1584 """strip a group of nodes from the repository
1585
1586 The set of node to strip may contains unknown nodes."""
1587 ui.debug('should strip %s nodes %s\n' %
1588 (name, ', '.join([node.short(n) for n in nodes])))
1589 with repo.lock():
1590 # do not let filtering get in the way of the cleanse
1591 # we should probably get rid of obsolescence marker created during the
1592 # histedit, but we currently do not have such information.
1593 repo = repo.unfiltered()
1594 # Find all nodes that need to be stripped
1595 # (we use %lr instead of %ln to silently ignore unknown items)
1596 nm = repo.changelog.nodemap
1597 nodes = sorted(n for n in nodes if n in nm)
1598 roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
1599 for c in roots:
1600 # We should process node in reverse order to strip tip most first.
1601 # but this trigger a bug in changegroup hook.
1602 # This would reduce bundle overhead
1603 repair.strip(ui, repo, c)
1604
1583 def safecleanupnode(ui, repo, name, nodes): 1605 def safecleanupnode(ui, repo, name, nodes):
1584 """strip or obsolete nodes 1606 """strip or obsolete nodes
1585 1607
1586 nodes could be either a set or dict which maps to replacements. 1608 nodes could be either a set or dict which maps to replacements.
1587 nodes could be unknown (outside the repo). 1609 nodes could be unknown (outside the repo).
1604 key=repo.changelog.rev) 1626 key=repo.changelog.rev)
1605 markers = [getmarker(t) for t in sortednodes] 1627 markers = [getmarker(t) for t in sortednodes]
1606 if markers: 1628 if markers:
1607 obsolete.createmarkers(repo, markers) 1629 obsolete.createmarkers(repo, markers)
1608 else: 1630 else:
1609 ui.debug('should strip %s nodes %s\n' % 1631 return cleanupnode(ui, repo, name, nodes)
1610 (name, ', '.join([node.short(n) for n in nodes])))
1611 with repo.lock():
1612 # Do not let filtering get in the way of the cleanse we should
1613 # probably get rid of obsolescence marker created during the
1614 # histedit, but we currently do not have such information.
1615 repo = repo.unfiltered()
1616 # Find all nodes that need to be stripped
1617 # (we use %lr instead of %ln to silently ignore unknown items)
1618 nm = repo.changelog.nodemap
1619 nodes = sorted(n for n in nodes if n in nm)
1620 roots = [c.node() for c in repo.set("roots(%ln)", nodes)]
1621 for c in roots:
1622 # We should process node in reverse order to strip tip most
1623 # first, but this trigger a bug in changegroup hook. This
1624 # would reduce bundle overhead
1625 repair.strip(ui, repo, c)
1626 1632
1627 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs): 1633 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
1628 if isinstance(nodelist, str): 1634 if isinstance(nodelist, str):
1629 nodelist = [nodelist] 1635 nodelist = [nodelist]
1630 if os.path.exists(os.path.join(repo.path, 'histedit-state')): 1636 if os.path.exists(os.path.join(repo.path, 'histedit-state')):