@@ -689,8 +689,8 @@ def setP4ExecBit(file, mode):
689689
690690 if not isModeExec (mode ):
691691 p4Type = getP4OpenedType (file )
692- p4Type = re .sub ('^([cku]?)x(.*)' , ' \\ 1 \ \ 2' , p4Type )
693- p4Type = re .sub ('(.*?\+.*?)x(.*?)' , ' \\ 1 \ \ 2' , p4Type )
692+ p4Type = re .sub (r '^([cku]?)x(.*)' , r'\1 \2' , p4Type )
693+ p4Type = re .sub (r '(.*?\+.*?)x(.*?)' , r'\1 \2' , p4Type )
694694 if p4Type [- 1 ] == "+" :
695695 p4Type = p4Type [0 :- 1 ]
696696
@@ -701,7 +701,7 @@ def getP4OpenedType(file):
701701 """Returns the perforce file type for the given file."""
702702
703703 result = p4_read_pipe (["opened" , wildcard_encode (file )])
704- match = re .match (".*\((.+)\)( \*exclusive\*)?\r ?$" , result )
704+ match = re .match (r ".*\((.+)\)( \*exclusive\*)?\r?$" , result )
705705 if match :
706706 return match .group (1 )
707707 else :
@@ -757,7 +757,7 @@ def parseDiffTreeEntry(entry):
757757
758758 global _diff_tree_pattern
759759 if not _diff_tree_pattern :
760- _diff_tree_pattern = re .compile (':(\d+) (\d+) (\w+) (\w+) ([A-Z])(\d+)?\t (.*?)((\t (.*))|$)' )
760+ _diff_tree_pattern = re .compile (r ':(\d+) (\d+) (\w+) (\w+) ([A-Z])(\d+)?\t(.*?)((\t(.*))|$)' )
761761
762762 match = _diff_tree_pattern .match (entry )
763763 if match :
@@ -918,9 +918,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
918918 if len (result ) > 0 :
919919 data = result [0 ].get ('data' )
920920 if data :
921- m = re .search ('Too many rows scanned \(over (\d+)\)' , data )
921+ m = re .search (r 'Too many rows scanned \(over (\d+)\)' , data )
922922 if not m :
923- m = re .search ('Request too large \(over (\d+)\)' , data )
923+ m = re .search (r 'Request too large \(over (\d+)\)' , data )
924924
925925 if m :
926926 limit = int (m .group (1 ))
@@ -1452,7 +1452,7 @@ def wildcard_encode(path):
14521452
14531453
14541454def wildcard_present (path ):
1455- m = re .search ("[*#@%]" , path )
1455+ m = re .search (r "[*#@%]" , path )
14561456 return m is not None
14571457
14581458
@@ -3048,7 +3048,7 @@ def stripRepoPath(self, path, prefixes):
30483048 # Preserve everything in relative path name except leading
30493049 # //depot/; just look at first prefix as they all should
30503050 # be in the same depot.
3051- depot = re .sub ("^(//[^/]+/).*" , r'\1' , prefixes [0 ])
3051+ depot = re .sub (r "^(//[^/]+/).*" , r'\1' , prefixes [0 ])
30523052 if p4PathStartsWith (path , depot ):
30533053 path = path [len (depot ):]
30543054
@@ -3603,7 +3603,7 @@ def importP4Labels(self, stream, p4Labels):
36033603 commitFound = True
36043604 else :
36053605 gitCommit = read_pipe (["git" , "rev-list" , "--max-count=1" ,
3606- "--reverse" , ":/\[git-p4:.*change = %d\]" % changelist ], ignore_error = True )
3606+ "--reverse" , r ":/\[git-p4:.*change = %d\]" % changelist ], ignore_error = True )
36073607 if len (gitCommit ) == 0 :
36083608 print ("importing label %s: could not find git commit for changelist %d" % (name , changelist ))
36093609 else :
@@ -4182,7 +4182,7 @@ def run(self, args):
41824182 if len (self .changesFile ) == 0 :
41834183 revision = "#head"
41844184
4185- p = re .sub ("\.\.\.$" , "" , p )
4185+ p = re .sub (r "\.\.\.$" , "" , p )
41864186 if not p .endswith ("/" ):
41874187 p += "/"
41884188
@@ -4291,7 +4291,7 @@ def rebase(self):
42914291 die ("Cannot find upstream branchpoint for rebase" )
42924292
42934293 # the branchpoint may be p4/foo~3, so strip off the parent
4294- upstream = re .sub ("~[0-9]+$" , "" , upstream )
4294+ upstream = re .sub (r "~[0-9]+$" , "" , upstream )
42954295
42964296 print ("Rebasing the current branch onto %s" % upstream )
42974297 oldHead = read_pipe (["git" , "rev-parse" , "HEAD" ]).strip ()
@@ -4320,8 +4320,8 @@ def __init__(self):
43204320 def defaultDestination (self , args ):
43214321 # TODO: use common prefix of args?
43224322 depotPath = args [0 ]
4323- depotDir = re .sub ("(@[^@]*)$" , "" , depotPath )
4324- depotDir = re .sub ("(#[^#]*)$" , "" , depotDir )
4323+ depotDir = re .sub (r "(@[^@]*)$" , "" , depotPath )
4324+ depotDir = re .sub (r "(#[^#]*)$" , "" , depotDir )
43254325 depotDir = re .sub (r"\.\.\.$" , "" , depotDir )
43264326 depotDir = re .sub (r"/$" , "" , depotDir )
43274327 return os .path .split (depotDir )[1 ]
0 commit comments