detect mercurial subrepositories

This commit is contained in:
Sebastian Sdorra
2011-11-28 16:53:08 +01:00
parent 7cfb796810
commit 4d15700052

View File

@@ -57,7 +57,14 @@ name = getName(path)
length = 0 length = 0
paths = [] paths = []
repo = hg.repository(ui.ui(), path = repositoryPath) repo = hg.repository(ui.ui(), path = repositoryPath)
mf = repo[revision].manifest() subrepos = {}
revCtx = repo[revision]
mf = revCtx.manifest()
hgsub = revCtx.filectx('.hgsub').data().split('\n')
for line in hgsub:
parts = line.split('=')
if len(parts) > 1:
subrepos[parts[0].strip()] = parts[1].strip()
if path is "": if path is "":
length = 1 length = 1
@@ -72,6 +79,10 @@ else:
files = [] files = []
directories = [] directories = []
for k, v in subrepos.iteritems():
if k.startswith(path):
directories.append(k)
for p in paths: for p in paths:
parts = p.split('/') parts = p.split('/')
depth = len(parts) depth = len(parts)
@@ -95,6 +106,9 @@ for dir in directories:
print ' <name>' + getName(dir) + '</name>' print ' <name>' + getName(dir) + '</name>'
print ' <path>' + dir + '</path>' print ' <path>' + dir + '</path>'
print ' <directory>true</directory>' print ' <directory>true</directory>'
subrepo = subrepos[dir]
if subrepo != None:
print ' <subRepositoryUrl>' + subrepo + '<subRepositoryUrl>'
print ' </file>' print ' </file>'
for file in files: for file in files: