Submitter | Drew Gottlieb |
---|---|
Date | March 13, 2015, 11:35 p.m. |
Message ID | <4c9d2b99b7517bf30737.1426289737@waste.org> |
Download | mbox | patch |
Permalink | /patch/8076/ |
State | Accepted |
Commit | 637da5711122c5f3028518eaf1fa8eb5bcbbe5d1 |
Headers | show |
Comments
This patch is optional :) On Fri, Mar 13, 2015 at 4:39 PM Drew Gottlieb <drgott@google.com> wrote: > # HG changeset patch > # User Drew Gottlieb <drgott@google.com> > # Date 1426286171 25200 > # Fri Mar 13 15:36:11 2015 -0700 > # Node ID 4c9d2b99b7517bf30737d1ec7b1b5f33e738afa2 > # Parent e6322f7d1ebdd7f67d0656bad2eacbd7d76547e5 > manifest: have context use self.hasdir() > > A couple places in context currently use "x in self._dirs" to check for the > existence of the directory, but this requires that all directories be > loaded > into a dict. Calling hasdir() instead puts the work on the the manifest to > check for the existence of a directory in the most efficient manner. > > diff --git a/mercurial/context.py b/mercurial/context.py > --- a/mercurial/context.py > +++ b/mercurial/context.py > @@ -607,10 +607,8 @@ > if match(fn): > yield fn > for fn in sorted(fset): > - if fn in self._dirs: > - # specified pattern is a directory > - continue > - match.bad(fn, _('no such file in rev %s') % self) > + if not self.hasdir(fn): > + match.bad(fn, _('no such file in rev %s') % self) > > def matches(self, match): > return self.walk(match) > @@ -1560,7 +1558,7 @@ > def bad(f, msg): > # 'f' may be a directory pattern from 'match.files()', > # so 'f not in ctx1' is not enough > - if f not in other and f not in other.dirs(): > + if f not in other and not other.hasdir(f): > self._repo.ui.warn('%s: %s\n' % > (self._repo.dirstate.pathto(f), > msg)) > match.bad = bad > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel >
On Fri, 2015-03-13 at 18:35 -0500, Drew Gottlieb wrote: > # HG changeset patch > # User Drew Gottlieb <drgott@google.com> > # Date 1426286171 25200 > # Fri Mar 13 15:36:11 2015 -0700 > # Node ID 4c9d2b99b7517bf30737d1ec7b1b5f33e738afa2 > # Parent e6322f7d1ebdd7f67d0656bad2eacbd7d76547e5 > manifest: have context use self.hasdir() These are queued for default, thanks. Nicely done, congratulations on your first Mercurial patches.
Patch
diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -607,10 +607,8 @@ if match(fn): yield fn for fn in sorted(fset): - if fn in self._dirs: - # specified pattern is a directory - continue - match.bad(fn, _('no such file in rev %s') % self) + if not self.hasdir(fn): + match.bad(fn, _('no such file in rev %s') % self) def matches(self, match): return self.walk(match) @@ -1560,7 +1558,7 @@ def bad(f, msg): # 'f' may be a directory pattern from 'match.files()', # so 'f not in ctx1' is not enough - if f not in other and f not in other.dirs(): + if f not in other and not other.hasdir(f): self._repo.ui.warn('%s: %s\n' % (self._repo.dirstate.pathto(f), msg)) match.bad = bad