##// END OF EJS Templates
subrepo: svn xml output is much easier to parse...
Patrick Mezard -
r10272:886858b8 default
parent child Browse files
Show More
@@ -5,7 +5,7 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 import errno, os, re
8 import errno, os, re, xml.dom.minidom
9 from i18n import _
9 from i18n import _
10 import config, util, node, error
10 import config, util, node, error
11 hg = None
11 hg = None
@@ -275,23 +275,22 b' class svnsubrepo(object):'
275 return retdata
275 return retdata
276
276
277 def _wcrev(self):
277 def _wcrev(self):
278 info = self._svncommand(['info'])
278 output = self._svncommand(['info', '--xml'])
279 mat = re.search('Revision: ([\d]+)\n', info)
279 doc = xml.dom.minidom.parseString(output)
280 if not mat:
280 entries = doc.getElementsByTagName('entry')
281 if not entries:
281 return 0
282 return 0
282 return mat.groups()[0]
283 return int(entries[0].getAttribute('revision') or 0)
283
284 def _url(self):
285 info = self._svncommand(['info'])
286 mat = re.search('URL: ([^\n]+)\n', info)
287 if not mat:
288 return 0
289 return mat.groups()[0]
290
284
291 def _wcclean(self):
285 def _wcclean(self):
292 status = self._svncommand(['status'])
286 output = self._svncommand(['status', '--xml'])
293 status = '\n'.join([s for s in status.splitlines() if s[0] != '?'])
287 doc = xml.dom.minidom.parseString(output)
294 if status.strip():
288 for s in doc.getElementsByTagName('wc-status'):
289 st = s.getAttribute('item')
290 if st and st != 'unversioned':
291 return False
292 props = s.getAttribute('props')
293 if props and props != 'none':
295 return False
294 return False
296 return True
295 return True
297
296
General Comments 0
You need to be logged in to leave comments. Login now