comparison mercurial/patch.py @ 25658:e93036747902

global: mass rewrite to use modern octal syntax Python 2.6 introduced a new octal syntax: "0oXXX", replacing "0XXX". The old syntax is not recognized in Python 3 and will result in a parse error. Mass rewrite all instances of the old octal syntax to the new syntax. This patch was generated by `2to3 -f numliterals -w -n .` and the diff was selectively recorded to exclude changes to "<N>l" syntax conversion, which will be handled separately.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 23 Jun 2015 22:30:33 -0700
parents c99f9715cc9a
children 328739ea70c3
comparison
equal deleted inserted replaced
25657:dcc56e10c23b 25658:e93036747902
286 self.mode = None 286 self.mode = None
287 self.op = 'MODIFY' 287 self.op = 'MODIFY'
288 self.binary = False 288 self.binary = False
289 289
290 def setmode(self, mode): 290 def setmode(self, mode):
291 islink = mode & 020000 291 islink = mode & 0o20000
292 isexec = mode & 0100 292 isexec = mode & 0o100
293 self.mode = (islink, isexec) 293 self.mode = (islink, isexec)
294 294
295 def copy(self): 295 def copy(self):
296 other = patchmeta(self.path) 296 other = patchmeta(self.path)
297 other.oldpath = self.oldpath 297 other.oldpath = self.oldpath
428 if self.opener.islink(fname): 428 if self.opener.islink(fname):
429 return (self.opener.readlink(fname), (True, False)) 429 return (self.opener.readlink(fname), (True, False))
430 430
431 isexec = False 431 isexec = False
432 try: 432 try:
433 isexec = self.opener.lstat(fname).st_mode & 0100 != 0 433 isexec = self.opener.lstat(fname).st_mode & 0o100 != 0
434 except OSError, e: 434 except OSError, e:
435 if e.errno != errno.ENOENT: 435 if e.errno != errno.ENOENT:
436 raise 436 raise
437 try: 437 try:
438 return (self.opener.read(fname), (False, isexec)) 438 return (self.opener.read(fname), (False, isexec))