From fa323cad32fa1804f84b6421417828fbc9b15da0 Mon Sep 17 00:00:00 2001 From: Philip Thiem Date: Sun, 30 Jun 2013 00:30:48 -0500 Subject: cleaned up the svn module, I think I can drop the old entry parsing all together --HG-- extra : rebase_source : 16b995fc27ea40fff0dd51734aea47775ff0033a --- setuptools/svn_utils.py | 86 +++++++++---------------------------------------- 1 file changed, 15 insertions(+), 71 deletions(-) (limited to 'setuptools/svn_utils.py') diff --git a/setuptools/svn_utils.py b/setuptools/svn_utils.py index ad3b5f15..3311d9cf 100644 --- a/setuptools/svn_utils.py +++ b/setuptools/svn_utils.py @@ -15,96 +15,40 @@ def get_entries_files(base, recurse=True): yield f.read() f.close() +#It would seem that svn info --xml and svn list --xml were fully supported by 1.3.x +#the special casing of the entry files seem to start at 1.4.x, so if we check +#for xml in entries and then fall back to the command line, this should catch everything. + class SVNEntries(object): - known_svn_versions = { - '1.4.x': 8, - '1.5.x': 9, - '1.6.x': 10, - #11 didn't exist (maybe 1.7-dev) - #12 is the number in the file there is another - #number in .svn/wb.db that is at larger so - #looks like they won't be updating it any longer. - '1.7.x+': 12, - } - - def __init__(self, data): + + def __init__(self, path, data): + self.path = path self.data = data @classmethod def load(class_, base): filename = os.path.join(base, '.svn', 'entries') f = open(filename) - result = SVNEntries.read(f) + result = SVNEntries.read(f, None) f.close() return result @classmethod - def read(class_, file): + def read(class_, file, path=None): data = file.read() if data.startswith('revision_line_number - and section[revision_line_number] - ] - return rev_numbers - - def get_undeleted_records(self): - undeleted = lambda s: s and s[0] and (len(s) < 6 or s[5] != 'delete') - result = [ - section[0] - for section in self.get_sections() - if undeleted(section) - ] - return result - class SVNEntriesXML(SVNEntries): def is_valid(self): return True @@ -171,7 +115,7 @@ class SVNEntriesCMD(SVNEntries): return self.urlre.search(self.get_sections()[0]).group(1) def parse_revision_numbers(self): - #NOTE: if one has recently commited, the new revision doesn't get updated until svn update + #NOTE: if one has recently committed, the new revision doesn't get updated until SVN update if not self.is_valid(): return list() else: @@ -182,7 +126,7 @@ class SVNEntriesCMD(SVNEntries): ] def get_undeleted_records(self): - #NOTE: Need to pars enteries? + #NOTE: Need to parse entities? if not self.is_valid(): return list() else: -- cgit v1.2.3