[PATCH stable] unionrepo: fix wrong rev being checked in iscensored (issue5024)

Yuya Nishihara yuya at tcha.org
Sun Jan 10 01:18:24 CST 2016


On Sat, 09 Jan 2016 17:03:58 -0800, Sean Farley wrote:
> Yuya Nishihara <yuya at tcha.org> writes:
> > On Fri, 08 Jan 2016 10:10:28 -0800, Sean Farley wrote:
> >> # HG changeset patch
> >> # User Sean Farley <sean at farley.io>
> >> # Date 1452106915 28800
> >> #      Wed Jan 06 11:01:55 2016 -0800
> >> # Branch stable
> >> # Node ID 258348d91ba9fd91adecd9cb5c3333816dc2f76d
> >> # Parent  7c598947fbbd78b26989326c61345c6e46855bdc
> >> unionrepo: fix wrong rev being checked in iscensored (issue5024)
> >> 
> >> diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
> >> --- a/mercurial/unionrepo.py
> >> +++ b/mercurial/unionrepo.py
> >> @@ -180,11 +180,12 @@ class unionfilelog(unionrevlog, filelog.
> >>  
> >>      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)
> >> +        node = self.node(rev)
> >> +        return self.revlog2.iscensored(self.revlog2.rev(node))
> >
> > Looks good, but can you add a test? ™
> 
> Sadly, I couldn't reproduce it simply. Could anyone help?

Got it.

hg init a
cd a
echo a0 >> f
hg ci -Am a0
cd ..

# +2 revisions to exceed index boundary
hg init b
cd b
echo b0 >> f
hg ci -Am b0
echo b1 >> f
hg ci -m b1

# "hg files -v" to call fctx.size() -> fctx.iscensored()
hg files -R union:../a -r2 -v


More information about the Mercurial-devel mailing list