1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add support for repos with svn:externals files

When a SVN repository has some svn:externals properties, files will be
reported with the X attribute, and lines will be added at the end to
list externals statuses with a text looking like
"Performing status on external item at ....".
Such lines were counted as a local modification by the regex, and the
module returned a change, even though they were none.

To have a clean (and parsable) "svn status" output, it is recommended
to use the --quiet option. The externals will only appear if they have
been modified. With this option on, it seems even safer to consider
there are local modifications when "svn status" outputs anything.
This commit is contained in:
Gugli 2015-02-13 15:06:15 +01:00 committed by Matt Clay
parent e6e8f65e92
commit a00c078912

View file

@ -153,11 +153,10 @@ class Subversion(object):
def has_local_mods(self):
'''True if revisioned files have been added or modified. Unrevisioned files are ignored.'''
lines = self._exec(["status", self.dest])
# Match only revisioned files, i.e. ignore status '?'.
regex = re.compile(r'^[^?]')
lines = self._exec(["status", "--quiet", self.dest])
# The --quiet option will return only modified files.
# Has local mods if more than 0 modifed revisioned files.
return len(filter(regex.match, lines)) > 0
return len(filter(len, lines)) > 0
def needs_update(self):
curr, url = self.get_revision()