llvm.org GIT mirror llvm / 4dc3e3a
[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 Reid Kleckner 2 years ago
1 changed file(s) with 19 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
204204 # Use ignore_errors because 'svn propget' prints errors if the file doesn't
205205 # have the named property. There doesn't seem to be a way to suppress that.
206206 eol_props = svn(svn_sr_path, 'propget', 'svn:eol-style', *files,
207 ignore_errors=True).split('\n')
207 ignore_errors=True)
208208 crlf_files = []
209 for eol_prop in eol_props:
210 # Remove spare CR.
211 eol_prop = eol_prop.strip('\r')
212 if not eol_prop:
213 continue
214 prop_parts = eol_prop.rsplit(' - ', 1)
215 if len(prop_parts) != 2:
216 eprint("unable to parse svn propget line:")
217 eprint(eol_prop)
218 continue
219 (f, eol_style) = prop_parts
220 if eol_style == 'native':
221 crlf_files.append(f)
209 if len(files) == 1:
210 # No need to split propget output on ' - ' when we have one file.
211 if eol_props.strip() == 'native':
212 crlf_files = files
213 else:
214 for eol_prop in eol_props.split('\n'):
215 # Remove spare CR.
216 eol_prop = eol_prop.strip('\r')
217 if not eol_prop:
218 continue
219 prop_parts = eol_prop.rsplit(' - ', 1)
220 if len(prop_parts) != 2:
221 eprint("unable to parse svn propget line:")
222 eprint(eol_prop)
223 continue
224 (f, eol_style) = prop_parts
225 if eol_style == 'native':
226 crlf_files.append(f)
222227 # Reformat all files with native SVN line endings to Unix format. SVN knows
223228 # files with native line endings are text files. It will commit just the
224229 # diff, and not a mass line ending change.