[patch] sqlite3 needs "Conection.text_factory = str"

Bug #489829 reported by Jozef Hatala
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar Hg Plugin
Fix Released
Undecided
Unassigned

Bug Description

This is on ArchLinux i386 with Python 2.6.4, bzr 2.0.1-1, mercurial 1.4-2 and the bzr-hg plugin's trunk as of now (revno 267).

With the attached patch applied I am now able to use "bzr upgrade" to turn a Mercurial repo into a Bazaar branch.

Here is what sqlite3 was complaining about when the text_factory was left at its default (the unicode function/constructor). For docs, search for "text_factory" at http://www.python.org/doc/2.6/library/sqlite3.html

$ bzr upgrade

starting upgrade of file:///home/jozef/tmp/bzr/test/
bzr: ERROR: sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/bzrlib/commands.py", line 842, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/bzrlib/commands.py", line 1037, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/site-packages/bzrlib/commands.py", line 654, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/site-packages/bzrlib/builtins.py", line 3162, in run
    upgrade(url, format)
  File "/usr/lib/python2.6/site-packages/bzrlib/upgrade.py", line 85, in upgrade
    Convert(url, format)
  File "/usr/lib/python2.6/site-packages/bzrlib/upgrade.py", line 40, in __init__
    self.convert()
  File "/usr/lib/python2.6/site-packages/bzrlib/upgrade.py", line 79, in convert
    self.bzrdir = converter.convert(self.bzrdir, self.pb)
  File "/home/jozef/.bazaar/plugins/hg/__init__.py", line 232, in convert
    target_repo.fetch(source_repo, pb=pb)
  File "/usr/lib/python2.6/site-packages/bzrlib/repository.py", line 1695, in fetch
    find_ghosts=find_ghosts, fetch_spec=fetch_spec)
  File "/usr/lib/python2.6/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/home/jozef/.bazaar/plugins/hg/fetch.py", line 642, in fetch
    self.addchangegroup(cg, mapping)
  File "/home/jozef/.bazaar/plugins/hg/fetch.py", line 521, in addchangegroup
    self._add_inventories(todo, mapping, pb)
  File "/home/jozef/.bazaar/plugins/hg/fetch.py", line 388, in _add_inventories
    rev.properties['manifest'], rev.foreign_revid, mapping)
  File "/home/jozef/.bazaar/plugins/hg/idmap.py", line 227, in insert_revision
    self.db.execute("insert into revision (revid, csid, manifest_id, mapping) values (?, ?, ?, ?)", (revid, changeset_id, manifest_id, str(mapping)))
ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

bzr 2.0.1 on python 2.6.4 (Linux-2.6.31-ARCH-i686-Intel-R-_Core-TM-2_Duo_CPU_E6550_@_2.33GHz-with-glibc2.0)
arguments: ['/usr/bin/bzr', 'upgrade']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bzrtools /usr/lib/python2.6/site-packages/bzrlib/plugins/bzrtools [2.0.1]
  hg /home/jozef/.bazaar/plugins/hg [0.2.0dev]
  launchpad /usr/lib/python2.6/site-packages/bzrlib/plugins/launchpad [2.0.1]
  netrc_credential_store /usr/lib/python2.6/site-packages/bzrlib/plugins/netrc_credential_store [2.0.1]
  svn /home/jozef/.bazaar/plugins/svn [1.0.1]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Related branches

Revision history for this message
Jozef Hatala (jh-launchpad-skrt) wrote :
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 489829] Re: [patch] sqlite3 needs "Conection.text_factory = str"

  status fixreleased

Changed in bzr-hg:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.