4
# Copyright (C) 2011 Jelmer Vernooij <jelmer@apache.org>
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
from cStringIO import StringIO
23
from bzrlib.tests import TestCaseWithTransport
25
from bzrlib.plugins.git.git_remote_helper import (
31
class OpenLocalDirTests(TestCaseWithTransport):
33
def test_from_env(self):
34
self.make_branch_and_tree('bla', format='git')
35
self.overrideEnv('GIT_DIR', os.path.join(self.test_dir, 'bla'))
38
def test_from_env_dir(self):
39
self.make_branch_and_tree('bla', format='git')
40
self.overrideEnv('GIT_DIR', os.path.join(self.test_dir, 'bla', '.git'))
43
def test_from_dir(self):
44
self.make_branch_and_tree('.', format='git')
48
class RemoteHelperTests(TestCaseWithTransport):
51
super(RemoteHelperTests, self).setUp()
52
self.local_dir = self.make_branch_and_tree('local', format='git').bzrdir
53
self.remote_dir = self.make_branch_and_tree('remote').bzrdir
54
self.shortname = 'bzr'
55
self.helper = RemoteHelper(self.local_dir, self.shortname, self.remote_dir)
57
def test_capabilities(self):
59
self.helper.cmd_capabilities(f, [])
61
base = "fetch\noption\npush\n"
62
self.assertTrue(capabs in (base+"\n", base+"import\n\n"), capabs)
64
def test_option(self):
66
self.helper.cmd_option(f, [])
67
self.assertEquals("unsupported\n", f.getvalue())
69
def test_list_basic(self):
71
self.helper.cmd_list(f, [])
73
'0000000000000000000000000000000000000000 HEAD\n'
74
'0000000000000000000000000000000000000000 refs/heads/master\n\n',