/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: 2006-09-20 14:51:03 UTC
  • mfrom: (0.8.23 version_info)
  • mto: This revision was merged to the branch mainline in revision 2028.
  • Revision ID: john@arbash-meinel.com-20060920145103-02725c6d6c886040
[merge] version-info plugin, and cleanup for layout in bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""Remove the last revision from the history of the current branch."""
18
 
 
19
 
# TODO: make the guts of this methods on tree, branch.
 
17
"""Remove the last revision from the history of the current branch.
 
18
"""
20
19
 
21
20
import os
22
21
 
23
 
from bzrlib.branch import Branch
24
22
from bzrlib.errors import BoundBranchOutOfDate
25
23
 
26
24
 
53
51
            raise BoundBranchOutOfDate(branch, master)
54
52
        if revno is None:
55
53
            revno = len(rh)
56
 
        old_revno, old_tip = branch.last_revision_info()
57
 
        new_revno = revno -1
58
54
 
59
55
        files_to_remove = []
60
56
        for r in range(revno-1, len(rh)):
61
57
            rev_id = rh.pop()
62
 
            # NB: performance would be better using the revision graph rather
63
 
            # than the whole revision.
64
58
            rev = branch.repository.get_revision(rev_id)
65
59
            # When we finish popping off the pending merges, we want
66
60
            # them to stay in the order that they used to be.
76
70
            if master is not None:
77
71
                master.set_revision_history(rh)
78
72
            branch.set_revision_history(rh)
79
 
            new_tip = branch.last_revision()
80
 
            if master is None:
81
 
                hook_local = None
82
 
                hook_master = branch
83
 
            else:
84
 
                hook_local = branch
85
 
                hook_master = master
86
 
            for hook in Branch.hooks['post_uncommit']:
87
 
                hook(hook_local, hook_master, old_revno, old_tip, new_revno,
88
 
                    new_tip)
89
73
            if tree is not None:
90
 
                if new_tip is not None:
91
 
                    parents = [new_tip]
 
74
                branch_tip = branch.last_revision()
 
75
                if branch_tip is not None:
 
76
                    parents = [branch.last_revision()]
92
77
                else:
93
78
                    parents = []
94
79
                parents.extend(reversed(pending_merges))