Mercurial > hg > hg-git
changeset 623:6faa5b0f8909
gitignore: gate feature on dirstate having rootcache and ignore having readpats
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 14 Dec 2013 11:19:25 -0500 (2013-12-14) |
parents | 09028a1e9895 |
children | ea72c664ae73 |
files | hggit/__init__.py tests/test-gitignore.t |
diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -41,7 +41,7 @@ 'collections', ]) -import gitrepo, hgrepo, gitdirstate +import gitrepo, hgrepo from git_handler import GitHandler testedwith = '1.9.3 2.0.2 2.1.2 2.2.3 2.3.1' @@ -130,9 +130,15 @@ repo.ui.status(_("clearing out the git cache data\n")) git = GitHandler(repo, ui) git.clear() - -extensions.wrapfunction(ignore, 'ignore', gitdirstate.gignore) -dirstate.dirstate = gitdirstate.gitdirstate + +from mercurial import dirstate +from mercurial import ignore +if (getattr(dirstate, 'rootcache', False) and + getattr(ignore, 'readpats', False)): + # only install our dirstate wrapper if it has a hope of working + import gitdirstate + extensions.wrapfunction(ignore, 'ignore', gitdirstate.gignore) + dirstate.dirstate = gitdirstate.gitdirstate def git_cleanup(ui, repo): new_map = []