revlog: use revlog.display_id in LookupError
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 03 May 2021 12:23:27 +0200
changeset 47155 96ee8ca99f5a
parent 47154 4532166a50b1
child 47156 89e11a6da785
revlog: use revlog.display_id in LookupError Differential Revision: https://phab.mercurial-scm.org/D10581
mercurial/bundlerepo.py
mercurial/filelog.py
mercurial/revlog.py
tests/test-bundle-r.t
tests/test-bundle.t
tests/test-convert-filemap.t
tests/test-convert-hg-source.t
tests/test-narrow-exchange.t
tests/test-pull-bundle.t
--- a/mercurial/bundlerepo.py	Mon May 03 12:23:17 2021 +0200
+++ b/mercurial/bundlerepo.py	Mon May 03 12:23:27 2021 +0200
@@ -84,12 +84,12 @@
             for p in (p1, p2):
                 if not self.index.has_node(p):
                     raise error.LookupError(
-                        p, self._indexfile, _(b"unknown parent")
+                        p, self.display_id, _(b"unknown parent")
                     )
 
             if not self.index.has_node(deltabase):
                 raise LookupError(
-                    deltabase, self._indexfile, _(b'unknown delta base')
+                    deltabase, self.display_id, _(b'unknown delta base')
                 )
 
             baserev = self.rev(deltabase)
--- a/mercurial/filelog.py	Mon May 03 12:23:17 2021 +0200
+++ b/mercurial/filelog.py	Mon May 03 12:23:27 2021 +0200
@@ -71,7 +71,7 @@
 
     def lookup(self, node):
         return storageutil.fileidlookup(
-            self._revlog, node, self._revlog._indexfile
+            self._revlog, node, self._revlog.display_id
         )
 
     def linkrev(self, rev):
--- a/mercurial/revlog.py	Mon May 03 12:23:17 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:23:27 2021 +0200
@@ -736,7 +736,7 @@
                 or node in self.nodeconstants.wdirfilenodeids
             ):
                 raise error.WdirUnsupported
-            raise error.LookupError(node, self._indexfile, _(b'no node'))
+            raise error.LookupError(node, self.display_id, _(b'no node'))
 
     # Accessors for index entries.
 
@@ -1446,7 +1446,7 @@
         if n:
             return n
 
-        raise error.LookupError(id, self._indexfile, _(b'no match found'))
+        raise error.LookupError(id, self.display_id, _(b'no match found'))
 
     def shortest(self, node, minlength=1):
         """Find the shortest unambiguous prefix that matches node."""
@@ -1460,7 +1460,7 @@
                 # single 'ff...' match
                 return True
             if matchednode is None:
-                raise error.LookupError(node, self._indexfile, _(b'no node'))
+                raise error.LookupError(node, self.display_id, _(b'no node'))
             return True
 
         def maybewdir(prefix):
@@ -1482,7 +1482,7 @@
             except error.RevlogError:
                 if node != self.nodeconstants.wdirid:
                     raise error.LookupError(
-                        node, self._indexfile, _(b'no node')
+                        node, self.display_id, _(b'no node')
                     )
             except AttributeError:
                 # Fall through to pure code
@@ -2461,12 +2461,12 @@
                 for p in (p1, p2):
                     if not self.index.has_node(p):
                         raise error.LookupError(
-                            p, self._indexfile, _(b'unknown parent')
+                            p, self.radix, _(b'unknown parent')
                         )
 
                 if not self.index.has_node(deltabase):
                     raise error.LookupError(
-                        deltabase, self._indexfile, _(b'unknown delta base')
+                        deltabase, self.display_id, _(b'unknown delta base')
                     )
 
                 baserev = self.rev(deltabase)
--- a/tests/test-bundle-r.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-bundle-r.t	Mon May 03 12:23:27 2021 +0200
@@ -224,7 +224,7 @@
   adding changesets
   transaction abort!
   rollback completed
-  abort: 00changelog.i@93ee6ab32777cd430e07da694794fb6a4f917712: unknown parent
+  abort: 00changelog@93ee6ab32777cd430e07da694794fb6a4f917712: unknown parent
   [50]
 
 revision 2
--- a/tests/test-bundle.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-bundle.t	Mon May 03 12:23:27 2021 +0200
@@ -751,7 +751,7 @@
 partial history bundle, fails w/ unknown parent
 
   $ hg -R bundle.hg verify
