[PATCH 2 of 3] context: override workingctx.hex() to avoid a crash

Yuya Nishihara yuya at tcha.org
Wed Jun 17 09:38:55 CDT 2015


On Tue, 16 Jun 2015 11:46:20 -0700, Pierre-Yves David wrote:
> On 06/16/2015 07:55 AM, Yuya Nishihara wrote:
> > On Mon, 15 Jun 2015 13:09:57 -0500, Matt Mackall wrote:
> >> I think this is pretty iffy. We might want to instead do something
> >> analogous to null and assign fff... to the working copy. If I were
> >> smarter way back when, I might have made the scheme look like:
> >>
> >> rev     hash
> >> 0       00000  <- null revision
> >> 1       ???    <- first revision
> >> ...
> >> maxint ffff   <- working copy
> >
> > I would agree if it were 2008 (though I would insist that rev should be
> > len(repo) for ease of arithmetic operation.)
> >
> > IMHO, wctx.hex() should be comparable to hex(wctx.node()), but changing
> > wctx.node() to '\xff...' would break many things. I doubt if we'll want to
> > go such route just for wdir().
> 
> I've been thinking about this for revset, and I agree with Matt here. 
> some maxint for working copy seems the way to go. Using len(repo) for 
> working dir seems like an excelent way to introduce subtle error in the 
> code.

Okay, I'll try INT_MAX revision to see if it will solve most of 'None' problems
in revset. I agree with you that len(repo) will hide errors.


More information about the Mercurial-devel mailing list