[git-llvm] Fix svn:eol-style issue for one-file patches

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302853 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Kleckner 2017-05-12 00:10:19 +00:00
parent 517aac8f47
commit 4dc3e3a6c2

View File

@ -205,21 +205,26 @@ def fix_eol_style_native(rev, sr, svn_sr_path):
# Use ignore_errors because 'svn propget' prints errors if the file doesn't # Use ignore_errors because 'svn propget' prints errors if the file doesn't
# have the named property. There doesn't seem to be a way to suppress that. # have the named property. There doesn't seem to be a way to suppress that.
eol_props = svn(svn_sr_path, 'propget', 'svn:eol-style', *files, eol_props = svn(svn_sr_path, 'propget', 'svn:eol-style', *files,
ignore_errors=True).split('\n') ignore_errors=True)
crlf_files = [] crlf_files = []
for eol_prop in eol_props: if len(files) == 1:
# Remove spare CR. # No need to split propget output on ' - ' when we have one file.
eol_prop = eol_prop.strip('\r') if eol_props.strip() == 'native':
if not eol_prop: crlf_files = files
continue else:
prop_parts = eol_prop.rsplit(' - ', 1) for eol_prop in eol_props.split('\n'):
if len(prop_parts) != 2: # Remove spare CR.
eprint("unable to parse svn propget line:") eol_prop = eol_prop.strip('\r')
eprint(eol_prop) if not eol_prop:
continue continue
(f, eol_style) = prop_parts prop_parts = eol_prop.rsplit(' - ', 1)
if eol_style == 'native': if len(prop_parts) != 2:
crlf_files.append(f) eprint("unable to parse svn propget line:")
eprint(eol_prop)
continue
(f, eol_style) = prop_parts
if eol_style == 'native':
crlf_files.append(f)
# Reformat all files with native SVN line endings to Unix format. SVN knows # Reformat all files with native SVN line endings to Unix format. SVN knows
# files with native line endings are text files. It will commit just the # files with native line endings are text files. It will commit just the
# diff, and not a mass line ending change. # diff, and not a mass line ending change.