M hgext3rd/confman/configuration.py +8 -3
@@ 89,7 89,9 @@ class configurationmanager(object):
if not os.path.exists(path):
return None
try:
- return repoclassbyconf(self.confs[section], path)(self, path)
+ return repoclassbyconf(
+ self.confs[section], path, self.opts.get('hggit')
+ )(self, path)
except error.RepoError:
return None
@@ 176,8 178,11 @@ class configurationmanager(object):
ui.status('cloning %s from %s to %s\n' % (section, source, dest))
try:
path = self.pathfromsection(section)
- repoclassbyconf(conf, path).clone(self, source, dest,
- self.confs[section])
+ repoclassbyconf(
+ conf, path, self.opts.get('hggit')
+ ).clone(
+ self, source, dest, self.confs[section]
+ )
except Exception, err:
# the clone operation did fail
self.failed.add(section)
M hgext3rd/confman/managed.py +15 -4
@@ 147,21 147,32 @@ class gitrevisioncontext(rcbase):
return out.splitlines()
-def repoclassbyconf(conf, path):
+def repoclassbyconf(conf, path, hggit=False):
'''introspect the configuration parameters values and the filesystem
and deduct the right repository manager class.
'''
uri = urlparse.urlparse(conf['pulluri'])
pulluri = conf['pulluri']
+
+ # first check the local repo (if it exists)
if (osp.isdir(osp.join(path, '.hg'))
or osp.isdir(osp.join(pulluri, '.hg'))):
return hgrepo
- if (uri.scheme == 'git' or uri.path.endswith('.git')
- or osp.isdir(osp.join(path, '.git'))
- or osp.isdir(osp.join(pulluri, '.git'))):
+
+ if osp.isdir(osp.join(path, '.git')):
return gitrepo
+
+ # then the hg-vs-git-vs-hggit
+ if (uri.scheme == 'git' or
+ uri.path.endswith('.git') or
+ osp.isdir(osp.join(pulluri, '.git'))):
+ if hggit:
+ return hgrepo
+ return gitrepo
+
if uri.path.endswith('.tar.gz') or uri.path.endswith('.tar.bz2'):
return tgzrepo
+
if uri.path.endswith('.zip'):
return ziprepo
return hgrepo
M hgext3rd/confman/opts.py +3 -1
@@ 5,6 5,8 @@ ROOTPATHOPT = ('', 'root-path', '',
PULLURIOPT = ('p', 'use-hgrc-path', '',
'distant repository path name registered into hgrc.paths.*')
URIMAPOPT = ('', 'uri-map-file', '', 'specify uri map file')
+HGGITOPT = ('', 'hggit', True, 'git: operate with hg-git')
-DEFAULTOPTS = [INCLUDEOPT, EXCLUDEOPT, ROOTPATHOPT]
+
+DEFAULTOPTS = [INCLUDEOPT, EXCLUDEOPT, ROOTPATHOPT, HGGITOPT]
REMOTEOPTS = [PULLURIOPT, URIMAPOPT]
M tests/test-git.t +3 -3
@@ 69,7 69,7 @@ Create working conf
Ensureconf
- $ hg cfensureconf
+ $ hg cfensureconf --no-hggit
Cloning into '$TESTTMP/conf/foo'...
done.
cloning foo from $TESTTMP/foo to $TESTTMP/conf/foo
@@ 142,7 142,7 @@ Add a git tag
conf
|- foo (HEAD) first-commit ok
`- bar.quux (default public) quux-version-1.0 ok
- $ hg cfensure
+ $ hg cfensure --no-hggit
From $TESTTMP/foo
???????..??????? master -> origin/master (glob)
* [new tag] foo-0.1 -> foo-0.1
@@ 166,7 166,7 @@ Add a git tag
|- foo (HEAD) first-commit [baseline 'foo-0.2' in a parallel branch]
`- bar.quux (default public) quux-version-1.0 ok
- $ hg cfensure
+ $ hg cfensure --no-hggit
foo
bar.quux