4
 
Sometimes people really need to rewrite history.  The canonical
 
5
 
example is that they have accidentally checked confidential
 
6
 
information into the wrong tree.
 
8
 
There is a tension between two imperatives:
 
10
 
* Accurately record all history.
 
12
 
* Remove critical information.
 
14
 
Of course we cannot control who may have made use of the information
 
15
 
in the time it was public, but often these things are caught early enough.
 
17
 
After history has been rewritten, anything that depends on that
 
18
 
history may be inconsistent.  We cannot consistently continue on a
 
19
 
version that has had some revisions knocked out; therefore it seems
 
20
 
simplest to kill the version over all.  
 
22
 
You can make a tag onto a new version from a previous consistent
 
25
 
Downstream users will need to switch on to the new version.
 
27
 
We can mark the version as killed so that mirroring will delete the
 
28
 
revisions and clients looking at the version can suggest switching.
 
30
 
This should be an extremely infrequent operation so it is OK that it
 
31
 
is simple as long as it fulfils the basic requirement.
 
33
 
A related problem is that people sometimes commit the wrong log
 
34
 
message, or (more seriously) the wrong files.  It is common to notice
 
35
 
immediately afterwards.
 
41
 
I think this is the best and most useful option at the moment: the
 
42
 
`uncommit command`_ undoes the last commit, and nothing else.  It can
 
43
 
be repeated to successively remove more and more history.
 
45
 
.. _`uncommit command`: cmdref.html#uncommit
 
50
 
    % bzr add launch-codes.txt
 
51
 
    % bzr commit -m 'add launch codes'
 
56
 
    [now back to just before the commit command]
 
60
 
    % bzr revert launch-codes.txt
 
64
 
If anyone else has depended on the option then the branches will have
 
65
 
diverged and that needs to be resolved somehow, probably by the other
 
66
 
people starting a new branch with the correct commit.  In particular
 
67
 
uncommitting from a shared branch will break anyone who has seen that
 
68
 
revision; possibly there needs to be a policy option on such branches
 
71
 
If someone else on that shared branch did a the equivalent of a
 
72
 
switch_ command then they would bring their changes onto the correct
 
73
 
basis.  Would it be reasonable to do that automatically?
 
75
 
.. _switch: cmdref.html#switch
 
85
 
    % baz add launch-codes.txt
 
86
 
    % baz commit -s 'add launch codes'
 
89
 
    % baz commit -s 'add good code'
 
94
 
    % baz commit --as-latest
 
95
 
    renamed old branch to my-project-old-1
 
96
 
    % baz eradicate my-project-old-1
 
101
 
  % baz add launch-codes.txt
 
102
 
  % baz commit -s 'add launch codes'
 
104
 
  % baz add good-code.c
 
105
 
  % baz commit -s 'add good code'
 
109
 
  % baz fork my-project--patch3 my-project-fixed
 
110
 
  % cd my-project-fixed
 
111
 
  % baz pull ../my-project patch5
 
114
 
  % mv my-project-fixed my-project
 
119
 
  % baz add launch-codes.txt
 
120
 
  % baz commit -s 'add launch codes'
 
122
 
  % baz add good-code.c
 
123
 
  % baz commit -s 'add good code'
 
126
 
  % baz branch patch-3 $(baz tree-version)
 
128
 
  % baz eliminate patch-4