[Updated] D9707: shelve: move method for getting stat (mtime) to new shelf class

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jan 16 10:57:23 UTC 2021


Closed by commit rHG2da2fecde961: shelve: move method for getting stat (mtime) to new shelf class (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9707?vs=24663&id=24942

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9707/new/

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

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -110,9 +110,6 @@
             self.backupvfs.makedir()
         util.rename(self.filename(), self.backupfilename())
 
-    def stat(self):
-        return self.vfs.stat(self.fname)
-
 
 class Shelf(object):
     """Represents a shelf, including possibly multiple files storing it.
@@ -130,6 +127,9 @@
     def exists(self):
         return self.vfs.exists(self.name + b'.' + patchextension)
 
+    def mtime(self):
+        return self.vfs.stat(self.name + b'.' + patchextension)[stat.ST_MTIME]
+
     def writeinfo(self, info):
         scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
 
@@ -642,8 +642,8 @@
         pfx, sfx = name.rsplit(b'.', 1)
         if not pfx or sfx != patchextension:
             continue
-        st = shelvedfile(repo, name).stat()
-        info.append((st[stat.ST_MTIME], shelvedfile(repo, pfx).filename()))
+        mtime = Shelf(repo, pfx).mtime()
+        info.append((mtime, shelvedfile(repo, pfx).filename()))
     return sorted(info, reverse=True)
 
 



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210116/7494a162/attachment-0002.html>


More information about the Mercurial-patches mailing list