changeset 46284:d7f763c8c58e

shelve: make gennames() helper generate relative backup paths When I saw `gennames()`, I thought it was meant to take a relative filename as argument. Maybe it was or maybe it wasn't, but it seems simpler to pass it a relative path anyway, so that's what this patch does. That also makes the call to backupvfs.exists() more natural (I expect a relative path to be passed there too). Differential Revision: https://phab.mercurial-scm.org/D9711
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Jan 2021 23:09:04 -0800
parents 8db5fa212ab0
children e79f8ae0901b
files mercurial/shelve.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/shelve.py	Thu Jan 07 22:38:19 2021 -0800
+++ b/mercurial/shelve.py	Thu Jan 07 23:09:04 2021 -0800
@@ -97,10 +97,9 @@
             for i in itertools.count(1):
                 yield b'%s-%d.%s' % (base, i, ext)
 
-        name = self.backupvfs.join(self.fname)
-        for n in gennames(name):
+        for n in gennames(self.fname):
             if not self.backupvfs.exists(n):
-                return n
+                return self.backupvfs.join(n)
 
     def movetobackup(self):
         if not self.backupvfs.isdir():