[PATCH 1 of 2] phases: add a phase and phasestr method to file context

Matt Mackall mpm at selenic.com
Wed Oct 17 15:50:25 CDT 2012


On Wed, 2012-10-17 at 15:13 -0500, Kevin Bullock wrote:
> On Oct 17, 2012, at 2:10 PM, Matt Mackall wrote:
> 
> > On Wed, 2012-10-17 at 13:08 -0500, Sean Farley wrote:
> > > [referring to filectx]
> > > def date(self):
> > >    return self._changectx.date()
> > 
> > Here, _changectx is one of:
> > 
> > a) the changectx you explicitly used to get here
> > b) the changectx of the node you used to get here
> > c) the changectx of the filectx's linkrev, if you got here by
> > following
> > the file graph
> > 
> > (a) and (b) are trouble-free. So things like
> > repo[rev].p1()["somefile"].date() will always do the right thing.
> > 
> > (c) is a changeset that introduced this file revision, but it's not
> > guaranteed to be the only one. So repo[rev][file].p1().date() may
> > not be
> > what you expect. This is a side effect of the fact that we only
> > store
> > one linkrev per file revision.
> > 

> Sounds like something that at least merits warning inside the
> function's docstring?

..except it's in no way specific to, what, filectx.date()?

It affects absolutely everything that tries to go back up the
changeset->manifest->file data hierarchy with linkrev: file-level
logging, annotate, partial push/pull. It's a fundamental caveat of
Mercurial's data storage schema (the analogous caveat in Git is "you
can't go back up the hierarchy and you can't jump in at the bottom
anyway so you always have to work top-down and visit every changeset"). 

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list