~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-09 14:43:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: john@arbash-meinel.com-20060809144327-d604af2edf646794
Clean up and write tests for permissions. Now we use fstat which should be cheap, and lets us check the permissions and the file size

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""
19
19
 
20
20
import os
21
 
import bzrlib
22
21
from bzrlib.errors import BoundBranchOutOfDate
23
22
 
24
23
def test_remove(filename):
35
34
    :param verbose: Print each step as you do it
36
35
    :param revno: Remove back to this revision
37
36
    """
38
 
    from bzrlib.atomicfile import AtomicFile
39
37
    unlockable = []
40
38
    try:
41
39
        if tree is not None:
45
43
        branch.lock_write()
46
44
        unlockable.append(branch)
47
45
 
 
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:]))
61
67
            if verbose:
62
68
                print 'Removing revno %d: %s' % (len(rh)+1, rev_id)
63
69
 
70
76
            branch.set_revision_history(rh)
71
77
            if tree is not None:
72
78
                tree.set_last_revision(branch.last_revision())
 
79
                pending_merges.reverse()
 
80
                tree.set_pending_merges(pending_merges)
73
81
    finally:
74
82
        for item in reversed(unlockable):
75
83
            item.unlock()