shelve: make gennames() helper generate relative backup paths
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 07 Jan 2021 23:09:04 -0800
changeset 46284 d7f763c8c58e
parent 46283 8db5fa212ab0
child 46285 e79f8ae0901b
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
mercurial/shelve.py
--- 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():