bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.358.2
by Jelmer Vernooij
Refresh copyright headers, add my email. |
1 |
# Copyright (C) 2009-2018 Jelmer Vernooij <jelmer@jelmer.uk>
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
2 |
# Copyright (C) 2007 Canonical Ltd
|
3 |
#
|
|
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.
|
|
8 |
#
|
|
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.
|
|
13 |
#
|
|
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
|
|
|
0.358.1
by Jelmer Vernooij
Fix FSF address. |
16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
17 |
|
18 |
"""Test the GitDir class"""
|
|
19 |
||
|
0.358.3
by Jelmer Vernooij
Enable absolute import. |
20 |
from __future__ import absolute_import |
21 |
||
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
22 |
from dulwich.repo import Repo as GitRepo |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
23 |
import os |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
24 |
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
25 |
from ... import ( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
26 |
controldir, |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
27 |
errors, |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
28 |
urlutils, |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
29 |
)
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
30 |
from ...tests import TestSkipped |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
31 |
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
32 |
from .. import ( |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
33 |
dir, |
34 |
tests, |
|
35 |
workingtree, |
|
36 |
)
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
37 |
|
38 |
||
39 |
class TestGitDir(tests.TestCaseInTempDir): |
|
40 |
||
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
41 |
def test_get_head_branch_reference(self): |
42 |
GitRepo.init(".") |
|
43 |
||
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
44 |
gd = controldir.ControlDir.open('.') |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
45 |
self.assertEqual( |
|
0.303.3
by Jelmer Vernooij
Prefer using branch segment parameter in reference branch URLs. |
46 |
"%s,branch=master" % |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
47 |
urlutils.local_path_to_url(os.path.abspath(".")), |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
48 |
gd.get_branch_reference()) |
49 |
||
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
50 |
def test_open_existing(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
51 |
GitRepo.init(".") |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
52 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
53 |
gd = controldir.ControlDir.open('.') |
|
0.200.148
by Jelmer Vernooij
Share more infrastructure between LocalGitDir and RemoteGitDir. |
54 |
self.assertIsInstance(gd, dir.LocalGitDir) |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
55 |
|
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
56 |
def test_open_workingtree(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
57 |
GitRepo.init(".") |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
58 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
59 |
gd = controldir.ControlDir.open('.') |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
60 |
raise TestSkipped |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
61 |
wt = gd.open_workingtree() |
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
62 |
self.assertIsInstance(wt, workingtree.GitWorkingTree) |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
63 |
|
64 |
def test_open_workingtree_bare(self): |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
65 |
GitRepo.init_bare(".") |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
66 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
67 |
gd = controldir.ControlDir.open('.') |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
68 |
self.assertRaises(errors.NoWorkingTree, gd.open_workingtree) |
69 |
||
|
0.398.1
by Jelmer Vernooij
Support reading .git files. |
70 |
def test_git_file(self): |
71 |
gitrepo = GitRepo.init("blah", mkdir=True) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
72 |
self.build_tree_contents( |
73 |
[('foo/', ), ('foo/.git', b'gitdir: ../blah/.git\n')]) |
|
|
0.398.1
by Jelmer Vernooij
Support reading .git files. |
74 |
|
75 |
gd = controldir.ControlDir.open('foo') |
|
76 |
self.assertEqual(gd.control_url.rstrip('/'), |
|
77 |
urlutils.local_path_to_url(os.path.abspath(gitrepo.controldir()))) |
|
78 |
||
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
79 |
|
|
0.200.977
by Jelmer Vernooij
Implement GitBzrDirFormat.__eq__. |
80 |
class TestGitDirFormat(tests.TestCase): |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
81 |
|
82 |
def setUp(self): |
|
83 |
super(TestGitDirFormat, self).setUp() |
|
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
84 |
self.format = dir.LocalGitControlDirFormat() |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
85 |
|
86 |
def test_get_format_description(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
87 |
self.assertEqual("Local Git Repository", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
88 |
self.format.get_format_description()) |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
89 |
|
|
0.200.977
by Jelmer Vernooij
Implement GitBzrDirFormat.__eq__. |
90 |
def test_eq(self): |
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
91 |
format2 = dir.LocalGitControlDirFormat() |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
92 |
self.assertEqual(self.format, format2) |
93 |
self.assertEqual(self.format, self.format) |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
94 |
bzr_format = controldir.format_registry.make_controldir("default") |
|
6939.3.7
by Jelmer Vernooij
Don't use deprecated assertNotEquals. |
95 |
self.assertNotEqual(self.format, bzr_format) |