mercurial/filemerge.py
changeset 14168 135e244776f0
parent 13565 984175605311
child 14230 d51630301241
equal deleted inserted replaced
14167:0e4753807c93 14168:135e244776f0
   111         return '\n'
   111         return '\n'
   112     return None # unknown
   112     return None # unknown
   113 
   113 
   114 def _matcheol(file, origfile):
   114 def _matcheol(file, origfile):
   115     "Convert EOL markers in a file to match origfile"
   115     "Convert EOL markers in a file to match origfile"
   116     tostyle = _eoltype(open(origfile, "rb").read())
   116     tostyle = _eoltype(util.readfile(origfile))
   117     if tostyle:
   117     if tostyle:
   118         data = open(file, "rb").read()
   118         data = util.readfile(file)
   119         style = _eoltype(data)
   119         style = _eoltype(data)
   120         if style:
   120         if style:
   121             newdata = data.replace(style, tostyle)
   121             newdata = data.replace(style, tostyle)
   122             if newdata != data:
   122             if newdata != data:
   123                 open(file, "wb").write(newdata)
   123                 util.writefile(file, newdata)
   124 
   124 
   125 def filemerge(repo, mynode, orig, fcd, fco, fca):
   125 def filemerge(repo, mynode, orig, fcd, fco, fca):
   126     """perform a 3-way merge in the working directory
   126     """perform a 3-way merge in the working directory
   127 
   127 
   128     mynode = parent node before merge
   128     mynode = parent node before merge