~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/uncommit.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-22 10:44:29 UTC
  • mto: This revision was merged to the branch mainline in revision 6094.
  • Revision ID: jelmer@samba.org-20110822104429-74f1o1at79fmno2n
More tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
 
29
29
def uncommit(branch, dry_run=False, verbose=False, revno=None, tree=None,
30
 
             local=False):
 
30
             local=False, keep_tags=False):
31
31
    """Remove the last revision from the supplied branch.
32
32
 
33
33
    :param dry_run: Don't actually change anything
36
36
    :param local: If this branch is bound, only remove the revisions from the
37
37
        local branch. If this branch is not bound, it is an error to pass
38
38
        local=True.
 
39
    :param keep_tags: Whether to keep tags pointing at the removed revisions
 
40
        around.
39
41
    """
40
42
    unlockable = []
41
43
    try:
66
68
            revno = old_revno
67
69
        new_revno = revno - 1
68
70
 
69
 
        revid_iterator = branch.repository.iter_reverse_revision_history(
70
 
                            old_tip)
71
71
        cur_revno = old_revno
72
72
        new_revision_id = old_tip
73
73
        graph = branch.repository.get_graph()
74
 
        for rev_id in revid_iterator:
 
74
        for rev_id in graph.iter_lefthand_ancestry(old_tip):
75
75
            if cur_revno == new_revno:
76
76
                new_revision_id = rev_id
77
77
                break