diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -352,12 +352,12 @@ class filectx(object): def size(self): return self._filelog.size(self._filerev) - def cmp(self, text): - """compare text with stored file revision + def cmp(self, fctx): + """compare with other file context - returns True if text is different than what is stored. + returns True if different than fctx. """ - return self._filelog.cmp(self._filenode, text) + return self._filelog.cmp(self._filenode, fctx.data()) def renamed(self): """check if file was actually renamed in this changeset revision @@ -935,12 +935,12 @@ class workingfilectx(filectx): raise return (t, tz) - def cmp(self, text): - """compare text with disk content + def cmp(self, fctx): + """compare with other file context - returns True if text is different than what is on disk. + returns True if different than fctx. """ - return self._repo.wread(self._path) != text + return self._repo.wread(self._path) != fctx.data() class memctx(object): """Use memctx to perform in-memory commits via localrepo.commitctx(). diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -135,7 +135,7 @@ def filemerge(repo, mynode, orig, fcd, f except IOError: return False - if not fco.cmp(fcd.data()): # files identical? + if not fco.cmp(fcd): # files identical? return None if fca == fco: # backwards, use working dir parent as ancestor diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1062,7 +1062,7 @@ class localrepository(repo.repository): # do a full compare of any files that might have changed for f in sorted(cmp): if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) - or ctx1[f].cmp(ctx2[f].data())): + or ctx1[f].cmp(ctx2[f])): modified.append(f) else: fixup.append(f) @@ -1106,7 +1106,7 @@ class localrepository(repo.repository): if fn in mf1: if (mf1.flags(fn) != mf2.flags(fn) or (mf1[fn] != mf2[fn] and - (mf2[fn] or ctx1[fn].cmp(ctx2[fn].data())))): + (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))): modified.append(fn) elif listclean: clean.append(fn) diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -73,7 +73,7 @@ class mergestate(object): def _checkunknown(wctx, mctx): "check for collisions between unknown files and files in mctx" for f in wctx.unknown(): - if f in mctx and mctx[f].cmp(wctx[f].data()): + if f in mctx and mctx[f].cmp(wctx[f]): raise util.Abort(_("untracked file in working directory differs" " from file in requested revision: '%s'") % f)