~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: Aaron Bentley
  • Date: 2006-05-30 15:53:33 UTC
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: abentley@panoramicfeedback.com-20060530155333-2fd164d1cdf2afc3
Move BadBundle error (and subclasses) to errors.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""
19
19
 
20
20
import os
 
21
import bzrlib
21
22
from bzrlib.errors import BoundBranchOutOfDate
22
23
 
23
24
def test_remove(filename):
34
35
    :param verbose: Print each step as you do it
35
36
    :param revno: Remove back to this revision
36
37
    """
 
38
    from bzrlib.atomicfile import AtomicFile
37
39
    unlockable = []
38
40
    try:
39
41
        if tree is not None:
43
45
        branch.lock_write()
44
46
        unlockable.append(branch)
45
47
 
46
 
        pending_merges = []
47
 
 
48
48
        master = branch.get_master_branch()
49
49
        if master is not None:
50
50
            master.lock_write()
58
58
        files_to_remove = []
59
59
        for r in range(revno-1, len(rh)):
60
60
            rev_id = rh.pop()
61
 
            rev = branch.repository.get_revision(rev_id)
62
 
            # When we finish popping off the pending merges, we want
63
 
            # them to stay in the order that they used to be.
64
 
            # but we pop from the end, so reverse the order, and
65
 
            # then get the order right at the end
66
 
            pending_merges.extend(reversed(rev.parent_ids[1:]))
67
61
            if verbose:
68
62
                print 'Removing revno %d: %s' % (len(rh)+1, rev_id)
69
63
 
76
70
            branch.set_revision_history(rh)
77
71
            if tree is not None:
78
72
                tree.set_last_revision(branch.last_revision())
79
 
                pending_merges.reverse()
80
 
                tree.set_pending_merges(pending_merges)
81
73
    finally:
82
74
        for item in reversed(unlockable):
83
75
            item.unlock()