##// 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 5 # This software may be used and distributed according to the terms of the
6 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 9 from i18n import _
10 10 import config, util, node, error
11 11 hg = None
@@ -275,24 +275,23 b' class svnsubrepo(object):'
275 275 return retdata
276 276
277 277 def _wcrev(self):
278 info = self._svncommand(['info'])
279 mat = re.search('Revision: ([\d]+)\n', info)
280 if not mat:
278 output = self._svncommand(['info', '--xml'])
279 doc = xml.dom.minidom.parseString(output)
280 entries = doc.getElementsByTagName('entry')
281 if not entries:
281 282 return 0
282 return mat.groups()[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]
283 return int(entries[0].getAttribute('revision') or 0)
290 284
291 285 def _wcclean(self):
292 status = self._svncommand(['status'])
293 status = '\n'.join([s for s in status.splitlines() if s[0] != '?'])
294 if status.strip():
295 return False
286 output = self._svncommand(['status', '--xml'])
287 doc = xml.dom.minidom.parseString(output)
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':
294 return False
296 295 return True
297 296
298 297 def dirty(self):
General Comments 0
You need to be logged in to leave comments. Login now