##// END OF EJS Templates
context: add isbinary function
Laurens Holst -
r15738:e86dd8df default
parent child Browse files
Show More
@@ -372,6 +372,12 b' class filectx(object):'
372 def size(self):
372 def size(self):
373 return self._filelog.size(self._filerev)
373 return self._filelog.size(self._filerev)
374
374
375 def isbinary(self):
376 try:
377 return util.binary(self.data())
378 except IOError:
379 return False
380
375 def cmp(self, fctx):
381 def cmp(self, fctx):
376 """compare with other file context
382 """compare with other file context
377
383
@@ -142,18 +142,12 b' def filemerge(repo, mynode, orig, fcd, f'
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" %
General Comments 0
You need to be logged in to leave comments. Login now