[PATCH 0 of 2] convert/gnuarch: followup of my previous fixes

Edouard Gomez ed.gomez at free.fr
Sun Jan 4 11:44:58 CST 2009

As promised:

Two more fixes to deal with cat-logs correctly:
 - convert/gnuarch: recode cat-log parts to utf-8 to be hg.description friendly
 - convert/gnuarch: add cat-log payload to commit description

There is only one 'bug' left in the current gnuarch backend. Explaination

In the arch repo:
 - add 'a' file
 - commit
 - rename 'a' to 'b'
 - add a new 'a' file
 - commit

During hg conversion:
 - 'a' gets added
 - commit
 - 'a' is renamed to 'b'
 - 'a' is added

An exception is thrown and probably says the file context is not ok
hg wise. How can i deal with these case. Using hg cmdline, i add 'a'
again and hg doesn't bail out.

The exception:
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial at selenic.com
** Mercurial Distributed SCM (version ea0ccc5d63e0)
** Extensions loaded: churn, convert, gpg, hgk, mq, patchbomb, zeroconf
Traceback (most recent call last):
  File "/home/ed/opt/mercurial/bin/hg", line 20, in <module>
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 20, in run
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 29, in dispatch
    return _runcatch(u, args)
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 45, in _runcatch
    return _dispatch(ui, args)
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 367, in _dispatch
    ret = _runcommand(ui, options, cmd, d)
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 416, in _runcommand
    return checkargs()
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 376, in checkargs
    return cmdfunc()
  File "/home/ed/opt/mercurial//lib/python/mercurial/dispatch.py", line 361, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/home/ed/opt/mercurial//lib/python/mercurial/util.py", line 715, in check
    return func(*args, **kwargs)
  File "/home/ed/opt/mercurial//lib/python/hgext/convert/__init__.py", line 182, in convert
    return convcmd.convert(ui, src, dest, revmapfile, **opts)
  File "/home/ed/opt/mercurial//lib/python/hgext/convert/convcmd.py", line 338, in convert
  File "/home/ed/opt/mercurial//lib/python/hgext/convert/convcmd.py", line 280, in convert
  File "/home/ed/opt/mercurial//lib/python/hgext/convert/convcmd.py", line 251, in copy
    newnode = self.dest.putcommit(files, copies, parents, commit, self.source)
  File "/home/ed/opt/mercurial//lib/python/hgext/convert/hg.py", line 146, in putcommit
    a = self.repo.commitctx(ctx)
  File "/home/ed/opt/mercurial//lib/python/mercurial/localrepo.py", line 810, in commitctx
  File "/home/ed/opt/mercurial//lib/python/mercurial/localrepo.py", line 857, in _commitctx
    new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed)
  File "/home/ed/opt/mercurial//lib/python/mercurial/localrepo.py", line 723, in filecommit
    self.ui.debug(_(" %s: copy %s:%s\n") % (fn, cf, hex(cr)))
TypeError: b2a_hex() argument 1 must be string or read-only buffer, not None

A bit of analysis told me that cr was 'None', the buggy filectx was dealing
with ChangeLog.
Output from pdb:
 ChangeLog: searching for copy revision for ChangeLog-1.0
> /home/ed/opt/mercurial/lib/python/mercurial/localrepo.py(726)filecommit()
-> self.ui.debug(_(" %s: copy %s:%s\n") % (fn, cf, hex(cr)))
(Pdb) print fn
(Pdb) print cf
(Pdb) print cr

Relevant part of tla replay output:
=>  ./ChangeLog	ChangeLog-1.0 (means ChangeLog is renamed to ChangeLog-1.0)
A   ChangeLog (obvious)

Edouard Gomez

More information about the Mercurial-devel mailing list