[issue1504] hg convert -s bzr doesn't handle remove & add of same directory in a uniq commit

Xavier ALT mercurial-bugs at selenic.com
Sun Feb 8 05:58:12 CST 2009


New submission from Xavier ALT <dex at phoenix-ind.net>:

When trying to convert bazaar repository to mercurial one using "hg convert" it
got a KeyError on self._modechache (hgext/convert/bzr.py)

The KeyError appear on a directory and on a commit which this directory appear
both on "delete" and "added" list.

I was able to reproduce the problem from an empty repository, here is the full
typescript for the test-case:


Le script a débuté sur dim. 08 févr. 2009 11:14:44 CET
[dex at ankaa test2]$ mkdir bzr1
[dex at ankaa test2]$ cd bzr1
[dex at ankaa bzr1]$ bzr init
Standalone tree (format: pack-0.92)
Location:
  branch root: .
[dex at ankaa bzr1]$ mkdir directory1
[dex at ankaa bzr1]$ bzr add directory1/
added directory1
[dex at ankaa bzr1]$ bzr commit -m "add directory 1"
Committing to: /home/dex/w/convert/test2/bzr1/
added directory1
Committed revision 1.
[dex at ankaa bzr1]$ bzr remove directory1/
deleted directory1
[dex at ankaa bzr1]$ ls
[dex at ankaa bzr1]$ mkdir directory1
[dex at ankaa bzr1]$ bzr add directory1/
added directory1
[dex at ankaa bzr1]$ bzr st
removed:
  directory1/
added:
  directory1/
[dex at ankaa bzr1]$ bzr commit -m "remove and re-add directory"
Committing to: /home/dex/w/convert/test2/bzr1/
added directory1
deleted directory1
Committed revision 2.
[dex at ankaa bzr1]$ hg convert -s bzr . ../hg1
initializing destination ../hg1 repository
scanning source...
sorting...
converting...
1 add directory1
0 remove and re-add directory1
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial at selenic.com
** Mercurial Distributed SCM (version 1.1.2)
** Extensions loaded: convert, hgk
Traceback (most recent call last):
  File "/usr/bin/hg", line 20, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 20, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 29, in
dispatch
    return _runcatch(u, args)
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 45, in
_runcatch
    return _dispatch(ui, args)
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 367, in
_dispatch
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 416, in
_runcommand
    return checkargs()
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 376, in
checkargs
    return cmdfunc()
  File "/usr/lib/python2.5/site-packages/mercurial/dispatch.py", line 361, in
<lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.5/site-packages/mercurial/util.py", line 715, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/hgext/convert/__init__.py", line 181,
in convert
    return convcmd.convert(ui, src, dest, revmapfile, **opts)
  File "/usr/lib/python2.5/site-packages/hgext/convert/convcmd.py", line 338, in
convert
    c.convert()
  File "/usr/lib/python2.5/site-packages/hgext/convert/convcmd.py", line 280, in
convert
    self.copy(c)
  File "/usr/lib/python2.5/site-packages/hgext/convert/convcmd.py", line 251, in
copy
    newnode = self.dest.putcommit(files, copies, parents, commit, self.source)
  File "/usr/lib/python2.5/site-packages/hgext/convert/hg.py", line 146, in
putcommit
    a = self.repo.commitctx(ctx)
  File "/usr/lib/python2.5/site-packages/mercurial/localrepo.py", line 810, in
commitctx
    update_dirstate=False)
  File "/usr/lib/python2.5/site-packages/mercurial/localrepo.py", line 855, in
_commitctx
    fctx = wctx.filectx(f)
  File "/usr/lib/python2.5/site-packages/mercurial/context.py", line 776, in filectx
    return self._filectxfn(self._repo, self, path)
  File "/usr/lib/python2.5/site-packages/hgext/convert/hg.py", line 117, in
getfilectx
    e = source.getmode(f, v)
  File "/usr/lib/python2.5/site-packages/hgext/convert/bzr.py", line 82, in getmode
    return self._modecache[(name, rev)]
KeyError: ('directory1', 'x.alt at ajm.lu-20090208101612-pnvocj1w8mjjgp53')

Script complété sur dim. 08 févr. 2009 11:16:31 CET

----------
messages: 8563
nosy: dex
priority: bug
status: unread
title: hg convert -s bzr doesn't handle remove & add of same directory in a uniq commit

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1504>
____________________________________________________



More information about the Mercurial-devel mailing list