-  abort: 00changelog.i@bbd179dfa0a71671c253b3ae0aa1513b60d199fa: unknown parent
+  abort: 00changelog@bbd179dfa0a71671c253b3ae0aa1513b60d199fa: unknown parent
   [50]
 
 full history bundle, refuses to verify non-local repo
--- a/tests/test-convert-filemap.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-convert-filemap.t	Mon May 03 12:23:27 2021 +0200
@@ -292,12 +292,12 @@
   $ rm -rf source/.hg/store/data/dir/file4
 #endif
   $ hg -q convert --filemap renames.fmap --datesort source dummydest
-  abort: data/dir/file3.i@e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c: no match found (reporevlogstore !)
+  abort: data/dir/file3@e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c: no match found (reporevlogstore !)
   abort: data/dir/file3/index@e96dce0bc6a2: no node (reposimplestore !)
   [50]
   $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo
-  ignoring: data/dir/file3.i@e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c: no match found (reporevlogstore !)
-  ignoring: data/dir/file4.i@6edd55f559cdce67132b12ca09e09cee08b60442: no match found (reporevlogstore !)
+  ignoring: data/dir/file3@e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c: no match found (reporevlogstore !)
+  ignoring: data/dir/file4@6edd55f559cdce67132b12ca09e09cee08b60442: no match found (reporevlogstore !)
   ignoring: data/dir/file3/index@e96dce0bc6a2: no node (reposimplestore !)
   ignoring: data/dir/file4/index@6edd55f559cd: no node (reposimplestore !)
   $ hg up -q -R renames.repo
--- a/tests/test-convert-hg-source.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-convert-hg-source.t	Mon May 03 12:23:27 2021 +0200
@@ -182,7 +182,7 @@
   sorting...
   converting...
   4 init
-  ignoring: data/b.i@1e88685f5ddec574a34c70af492f95b6debc8741: no match found (reporevlogstore !)
+  ignoring: data/b@1e88685f5ddec574a34c70af492f95b6debc8741: no match found (reporevlogstore !)
   ignoring: data/b/index@1e88685f5dde: no node (reposimplestore !)
   3 changeall
   2 changebagain
--- a/tests/test-narrow-exchange.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-narrow-exchange.t	Mon May 03 12:23:27 2021 +0200
@@ -105,7 +105,7 @@
   remote: adding file changes
   remote: transaction abort!
   remote: rollback completed
-  remote: abort: data/inside2/f.i@4a1aa07735e673e20c00fae80f40dc301ee30616: unknown parent (reporevlogstore !)
+  remote: abort: data/inside2/f@4a1aa07735e673e20c00fae80f40dc301ee30616: unknown parent (reporevlogstore !)
   remote: abort: data/inside2/f/index@4a1aa07735e6: no node (reposimplestore !)
   abort: stream ended unexpectedly (got 0 bytes, expected 4)
   [255]
@@ -218,8 +218,8 @@
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 0 changes to 0 files (no-lfs-on !)
-  remote: error: pretxnchangegroup.lfs hook raised an exception: data/inside2/f.i@f59b4e0218355383d2789196f1092abcf2262b0c: no match found (lfs-on !)
+  remote: error: pretxnchangegroup.lfs hook raised an exception: data/inside2/f@f59b4e0218355383d2789196f1092abcf2262b0c: no match found (lfs-on !)
   remote: transaction abort! (lfs-on !)
   remote: rollback completed (lfs-on !)
-  remote: abort: data/inside2/f.i@f59b4e0218355383d2789196f1092abcf2262b0c: no match found (lfs-on !)
+  remote: abort: data/inside2/f@f59b4e0218355383d2789196f1092abcf2262b0c: no match found (lfs-on !)
   abort: stream ended unexpectedly (got 0 bytes, expected 4) (lfs-on !)
--- a/tests/test-pull-bundle.t	Mon May 03 12:23:17 2021 +0200
+++ b/tests/test-pull-bundle.t	Mon May 03 12:23:27 2021 +0200
@@ -185,7 +185,7 @@
   adding changesets
   adding manifests
   adding file changes
-  abort: 00changelog.i@66f7d451a68b85ed82ff5fcc254daf50c74144bd: no node
+  abort: 00changelog@66f7d451a68b85ed82ff5fcc254daf50c74144bd: no node
   [50]
   $ cd ..
   $ killdaemons.py