Patchwork [02,of,10] py3: abuse r'' to access keys in keyword arguments

login
register
mail settings
Submitter Pulkit Goyal
Date May 4, 2017, 10:46 p.m.
Message ID <b686f18461301572e82a.1493938007@pulkit-goyal>
Download mbox | patch
Permalink /patch/20441/
State Accepted
Headers show

Comments

Pulkit Goyal - May 4, 2017, 10:46 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1493806288 -19800
#      Wed May 03 15:41:28 2017 +0530
# Node ID b686f18461301572e82a1d85b2691d1d1d7f27b5
# Parent  28e7209f8d5fd3525b435eccd8ab78813531b6db
py3: abuse r'' to access keys in keyword arguments

Patch

diff -r 28e7209f8d5f -r b686f1846130 hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Wed May 03 15:37:51 2017 +0530
+++ b/hgext/largefiles/overrides.py	Wed May 03 15:41:28 2017 +0530
@@ -105,9 +105,9 @@ 
             scmutil.matchandpats)
 
 def addlargefiles(ui, repo, isaddremove, matcher, **opts):
-    large = opts.get('large')
+    large = opts.get(r'large')
     lfsize = lfutil.getminsize(
-        ui, lfutil.islfilesrepo(repo), opts.get('lfsize'))
+        ui, lfutil.islfilesrepo(repo), opts.get(r'lfsize'))
 
     lfmatcher = None
     if lfutil.islfilesrepo(repo):
@@ -258,7 +258,7 @@ 
 
 def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts):
     # The --normal flag short circuits this override
-    if opts.get('normal'):
+    if opts.get(r'normal'):
         return orig(ui, repo, matcher, prefix, explicitonly, **opts)
 
     ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts)
diff -r 28e7209f8d5f -r b686f1846130 mercurial/subrepo.py
--- a/mercurial/subrepo.py	Wed May 03 15:37:51 2017 +0530
+++ b/mercurial/subrepo.py	Wed May 03 15:41:28 2017 +0530
@@ -1878,9 +1878,9 @@ 
         deleted, unknown, ignored, clean = [], [], [], []
 
         command = ['status', '--porcelain', '-z']
-        if opts.get('unknown'):
+        if opts.get(r'unknown'):
             command += ['--untracked-files=all']
-        if opts.get('ignored'):
+        if opts.get(r'ignored'):
             command += ['--ignored']
         out = self._gitcommand(command)
 
@@ -1908,7 +1908,7 @@ 
             elif st == '!!':
                 ignored.append(filename1)
 
-        if opts.get('clean'):
+        if opts.get(r'clean'):
             out = self._gitcommand(['ls-files'])
             for f in out.split('\n'):
                 if not f in changedfiles:
@@ -1921,7 +1921,7 @@ 
     def diff(self, ui, diffopts, node2, match, prefix, **opts):
         node1 = self._state[1]
         cmd = ['diff', '--no-renames']
-        if opts['stat']:
+        if opts[r'stat']:
             cmd.append('--stat')
         else:
             # for Git, this also implies '-p'
@@ -1964,7 +1964,7 @@ 
     @annotatesubrepoerror
     def revert(self, substate, *pats, **opts):
         self.ui.status(_('reverting subrepo %s\n') % substate[0])
-        if not opts.get('no_backup'):
+        if not opts.get(r'no_backup'):
             status = self.status(None)
             names = status.modified
             for name in names:
@@ -1973,7 +1973,7 @@ 
                         (name, bakname))
                 self.wvfs.rename(name, bakname)
 
-        if not opts.get('dry_run'):
+        if not opts.get(r'dry_run'):
             self.get(substate, overwrite=True)
         return []