##// END OF EJS Templates
subrepo: clean up lingering bytes/str issues in svn support...
Augie Fackler -
r41635:fa7d4e6a default
parent child Browse files
Show More
@@ -961,6 +961,7 b' class svnsubrepo(abstractsubrepo):'
961 universal_newlines=True,
961 universal_newlines=True,
962 env=procutil.tonativeenv(env), **extrakw)
962 env=procutil.tonativeenv(env), **extrakw)
963 stdout, stderr = p.communicate()
963 stdout, stderr = p.communicate()
964 stdout, stderr = pycompat.fsencode(stdout), pycompat.fsencode(stderr)
964 stderr = stderr.strip()
965 stderr = stderr.strip()
965 if not failok:
966 if not failok:
966 if p.returncode:
967 if p.returncode:
@@ -987,13 +988,14 b' class svnsubrepo(abstractsubrepo):'
987 # both. We used to store the working directory one.
988 # both. We used to store the working directory one.
988 output, err = self._svncommand(['info', '--xml'])
989 output, err = self._svncommand(['info', '--xml'])
989 doc = xml.dom.minidom.parseString(output)
990 doc = xml.dom.minidom.parseString(output)
990 entries = doc.getElementsByTagName('entry')
991 entries = doc.getElementsByTagName(r'entry')
991 lastrev, rev = '0', '0'
992 lastrev, rev = '0', '0'
992 if entries:
993 if entries:
993 rev = str(entries[0].getAttribute('revision')) or '0'
994 rev = pycompat.bytestr(entries[0].getAttribute(r'revision')) or '0'
994 commits = entries[0].getElementsByTagName('commit')
995 commits = entries[0].getElementsByTagName(r'commit')
995 if commits:
996 if commits:
996 lastrev = str(commits[0].getAttribute('revision')) or '0'
997 lastrev = pycompat.bytestr(
998 commits[0].getAttribute(r'revision')) or '0'
997 return (lastrev, rev)
999 return (lastrev, rev)
998
1000
999 def _wcrev(self):
1001 def _wcrev(self):
@@ -1008,19 +1010,19 b' class svnsubrepo(abstractsubrepo):'
1008 output, err = self._svncommand(['status', '--xml'])
1010 output, err = self._svncommand(['status', '--xml'])
1009 externals, changes, missing = [], [], []
1011 externals, changes, missing = [], [], []
1010 doc = xml.dom.minidom.parseString(output)
1012 doc = xml.dom.minidom.parseString(output)
1011 for e in doc.getElementsByTagName('entry'):
1013 for e in doc.getElementsByTagName(r'entry'):
1012 s = e.getElementsByTagName('wc-status')
1014 s = e.getElementsByTagName(r'wc-status')
1013 if not s:
1015 if not s:
1014 continue
1016 continue
1015 item = s[0].getAttribute('item')
1017 item = s[0].getAttribute(r'item')
1016 props = s[0].getAttribute('props')
1018 props = s[0].getAttribute(r'props')
1017 path = e.getAttribute('path')
1019 path = e.getAttribute(r'path').encode('utf8')
1018 if item == 'external':
1020 if item == r'external':
1019 externals.append(path)
1021 externals.append(path)
1020 elif item == 'missing':
1022 elif item == r'missing':
1021 missing.append(path)
1023 missing.append(path)
1022 if (item not in ('', 'normal', 'unversioned', 'external')
1024 if (item not in (r'', r'normal', r'unversioned', r'external')
1023 or props not in ('', 'none', 'normal')):
1025 or props not in (r'', r'none', r'normal')):
1024 changes.append(path)
1026 changes.append(path)
1025 for path in changes:
1027 for path in changes:
1026 for ext in externals:
1028 for ext in externals:
@@ -1141,14 +1143,14 b' class svnsubrepo(abstractsubrepo):'
1141 output = self._svncommand(['list', '--recursive', '--xml'])[0]
1143 output = self._svncommand(['list', '--recursive', '--xml'])[0]
1142 doc = xml.dom.minidom.parseString(output)
1144 doc = xml.dom.minidom.parseString(output)
1143 paths = []
1145 paths = []
1144 for e in doc.getElementsByTagName('entry'):
1146 for e in doc.getElementsByTagName(r'entry'):
1145 kind = pycompat.bytestr(e.getAttribute('kind'))
1147 kind = pycompat.bytestr(e.getAttribute(r'kind'))
1146 if kind != 'file':
1148 if kind != 'file':
1147 continue
1149 continue
1148 name = ''.join(c.data for c
1150 name = r''.join(c.data for c
1149 in e.getElementsByTagName('name')[0].childNodes
1151 in e.getElementsByTagName(r'name')[0].childNodes
1150 if c.nodeType == c.TEXT_NODE)
1152 if c.nodeType == c.TEXT_NODE)
1151 paths.append(name.encode('utf-8'))
1153 paths.append(name.encode('utf8'))
1152 return paths
1154 return paths
1153
1155
1154 def filedata(self, name, decode):
1156 def filedata(self, name, decode):
General Comments 0
You need to be logged in to leave comments. Login now