hgbook.red-bean.com, hook-writing, and documentation

Matt Mackall mpm at selenic.com
Tue Apr 27 14:40:46 CDT 2010


On Sun, 2010-04-25 at 00:48 +0200, Benoit Boissinot wrote:
> On Sat, Apr 24, 2010 at 04:48:30PM -0400, Greg Ward wrote:
> > On Fri, Apr 23, 2010 at 9:10 AM, Ben Sizer <bens at monumentalgames.com> wrote:
> > > I also found out that "for filename in repo[none]", despite the docs
> > > implying that it would iterate over the files you've changed,
> > > actually in my case iterates over every single file in the
> > > repository. Rather strange. (But no doubt someone who understands
> > > Mercurial better than I would disagree.) Iterating over
> > > repo[none].files() was what I needed.
> > 
> > Are you reading http://mercurial.selenic.com/wiki/MercurialApi,
> > section 5 "Change Contexts"?  If so, it seems fairly clear to me:
> > 
> >   * for filename in changectx - loops over all files in the changeset
> > (in sorted order)
> > [...]
> >   * ctx.files() - the files changed in the changeset
> > 
> > I would hope you get the same behaviour for a changectx (representing
> > an actual changeset) and repo[None], which is actually a workingctx
> > object representing the working dir (what will become your next
> > changeset).  It sounds to me like the behaviour you saw confirms that,
> > and it's exactly what I would have expected from the docs in that wiki
> > page.
> 
> for f in repo[None] returns (on purpose, according to Matt)
> changed+added+clean+modified+*unknown*.

Yes and no. Unknown files -are- in the working context manifest, a fact
that's used and depended on by merge for a couple annoying cases. But
it's perhaps not necessary that we return unknown files when iterating
over a wctx - that's just the default behavior inherited from the
context base class.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list