*** This bug is a duplicate of bug 660540 ***
    https://bugs.launchpad.net/bugs/660540

Hrm, interesting. I added a pdb set_trace call to check this out. Looks
like a string is being iterated over in a rather strange way. I can't
imagine that 'refs/heads/master' is intended to be iterated over by-
character. Rather, by a split on '/'.

Here's the interactive pdb session:

(Pdb) list
 26               the Bazaar branch names as values.
 27             """
 28             bazaar_names = {}
 29             for ref_name in sorted(ref_names):
 30                 import pdb;pdb.set_trace()
 31  ->             parts = ref_name.split('/')
 32                 if parts[0] == 'refs':
 33                     parts.pop(0)
 34                 category = parts.pop(0)
 35                 if category == 'heads':
 36                     bazaar_name = self._git_to_bzr_name(parts[-1])
(Pdb) ref_name
'/'
(Pdb) ref_names
'refs/heads/master'
(Pdb) sorted(ref_names)
['/', '/', 'a', 'a', 'd', 'e', 'e', 'e', 'f', 'h', 'm', 'r', 'r', 's', 's', 
's', 't']
(Pdb) 

I added the following just before the 'for' loop:

        if not isinstance(ref_names, list):
            ref_names = [ref_names]

This resulted in another exception, however:

  File "/usr/lib/python2.6/dist-packages/bzrlib/revision.py", line 93, in 
_check_properties
    (value, name))
ValueError: invalid property value {'refs/heads/master': 'trunk'} for 
'branch-nick'

After some hacking around, it seems that even though git_to_bzr() is
returning a dict, when a string is expected. In particular, check out
the following from a pdb session:


(Pdb) down
> /usr/lib/python2.6/dist-packages/bzrlib/plugins/fastimport/bzr_commit_handler.py(227)build_revision()
-> self.branch_ref)
(Pdb) list
222     
223         def build_revision(self):
224             rev_props = 
self._legal_revision_properties(self.command.properties)
225             if 'branch-nick' not in rev_props:
226                 rev_props['branch-nick'] = 
self.cache_mgr.branch_mapper.git_to_bzr(
227  ->                     self.branch_ref)
228             self._save_author_info(rev_props)
229             committer = self.command.committer
230             who = self._format_name_email(committer[0], committer[1])
231             message = self.command.message
232             if not _serializer_handles_escaping:

rev_props['branch-nick'] should be getting a string assigned to it, but
instead, it's getting a dict.

I hacked around this (badly) just to get things working by returning the
following from git_to_bzr:

return bazaar_names.values()[0]

Hope this helps...


** Also affects: bzr-fastimport
   Importance: Undecided
       Status: New

-- 
bzr crashed with IndexError in git_to_bzr()
https://bugs.launchpad.net/bugs/662245
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to