comparison mercurial/hbisect.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 1c46b18b0e1c
children 0ca8410ea345
comparison
equal deleted inserted replaced
23876:48fd1dfb99aa 23877:7cc77030c557
134 134
135 135
136 def load_state(repo): 136 def load_state(repo):
137 state = {'current': [], 'good': [], 'bad': [], 'skip': []} 137 state = {'current': [], 'good': [], 'bad': [], 'skip': []}
138 if os.path.exists(repo.join("bisect.state")): 138 if os.path.exists(repo.join("bisect.state")):
139 for l in repo.opener("bisect.state"): 139 for l in repo.vfs("bisect.state"):
140 kind, node = l[:-1].split() 140 kind, node = l[:-1].split()
141 node = repo.lookup(node) 141 node = repo.lookup(node)
142 if kind not in state: 142 if kind not in state:
143 raise util.Abort(_("unknown bisect kind %s") % kind) 143 raise util.Abort(_("unknown bisect kind %s") % kind)
144 state[kind].append(node) 144 state[kind].append(node)
145 return state 145 return state
146 146
147 147
148 def save_state(repo, state): 148 def save_state(repo, state):
149 f = repo.opener("bisect.state", "w", atomictemp=True) 149 f = repo.vfs("bisect.state", "w", atomictemp=True)
150 wlock = repo.wlock() 150 wlock = repo.wlock()
151 try: 151 try:
152 for kind in sorted(state): 152 for kind in sorted(state):
153 for node in state[kind]: 153 for node in state[kind]:
154 f.write("%s %s\n" % (kind, hex(node))) 154 f.write("%s %s\n" % (kind, hex(node)))