Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 16450:c9c8c9053119 stable
archive: make it work with svn subrepos (issue3308)
- _svncommand() in files() returns a tuple since 0ae98cd2a83f not a string.
- _svncommand() in filedata() returns a tuple not a string.
- "svn list" returns files but also directories.
- "svn list" is not recursive by default.
I have no idea what happens to svn:externals possibly embedded in the svn
subrepository.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Mon, 16 Apr 2012 11:48:15 +0200 |
parents | 8ae7626d8bf1 |
children | 9c431cfdca12 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Fri Apr 13 15:07:13 2012 +0200 +++ b/mercurial/subrepo.py Mon Apr 16 11:48:15 2012 +0200 @@ -740,12 +740,21 @@ return True def files(self): - output = self._svncommand(['list']) - # This works because svn forbids \n in filenames. - return output.splitlines() + output = self._svncommand(['list', '--recursive', '--xml'])[0] + doc = xml.dom.minidom.parseString(output) + paths = [] + for e in doc.getElementsByTagName('entry'): + kind = str(e.getAttribute('kind')) + if kind != 'file': + continue + name = ''.join(c.data for c + in e.getElementsByTagName('name')[0].childNodes + if c.nodeType == c.TEXT_NODE) + paths.append(name) + return paths def filedata(self, name): - return self._svncommand(['cat'], name) + return self._svncommand(['cat'], name)[0] class gitsubrepo(abstractsubrepo):