Merging from bzr branch gives AttributeError

Bug #416328 reported by Marc Christiansen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
Fix Released
Medium
Unassigned

Bug Description

When merging back a bzr branch into a svn checkout, I got the following:
AttributeError: 'Revision' object has no attribute 'foreign_revid'

The following steps reproduce the error (spam is the non-public svn checkout; I renamed it in the bug report):

> bzr branch spam /tmp/test-zr
> cd /tmp/test-zr
> echo a >>_articleexport.php
> bzr commit -m 'none'
> cd -
> cd spam
> bzr merge /tmp/test-zr
bzr: ERROR: exceptions.AttributeError: 'Revision' object has no attribute 'foreign_revid'

Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/bzrlib/commands.py", line 835, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/bzrlib/commands.py", line 1030, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib64/python2.6/site-packages/bzrlib/commands.py", line 647, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib64/python2.6/site-packages/bzrlib/plugins/qbzr/lib/commands.py", line 662, in run
    return bzrlib.builtins.cmd_merge.run(self, *args, **kw)
  File "/usr/lib64/python2.6/site-packages/bzrlib/builtins.py", line 3683, in run
    location, revision, remember, possible_transports, pb)
  File "/usr/lib64/python2.6/site-packages/bzrlib/builtins.py", line 3790, in _get_merger_from_branch
    other_revision_id, base_revision_id, other_branch, base_branch)
  File "/usr/lib64/python2.6/site-packages/bzrlib/merge.py", line 204, in from_revision_ids
    merger.set_other_revision(other, other_branch)
  File "/usr/lib64/python2.6/site-packages/bzrlib/merge.py", line 343, in set_other_revision
    self._maybe_fetch(other_branch, self.this_branch, self.other_rev_id)
  File "/usr/lib64/python2.6/site-packages/bzrlib/merge.py", line 360, in _maybe_fetch
    target.fetch(source, revision_id)
  File "/usr/lib64/python2.6/site-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib64/python2.6/site-packages/bzrlib/branch.py", line 565, in fetch
    pb=pb)
  File "/usr/lib64/python2.6/site-packages/bzrlib/repository.py", line 1544, in fetch
    find_ghosts=find_ghosts, fetch_spec=fetch_spec)
  File "/home/marc/.bazaar/plugins/svn/push.py", line 414, in fetch
    self.copy_content(revision_id=revision_id, pb=pb)
  File "/home/marc/.bazaar/plugins/svn/push.py", line 403, in copy_content
    self.push_nonmainline_revision(rev, layout)
  File "/home/marc/.bazaar/plugins/svn/push.py", line 359, in push_nonmainline_revision
    foreign_sibling=rev.foreign_revid)
AttributeError: 'Revision' object has no attribute 'foreign_revid'

bzr 1.17 on python 2.6.2 (linux2)
arguments: ['/usr/bin/bzr', 'merge', '/tmp/test-zr']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'de_DE.utf8'
plugins:
  bzrtools /usr/lib64/python2.6/site-packages/bzrlib/plugins/bzrtools [1.17]
  explorer /home/marc/.bazaar/plugins/explorer [0.6.1]
  gtk /home/marc/.bazaar/plugins/gtk [0.96.2]
  launchpad /usr/lib64/python2.6/site-packages/bzrlib/plugins/launchpad [1.17]
  netrc_credential_store /usr/lib64/python2.6/site-packages/bzrlib/plugins/netrc_credential_store [1.17]
  qbzr /usr/lib64/python2.6/site-packages/bzrlib/plugins/qbzr [0.12]
  svn /home/marc/.bazaar/plugins/svn [0.6.4]
  xmloutput /home/marc/.bazaar/plugins/xmloutput [0.8.5]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

subvertpy 0.6.8

I have attached part of .bzr.log

Just for the case it's not clear from the log, type(rev) == <class 'bzrlib.revision.Revision'>

Related branches

Revision history for this message
Marc Christiansen (tolot-solar-empire) wrote :
Revision history for this message
Marc Christiansen (tolot-solar-empire) wrote :

The following patch seems to make merging work again. At least with the test case above.

--- push.py.orig 2009-08-27 09:27:06.000000000 +0200
+++ push.py 2009-08-27 09:27:14.000000000 +0200
@@ -356,7 +356,7 @@
             base_mapping = None
         else:
             base_foreign_revid, base_mapping = self.target.lookup_revision_id(parent_revid,
- foreign_sibling=rev.foreign_revid)
+ foreign_sibling=getattr(rev, 'foreign_revid', None))
             (_, target_project, _, _) = layout.parse(base_foreign_revid[1])
         bp = determine_branch_path(rev, layout, target_project)
         target_config = self._get_branch_config(bp)

Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: New → Triaged
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
milestone: none → 1.0.0
Revision history for this message
Mike (mnishiza) wrote :

I added the patch and no longer received the error, but I still got a message that the merge was denied because it would change the mainline history.

Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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