# HG changeset patch # User Sean Farley # Date 1446159437 25200 # Node ID 393bde462133378354aa7d1ef392931b5e5ad1d6 # Parent 584961625a58114f3092300279a0da5bbb34c079 init: only activate git ignore logic in reposetup This will massively speed up 'hg status' on repos that are not git based. On my macports repo, status went from Before: 0m0.591s After: 0m0.297s diff --git a/hggit/__init__.py b/hggit/__init__.py --- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -203,6 +203,17 @@ def reposetup(ui, repo): if not isinstance(repo, gitrepo.gitrepo): + + if (getattr(dirstate, 'rootcache', False) and + (not ignoremod or getattr(ignore, 'readpats', False))): + # only install our dirstate wrapper if it has a hope of working + import gitdirstate + if ignoremod: + def ignorewrap(orig, *args, **kwargs): + return gitdirstate.gignore(*args, **kwargs) + extensions.wrapfunction(ignore, 'ignore', ignorewrap) + dirstate.dirstate = gitdirstate.gitdirstate + klass = hgrepo.generate_repo_subclass(repo.__class__) repo.__class__ = klass @@ -241,16 +252,6 @@ ctx = scmutil.revsingle(repo, opts.get('rev'), '.') return verify.verify(ui, repo, ctx) -if (getattr(dirstate, 'rootcache', False) and - (not ignoremod or getattr(ignore, 'readpats', False))): - # only install our dirstate wrapper if it has a hope of working - import gitdirstate - if ignoremod: - def ignorewrap(orig, *args, **kwargs): - return gitdirstate.gignore(*args, **kwargs) - extensions.wrapfunction(ignore, 'ignore', ignorewrap) - dirstate.dirstate = gitdirstate.gitdirstate - @command('git-cleanup') def git_cleanup(ui, repo): '''clean up Git commit map after history editing'''