Patchwork D9711: shelve: make gennames() helper generate relative backup paths

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2021, 8:37 p.m.
Message ID <differential-rev-PHID-DREV-2zymagkuve7xtim6swiz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48021/
State Superseded
Headers show

Comments

phabricator - Jan. 8, 2021, 8:37 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -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():