[PATCH 2 of 2] revset: have rev() validate input by repo.__contains__()

Yuya Nishihara yuya at tcha.org
Tue Feb 3 08:43:15 CST 2015


On Mon, 02 Feb 2015 22:17:21 +0000, Pierre-Yves David wrote:
> On 02/02/2015 03:29 PM, Yuya Nishihara wrote:
> > On Mon, 02 Feb 2015 14:23:42 +0000, Pierre-Yves David wrote:
> >> On 02/02/2015 02:15 PM, Yuya Nishihara wrote:
> >>> # HG changeset patch
> >>> # User Yuya Nishihara <yuya at tcha.org>
> >>> # Date 1420884012 -32400
> >>> #      Sat Jan 10 19:00:12 2015 +0900
> >>> # Node ID d247b985ebc0acdb837bc89288c8569151446620
> >>> # Parent  184aa519a7a72ab10361d91f66455e3cea8f4f50
> >>> revset: have rev() validate input by repo.__contains__()
> >>>
> >>> fullreposet.__contains__() will be rewritten in order to support "null"
> >>> revision, so "rev()" can't rely on it.
> >>
> >> Note that this change broke some of the Mercurial extension (because
> >> ::nullrev stopped being empty). So we have to be careful (even if this
> >> change makes sense).
> >
> > "::null" should work as long as the repository has no hidden revision, i.e.
> > len(subset) == len(repo).
> 
> The specific instance of the breakage was code using "null" as a special
> value and relying on revset being empty in that case. Not expecting a -1
> value. There may be other related bug lurking in internal code using revset.
> 
> http://42.netv6.net/evolve-main/rev/9e3f332f7630

I see. You're referring to "ancestors(null)" and future null-rev patches
might possibly expose similar problems.

http://selenic.com/repo/hg/rev/b1e026c25552

I have to be careful about "%n" and "%ln".  Other format string won't point
null revision by accident.  "%d" can't handle negative number correctly, and
"rev(-1)" is new.

Regards,


More information about the Mercurial-devel mailing list