[Svnmerge] updates for python 2.6?

Jon Schewe jpschewe at mtu.net
Tue Mar 10 18:15:46 PDT 2009


Giovanni Bajo wrote:
> On Wed, 4 Mar 2009 10:01:32 -0500, "Dustin J. Mitchell" <dustin at zmanda.com>
> wrote:
>   
>> On Tue, Mar 3, 2009 at 10:18 PM, Jon Schewe <jpschewe at mtu.net> wrote:
>>     
>>> Once I updated to python 2.6 I started noticing this warning.
>>>
>>> /home/jpschewe/bin/svnmerge.py:71: DeprecationWarning: The popen2 module
>>> is deprecated.  Use the subprocess module.
>>>  import sys, os, getopt, re, types, tempfile, time, popen2, locale
>>>       
>> Patches are appreciated!
>>
>> :)
>>     
>
> And this is an easy one: just move the popen2 import near to its only
> usage. You will see that it's not being currently used, as the code already
> defaults to subprocess.
>   
Patch below:
Index: svnmerge.py
===================================================================
--- svnmerge.py    (revision 36477)
+++ svnmerge.py    (working copy)
@@ -71,7 +71,7 @@
 #  A "target" is generally user-specified, and may be a working copy or
 #  a URL.
 
-import sys, os, getopt, re, types, tempfile, time, popen2, locale
+import sys, os, getopt, re, types, tempfile, time, locale
 from bisect import bisect
 from xml.dom import pulldom
 
@@ -282,6 +282,7 @@
     # support versions of python before 2.4 (slower on some systems)
     def launch(cmd, split_lines=True):
         if os.name not in ['nt', 'os2']:
+        import popen2
             p = popen2.Popen4(cmd)
             p.tochild.close()
             if split_lines:

-- 
Jon Schewe | http://mtu.net/~jpschewe
If you see an attachment named signature.asc, this is my digital
signature. See http://www.gnupg.org for more information.

For I am convinced that neither death nor life, neither angels nor
demons, neither the present nor the future, nor any powers,
neither height nor depth, nor anything else in all creation, will
be able to separate us from the love of God that is in Christ
Jesus our Lord. - Romans 8:38-39

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/svnmerge/attachments/20090310/5b5ac896/attachment.htm 


More information about the Svnmerge mailing list