equal
deleted
inserted
replaced
122 |
122 |
123 |
123 |
124 def _unknownnode(node): |
124 def _unknownnode(node): |
125 """ raises ValueError when branchcache found a node which does not exists |
125 """ raises ValueError when branchcache found a node which does not exists |
126 """ |
126 """ |
127 raise ValueError(r'node %s does not exist' % pycompat.sysstr(hex(node))) |
127 raise ValueError('node %s does not exist' % pycompat.sysstr(hex(node))) |
128 |
128 |
129 |
129 |
130 def _branchcachedesc(repo): |
130 def _branchcachedesc(repo): |
131 if repo.filtername is not None: |
131 if repo.filtername is not None: |
132 return b'branch cache (%s)' % repo.filtername |
132 return b'branch cache (%s)' % repo.filtername |
258 filteredhash=filteredhash, |
258 filteredhash=filteredhash, |
259 hasnode=hasnode, |
259 hasnode=hasnode, |
260 ) |
260 ) |
261 if not bcache.validfor(repo): |
261 if not bcache.validfor(repo): |
262 # invalidate the cache |
262 # invalidate the cache |
263 raise ValueError(r'tip differs') |
263 raise ValueError('tip differs') |
264 bcache.load(repo, lineiter) |
264 bcache.load(repo, lineiter) |
265 except (IOError, OSError): |
265 except (IOError, OSError): |
266 return None |
266 return None |
267 |
267 |
268 except Exception as inst: |
268 except Exception as inst: |
292 line = line.rstrip(b'\n') |
292 line = line.rstrip(b'\n') |
293 if not line: |
293 if not line: |
294 continue |
294 continue |
295 node, state, label = line.split(b" ", 2) |
295 node, state, label = line.split(b" ", 2) |
296 if state not in b'oc': |
296 if state not in b'oc': |
297 raise ValueError(r'invalid branch state') |
297 raise ValueError('invalid branch state') |
298 label = encoding.tolocal(label.strip()) |
298 label = encoding.tolocal(label.strip()) |
299 node = bin(node) |
299 node = bin(node) |
300 self._entries.setdefault(label, []).append(node) |
300 self._entries.setdefault(label, []).append(node) |
301 if state == b'c': |
301 if state == b'c': |
302 self._closednodes.add(node) |
302 self._closednodes.add(node) |
644 # the cache was bypassing itself by setting: |
644 # the cache was bypassing itself by setting: |
645 # |
645 # |
646 # self.branchinfo = self._branchinfo |
646 # self.branchinfo = self._branchinfo |
647 # |
647 # |
648 # Since we now have data in the cache, we need to drop this bypassing. |
648 # Since we now have data in the cache, we need to drop this bypassing. |
649 if r'branchinfo' in vars(self): |
649 if 'branchinfo' in vars(self): |
650 del self.branchinfo |
650 del self.branchinfo |
651 |
651 |
652 def _setcachedata(self, rev, node, branchidx): |
652 def _setcachedata(self, rev, node, branchidx): |
653 """Writes the node's branch data to the in-memory cache data.""" |
653 """Writes the node's branch data to the in-memory cache data.""" |
654 if rev == nullrev: |
654 if rev == nullrev: |