# HG changeset patch # User Mads Kiilerich # Date 1254961620 -7200 # Node ID 442fe2ca104d2b6330a8c60173b8f240ec807a0b # Parent ff2d4f541ae9decdc121fd2a977f37b8da662dae Simpler handling of detection of git repos This also fixes git.intree support diff -r ff2d4f541ae9 -r 442fe2ca104d __init__.py --- a/__init__.py Wed Aug 19 21:13:07 2009 +0100 +++ b/__init__.py Thu Oct 08 02:27:00 2009 +0200 @@ -14,12 +14,11 @@ ''' +import os + from mercurial import commands, extensions, hg, util from mercurial.i18n import _ -from dulwich.repo import Repo -from dulwich.errors import NotGitRepository - import gitrepo, hgrepo from git_handler import GitHandler @@ -28,15 +27,15 @@ hg.schemes['git'] = gitrepo hg.schemes['git+ssh'] = gitrepo +# support for `hg clone localgitrepo` _oldlocal = hg.schemes['file'] def _local(path): p = util.drop_scheme('file', path) - try: - Repo(p) + if (os.path.exists(os.path.join(p, '.git')) and + not os.path.exists(os.path.join(p, '.hg'))): return gitrepo - except NotGitRepository: - return _oldlocal(path) + return _oldlocal(path) hg.schemes['file'] = _local