3
Remove the last committed revision.
4
Does not modify the working tree, use 'bzr revert' for that.
7
import bzrlib, bzrlib.commands
9
class cmd_uncommit(bzrlib.commands.Command):
10
"""Remove the last committed revision.
12
By supplying the --remove flag, it will not only remove the entry
13
from revision_history, but also remove all of the entries in the
16
--verbose will print out what is being removed.
17
--dry-run will go through all the motions, but not actually
20
In the future, uncommit will create a changeset, which can then
23
takes_options = ['remove', 'dry-run', 'verbose']
24
takes_args = ['location?']
27
def run(self, location=None, remove=False,
28
dry_run=False, verbose=False):
29
from bzrlib.branch import find_branch
30
from bzrlib.log import log_formatter
35
b = find_branch(location)
38
rev_id = b.last_patch()
40
print 'No revisions to uncommit.'
42
lf = log_formatter('short', to_file=sys.stdout)
43
lf.show(revno, b.get_revision(rev_id), None)
45
print 'The above revision will be removed.'
46
val = raw_input('Are you sure [y/N]? ')
47
if val.lower() not in ('y', 'yes'):
51
uncommit.uncommit(b, remove_files=remove,
52
dry_run=dry_run, verbose=verbose)
54
bzrlib.commands.register_command(cmd_uncommit)
55
bzrlib.commands.OPTIONS['remove'] = None
56
bzrlib.commands.OPTIONS['dry-run'] = None