D1313: dirstate: gate access to self._map.dirs

mbthomas (Mark Thomas) phabricator at mercurial-scm.org
Fri Nov 3 19:16:01 EDT 2017


mbthomas requested changes to this revision.
mbthomas added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> dirstate.py:405
>              scmutil.checkfilename(f)
> -            if f in self._map.dirs:
> -                raise error.Abort(_('directory %r already in dirstate') % f)
> -            # shadows
> -            for d in util.finddirs(f):
> -                if d in self._map.dirs:
> -                    break
> -                entry = self._map.get(d)
> -                if entry is not None and entry[0] != 'r':
> -                    raise error.Abort(
> -                        _('file %r in dirstate clashes with %r') % (d, f))
> +            if "dirs" in self._map.__dict__:
> +                if f in self._map.dirs:

I don't think it's safe to do this.  We're looking for clashes between files and directories, so we do need to look in self.dirs, even if that means generating it because we're accessing it for the first time.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1313

To: mbolin, #hg-reviewers, mbthomas
Cc: mbthomas, durham, mercurial-devel


More information about the Mercurial-devel mailing list