[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

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

From: Justin Akehurst <justin.akehurst_at_isilon.com>
Date: Fri, 28 Mar 2008 14:21:23 -0700

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_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-29 00:34:27 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.