Subject: Foolproof Bazaar

From: Daniel van Vugt <[email-masked]>
Date: Fri, 31 Jul 2015 10:49:15 +0800

All,

I've been using thumper's append-only trick on mir-team's branches for a 
few years now, to prevent us from accidentally deleting history in bzr 
(yes it's too easy otherwise).

Should I forget to do this on future branches, or happen to not be 
around, the instructions are below...

- Daniel

On 12/02/13 10:01, Tim Penhey wrote:
> On 12/02/13 14:24, Daniel van Vugt wrote:
>> Yes this happened last year (on 9th Feb too). And we immediately locked
>> down the branch to prevent direct pushes from being able to overwrite
>> previous revisions.
>>
>> However, that was lp:compiz-core and the same protection was probably
>> not applied when we switched to lp:compiz later in the year.
>>
>> It's not direct push access that's a problem. We just need to lock out
>> any pushes that change history (overwrite previous revisions). Tim has a
>> little script for adding the protection to any branch.
>
> Hi there,
>
> I used a little bazaar plugin [1] to do this.
>
> Then ran:
>    $ bzr append-only lp:compiz
>
> So compiz trunk is in append only mode now, so rewriting history is not
> allowed.
>
> You need to have write access to the branch to use this command.
>
> Cheers,
> Tim
>
>
> [1] -- put the following in ~/.bazaar/plugins/append_only.py
>
> from bzrlib.branch import Branch
> from bzrlib.commands import Command, register_command
>
>
> class cmd_append_only(Command):
>      takes_args = ['branch']
>      def run(self, branch):
>          """See `Command`."""
>          b = Branch.open(branch)
>          b.lock_write()
>          b.set_append_revisions_only(True)
>          b.unlock()
>
>
> register_command(cmd_append_only)
>
>
>