diff mercurial/localrepo.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 be384a2052aa
children 7f489b9a79a1
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Nov 10 07:30:14 2019 -0800
+++ b/mercurial/localrepo.py	Fri Nov 08 11:19:20 2019 -0800
@@ -2459,9 +2459,9 @@
 
     def invalidatecaches(self):
 
-        if r'_tagscache' in vars(self):
+        if '_tagscache' in vars(self):
             # can't use delattr on proxy
-            del self.__dict__[r'_tagscache']
+            del self.__dict__['_tagscache']
 
         self._branchcaches.clear()
         self.invalidatevolatilesets()
@@ -2480,13 +2480,13 @@
         rereads the dirstate. Use dirstate.invalidate() if you want to
         explicitly read the dirstate again (i.e. restoring it to a previous
         known good state).'''
-        if hasunfilteredcache(self, r'dirstate'):
+        if hasunfilteredcache(self, 'dirstate'):
             for k in self.dirstate._filecache:
                 try:
                     delattr(self.dirstate, k)
                 except AttributeError:
                     pass
-            delattr(self.unfiltered(), r'dirstate')
+            delattr(self.unfiltered(), 'dirstate')
 
     def invalidate(self, clearfilecache=False):
         '''Invalidates both store and non-store parts other than dirstate
@@ -2536,7 +2536,7 @@
         """Reload stats of cached files so that they are flagged as valid"""
         for k, ce in self._filecache.items():
             k = pycompat.sysstr(k)
-            if k == r'dirstate' or k not in self.__dict__:
+            if k == 'dirstate' or k not in self.__dict__:
                 continue
             ce.refresh()
 
@@ -3363,10 +3363,10 @@
             if tr is not None:
                 hookargs.update(tr.hookargs)
             hookargs = pycompat.strkwargs(hookargs)
-            hookargs[r'namespace'] = namespace
-            hookargs[r'key'] = key
-            hookargs[r'old'] = old
-            hookargs[r'new'] = new
+            hookargs['namespace'] = namespace
+            hookargs['key'] = key
+            hookargs['old'] = old
+            hookargs['new'] = new
             self.hook(b'prepushkey', throw=True, **hookargs)
         except error.HookAbort as exc:
             self.ui.write_err(_(b"pushkey-abort: %s\n") % exc)
@@ -3706,7 +3706,7 @@
     # of repos call close() on repo references.
     class poisonedrepository(object):
         def __getattribute__(self, item):
-            if item == r'close':
+            if item == 'close':
                 return object.__getattribute__(self, item)
 
             raise error.ProgrammingError(
@@ -3718,4 +3718,4 @@
 
     # We may have a repoview, which intercepts __setattr__. So be sure
     # we operate at the lowest level possible.
-    object.__setattr__(repo, r'__class__', poisonedrepository)
+    object.__setattr__(repo, '__class__', poisonedrepository)