Patchwork D9276: transaction: rename find to findoffset and drop backup file support

login
register
mail settings
Submitter phabricator
Date Nov. 7, 2020, 9:32 p.m.
Message ID <differential-rev-PHID-DREV-4dpltpeef3fwxlfemma7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47552/
State Superseded
Headers show

Comments

phabricator - Nov. 7, 2020, 9:32 p.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  transaction.find used to support access to both the regular file and
  backup file list. They have different formats, so any consumer has to be
  aware of the difference alredy. There is no in-core consumer for the
  backup file access, so don't provide it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/transaction.py

CHANGE DETAILS




To: joerg.sonnenberger, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -395,11 +395,9 @@ 
         return any
 
     @active
-    def find(self, file):
+    def findoffset(self, file):
         if file in self._map:
-            return self._entries[self._map[file]]
-        if file in self._backupmap:
-            return self._backupentries[self._backupmap[file]]
+            return self._entries[self._map[file]][1]
         return None
 
     @active
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2000,12 +2000,11 @@ 
         ):
             return
 
-        trinfo = tr.find(self.indexfile)
-        if trinfo is None:
+        troffset = tr.findoffset(self.indexfile)
+        if troffset is None:
             raise error.RevlogError(
                 _(b"%s not found in the transaction") % self.indexfile
             )
-        troffset = trinfo[1]
         trindex = 0
         tr.add(self.datafile, 0)