comparison mercurial/filemerge.py @ 15738:e86dd8dfdea0

context: add isbinary function
author Laurens Holst <laurens.hg@grauw.nl>
date Wed, 21 Dec 2011 18:20:15 +0100
parents 2371f4aea665
children 83925d3a4559 b605448eb254
comparison
equal deleted inserted replaced
15737:8edd9f2c7b57 15738:e86dd8dfdea0
140 f = os.fdopen(fd, "wb") 140 f = os.fdopen(fd, "wb")
141 f.write(data) 141 f.write(data)
142 f.close() 142 f.close()
143 return name 143 return name
144 144
145 def isbin(ctx):
146 try:
147 return util.binary(ctx.data())
148 except IOError:
149 return False
150
151 if not fco.cmp(fcd): # files identical? 145 if not fco.cmp(fcd): # files identical?
152 return None 146 return None
153 147
154 ui = repo.ui 148 ui = repo.ui
155 fd = fcd.path() 149 fd = fcd.path()
156 binary = isbin(fcd) or isbin(fco) or isbin(fca) 150 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
157 symlink = 'l' in fcd.flags() + fco.flags() 151 symlink = 'l' in fcd.flags() + fco.flags()
158 tool, toolpath = _picktool(repo, ui, fd, binary, symlink) 152 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
159 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" % 153 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
160 (tool, fd, binary, symlink)) 154 (tool, fd, binary, symlink))
161 155