Mercurial > evolve
changeset 4804:079dbf36e884
python3: add raw prefix in cases harder to analyze at the token level
The `byteify-strings.py` script would be a lot more complicated if it had to
do backtracking and other more advanced static analysis to figure our those
cases, so we have to add the raw prefix to those cases manually.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 06 Aug 2019 11:26:29 +0200 |
parents | 88472e743c64 |
children | 60e8cdce0e9c |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/depthcache.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/firstmergecache.py hgext3rd/evolve/legacy.py hgext3rd/evolve/obscache.py hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/obsexchange.py hgext3rd/evolve/stablerangecache.py hgext3rd/evolve/stablesort.py hgext3rd/serverminitopic.py hgext3rd/topic/__init__.py hgext3rd/topic/discovery.py |
diffstat | 15 files changed, 34 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/__init__.py Tue Aug 06 11:26:29 2019 +0200 @@ -1291,7 +1291,7 @@ Exist as a separated function to allow the evolve extension for a more subtle handling. """ - if 'debugobsconvert' in sys.argv: + if r'debugobsconvert' in sys.argv: return for mark in markers: if node.nullid in mark[1]:
--- a/hgext3rd/evolve/cmdrewrite.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Aug 06 11:26:29 2019 +0200 @@ -1015,9 +1015,9 @@ fold = opts.get('fold') split = opts.get('split') - options = [o for o in ('pair', 'fold', 'split') if opts.get(o)] + options = [o for o in (r'pair', r'fold', r'split') if opts.get(o)] if 1 < len(options): - _opts = pycompat.sysbytes(', '.join(options)) + _opts = pycompat.sysbytes(r', '.join(options)) raise error.Abort(_("can only specify one of %s") % _opts) if bookmarks:
--- a/hgext3rd/evolve/compat.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/compat.py Tue Aug 06 11:26:29 2019 +0200 @@ -79,7 +79,7 @@ ui.progress(topic, pos, item, unit, total) # XXX: Better detection of property cache -if 'predecessors' not in dir(obsolete.obsstore): +if r'predecessors' not in dir(obsolete.obsstore): @property def predecessors(self): return self.precursors @@ -90,13 +90,13 @@ # XXX Would it be better at the module level? varnames = context.memfilectx.__init__.__code__.co_varnames - if "copysource" in varnames: + if r"copysource" in varnames: mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), islink='l' in flags, isexec='x' in flags, copysource=copied.get(path)) # compat with hg <- 4.9 - elif varnames[2] == "changectx": + elif varnames[2] == r"changectx": mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), islink='l' in flags, isexec='x' in flags, @@ -116,10 +116,10 @@ # hg < 4.6 compat 8b6dd3922f70 if util.safehasattr(inspect, 'signature'): signature = inspect.signature(mdiff.unidiff) - needsbinary = 'binary' in signature.parameters + needsbinary = r'binary' in signature.parameters else: argspec = inspect.getargspec(mdiff.unidiff) - needsbinary = 'binary' in argspec.args + needsbinary = r'binary' in argspec.args if needsbinary: args.append(False)
--- a/hgext3rd/evolve/depthcache.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/depthcache.py Tue Aug 06 11:26:29 2019 +0200 @@ -79,7 +79,7 @@ @localrepo.unfilteredmethod def destroyed(self): - if 'depthcache' in vars(self): + if r'depthcache' in vars(self): self.depthcache.clear() super(depthcacherepo, self).destroyed()
--- a/hgext3rd/evolve/evolvecmd.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/evolvecmd.py Tue Aug 06 11:26:29 2019 +0200 @@ -1644,7 +1644,7 @@ elif len(specifiedcategories) == 1: targetcat = specifiedcategories[0] - ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve') + ui.setconfig('ui', 'forcemerge', opts.get('tool', r''), 'evolve') evolvestate = state.cmdstate(repo) # Continuation handling
--- a/hgext3rd/evolve/firstmergecache.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/firstmergecache.py Tue Aug 06 11:26:29 2019 +0200 @@ -41,7 +41,7 @@ @localrepo.unfilteredmethod def destroyed(self): - if 'firstmergecach' in vars(self): + if r'firstmergecach' in vars(self): self.firstmergecache.clear() super(firstmergecacherepo, self).destroyed()
--- a/hgext3rd/evolve/legacy.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/legacy.py Tue Aug 06 11:26:29 2019 +0200 @@ -50,7 +50,7 @@ evolveopts = 'all' ui.setconfig('experimental', 'evolution', evolveopts) for arg in sys.argv: - if 'debugc' in arg: + if r'debugc' in arg: break else: data = repo.vfs.tryread('obsolete-relations')
--- a/hgext3rd/evolve/obscache.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/obscache.py Tue Aug 06 11:26:29 2019 +0200 @@ -82,7 +82,7 @@ def markersfrom(obsstore, byteoffset, firstmarker): if not firstmarker: return list(obsstore) - elif '_all' in vars(obsstore): + elif r'_all' in vars(obsstore): # if the data are in memory, just use that return obsstore._all[firstmarker:] else: @@ -339,7 +339,7 @@ def _setdata(self, data): """set a new bytearray data, invalidating the 'get' shortcut if needed""" self._data = data - if 'get' in vars(self): + if r'get' in vars(self): del self.get def clear(self, reset=False): @@ -476,7 +476,7 @@ @localrepo.unfilteredmethod def destroyed(self): - if 'obsstore' in vars(self): + if r'obsstore' in vars(self): self.obsstore.obscache.clear() super(obscacherepo, self).destroyed()
--- a/hgext3rd/evolve/obsdiscovery.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/obsdiscovery.py Tue Aug 06 11:26:29 2019 +0200 @@ -353,7 +353,7 @@ self._new.clear() if reset: self._valid = False - if '_con' in vars(self): + if r'_con' in vars(self): del self._con def get(self, rangeid): @@ -377,7 +377,7 @@ except (sqlite3.DatabaseError, sqlite3.OperationalError): # something is wrong with the sqlite db # Since this is a cache, we ignore it. - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._new.clear() return value @@ -528,7 +528,7 @@ repo = repo.unfiltered() try: with repo.lock(): - if 'stablerange' in vars(repo): + if r'stablerange' in vars(repo): repo.stablerange.save(repo) self._save(repo) except error.LockError: @@ -548,7 +548,7 @@ # # operational error catch read-only and locked database # IntegrityError catch Unique constraint error that may arise - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._new.clear() repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) @@ -557,7 +557,7 @@ def _trysave(self, repo): if self._con is None: util.unlinkpath(self._path, ignoremissing=True) - if '_con' in vars(self): + if r'_con' in vars(self): del self._con con = self._db() @@ -585,7 +585,7 @@ repo.ui.warn(msg) self._new.clear() self._valid = False - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._valid = False return @@ -618,7 +618,7 @@ class obshashrepo(repo.__class__): @localrepo.unfilteredmethod def destroyed(self): - if 'obsstore' in vars(self): + if r'obsstore' in vars(self): self.obsstore.rangeobshashcache.clear() toplevel = not util.safehasattr(self, '_destroying') if toplevel:
--- a/hgext3rd/evolve/obsexchange.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/obsexchange.py Tue Aug 06 11:26:29 2019 +0200 @@ -83,12 +83,12 @@ return ret def _getbundleobsmarkerpart(orig, bundler, repo, source, **kwargs): - if not (set(['evo_obscommon', 'evo_missing_nodes']) & set(kwargs)): + if not (set([r'evo_obscommon', r'evo_missing_nodes']) & set(kwargs)): return orig(bundler, repo, source, **kwargs) if kwargs.get('obsmarkers', False): heads = kwargs.get('heads') - if 'evo_obscommon' in kwargs: + if r'evo_obscommon' in kwargs: if heads is None: heads = repo.heads() obscommon = kwargs.get('evo_obscommon', ())
--- a/hgext3rd/evolve/stablerangecache.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/stablerangecache.py Tue Aug 06 11:26:29 2019 +0200 @@ -223,7 +223,7 @@ except (sqlite3.DatabaseError, sqlite3.OperationalError): # something is wrong with the sqlite db # Since this is a cache, we ignore it. - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._unsavedsubranges.clear() @@ -278,7 +278,7 @@ # # operational error catch read-only and locked database # IntegrityError catch Unique constraint error that may arise - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._unsavedsubranges.clear() repo.ui.log('evoext-cache', 'error while saving new data: %s' % exc) @@ -294,7 +294,7 @@ if self._con is None: util.unlinkpath(self._path, ignoremissing=True) - if '_con' in vars(self): + if r'_con' in vars(self): del self._con con = self._db() @@ -375,7 +375,7 @@ def clear(self, reset=False): super(stablerangesql, self).clear(reset=reset) - if '_con' in vars(self): + if r'_con' in vars(self): del self._con self._subrangescache.clear() @@ -436,7 +436,7 @@ @localrepo.unfilteredmethod def destroyed(self): - if 'stablerange' in vars(self): + if r'stablerange' in vars(self): self.stablerange.clear() del self.stablerange super(stablerangerepo, self).destroyed()
--- a/hgext3rd/evolve/stablesort.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/evolve/stablesort.py Tue Aug 06 11:26:29 2019 +0200 @@ -669,7 +669,7 @@ @localrepo.unfilteredmethod def destroyed(self): - if 'stablesort' in vars(self): + if r'stablesort' in vars(self): self.stablesort.clear() super(stablesortrepo, self).destroyed()
--- a/hgext3rd/serverminitopic.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/serverminitopic.py Tue Aug 06 11:26:29 2019 +0200 @@ -67,7 +67,7 @@ def _init__(self, *args, **kwargs): super(revbranchcacheoverlay, self).__init__(*args, **kwargs) - if 'branchinfo' in vars(self): + if r'branchinfo' in vars(self): del self.branchinfo def branchinfo(self, rev, changelog=None): @@ -95,7 +95,7 @@ class topicawarerbc(revbranchcacheoverlay, cache.__class__): pass cache.__class__ = topicawarerbc - if 'branchinfo' in vars(cache): + if r'branchinfo' in vars(cache): del cache.branchinfo self._revbranchcache = cache return self._revbranchcache
--- a/hgext3rd/topic/__init__.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/topic/__init__.py Tue Aug 06 11:26:29 2019 +0200 @@ -242,7 +242,7 @@ # we need to do old style declaration for <= 4.5 templatekeyword = registrar.templatekeyword() -post45template = 'requires=' in templatekeyword.__doc__ +post45template = r'requires=' in templatekeyword.__doc__ def _contexttopic(self, force=False): if not (force or self.mutable()):
--- a/hgext3rd/topic/discovery.py Tue Aug 06 11:17:38 2019 +0200 +++ b/hgext3rd/topic/discovery.py Tue Aug 06 11:26:29 2019 +0200 @@ -117,7 +117,7 @@ summary[key] = ([value[1][0]], ) + value[1:] return summary finally: - if 'unfiltered' in vars(repo): + if r'unfiltered' in vars(repo): del repo.unfiltered repo.__class__ = oldrepocls if remotebranchmap is not None: