bzr-svn fails with NoSuchRevision when pulling a branch that was moved at some point in history

Bug #237901 reported by Alexey Borzenkov
2
Affects Status Importance Assigned to Milestone
Bazaar Subversion Plugin
Fix Released
Medium
Jelmer Vernooij

Bug Description

For example, I had a project that I was developing at

    /tcl/tools/trunk

Then at some point /tcl/tools was renamed to /tcl/df-tcl. bzr-svn can no longer handle this situation.

I'm not sure why the exception is happening in the first place, but by speculation I assume this is because of the difference between logwalker.py and repository.py in how they call to changes_path. The attached patch fixes the problem (in this very specific case) and bzr no longer dies with NoSuchRevision exception, it's not complete, but it's a start. For example I have another branch thas was moved not once, but twice, and this causes part of the history to disappear (because logwalker does not track what path was changed *into*? I'll see if it can be easily fixed).

Related branches

Revision history for this message
Alexey Borzenkov (snaury) wrote :
Revision history for this message
Alexey Borzenkov (snaury) wrote :

Ah, now I see. My problem was that /python/df-python was renamed to /python/trunk, which then was renamed to /python/df-python/trunk. TrunkBranchingScheme returns False for is_branch() and history becomes truncated. I wonder however, if that's the right thing to do? git-svn, for example, pulls the complete history, bzr-svn does not.

Revision history for this message
Alexey Borzenkov (snaury) wrote :

And BranchingScheme.unprefix ensures this design limitation won't be easy to fix at all. Oh well... x_x

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

I don't think this is related to branching schemes. Unless you're specifying a revision explicitly, you shouldn't be getting a NoSuchRevision error, even with branching schemes in place.

Branching schemes will go away at some point in the future, see bug 130372

Revision history for this message
Alexey Borzenkov (snaury) wrote :

No, no, no. Branching schemes are (almost) not related to NoSuchRevision. And my patch fixes the NoSuchRevision only.

As an explanation why it was happening in the first place: you see, when I checkout /tcl/df-tcl/trunk at some point history goes into /tcl/tools/trunk. Because of the way branching is handled it is (wrongly?) detected as a branch of /tcl/df-tcl/trunk (call to mapping.is_branch in SvnRepository.iter_changes returns True), so it goes on. Because CachingLogWalker.iter_changes can return revisions that are on a different path (parents in call to changes.changes_path is True). Later we get into SvnRepository.lhs_revision_parent, where call to changes.changes_path has parents=False (the default). Now *here* we have a problem, because the change is for the current path, but the change happened for a parent, i.e.:

    We have path: 'tcl/df-tcl/trunk'
    We have changes: {'tcl/tools': (u'D', None, -1), 'tcl/df-tcl': (u'A', 'tcl/tools', 96)}

tcl/df-tcl is not a child of tcl/df-tcl/trunk, so the call fails and you get NoSuchRevision. And my patch fixes this exact issue.

Branching schemes were related to a different issue. A part of history is cut off because branching schemes don't handle unrelated paths well, and I was reorganizing my repository in the past, so the part before that reorganizing is cut off for at least my df-python project. I'm glad to hear that branching schemes are going away (and hope to see it soon), their design is very flawed in regards to unrelated paths, since there's no way you can implement BranchingScheme.unprefix for them, and even in other cases it assumes /tcl/tools/trunk and /tcl/df-tcl/trunk are branches of one another, which they might not be.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Ok, good we agree about where the problem is :-)

I'll merge your patch as soon I can come up with a test that reproduces it.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

The patch was incorrect - the code in logwalker was incorrect as well.

Should be fixed properly now.

Changed in bzr-svn:
assignee: nobody → jelmer
milestone: none → 0.4.11
status: New → Fix Committed
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
importance: Undecided → Medium
Jelmer Vernooij (jelmer)
Changed in bzr-svn:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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