Mercurial > public > mercurial-scm > hg
comparison mercurial/branchmap.py @ 43506:9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
This is the promised second step on single-quoted strings. These had
existed because our source transformer didn't turn r'' into b'', so we
had tagged some strings as r-strings to get "native" strings on both
Pythons. Now that the transformer is gone, we can dispense with this
nonsense.
Methodology:
I ran
hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
in an emacs grep-mode buffer, and then used a keyboard macro to
iterate over the results and remove the r prefix as needed.
# skip-blame removing unneeded r prefixes left over from Python 3 migration.
Differential Revision: https://phab.mercurial-scm.org/D7306
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 08 Nov 2019 11:19:20 -0800 |
parents | 1a47fe4bc154 |
children | 43f57b9620d2 |
comparison
equal
deleted
inserted
replaced
43505:47fac1692ede | 43506:9f70512ae2cf |
---|---|
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: |