comparison mercurial/bundle2.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 daade078f1f0
children 888bd39ed555
comparison
equal deleted inserted replaced
43505:47fac1692ede 43506:9f70512ae2cf
835 835
836 Note: no option are currently supported. Any input will be either 836 Note: no option are currently supported. Any input will be either
837 ignored or failing. 837 ignored or failing.
838 """ 838 """
839 if not name: 839 if not name:
840 raise ValueError(r'empty parameter name') 840 raise ValueError('empty parameter name')
841 if name[0:1] not in pycompat.bytestr( 841 if name[0:1] not in pycompat.bytestr(
842 string.ascii_letters # pytype: disable=wrong-arg-types 842 string.ascii_letters # pytype: disable=wrong-arg-types
843 ): 843 ):
844 raise ValueError(r'non letter first character: %s' % name) 844 raise ValueError('non letter first character: %s' % name)
845 try: 845 try:
846 handler = b2streamparamsmap[name.lower()] 846 handler = b2streamparamsmap[name.lower()]
847 except KeyError: 847 except KeyError:
848 if name[0:1].islower(): 848 if name[0:1].islower():
849 indebug(self.ui, b"ignoring unknown parameter %s" % name) 849 indebug(self.ui, b"ignoring unknown parameter %s" % name)
1143 ## finalize header 1143 ## finalize header
1144 try: 1144 try:
1145 headerchunk = b''.join(header) 1145 headerchunk = b''.join(header)
1146 except TypeError: 1146 except TypeError:
1147 raise TypeError( 1147 raise TypeError(
1148 r'Found a non-bytes trying to ' 1148 'Found a non-bytes trying to '
1149 r'build bundle part header: %r' % header 1149 'build bundle part header: %r' % header
1150 ) 1150 )
1151 outdebug(ui, b'header chunk size: %i' % len(headerchunk)) 1151 outdebug(ui, b'header chunk size: %i' % len(headerchunk))
1152 yield _pack(_fpartheadersize, len(headerchunk)) 1152 yield _pack(_fpartheadersize, len(headerchunk))
1153 yield headerchunk 1153 yield headerchunk
1154 ## payload 1154 ## payload
1795 params = b"%s%s" % (urlreq.quote(b"requirements="), requirements) 1795 params = b"%s%s" % (urlreq.quote(b"requirements="), requirements)
1796 return params 1796 return params
1797 1797
1798 1798
1799 def addpartbundlestream2(bundler, repo, **kwargs): 1799 def addpartbundlestream2(bundler, repo, **kwargs):
1800 if not kwargs.get(r'stream', False): 1800 if not kwargs.get('stream', False):
1801 return 1801 return
1802 1802
1803 if not streamclone.allowservergeneration(repo): 1803 if not streamclone.allowservergeneration(repo):
1804 raise error.Abort( 1804 raise error.Abort(
1805 _( 1805 _(
1817 # goal of stream clones, which is to be fast. Communicate the desire 1817 # goal of stream clones, which is to be fast. Communicate the desire
1818 # to avoid compression to consumers of the bundle. 1818 # to avoid compression to consumers of the bundle.
1819 bundler.prefercompressed = False 1819 bundler.prefercompressed = False
1820 1820
1821 # get the includes and excludes 1821 # get the includes and excludes
1822 includepats = kwargs.get(r'includepats') 1822 includepats = kwargs.get('includepats')
1823 excludepats = kwargs.get(r'excludepats') 1823 excludepats = kwargs.get('excludepats')
1824 1824
1825 narrowstream = repo.ui.configbool( 1825 narrowstream = repo.ui.configbool(
1826 b'experimental', b'server.stream-narrow-clones' 1826 b'experimental', b'server.stream-narrow-clones'
1827 ) 1827 )
1828 1828
1987 raise error.Abort(msg, hint=hint) 1987 raise error.Abort(msg, hint=hint)
1988 1988
1989 extrakwargs = {} 1989 extrakwargs = {}
1990 targetphase = inpart.params.get(b'targetphase') 1990 targetphase = inpart.params.get(b'targetphase')
1991 if targetphase is not None: 1991 if targetphase is not None:
1992 extrakwargs[r'targetphase'] = int(targetphase) 1992 extrakwargs['targetphase'] = int(targetphase)
1993 ret = _processchangegroup( 1993 ret = _processchangegroup(
1994 op, 1994 op,
1995 cg, 1995 cg,
1996 tr, 1996 tr,
1997 b'bundle2', 1997 b'bundle2',