diff mercurial/obsolete.py @ 28868:445a25bb70be

obsstore: move delete function from obsstore class to repair module Since one of the original patches was accepted already and people on the mailing list still have suggestions as to how this should be improved, I'm implementing those suggestions in the following patches (this and the ones that might follow).
author Kostia Balytskyi <ikostia@fb.com>
date Tue, 12 Apr 2016 04:06:50 -0700
parents ffcc649a4e8f
children 9ac309946df9
line wrap: on
line diff
--- a/mercurial/obsolete.py	Tue Apr 12 03:40:53 2016 -0700
+++ b/mercurial/obsolete.py	Tue Apr 12 04:06:50 2016 -0700
@@ -628,30 +628,6 @@
         transaction.hookargs['new_obsmarkers'] = str(previous + len(new))
         return len(new)
 
-    def delete(self, indices):
-        """Delete some obsmarkers from store and return how many were deleted
-
-        Indices is a list of ints which are the indices
-        of the markers to be deleted."""
-        if not indices:
-            # we don't want to rewrite the obsstore with the same content
-            return
-
-        left = []
-        current = self._all
-        n = 0
-        for i, m in enumerate(current):
-            if i in indices:
-                n += 1
-                continue
-            left.append(m)
-
-        newobsstore = self.svfs('obsstore', 'w', atomictemp=True)
-        for bytes in encodemarkers(left, True, self._version):
-            newobsstore.write(bytes)
-        newobsstore.close()
-        return n
-
     def mergemarkers(self, transaction, data):
         """merge a binary stream of markers inside the obsstore