remove-tree removes shelved changes without warning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Unassigned |
Bug Description
The bzr remove-tree command will blow away any shelved changes without warning or prompting.
For example:
$ bzr init
$ echo foo > foo
$ bzr add
$ bzr ci -m "added foo"
$ echo bar > foo
$ bzr shelve --all -m "changed foo to bar"
Changes shelved with id "1".
$ bzr shelve --list
1: changed foo to bar
$ bzr remove-tree
$ bzr checkout
$ bzr shelve --list
No shelved changes.
I am not sure if this behaviour is intentional or not (i.e., I am not sure if the shelved changes are considered part of the working tree or the branch). In any case, this behaviour is bad: data loss can be caused if someone (e.g., me) runs bzr remove-tree without checking if there were shelved changes, and later realises he had some useful but unfinished changes shelved in that branch.
If the removal of shelved changes is unintentional, then it should be fixed so that running bzr remove-tree does *not* destroy the shelved changes (such that if I run bzr checkout again, my shelf still exists).
Conversely, if the removal of shelved changes is an intended part of the remove-tree operation, it should not happen without warning. Running bzr remove-tree on a branch with shelved changes should print:
bzr: ERROR: Working tree "<path>" has shelved changes (See bzr shelve --list).
(Much like the error you get when you run bzr remove-tree with regular uncommitted changes.)
This should be circumventable with bzr remove-tree --force.
Related branches
- Martin Pool: Approve
- Alexander Belchenko: Approve
-
Diff: 73 lines (+29/-1)3 files modifiedbzrlib/builtins.py (+3/-1)
bzrlib/errors.py (+6/-0)
bzrlib/tests/blackbox/test_remove_tree.py (+20/-0)
Also, in the latter case, the usage message for remove-tree should be updated:
--force Remove the working tree even if it has uncommitted or shelved changes.
(Added "or shelved".)