1
# Copyright (C) 2009 Canonical Ltd
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.
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.
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
17
"""Test the BranchMapper methods."""
19
from bzrlib import tests
21
from bzrlib.plugins.fastimport import (
26
class TestBranchMapper(tests.TestCase):
28
def test_git_to_bzr(self):
29
m = branch_mapper.BranchMapper()
35
'refs/remotes/origin/master',
36
'refs/remotes/origin/foo',
38
git_to_bzr_map = m.git_to_bzr(git_refs)
39
self.assertEqual(git_to_bzr_map, {
40
'refs/heads/master': 'trunk',
41
'refs/heads/foo': 'foo',
42
'refs/tags/master': 'trunk.tag',
43
'refs/tags/foo': 'foo.tag',
44
'refs/remotes/origin/master': 'trunk.remote',
45
'refs/remotes/origin/foo': 'foo.remote',
48
def test_git_to_bzr_for_trunk(self):
49
# As 'master' in git is mapped to trunk in bzr, we need to handle
50
# 'trunk' in git in a sensible way.
51
m = branch_mapper.BranchMapper()
55
'refs/remotes/origin/trunk',
56
'refs/heads/git-trunk',
57
'refs/tags/git-trunk',
58
'refs/remotes/origin/git-trunk',
60
git_to_bzr_map = m.git_to_bzr(git_refs)
61
self.assertEqual(git_to_bzr_map, {
62
'refs/heads/trunk': 'git-trunk',
63
'refs/tags/trunk': 'git-trunk.tag',
64
'refs/remotes/origin/trunk': 'git-trunk.remote',
65
'refs/heads/git-trunk': 'git-git-trunk',
66
'refs/tags/git-trunk': 'git-git-trunk.tag',
67
'refs/remotes/origin/git-trunk':'git-git-trunk.remote',