/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-16 10:44:11 UTC
  • mto: This revision was merged to the branch mainline in revision 3299.
  • Revision ID: john@arbash-meinel.com-20080316104411-t3lmcw0blmnoe0qo
Add uncommit --local.
Add some genuine whitebox testing of bzrlib.uncommit.uncommit
Add a local=??? flag to uncommit() and allow it being set by
uncommit --local.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from bzrlib.errors import BoundBranchOutOfDate
26
26
 
27
27
 
28
 
def uncommit(branch, dry_run=False, verbose=False, revno=None, tree=None):
 
28
def uncommit(branch, dry_run=False, verbose=False, revno=None, tree=None,
 
29
             local=False):
29
30
    """Remove the last revision from the supplied branch.
30
31
 
31
32
    :param dry_run: Don't actually change anything
45
46
        if tree is not None:
46
47
            pending_merges = tree.get_parent_ids()[1:]
47
48
 
48
 
        master = branch.get_master_branch()
49
 
        if master is not None:
50
 
            master.lock_write()
51
 
            unlockable.append(master)
 
49
        if local:
 
50
            master = None
 
51
        else:
 
52
            master = branch.get_master_branch()
 
53
            if master is not None:
 
54
                master.lock_write()
 
55
                unlockable.append(master)
52
56
        rh = branch.revision_history()
53
57
        if master is not None and rh[-1] != master.last_revision():
54
58
            raise BoundBranchOutOfDate(branch, master)