[PATCH 2 of 6] scmutil.addremove: use the dirstate's map directly

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Apr 2 14:49:05 CDT 2013


On 2 Apr 2013, at 2:36 PM, Siddharth Agarwal wrote:

> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1364888347 25200
> #      Tue Apr 02 00:39:07 2013 -0700
> # Node ID 891827de9c10b0bbedd2e74ef48189dfb4af77e1
> # Parent  d723353c8a0ab2ced8606014abee43aa0b1e3fa4
> scmutil.addremove: use the dirstate's map directly
> 
> On a large repository with 170,000 files, this speeds up perfaddremove from
> 2.78 seconds to 2.29.
> 
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -676,10 +676,11 @@ def addremove(repo, pats=[], opts={}, dr
>     m.bad = lambda x, y: rejected.append(x)
> 
>     ctx = repo[None]
> +    dget = repo.dirstate._map.get

Boo, hiss. If dirstate's map needs to be a public object (and it looks like there's several places where it does), let's refactor it into a proper external collaborator of the dirstate object.

Fewer Law of Demeter violations, not more.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list