bzr-rebase discards all your work when you forget to commit before invoking it
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bzr-rewrite |
Fix Released
|
High
|
Jelmer Vernooij | ||
bzr-rebase (Debian) |
Fix Released
|
Unknown
|
Bug Description
If your forget to commit before invoking "bzr rebase" (or do not know that you should), you get an error message telling you that.
However, at that point bzr rebase has already written state to disk which makes it think that there is a rebase in progress that needs to be continued or aborted. It's a damned if you do, damned if you don't situation; because whether you commit or abort, you lose all your work.
It would be better to check for uncommitted revisions *before* starting the rebase at all.
#!/usr/bin/env bash
rm -rf repo branch
bzr init repo
echo "Stuff" > repo/file.txt
bzr add repo/
bzr commit -m 'Initial version' repo
bzr branch repo branch
echo "More stuff in master repo" >> repo/file2.txt
bzr add repo/
bzr commit -m 'Another upstream version' repo
echo "More stuff in branch" >> branch/file.txt
bzr commit -m 'Extra commit to workaround Bug #144401' branch
echo "The fruit of hours of blood, sweat and tears" >> branch/
bzr add branch/
# This will say: "ERROR: Working tree has uncommitted changes."
( cd branch; bzr rebase || true)
bzr commit -m 'Oops, I forgot to commit' branch
# This will say: "ERROR: A rebase operation was interrupted. Continue using 'bzr rebase-continue' or abort using 'bzr rebase-abort'"
( cd branch; bzr rebase || true)
# Should I abort or continue? Makes no difference, either way otherfile.txt will be gone
( cd branch; bzr rebase-abort )
# otherfile.txt is now no longer versioned
bzr inventory --kind=file branch/
# This will say "No such file". All my hard work gone!
cat branch/
Changed in bzr-rebase: | |
status: | Fix Committed → Fix Released |
Changed in bzr-rebase: | |
status: | Unknown → New |
Changed in bzr-rebase: | |
status: | New → Confirmed |
Changed in bzr-rebase: | |
status: | Confirmed → Fix Released |
status triaged samba.org/ ~jelmer/
importance high
--
Jelmer Vernooij <email address hidden> - http://
Jabber: <email address hidden>