subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1740670 - /subversion/trunk/tools/dist/backport/merger.py
Date Sat, 23 Apr 2016 20:51:42 GMT
Author: danielsh
Date: Sat Apr 23 20:51:42 2016
New Revision: 1740670

URL: http://svn.apache.org/viewvc?rev=1740670&view=rev
Log:
backport.py: Don't assume UTF-8 may be passed in argv.

Not actually required — on my machine, «
    subprocess.Popen([x.encode('UTF-8') for x in argv])
» works just fine — but this is consistent with the cmdline client.

* tools/dist/backport/merger.py:
  (contextlib, tempfile): Import.
  (log_message_file): New helper function.
  (merge): Pass the log message in a file.

Modified:
    subversion/trunk/tools/dist/backport/merger.py

Modified: subversion/trunk/tools/dist/backport/merger.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport/merger.py?rev=1740670&r1=1740669&r2=1740670&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport/merger.py (original)
+++ subversion/trunk/tools/dist/backport/merger.py Sat Apr 23 20:51:42 2016
@@ -23,12 +23,14 @@ backport.merger - library for running ST
 
 import backport.status
 
+import contextlib
 import functools
 import logging
 import os
 import re
 import subprocess
 import sys
+import tempfile
 import time
 import unittest
 
@@ -141,6 +143,14 @@ def _includes_only_svn_mergeinfo_changes
   return False
 
 
+@contextlib.contextmanager
+def log_message_file(logmsg):
+  "Context manager that returns a file containing the text LOGMSG."
+  with tempfile.NamedTemporaryFile(mode='w+', encoding="UTF-8") as logmsg_file:
+    logmsg_file.write(logmsg)
+    logmsg_file.flush()
+    yield logmsg_file.name
+  
 def merge(entry, expected_stderr=None, *, commit=False):
   """Merges ENTRY into the working copy at cwd.
 
@@ -209,7 +219,9 @@ def merge(entry, expected_stderr=None, *
       s = s[:-1]
     open('./STATUS', 'w').write(s)
 
-    run_svn_quiet(['commit', '-m', logmsg])
+    # Don't assume we can pass UTF-8 in argv.
+    with log_message_file(logmsg) as logmsg_filename:
+      run_svn_quiet(['commit', '-F', logmsg_filename])
 
   # TODO(interactive mode): add the 'svn status' display
 



Mime
View raw message