From a40c11b0e8c045bc5b1f6e83e1014f3d6b94fe66 Mon Sep 17 00:00:00 2001 From: Philip Thiem Date: Thu, 4 Jul 2013 09:55:43 -0500 Subject: If using a command, we can query the working copy version directly. --HG-- extra : rebase_source : e329ddea4345c4acd90997e8994bd3715926cfbb --- setuptools/svn_utils.py | 52 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'setuptools/svn_utils.py') diff --git a/setuptools/svn_utils.py b/setuptools/svn_utils.py index 86fed4d1..c052f671 100644 --- a/setuptools/svn_utils.py +++ b/setuptools/svn_utils.py @@ -216,14 +216,40 @@ class SVNEntriesXML(SVNEntries): ] return results +import xml.dom.pulldom class SVNEntriesCMD(SVNEntries): + # + # + # + # + # ... + # ... + # + # + # ... + # + # + # ... + # + # + # ... + # entrypathre = re.compile(r']*path="(\.+)">', re.I) entryre = re.compile(r'', re.DOTALL or re.I) urlre = re.compile(r'(.*?)', re.I) revre = re.compile(r']*revision="(\d+)"', re.I) namere = re.compile(r'(.*?)', re.I) + #svnversion return values (previous implementations return max revision) + # 4123:4168 mixed revision working copy + # 4168M modified working copy + # 4123S switched working copy + # 4123:4168MS mixed revision, modified, switched working copy + svnverre = re.compile(r'(?:(\d+):)?(\d+)([a-z]*)\s*$', re.I) + def __get_cached_dir_data(self): return self.dir_data @@ -251,18 +277,20 @@ class SVNEntriesCMD(SVNEntries): "Get repository URL" return self.urlre.search(self.get_dir_data()[0]).group(1) - def parse_revision_numbers(self): - #NOTE: if one has recently committed, - # the new revision doesn't get updated until SVN update - if not self.is_valid(): - return list() - else: - return [ - int(m.group(1)) - for entry in self.get_entries() - for m in self.revre.finditer(entry) - if m.group(1) - ] + + def parse_revision(self): + _, data = _run_command(['svnversion', self.path]) + parsed = self.svnverre.match(data) + if parsed: + log.warn('Parsed!') + try: + #No max needed this command summarizes working copy since 1.0 + return int(parsed.group(2)) + except ValueError: + #This should only happen if the revision is WAY too big. + pass + log.warn(repr(data)) + return 0 def get_undeleted_records(self): #NOTE: Need to parse entities? -- cgit v1.2.1