# HG changeset patch # User Sean Farley # Date 1435361799 25200 # Node ID e28affca64dee058ca53017031f226e324651ef8 # Parent ee9017a3c269f35735917eb8614844900db73f03 init: test for git http(s) paths Wraps the http(s) schemes to test for a .git at the end of the url. diff --git a/hggit/__init__.py b/hggit/__init__.py --- a/hggit/__init__.py +++ b/hggit/__init__.py @@ -109,6 +109,20 @@ hg.schemes['file'] = _local +def _httpgitwrapper(orig): + # we should probably test the connection but for now, we just keep it + # simple and check for a url ending in '.git' + def httpgitscheme(uri): + if uri.endswith('.git'): + return gitrepo + + return orig(uri) + + return httpgitscheme + +hg.schemes['https'] = _httpgitwrapper(hg.schemes['https']) +hg.schemes['http'] = _httpgitwrapper(hg.schemes['http']) + hgdefaultdest = hg.defaultdest def defaultdest(source): for scheme in util.gitschemes: