absorb: use scmutil.cleanupnodes() also when obsmarkers are disabled
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 27 Feb 2019 16:33:15 -0800
changeset 41812 c91321e86071
parent 41811 a008e0af892e
child 41813 b38c7304974f
absorb: use scmutil.cleanupnodes() also when obsmarkers are disabled A side-effect of this is the new warning in the test case, but the warning is valid, so I don't think that's a problem. Differential Revision: https://phab.mercurial-scm.org/D6035
hgext/absorb.py
tests/test-absorb-strip.t
--- a/hgext/absorb.py	Wed Feb 27 16:15:10 2019 -0800
+++ b/hgext/absorb.py	Wed Feb 27 16:33:15 2019 -0800
@@ -50,7 +50,6 @@
     phases,
     pycompat,
     registrar,
-    repair,
     scmutil,
     util,
 )
@@ -690,9 +689,9 @@
                 if self.repo['.'].node() in self.replacemap:
                     self._moveworkingdirectoryparent()
                 if self._useobsolete:
-                    self._obsoleteoldcommits()
+                    self._cleanupoldcommits()
             if not self._useobsolete: # strip must be outside transactions
-                self._stripoldcommits()
+                self._cleanupoldcommits()
         return self.finalnode
 
     def printchunkstats(self):
@@ -859,22 +858,12 @@
         """() -> bool"""
         return obsolete.isenabled(self.repo, obsolete.createmarkersopt)
 
-    def _obsoleteoldcommits(self):
+    def _cleanupoldcommits(self):
         replacements = {k: ([v] if v is not None else [])
                         for k, v in self.replacemap.iteritems()}
         if replacements:
             scmutil.cleanupnodes(self.repo, replacements, operation='absorb')
 
-    def _stripoldcommits(self):
-        nodelist = self.replacemap.keys()
-        # make sure we don't strip innocent children
-        revs = self.repo.revs('%ln - (::(heads(%ln::)-%ln))', nodelist,
-                              nodelist, nodelist)
-        tonode = self.repo.changelog.node
-        nodelist = [tonode(r) for r in revs]
-        if nodelist:
-            repair.strip(self.repo.ui, self.repo, nodelist)
-
 def _parsechunk(hunk):
     """(crecord.uihunk or patch.recordhunk) -> (path, (a1, a2, [bline]))"""
     if type(hunk) not in (crecord.uihunk, patch.recordhunk):
--- a/tests/test-absorb-strip.t	Wed Feb 27 16:15:10 2019 -0800
+++ b/tests/test-absorb-strip.t	Wed Feb 27 16:33:15 2019 -0800
@@ -23,6 +23,7 @@
   $ echo 1 >> B
   $ echo 2 >> D
   $ hg absorb -a
+  warning: orphaned descendants detected, not stripping 112478962961, 26805aba1e60
   saved backup bundle to * (glob)
   2 of 2 chunk(s) applied