[meld/Python3: 27/54] vc._vc: Move to using universal-newline mode for unicode handling



commit b17f267461176086d6dcfa053af91a61d76941cc
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Nov 15 08:02:56 2015 +1000

    vc._vc: Move to using universal-newline mode for unicode handling
    
    This appears to be the supported way of doing this in Python 3. As it
    stands, our unicode support on anything except Git is purely accidental
    anyway, so as long as Git unicode filenames continue to work, we're no
    worse off.

 meld/vc/_vc.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 46046fd..94d3311 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -153,7 +153,9 @@ class Vc(object):
         Note that this runs at the *location*, not at the *root*.
         """
         cmd = (self.CMD,) + args
-        return subprocess.Popen(cmd, cwd=self.location, stdout=subprocess.PIPE)
+        return subprocess.Popen(
+            cmd, cwd=self.location, stdout=subprocess.PIPE,
+            universal_newlines=True)
 
     def get_files_to_commit(self, paths):
         """Get a list of files that will be committed from paths
@@ -381,7 +383,9 @@ class InvalidVCRevision(ValueError):
 
 # Return the stdout output of a given command
 def popen(cmd, cwd=None):
-    return subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE).stdout
+    process = subprocess.Popen(
+        cmd, cwd=cwd, stdout=subprocess.PIPE, universal_newlines=True)
+    return process.stdout
 
 
 def call_temp_output(cmd, cwd, file_id=''):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]