You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Justin Akehurst <ju...@isilon.com> on 2008/03/28 21:21:23 UTC

Bug in svnmerge.py, rev 30107 (not fully compatible with Python 2.2.x)

Traceback I received:
Traceback (most recent call last):
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 2160, in ?
    main(sys.argv[1:])
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 2155, in main
    cmd(branch_dir, branch_props)
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 1642, in
__call__
    return self.func(*args, **kwargs)
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 1391, in
action_merge
    print >>f, construct_merged_log_message(opts["source-url"], revs),
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 964, in
construct_merged_log_message
    message = get_commit_log(url, r)
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 950, in
get_commit_log
    return recode_stdout_to_file("".join(out[1:]))
  File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 220, in
recode_stdout_to_file
    if locale.getdefaultlocale()[1] is None or sys.stdout.encoding is None:
AttributeError: 'file' object has no attribute 'encoding'

The problem: sys.stdout (file object) under Python 2.2.2 does not have the
'encoding' attribute.

My workaround:
@@ -217,7 +217,7 @@
     return prefix + lines[:-1].replace("\n", "\n"+prefix) + "\n"
 
 def recode_stdout_to_file(s):
-    if locale.getdefaultlocale()[1] is None or sys.stdout.encoding is None:
+    if locale.getdefaultlocale()[1] is None or not
sys.stdout.has_attr('encoding') or sys.stdout.encoding is None:
       return s
     u = s.decode(sys.stdout.encoding)
     return u.encode(locale.getdefaultlocale()[1])

Is this a real bug? I think it is.

-Justin Akehurst


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Bug in svnmerge.py, rev 30107 (not fully compatible with Python 2.2.x)

Posted by Blair Zajac <bl...@orcaware.com>.
Hi Justin,

svnmerge has it's own mailing list that you can send this report to:

http://www.orcaware.com/mailman/listinfo/svnmerge

It'll probably get more visibility there.

Regards,
Blair

Justin Akehurst wrote:
> Traceback I received:
> Traceback (most recent call last):
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 2160, in ?
>     main(sys.argv[1:])
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 2155, in main
>     cmd(branch_dir, branch_props)
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 1642, in
> __call__
>     return self.func(*args, **kwargs)
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 1391, in
> action_merge
>     print >>f, construct_merged_log_message(opts["source-url"], revs),
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 964, in
> construct_merged_log_message
>     message = get_commit_log(url, r)
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 950, in
> get_commit_log
>     return recode_stdout_to_file("".join(out[1:]))
>   File "/ifs/home/jakehurst/workspace/tools/svnmerge.py", line 220, in
> recode_stdout_to_file
>     if locale.getdefaultlocale()[1] is None or sys.stdout.encoding is None:
> AttributeError: 'file' object has no attribute 'encoding'
> 
> The problem: sys.stdout (file object) under Python 2.2.2 does not have the
> 'encoding' attribute.
> 
> My workaround:
> @@ -217,7 +217,7 @@
>      return prefix + lines[:-1].replace("\n", "\n"+prefix) + "\n"
>  
>  def recode_stdout_to_file(s):
> -    if locale.getdefaultlocale()[1] is None or sys.stdout.encoding is None:
> +    if locale.getdefaultlocale()[1] is None or not
> sys.stdout.has_attr('encoding') or sys.stdout.encoding is None:
>        return s
>      u = s.decode(sys.stdout.encoding)
>      return u.encode(locale.getdefaultlocale()[1])
> 
> Is this a real bug? I think it is.
> 
> -Justin Akehurst
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org