~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_revision.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2011, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
66
66
    br2 = tree2.branch
67
67
    tree2.commit("Commit four", rev_id="b@u-0-3")
68
68
    tree2.commit("Commit five", rev_id="b@u-0-4")
69
 
    revisions_2 = br2.revision_history()
70
 
    self.assertEquals(revisions_2[-1], 'b@u-0-4')
 
69
    self.assertEqual(br2.last_revision(), 'b@u-0-4')
71
70
 
72
71
    tree1.merge_from_branch(br2)
73
72
    tree1.commit("Commit six", rev_id="a@u-0-3")
74
73
    tree1.commit("Commit seven", rev_id="a@u-0-4")
75
74
    tree2.commit("Commit eight", rev_id="b@u-0-5")
76
 
    self.assertEquals(br2.revision_history()[-1], 'b@u-0-5')
 
75
    self.assertEqual(br2.last_revision(), 'b@u-0-5')
77
76
 
78
77
    tree1.merge_from_branch(br2)
79
78
    tree1.commit("Commit nine", rev_id="a@u-0-5")
80
79
    # DO NOT MERGE HERE - we WANT a GHOST.
81
 
    tree2.add_parent_tree_id(br1.revision_history()[4])
 
80
    br1.lock_read()
 
81
    try:
 
82
        graph = br1.repository.get_graph()
 
83
        revhistory = list(graph.iter_lefthand_ancestry(br1.last_revision(),
 
84
            [revision.NULL_REVISION]))
 
85
        revhistory.reverse()
 
86
    finally:
 
87
        br1.unlock()
 
88
    tree2.add_parent_tree_id(revhistory[4])
82
89
    tree2.commit("Commit ten - ghost merge", rev_id="b@u-0-6")
83
90
 
84
91
    return br1, br2