switch doesn't delete ignored files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Bazaar |
Medium
|
Unassigned |
Bug Description
If I have ignored files in a subdirectory which does not exist in a parallel branch, switching to that parallel branch produces a conflict due to it being unable to delete the subdirectory because it is not empty. If I remove the ignored files, it switches correctly.
Steps to reproduce:
C:\tmp\bzrtest>bzr init-repo .
Shared repository with trees (format: 2a)
Location:
shared repository: .
C:\tmp\bzrtest>bzr init trunk
Created a repository tree (format: 2a)
Using shared repository: C:/tmp/bzrtest/
C:\tmp\bzrtest>cd trunk
C:\tmp\
C:\tmp\
C:\tmp\
adding module1
adding module1/file1.txt
C:\tmp\
Committing to: C:/tmp/
added module1
added module1/file1.txt
Committed revision 1.
C:\tmp\
C:\tmp\bzrtest>bzr branch trunk ver1
Branched 1 revision(s).
C:\tmp\bzrtest>cd trunk
C:\tmp\
C:\tmp\
C:\tmp\
adding module2
adding module2/file2.txt
C:\tmp\
Committing to: C:/tmp/
added module2
added module2/file2.txt
Committed revision 2.
C:\tmp\
C:\tmp\bzrtest>bzr co --lightweight trunk work
C:\tmp\bzrtest>cd work
C:\tmp\
C:\tmp\
C:\tmp\
C:\tmp\
Committing to: C:/tmp/
added .bzrignore
Committed revision 3.
C:\tmp\
Conflict: can't delete module2 because it is not empty. Not deleting.
Updated to revision 1.
Switched to branch: C:/tmp/
C:\tmp\
Conflict adding file module2. Moved existing file to module2.moved.
Updated to revision 3.
Switched to branch: C:/tmp/
C:\tmp\
C:\tmp\
C:\tmp\
Updated to revision 1.
Switched to branch: C:/tmp/
C:\tmp\
Updated to revision 3.
Switched to branch: C:/tmp/
Martin Packman (gz) wrote : | #1 |
There are two different things that could be useful:
* delete all ignored files -- might be a useful option, default off
* don't conflict on deleting directories with ignored files - might be a dupe
Gordon Tyler (doxxx) wrote : | #3 |
I'd be happy with the no conflicts choice.
Vincent Ladeuil (vila) wrote : | #4 |
Can be reproduced with:
bzr test-script ./803594.bug
with 803594.bug containing:
$ bzr init-repo .
Shared repository with trees (format: 2a)
Location:
shared repository: .
$ bzr init trunk
Created a repository tree (format: 2a)
Using shared repository: ...
$ cd trunk
$ mkdir module1
$ echo "stuff" > module1/file1.txt
$ bzr add
adding module1
adding module1/file1.txt
$ bzr commit -m "Added module1"
2>Committing to: ...trunk/
2>added module1
2>added module1/file1.txt
2>Committed revision 1.
$ cd ..
$ bzr branch trunk ver1
2>Branched 1 revision(s).
$ cd trunk
$ mkdir module2
$ echo "stuff" > module2/file2.txt
$ bzr add
adding module2
adding module2/file2.txt
$ bzr commit -m "Added module2"
2>Committing to: ...trunk/
2>added module2
2>added module2/file2.txt
2>Committed revision 2.
$ cd ..
$ bzr co --lightweight trunk work
$ cd work
$ mkdir module2/temp
$ echo "stuff" > module2/
$ bzr ignore module2/temp
$ bzr commit -m "added ignore"
2>Committing to: .../trunk/
2>added .bzrignore
2>Committed revision 3.
$ bzr switch ver1
2>Conflict: can't delete module2 because it is not empty. Not deleting.
2>Updated to revision 1.
2>Switched to branch: .../ver1/
$ bzr switch trunk
2>Conflict adding file module2. Moved existing file to module2.moved.
2>Updated to revision 3.
2>Switched to branch: .../trunk/
$ bzr revert
$ rm -rf module2.moved
$ bzr switch ver1
2>Updated to revision 1.
2>Switched to branch: .../ver1/
$ bzr switch trunk
2>Updated to revision 3.
2>Switched to branch: .../trunk/
which makes it easier to reproduce on any platform
Changed in bzr: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Vincent Ladeuil (vila) wrote : | #5 |
This can be worked around with bzr.transform.
--- /home/vila/
+++ /home/vila/
@@ -1,3 +1,4 @@
+$ bzr config --scope=bazaar bzr.transform.
$ bzr init-repo .
Shared repository with trees (format: 2a)
Location:
@@ -41,11 +42,10 @@
2>added .bzrignore
2>Committed revision 3.
$ bzr switch ver1
-2>Conflict: can't delete module2 because it is not empty. Not deleting.
+2>module2/temp has been orphaned in bzr-orphans
2>Updated to revision 1.
2>Switched to branch: .../ver1/
$ bzr switch trunk
-2>Conflict adding file module2. Moved existing file to module2.moved.
2>Updated to revision 3.
2>Switched to branch: .../trunk/
$ bzr revert
Vincent Ladeuil (vila) wrote : | #6 |
Ignored files should not be deleted (some ignored files are very precious like build artefacts that take a long time to produce).
Once we implement a way to distinguish between junk and precious files (which are two different kind of ignored files) we can delete the junk files automatically.
Changed in bzr: | |
status: | Confirmed → Won't Fix |
Martin Pool (mbp) wrote : | #7 |
There's still a real user problem here, even if we don't want to delete ignored files by default.
Changed in bzr: | |
status: | Won't Fix → Confirmed |
tags: | added: check-for-breezy |
On the other hand, if switch did delete ignored files, it would be a whole lot less useful for big branches where you want to preserve build artefacts and such like.