comparison mercurial/util.py @ 37322:a67fd1fe5109

stringutil: drop escapedata() in favor of escapestr() They are quite similar. Let's choose one that uses standard Python escape.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 04 Apr 2018 23:26:49 +0900
parents 24ab3381bf15
children b23e3cc1afd4
comparison
equal deleted inserted replaced
37321:e826fe7a08c7 37322:a67fd1fe5109
746 return 746 return
747 747
748 # Simple case writes all data on a single line. 748 # Simple case writes all data on a single line.
749 if b'\n' not in data: 749 if b'\n' not in data:
750 if self.logdataapis: 750 if self.logdataapis:
751 self.fh.write(': %s\n' % stringutil.escapedata(data)) 751 self.fh.write(': %s\n' % stringutil.escapestr(data))
752 else: 752 else:
753 self.fh.write('%s> %s\n' 753 self.fh.write('%s> %s\n'
754 % (self.name, stringutil.escapedata(data))) 754 % (self.name, stringutil.escapestr(data)))
755 self.fh.flush() 755 self.fh.flush()
756 return 756 return
757 757
758 # Data with newlines is written to multiple lines. 758 # Data with newlines is written to multiple lines.
759 if self.logdataapis: 759 if self.logdataapis:
760 self.fh.write(':\n') 760 self.fh.write(':\n')
761 761
762 lines = data.splitlines(True) 762 lines = data.splitlines(True)
763 for line in lines: 763 for line in lines:
764 self.fh.write('%s> %s\n' 764 self.fh.write('%s> %s\n'
765 % (self.name, stringutil.escapedata(line))) 765 % (self.name, stringutil.escapestr(line)))
766 self.fh.flush() 766 self.fh.flush()
767 767
768 class fileobjectobserver(baseproxyobserver): 768 class fileobjectobserver(baseproxyobserver):
769 """Logs file object activity.""" 769 """Logs file object activity."""
770 def __init__(self, fh, name, reads=True, writes=True, logdata=False, 770 def __init__(self, fh, name, reads=True, writes=True, logdata=False,
3843 system = _deprecatedfunc(procutil.system, '4.6') 3843 system = _deprecatedfunc(procutil.system, '4.6')
3844 gui = _deprecatedfunc(procutil.gui, '4.6') 3844 gui = _deprecatedfunc(procutil.gui, '4.6')
3845 hgcmd = _deprecatedfunc(procutil.hgcmd, '4.6') 3845 hgcmd = _deprecatedfunc(procutil.hgcmd, '4.6')
3846 rundetached = _deprecatedfunc(procutil.rundetached, '4.6') 3846 rundetached = _deprecatedfunc(procutil.rundetached, '4.6')
3847 3847
3848 escapedata = _deprecatedfunc(stringutil.escapedata, '4.6')
3849 binary = _deprecatedfunc(stringutil.binary, '4.6') 3848 binary = _deprecatedfunc(stringutil.binary, '4.6')
3850 stringmatcher = _deprecatedfunc(stringutil.stringmatcher, '4.6') 3849 stringmatcher = _deprecatedfunc(stringutil.stringmatcher, '4.6')
3851 shortuser = _deprecatedfunc(stringutil.shortuser, '4.6') 3850 shortuser = _deprecatedfunc(stringutil.shortuser, '4.6')
3852 emailuser = _deprecatedfunc(stringutil.emailuser, '4.6') 3851 emailuser = _deprecatedfunc(stringutil.emailuser, '4.6')
3853 email = _deprecatedfunc(stringutil.email, '4.6') 3852 email = _deprecatedfunc(stringutil.email, '4.6')