mercurial/shelve.py
changeset 49427 c4417029e6c2
parent 49426 24ffd13893cc
child 49429 fa00c407d61c
equal deleted inserted replaced
49426:24ffd13893cc 49427:c4417029e6c2
   110     def __init__(self, vfs, name):
   110     def __init__(self, vfs, name):
   111         self.vfs = vfs
   111         self.vfs = vfs
   112         self.name = name
   112         self.name = name
   113 
   113 
   114     def exists(self):
   114     def exists(self):
   115         return self.vfs.exists(self.name + b'.patch') and self.vfs.exists(
   115         return self._exists(b'.shelve') or self._exists(b'.patch', b'.hg')
   116             self.name + b'.hg'
   116 
   117         )
   117     def _exists(self, *exts):
       
   118         return all(self.vfs.exists(self.name + ext) for ext in exts)
   118 
   119 
   119     def mtime(self):
   120     def mtime(self):
   120         return self.vfs.stat(self.name + b'.patch')[stat.ST_MTIME]
   121         try:
       
   122             return self._stat(b'.shelve')[stat.ST_MTIME]
       
   123         except FileNotFoundError:
       
   124             return self._stat(b'.patch')[stat.ST_MTIME]
       
   125 
       
   126     def _stat(self, ext):
       
   127         return self.vfs.stat(self.name + ext)
   121 
   128 
   122     def writeinfo(self, info):
   129     def writeinfo(self, info):
   123         scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
   130         scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
   124 
   131 
   125     def hasinfo(self):
   132     def hasinfo(self):