bzr-rebase discards all your work when you forget to commit before invoking it

Bug #144407 reported by Pieter Nagel
4
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/otherfile.txt
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/otherfile.txt

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 144407] bzr-rebase discards all your work when you forget to commit before invoking it

  status triaged
  importance high
--
Jelmer Vernooij <email address hidden> - http://samba.org/~jelmer/
Jabber: <email address hidden>

Changed in bzr-rebase:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Jelmer Vernooij (jelmer) wrote :
Changed in bzr-rebase:
assignee: nobody → jelmer
status: Triaged → Fix Committed
Jelmer Vernooij (jelmer)
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
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.