The reason is that Branch5._sync... does:
try:
new_history = revision_history[:revision_history.index(revision_id)]
except IndexError:
new_history = self.generate_history(revision_id)
Which means that if necessary it will regenerate a revision history for that id.
However, Branch6 uses:
if revision_id is None:
revno, revision_id = self.last_revision_info()
else:
revno = self.revision_id_to_revno(revision_id) destination.set_last_revision_info(revno, revision_id)
With no fallback in the case that revision_id doesn't exist in the revision_history.
The difficulty is that 'set_last_revision_info()' needs to know the revno for the given revision. Which in general means creating the full history for it, and finding it's left-hand distance to null (revno).
It would be nice if we could figure this stuff out without traversing the whole graph, but
a) Revisions don't record their revno at commit time (though they could)
b) revno is distance to null, so you have to walk back to null to find the distance.
In tracking through the code it seems to occurring in:
BzrDir.sprout() copy_content_ into() _synchronize_ history( )
Branch.sprout()
Branch.
Branch6.
The reason is that Branch5._sync... does: history[ :revision_ history. index(revision_ id)] history( revision_ id)
try:
new_history = revision_
except IndexError:
new_history = self.generate_
Which means that if necessary it will regenerate a revision history for that id.
However, Branch6 uses:
if revision_id is None: revision_ info() id_to_revno( revision_ id)
destination. set_last_ revision_ info(revno, revision_id)
revno, revision_id = self.last_
else:
revno = self.revision_
With no fallback in the case that revision_id doesn't exist in the revision_history.
The difficulty is that 'set_last_ revision_ info()' needs to know the revno for the given revision. Which in general means creating the full history for it, and finding it's left-hand distance to null (revno).
A simple fix is:
rev = self.repository .get_revision( revision_ id) history( self.repository )[1:]
new_history = rev.get_
revno = len(new_history)
Another possibility is:
revno = len(list( self.repository .iter_reverse_ revision_ history( revision_ id)))
It would be nice if we could figure this stuff out without traversing the whole graph, but
a) Revisions don't record their revno at commit time (though they could)
b) revno is distance to null, so you have to walk back to null to find the distance.