comparison hgext/shelve.py @ 23877:7cc77030c557

localrepo: remove all external users of localrepo.opener This change touches every module in which repository.opener was being used, and changes it for the equivalent repository.vfs. This is meant to make it easier to split the repository.vfs into several separate vfs. It should now be possible to remove localrepo.opener.
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Thu, 15 Jan 2015 23:17:12 +0100
parents ebef5fcf7bd0
children cda18ded2c48
comparison
equal deleted inserted replaced
23876:48fd1dfb99aa 23877:7cc77030c557
93 _version = 1 93 _version = 1
94 _filename = 'shelvedstate' 94 _filename = 'shelvedstate'
95 95
96 @classmethod 96 @classmethod
97 def load(cls, repo): 97 def load(cls, repo):
98 fp = repo.opener(cls._filename) 98 fp = repo.vfs(cls._filename)
99 try: 99 try:
100 version = int(fp.readline().strip()) 100 version = int(fp.readline().strip())
101 101
102 if version != cls._version: 102 if version != cls._version:
103 raise util.Abort(_('this version of shelve is incompatible ' 103 raise util.Abort(_('this version of shelve is incompatible '
119 119
120 return obj 120 return obj
121 121
122 @classmethod 122 @classmethod
123 def save(cls, repo, name, originalwctx, pendingctx, stripnodes): 123 def save(cls, repo, name, originalwctx, pendingctx, stripnodes):
124 fp = repo.opener(cls._filename, 'wb') 124 fp = repo.vfs(cls._filename, 'wb')
125 fp.write('%i\n' % cls._version) 125 fp.write('%i\n' % cls._version)
126 fp.write('%s\n' % name) 126 fp.write('%s\n' % name)
127 fp.write('%s\n' % hex(originalwctx.node())) 127 fp.write('%s\n' % hex(originalwctx.node()))
128 fp.write('%s\n' % hex(pendingctx.node())) 128 fp.write('%s\n' % hex(pendingctx.node()))
129 fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()])) 129 fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()]))