Pushing from bzr 1.3 => bzr < 1.2 is broken for Branch5 (AssertionError)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Critical
|
John A Meinel |
Bug Description
While trying to push to a remote repo, bzr failed with an error about the revno being different than the length of the repo's history. The sequence leading up to this was, approximately:
gutsy-box> bzr init foo
... work on stuff ...
gutsy-box> bzr commit
sid-box> bzr branch bzr+ssh:
... work on stuff ...
sid-box> bzr commit
sid-box> bzr push --remember bzr+ssh:
The gutsy box is x86_64, running bzr 0.90-1. The sid box is ia64, running bzr 1.3-1. Perhaps this is a version mismatch, or just an old bug.
The symptoms look similar to bug 91725 and bug 177855, but the versions and commands invoked are different, so it's hard to say whether this is a new issue.
The full output was:
~/src/project/> bzr push --remember bzr+ssh:
This transport does not update the working tree of: bzr+ssh:
Server is too old for fast get_parent_map, reconnecting. (Upgrade the server to Bazaar 1.2 to avoid this)
bzr: ERROR: exceptions.
Traceback (most recent call last):
File "/usr/lib/
return run_bzr(argv)
File "/usr/lib/
ret = run(*run_argv)
File "/usr/lib/
return self.run(
File "/usr/lib/
stop_
File "/usr/lib/
return unbound(self, *args, **kwargs)
File "/usr/lib/
_override_
File "/usr/lib/
result = self._basic_
File "/usr/lib/
target.
File "/usr/lib/
return self._real_
File "/usr/lib/
return unbound(self, *args, **kwargs)
File "/usr/lib/
other_
File "/usr/lib/
return unbound(self, *args, **kwargs)
File "/usr/lib/
assert len(history) == revno, '%d != %d' % (len(history), revno)
AssertionError: 3 != 4
bzr 1.3 on python 2.4.5.candidate.1 (linux2)
arguments: ['/usr/bin/bzr', 'push', '--remember', 'bzr+ssh:
encoding: 'ANSI_X3.4-1968', fsenc: 'ANSI_X3.4-1968', lang: 'C'
plugins:
bzrtools /usr/lib/
gtk /usr/lib/
launchpad /usr/lib/
*** Bazaar has encountered an internal error.
Please report a bug at https:/
including this traceback, and a description of what you
were doing when the error occurred.
[1] 22676 exit 4 bzr push --remember bzr+ssh:
Afterward, the original (gutsy) repo is in a strange state...
(~/src/project/> bzr check
checked branch file://
checked repository <bzrlib.
4 revisions
5 unique file texts
4 repeated file texts
3 weaves
~/src/project/> bzr revno
2
~/src/project/> bzr revision-history | wc -l
2
It looks like the transaction is halfway completed.
Related branches
Changed in bzr: | |
status: | Fix Committed → Fix Released |
Looking into this, the problem is with the RemoteRepositor y.get_parent_ map() code.
Specifically, if the server doesn't support get_parent_map() it falls back to just calling get_revision_ graph() .
However, for nodes with 0 parents, get_parent_map() returns ('null:',) while get_revision_ graph() just returns ().
for get_parent_map(), a return of () means that the revision is a ghost.
This shows up for Branch5, because it checks the normalization of history when you call set_last_ revision_ info(). And the _lefthand_history() code iterates backwards, stopping when it finds a ghost.
So when you "bzr push bzr+ssh://" a Branch5 (dirstate) it checks the length of the remote history, and doesn't include the first revision (because it thinks it is a ghost).
The fix isn't very hard, you just need to filter the get_revision_ graph() call and substitute ('null:',) for any () nodes.
I'll work up a patch. This is probably worthy of a 1.3.2 fix if we really want to allow bzr >1.2 to interoperate with bzr <1.2 (and 1.3.2 because that is easier to get into Hardy than asking them to release 1.5)