Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
16416:c3aedd526d53 | 16450:c9c8c9053119 |
---|---|
738 def push(self, opts): | 738 def push(self, opts): |
739 # push is a no-op for SVN | 739 # push is a no-op for SVN |
740 return True | 740 return True |
741 | 741 |
742 def files(self): | 742 def files(self): |
743 output = self._svncommand(['list']) | 743 output = self._svncommand(['list', '--recursive', '--xml'])[0] |
744 # This works because svn forbids \n in filenames. | 744 doc = xml.dom.minidom.parseString(output) |
745 return output.splitlines() | 745 paths = [] |
746 for e in doc.getElementsByTagName('entry'): | |
747 kind = str(e.getAttribute('kind')) | |
748 if kind != 'file': | |
749 continue | |
750 name = ''.join(c.data for c | |
751 in e.getElementsByTagName('name')[0].childNodes | |
752 if c.nodeType == c.TEXT_NODE) | |
753 paths.append(name) | |
754 return paths | |
746 | 755 |
747 def filedata(self, name): | 756 def filedata(self, name): |
748 return self._svncommand(['cat'], name) | 757 return self._svncommand(['cat'], name)[0] |
749 | 758 |
750 | 759 |
751 class gitsubrepo(abstractsubrepo): | 760 class gitsubrepo(abstractsubrepo): |
752 def __init__(self, ctx, path, state): | 761 def __init__(self, ctx, path, state): |
753 # TODO add git version check. | 762 # TODO add git version check. |