mercurial/shelve.py
changeset 46294 d3b226b6c8c6
parent 46293 9cdef4c41c94
child 46295 f8c5e6ecd008
equal deleted inserted replaced
46293:9cdef4c41c94 46294:d3b226b6c8c6
    62 )
    62 )
    63 
    63 
    64 backupdir = b'shelve-backup'
    64 backupdir = b'shelve-backup'
    65 shelvedir = b'shelved'
    65 shelvedir = b'shelved'
    66 shelvefileextensions = [b'hg', b'patch', b'shelve']
    66 shelvefileextensions = [b'hg', b'patch', b'shelve']
    67 # universal extension is present in all types of shelves
       
    68 patchextension = b'patch'
       
    69 
    67 
    70 # we never need the user, so we use a
    68 # we never need the user, so we use a
    71 # generic user for all shelve operations
    69 # generic user for all shelve operations
    72 shelveuser = b'shelve@localhost'
    70 shelveuser = b'shelve@localhost'
    73 
    71 
    87     @staticmethod
    85     @staticmethod
    88     def open(repo, name):
    86     def open(repo, name):
    89         return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name)
    87         return Shelf(vfsmod.vfs(repo.vfs.join(shelvedir)), name)
    90 
    88 
    91     def exists(self):
    89     def exists(self):
    92         return self.vfs.exists(
    90         return self.vfs.exists(self.name + b'.patch') and self.vfs.exists(
    93             self.name + b'.' + patchextension
    91             self.name + b'.hg'
    94         ) and self.vfs.exists(self.name + b'.hg')
    92         )
    95 
    93 
    96     def mtime(self):
    94     def mtime(self):
    97         return self.vfs.stat(self.name + b'.' + patchextension)[stat.ST_MTIME]
    95         return self.vfs.stat(self.name + b'.patch')[stat.ST_MTIME]
    98 
    96 
    99     def writeinfo(self, info):
    97     def writeinfo(self, info):
   100         scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
    98         scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info)
   101 
    99 
   102     def hasinfo(self):
   100     def hasinfo(self):