bzr-fast-export exports rm+mv incorrectly

Bug #268933 reported by Jonas
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar Fast Import
Confirmed
Medium
Ian Clatworthy

Bug Description

if doing
bzr rm a
bzr mv b a
commit

then bzr-fast-export will export a mv followed by a rm, causing a to vanish in total
(btw, bzr diff -c also shows them in "opposite" order)

Tags: export
Revision history for this message
Jonas (jonas-annica) wrote :
Revision history for this message
Jonas (jonas-annica) wrote :
  • pp Edit (1.3 KiB, text/plain)

Proposed patch.
Move delete-handling earlier in emit_commit

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Patch applied to trunk and available in rev 87.

Changed in bzr-fastimport:
assignee: nobody → ian-clatworthy
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Jonas (jonas-annica) wrote :

hmm..found a bug in my patch...
will try to write another variant...
but I don't know the internals, so it's really just guess work

/Jonas

Revision history for this message
Jonas (jonas-annica) wrote :

Found case where current patch does not work

Revision history for this message
Jonas (jonas-annica) wrote :

new variant of patch

Revision history for this message
Gabriel de Perthuis (g2p) wrote :

The current code (r87) is also screwy and can't import ipython (these revisions: http://bazaar.launchpad.net/~ipython-dev/ipython/trunk/revision/1004 http://bazaar.launchpad.net/~ipython-dev/ipython/trunk/revision/1001.1.3 http://bazaar.launchpad.net/~ipython-dev/ipython/trunk/revision/1001.1.1 ).

Here is a test case:

bzr init
mkdir fools
touch fools/FOO
bzr add fools/FOO
bzr commit -m Initial
bzr mv fools/FOO .
bzr rm fools
bzr commit -m MvRm

# Fails
git init; ~/var/co/bzr/bzr-fastimport/exporters/bzr-fast-export.py . |git fast-import

# Exported data
/home/g2p/var/co/bzr/bzr-fastimport/exporters/bzr-fast-export.py .
*** BzrFastExport: Exported 0 commits; forcing checkpoint
checkpoint
commit refs/heads/tmp
mark :1
committer <whomever> 1224661056 +0200
data 7
Initial
M 644 inline fools/FOO
data 0

commit refs/heads/master
mark :2
committer <whomever> 1224661106 +0200
data 4
MvRm
from :1
D fools
R fools/FOO FOO

# When what should be exported is:
R fools/FOO FOO
D fools

Revision history for this message
Gabriel de Perthuis (g2p) wrote :

Reopen, see second test case.

Changed in bzr-fastimport:
status: Fix Committed → Confirmed
Revision history for this message
Gabriel de Perthuis (g2p) wrote :

Tree.changes_from is lossy (the docs hint at it as well: http://bazaar-vcs.org/Integrating_with_Bazaar ). I'll try to rewrite this using Tree.iter_changes .

Revision history for this message
Gabriel de Perthuis (g2p) wrote :

I've rewritten the exporter to stream directly the iter_changes operations. This does fix my testcase, which was with the exporter being too much involved with directory moves.

But these are not the correct semantics yet, because iter_changes appears to give an unordered set of changes.

For example (this bug's first testcase), it returns things like:
R a b
D b
Which, serialized, should become
D b
R a b

Another problematic situation is (#285175):
R b a
R a b
Which needs an intermediary to be serialized
R b t
R a b
R t a

Revision history for this message
Jonas (jonas-annica) wrote : SV: [Bug 268933] Re: bzr-fast-export exports rm+mv incorrectly

See:

https://bugs.launchpad.net/bzr-fastimport/+bug/285175

Furthermore, I don't know of any case not working with my latest patch
on this bug

Do you ?

/Jonas

--- Den tors 2008-10-23 skrev Gabriel de Perthuis <email address hidden>:

> Från: Gabriel de Perthuis <email address hidden>
> Ämne: [Bug 268933] Re: bzr-fast-export exports rm+mv incorrectly
> Till: <email address hidden>
> Datum: torsdag 23 oktober 2008 01.29
> I've rewritten the exporter to stream directly the
> iter_changes
> operations. This does fix my testcase, which was with the
> exporter being
> too much involved with directory moves.
>
> But these are not the correct semantics yet, because
> iter_changes
> appears to give an unordered set of changes.
>
> For example (this bug's first testcase), it returns
> things like:
> R a b
> D b
> Which, serialized, should become
> D b
> R a b
>
> Another problematic situation is (#285175):
> R b a
> R a b
> Which needs an intermediary to be serialized
> R b t
> R a b
> R t a
>
>
> ** Attachment added: "WIP patch"
>
> http://launchpadlibrarian.net/18808271/iter_changes.patch
>
> --
> bzr-fast-export exports rm+mv incorrectly
> https://bugs.launchpad.net/bugs/268933
> You received this bug notification because you are a direct
> subscriber
> of the bug.
>
> Status in Bazaar Fast Import Plugin: Confirmed
>
> Bug description:
> if doing
> bzr rm a
> bzr mv b a
> commit
>
> then bzr-fast-export will export a mv followed by a rm,
> causing a to vanish in total
> (btw, bzr diff -c also shows them in "opposite"
> order)

      __________________________________________________________
Låna pengar utan säkerhet. Jämför vilkor online hos Kelkoo.
http://www.kelkoo.se/c-100390123-lan-utan-sakerhet.html?partnerId=96915014

Revision history for this message
Gabriel de Perthuis (g2p) wrote :

I've tested your latest patch.
My testcase ( https://bugs.launchpad.net/bzr-fastimport/+bug/268933/comments/7 ) still fails, due to the way directory moves are handled.
I'll see if I can work on top of your patch. Anyway, I'll check with the testcases of both bugs.

tags: added: export
Revision history for this message
Chow Loong Jin (hyperair) wrote :

I believe lp:tangerine also suffers from this. A previous version of bzr-fast-export I grabbed from somewhere I don't remember appears to handle it correctly though.

Revision history for this message
Chow Loong Jin (hyperair) wrote :

Or not. Poking in git fast-import log shows that it's more similar to bug #219042 instead. Sorry for the noise.

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.