@@ -689,8 +689,8 @@ def setP4ExecBit(file, mode):
689
689
690
690
if not isModeExec (mode ):
691
691
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 )
694
694
if p4Type [- 1 ] == "+" :
695
695
p4Type = p4Type [0 :- 1 ]
696
696
@@ -701,7 +701,7 @@ def getP4OpenedType(file):
701
701
"""Returns the perforce file type for the given file."""
702
702
703
703
result = p4_read_pipe (["opened" , wildcard_encode (file )])
704
- match = re .match (".*\((.+)\)( \*exclusive\*)?\r ?$" , result )
704
+ match = re .match (r ".*\((.+)\)( \*exclusive\*)?\r?$" , result )
705
705
if match :
706
706
return match .group (1 )
707
707
else :
@@ -757,7 +757,7 @@ def parseDiffTreeEntry(entry):
757
757
758
758
global _diff_tree_pattern
759
759
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(.*))|$)' )
761
761
762
762
match = _diff_tree_pattern .match (entry )
763
763
if match :
@@ -918,9 +918,9 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,
918
918
if len (result ) > 0 :
919
919
data = result [0 ].get ('data' )
920
920
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 )
922
922
if not m :
923
- m = re .search ('Request too large \(over (\d+)\)' , data )
923
+ m = re .search (r 'Request too large \(over (\d+)\)' , data )
924
924
925
925
if m :
926
926
limit = int (m .group (1 ))
@@ -1452,7 +1452,7 @@ def wildcard_encode(path):
1452
1452
1453
1453
1454
1454
def wildcard_present (path ):
1455
- m = re .search ("[*#@%]" , path )
1455
+ m = re .search (r "[*#@%]" , path )
1456
1456
return m is not None
1457
1457
1458
1458
@@ -3048,7 +3048,7 @@ def stripRepoPath(self, path, prefixes):
3048
3048
# Preserve everything in relative path name except leading
3049
3049
# //depot/; just look at first prefix as they all should
3050
3050
# be in the same depot.
3051
- depot = re .sub ("^(//[^/]+/).*" , r'\1' , prefixes [0 ])
3051
+ depot = re .sub (r "^(//[^/]+/).*" , r'\1' , prefixes [0 ])
3052
3052
if p4PathStartsWith (path , depot ):
3053
3053
path = path [len (depot ):]
3054
3054
@@ -3603,7 +3603,7 @@ def importP4Labels(self, stream, p4Labels):
3603
3603
commitFound = True
3604
3604
else :
3605
3605
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 )
3607
3607
if len (gitCommit ) == 0 :
3608
3608
print ("importing label %s: could not find git commit for changelist %d" % (name , changelist ))
3609
3609
else :
@@ -4182,7 +4182,7 @@ def run(self, args):
4182
4182
if len (self .changesFile ) == 0 :
4183
4183
revision = "#head"
4184
4184
4185
- p = re .sub ("\.\.\.$" , "" , p )
4185
+ p = re .sub (r "\.\.\.$" , "" , p )
4186
4186
if not p .endswith ("/" ):
4187
4187
p += "/"
4188
4188
@@ -4291,7 +4291,7 @@ def rebase(self):
4291
4291
die ("Cannot find upstream branchpoint for rebase" )
4292
4292
4293
4293
# 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 )
4295
4295
4296
4296
print ("Rebasing the current branch onto %s" % upstream )
4297
4297
oldHead = read_pipe (["git" , "rev-parse" , "HEAD" ]).strip ()
@@ -4320,8 +4320,8 @@ def __init__(self):
4320
4320
def defaultDestination (self , args ):
4321
4321
# TODO: use common prefix of args?
4322
4322
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 )
4325
4325
depotDir = re .sub (r"\.\.\.$" , "" , depotDir )
4326
4326
depotDir = re .sub (r"/$" , "" , depotDir )
4327
4327
return os .path .split (depotDir )[1 ]
0 commit comments