~bzr-pqm/bzr/bzr.dev

2052.3.2 by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical
1
# Copyright (C) 2005 Canonical Ltd
1551.3.11 by Aaron Bentley
Merge from Robert
2
# -*- coding: utf-8 -*-
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
3
#
1551.3.11 by Aaron Bentley
Merge from Robert
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
8
#
1551.3.11 by Aaron Bentley
Merge from Robert
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
13
#
1551.3.11 by Aaron Bentley
Merge from Robert
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
from bzrlib.tests.blackbox import ExternalBase
18
import os
19
20
21
class TestFindMergeBase(ExternalBase):
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
22
1551.3.11 by Aaron Bentley
Merge from Robert
23
    def test_find_merge_base(self):
24
        os.mkdir('a')
25
        os.chdir('a')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
26
        self.run_bzr('init')
27
        self.run_bzr('commit -m foo --unchanged')
28
        self.run_bzr('branch . ../b')
2530.3.4 by Martin Pool
Deprecate run_bzr_captured in favour of just run_bzr
29
        q = self.run_bzr(['find-merge-base', '.', '../b'])[0]
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
30
        self.run_bzr('commit -m bar --unchanged')
1551.3.11 by Aaron Bentley
Merge from Robert
31
        os.chdir('../b')
2530.3.1 by Martin Pool
Cleanup old variations on run_bzr in the test suite
32
        self.run_bzr('commit -m baz --unchanged')
2530.3.4 by Martin Pool
Deprecate run_bzr_captured in favour of just run_bzr
33
        r = self.run_bzr(['find-merge-base', '.', '../a'])[0]
1551.3.11 by Aaron Bentley
Merge from Robert
34
        self.assertEqual(q, r)
35
        
2490.2.28 by Aaron Bentley
Fix handling of null revision
36
    def test_find_null_merge_base(self):
37
        tree = self.make_branch_and_tree('foo')
38
        tree.commit('message')
39
        tree2 = self.make_branch_and_tree('bar')
40
        r = self.run_bzr('find-merge-base', 'foo', 'bar')[0]
41
        self.assertEqual('merge base is revision null:\n', r)