D6035: absorb: use scmutil.cleanupnodes() also when obsmarkers are disabled

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Feb 27 20:48:53 EST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc91321e86071: absorb: use scmutil.cleanupnodes() also when obsmarkers are disabled (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6035?vs=14262&id=14265

REVISION DETAIL
  https://phab.mercurial-scm.org/D6035

AFFECTED FILES
  hgext/absorb.py
  tests/test-absorb-strip.t

CHANGE DETAILS

diff --git a/tests/test-absorb-strip.t b/tests/test-absorb-strip.t
--- a/tests/test-absorb-strip.t
+++ b/tests/test-absorb-strip.t
@@ -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
 
diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -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):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list