status shows incorrect info on mv over rm'd file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
High
|
John A Meinel |
Bug Description
If I rm a file, then mv another file over the same name, 'status' shows the wrong information. If I 'commit' the changes, they come out right in the log however.
Some notes:
- This affects dirstate trees, on 0.15 and current bzr.dev. It does not affect knit trees.
- This IS an ordering-dependent problem. If I call the files 'foo' and 'bzr' instead of 'M' and 'x', the problem does NOT occur (originally seen in a tree with Makefile and xMakefile)
When the following script runs, the 'stat' shows me:
removed:
M
x
It should instead show:
removed:
M
renamed:
x => M
('dbzr' is my bzr.dev symlinks. Salt to taste)
#!/bin/sh
bzr="dbzr"
${bzr} init
touch M x
${bzr} add
${bzr} ci -m '1'
rm M
${bzr} rm M
${bzr} mv x M
${bzr} stat
Confirmed.
The dirstate file itself seems to have recorded this correctly (It shows that x was renamed to M, and that M with the old file id was deleted.
If you switch the removed file, it "works".
bzr init foo
cd foo
touch M x
bzr add
bzr commit -m 1
rm x
bzr rm x
bzr mv M x
bzr status
Will properly show M => x and x removed.
I think the problem is that _iter_changes is finding that x is renamed, and then looking up the record for M, and finding the deleted one, rather than the proper target.
And I *think* that is because the file-id "x-foobabrabou" is sorting after "M-aboeunthoeu", so whether we find the existing file, or the deleted one switches based on original filename (which effects file id).