comparison mercurial/context.py @ 37084:f0b6fbea00cf

stringutil: bulk-replace call sites to point to new module This might conflict with other patches floating around, sorry.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 22 Mar 2018 21:56:20 +0900
parents b33b91ca2ec2
children 656ac240f392
comparison
equal deleted inserted replaced
37083:f99d64e8a4e4 37084:f0b6fbea00cf
44 sparse, 44 sparse,
45 subrepo, 45 subrepo,
46 subrepoutil, 46 subrepoutil,
47 util, 47 util,
48 ) 48 )
49 from .utils import dateutil 49 from .utils import (
50 dateutil,
51 stringutil,
52 )
50 53
51 propertycache = util.propertycache 54 propertycache = util.propertycache
52 55
53 nonascii = re.compile(br'[^\x21-\x7f]').search 56 nonascii = re.compile(br'[^\x21-\x7f]').search
54 57
816 def path(self): 819 def path(self):
817 return self._path 820 return self._path
818 821
819 def isbinary(self): 822 def isbinary(self):
820 try: 823 try:
821 return util.binary(self.data()) 824 return stringutil.binary(self.data())
822 except IOError: 825 except IOError:
823 return False 826 return False
824 def isexec(self): 827 def isexec(self):
825 return 'x' in self.flags() 828 return 'x' in self.flags()
826 def islink(self): 829 def islink(self):
1498 # symlink 1501 # symlink
1499 sane = [] 1502 sane = []
1500 for f in files: 1503 for f in files:
1501 if self.flags(f) == 'l': 1504 if self.flags(f) == 'l':
1502 d = self[f].data() 1505 d = self[f].data()
1503 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d): 1506 if (d == '' or len(d) >= 1024 or '\n' in d
1507 or stringutil.binary(d)):
1504 self._repo.ui.debug('ignoring suspect symlink placeholder' 1508 self._repo.ui.debug('ignoring suspect symlink placeholder'
1505 ' "%s"\n' % f) 1509 ' "%s"\n' % f)
1506 continue 1510 continue
1507 sane.append(f) 1511 sane.append(f)
1508 return sane 1512 return sane