bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
1  | 
# Copyright (C) 2004, 2005 by Canonical Ltd
 | 
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
2  | 
#
 | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
7  | 
#
 | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
8  | 
# This program is distributed in the hope that it will be useful,
 | 
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
12  | 
#
 | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
13  | 
# You should have received a copy of the GNU General Public License
 | 
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
17  | 
"""Tests for branch.pull behaviour."""
 | 
|
18  | 
||
19  | 
import os  | 
|
20  | 
||
21  | 
from bzrlib.branch import Branch  | 
|
22  | 
from bzrlib.osutils import abspath, realpath  | 
|
23  | 
from bzrlib.tests import TestCaseWithTransport  | 
|
24  | 
||
25  | 
||
26  | 
class TestPull(TestCaseWithTransport):  | 
|
27  | 
||
28  | 
def test_pull_convergence_simple(self):  | 
|
29  | 
        # when revisions are pulled, the left-most accessible parents must 
 | 
|
30  | 
        # become the revision-history.
 | 
|
31  | 
parent = self.make_branch_and_tree('parent')  | 
|
32  | 
parent.commit('1st post', rev_id='P1', allow_pointless=True)  | 
|
33  | 
mine = parent.bzrdir.sprout('mine').open_workingtree()  | 
|
34  | 
mine.commit('my change', rev_id='M1', allow_pointless=True)  | 
|
| 
1979.2.1
by Robert Collins
 (robertc) adds a convenience method "merge_from_branch" to WorkingTree.  | 
35  | 
parent.merge_from_branch(mine.branch)  | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
36  | 
parent.commit('merge my change', rev_id='P2')  | 
37  | 
mine.pull(parent.branch)  | 
|
38  | 
self.assertEqual(['P1', 'P2'], mine.branch.revision_history())  | 
|
39  | 
||
40  | 
def test_pull_merged_indirect(self):  | 
|
41  | 
        # it should be possible to do a pull from one branch into another
 | 
|
42  | 
        # when the tip of the target was merged into the source branch
 | 
|
43  | 
        # via a third branch - so its buried in the ancestry and is not
 | 
|
44  | 
        # directly accessible.
 | 
|
45  | 
parent = self.make_branch_and_tree('parent')  | 
|
46  | 
parent.commit('1st post', rev_id='P1', allow_pointless=True)  | 
|
47  | 
mine = parent.bzrdir.sprout('mine').open_workingtree()  | 
|
48  | 
mine.commit('my change', rev_id='M1', allow_pointless=True)  | 
|
49  | 
other = parent.bzrdir.sprout('other').open_workingtree()  | 
|
| 
1979.2.1
by Robert Collins
 (robertc) adds a convenience method "merge_from_branch" to WorkingTree.  | 
50  | 
other.merge_from_branch(mine.branch)  | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
51  | 
other.commit('merge my change', rev_id='O2')  | 
| 
1979.2.1
by Robert Collins
 (robertc) adds a convenience method "merge_from_branch" to WorkingTree.  | 
52  | 
parent.merge_from_branch(other.branch)  | 
| 
1649.1.1
by Robert Collins
 * 'pull' and 'push' now normalise the revision history, so that any two  | 
53  | 
parent.commit('merge other', rev_id='P2')  | 
54  | 
mine.pull(parent.branch)  | 
|
55  | 
self.assertEqual(['P1', 'P2'], mine.branch.revision_history())  |