Mercurial > hg
changeset 24118:76f6ae06ddf5
revlog: add "iscensored()" to revlog public API
The iscensored method will be used by the exchange layer to reject
nonconforming deltas involving censored revisions (and to produce
conforming deltas).
For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
author | Mike Edgar <adgar@google.com> |
---|---|
date | Fri, 23 Jan 2015 17:01:39 -0500 |
parents | 9cfd7c4f22f5 |
children | a5a06c9c7407 |
files | mercurial/filelog.py mercurial/revlog.py mercurial/unionrepo.py |
diffstat | 3 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filelog.py Fri Feb 06 01:44:24 2015 +0000 +++ b/mercurial/filelog.py Fri Jan 23 17:01:39 2015 -0500 @@ -64,7 +64,7 @@ node = self.node(rev) if self.renamed(node): return len(self.read(node)) - if self._iscensored(rev): + if self.iscensored(rev): return 0 # XXX if self.read(node).startswith("\1\n"), this returns (size+4) @@ -85,7 +85,7 @@ return False # censored files compare against the empty file - if self._iscensored(self.rev(node)): + if self.iscensored(self.rev(node)): return text != '' # renaming a file produces a different hash, even if the data @@ -104,6 +104,6 @@ raise error.CensoredNodeError(self.indexfile, node) raise - def _iscensored(self, rev): + def iscensored(self, rev): """Check if a file revision is censored.""" return self.flags(rev) & revlog.REVIDX_ISCENSORED
--- a/mercurial/revlog.py Fri Feb 06 01:44:24 2015 +0000 +++ b/mercurial/revlog.py Fri Jan 23 17:01:39 2015 -0500 @@ -1419,6 +1419,10 @@ return content + def iscensored(self, rev): + """Check if a file revision is censored.""" + return False + def getstrippoint(self, minlink): """find the minimum rev that must be stripped to strip the linkrev
--- a/mercurial/unionrepo.py Fri Feb 06 01:44:24 2015 +0000 +++ b/mercurial/unionrepo.py Fri Jan 23 17:01:39 2015 -0500 @@ -160,6 +160,12 @@ def baserevdiff(self, rev1, rev2): return filelog.filelog.revdiff(self, rev1, rev2) + def iscensored(self, rev): + """Check if a revision is censored.""" + if rev <= self.repotiprev: + return filelog.filelog.iscensored(self, rev) + return self.revlog2.iscensored(rev) + class unionpeer(localrepo.localpeer): def canpush(self): return False