Mercurial > hg-stable
diff mercurial/context.py @ 11702:eb07fbc21e9c
filectx: use cmp(self, fctx) instead of cmp(self, text)
This allows more flexibility in implementation, and in particular,
lets the context decide if revision text has to be loaded or not.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Tue, 27 Jul 2010 23:40:46 +0900 |
parents | ce95d8b87d22 |
children | 55a2af02e45c |
line wrap: on
line diff
--- a/mercurial/context.py Wed Jul 28 11:07:20 2010 +0200 +++ b/mercurial/context.py Tue Jul 27 23:40:46 2010 +0900 @@ -352,12 +352,12 @@ 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 @@ 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().