Skip to content
Snippets Groups Projects
Unverified Commit 1dc8f952 authored by Todd Gamblin's avatar Todd Gamblin Committed by GitHub
Browse files

Use `svn info --xml` instead of `svn info` to get svn revisions (#11466)

- `svn info` prints different results depending on the system locale
  - in particular, Japanese output doesn't contain "Revision:"

- Change Spack code to use XML output instead of using the human output
parent 821b7d3b
Branches
Tags
No related merge requests found
......@@ -26,6 +26,7 @@
import re
import shutil
import copy
import xml.etree.ElementTree
from functools import wraps
from six import string_types, with_metaclass
......@@ -771,13 +772,9 @@ def source_id(self):
return self.revision
def get_source_id(self):
output = self.svn('info', self.url, output=str)
if not output:
return None
lines = output.split('\n')
for line in lines:
if line.startswith('Revision:'):
return line.split()[-1]
output = self.svn('info', '--xml', self.url, output=str)
info = xml.etree.ElementTree.fromstring(output)
return info.find('entry/commit').get('revision')
@_needs_stage
def fetch(self):
......
......@@ -9,7 +9,7 @@
import os
import os.path
import shutil
import re
import xml.etree.ElementTree
import ordereddict_backport
import py
......@@ -725,12 +725,9 @@ def mock_svn_repository(tmpdir_factory):
}
def get_rev():
output = svn('info', output=str)
assert "Revision" in output
for line in output.split('\n'):
match = re.match(r'Revision: (\d+)', line)
if match:
return match.group(1)
output = svn('info', '--xml', output=str)
info = xml.etree.ElementTree.fromstring(output)
return info.find('entry/commit').get('revision')
t = Bunch(checks=checks, url=url, hash=get_rev, path=str(repodir))
yield t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment