Skip to content

jelmer/bzr-rewrite

Repository files navigation

This plugin provides various commands for rewriting Bazaar revisions in 
an automated fashion. 

It includes a 'bzr rebase' command, in the same fashion of the 
famous ``git rebase`` command.

==========
How to use
==========
Simply run ``bzr rebase``, optionally specifying an upstream branch. If no 
branch is specified, it will use the current parent branch (which is usually 
what you want).

If the rebase fails halfway through, perhaps because of conflicts 
replaying a revision, it will abort. When it's aborted, you can either resolve
the conflicts (using "bzr resolve") and run ``bzr rebase-continue`` or 
abort the rebase and undo all changes it's done using ``bzr rebase-abort``. 
The current state of the rebase can be viewed with the ``bzr rebase-todo`` 
command. See "bzr help rebase" for more details.

In the future, I hope it can also support rebasing on top of an unrelated 
branch.

============
How it works
============
The plugin will start off by writing a plan for the rebase, which it 
will write to .bzr/checkout/rebase-state. If the rebase is interrupted 
(conflicts that have to be resolved by the user) and 
needs to be continued or aborted, it will read this file to see what needs 
(still) needs to be done.

The rebase-state file contains the following information:
 * last-revision-info when the rebase was started
 * map of revisions that need to be replaced. In simple situations, 
   this would contain the revision on top of which the rebase is taking 
   place and the revisions that are only on the branch that is being 
   rebased.

   The map is from old revid to a tuple with new revid and new parents.

   For example, in the following scenario:

   A -> B -> C -> D main
        \ -> E -> F next

   Where next would be rebased on top of main, the replace map would look 
   something like this:

	E -> (E', [D])
	F -> (F', [E'])

The rebase plan contains the newly generated revision ids so that it is 
not necessary to update it after each revision that has been written 
because the new generated revision ids would have to be known when rewriting 
their children.

The 'rebase-of' revision property of newly created revisions 
will be set to the revision id of the revision they are a rewrite of.

About

Hacky rewrite plugin for Bazaar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages