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

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 17:10:20 PDT 2017


Author: rnk
Date: Thu May 11 19:10:19 2017
New Revision: 302853

URL: http://llvm.org/viewvc/llvm-project?rev=302853&view=rev
Log:
[git-llvm] Fix svn:eol-style issue for one-file patches

Modified:
    llvm/trunk/utils/git-svn/git-llvm

Modified: llvm/trunk/utils/git-svn/git-llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/git-svn/git-llvm?rev=302853&r1=302852&r2=302853&view=diff
==============================================================================
--- llvm/trunk/utils/git-svn/git-llvm (original)
+++ llvm/trunk/utils/git-svn/git-llvm Thu May 11 19:10:19 2017
@@ -205,21 +205,26 @@ def fix_eol_style_native(rev, sr, svn_sr
     # 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.
     eol_props = svn(svn_sr_path, 'propget', 'svn:eol-style', *files,
-                    ignore_errors=True).split('\n')
+                    ignore_errors=True)
     crlf_files = []
-    for eol_prop in eol_props:
-        # Remove spare CR.
-        eol_prop = eol_prop.strip('\r')
-        if not eol_prop:
-            continue
-        prop_parts = eol_prop.rsplit(' - ', 1)
-        if len(prop_parts) != 2:
-            eprint("unable to parse svn propget line:")
-            eprint(eol_prop)
-            continue
-        (f, eol_style) = prop_parts
-        if eol_style == 'native':
-            crlf_files.append(f)
+    if len(files) == 1:
+        # No need to split propget output on ' - ' when we have one file.
+        if eol_props.strip() == 'native':
+            crlf_files = files
+    else:
+        for eol_prop in eol_props.split('\n'):
+            # Remove spare CR.
+            eol_prop = eol_prop.strip('\r')
+            if not eol_prop:
+                continue
+            prop_parts = eol_prop.rsplit(' - ', 1)
+            if len(prop_parts) != 2:
+                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
     # files with native line endings are text files. It will commit just the
     # diff, and not a mass line ending change.




More information about the llvm-commits mailing list