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.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
20 |
from dulwich.repo import Repo as GitRepo |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
21 |
import os |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
22 |
|
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
23 |
from ... import ( |
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
24 |
controldir, |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
25 |
errors, |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
26 |
urlutils, |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
27 |
)
|
|
7385.2.2
by Jelmer Vernooij
Raise exception when requesting shared repository be created. |
28 |
from ...transport import get_transport |
|
6986.2.1
by Jelmer Vernooij
Move breezy.plugins.git to breezy.git. |
29 |
from ...tests import TestSkipped |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
30 |
|
|
0.200.1642
by Jelmer Vernooij
Use relative imports in tests. |
31 |
from .. import ( |
|
0.200.254
by Jelmer Vernooij
Fix tests. |
32 |
dir, |
33 |
tests, |
|
34 |
workingtree, |
|
35 |
)
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
36 |
|
37 |
||
38 |
class TestGitDir(tests.TestCaseInTempDir): |
|
39 |
||
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
40 |
def test_get_head_branch_reference(self): |
41 |
GitRepo.init(".") |
|
42 |
||
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
43 |
gd = controldir.ControlDir.open('.') |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
44 |
self.assertEqual( |
|
0.303.3
by Jelmer Vernooij
Prefer using branch segment parameter in reference branch URLs. |
45 |
"%s,branch=master" % |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
46 |
urlutils.local_path_to_url(os.path.abspath(".")), |
|
0.200.1377
by Jelmer Vernooij
Fix get_branch_reference. |
47 |
gd.get_branch_reference()) |
48 |
||
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
49 |
def test_open_existing(self): |
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
50 |
GitRepo.init(".") |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
51 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
52 |
gd = controldir.ControlDir.open('.') |
|
0.200.148
by Jelmer Vernooij
Share more infrastructure between LocalGitDir and RemoteGitDir. |
53 |
self.assertIsInstance(gd, dir.LocalGitDir) |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
54 |
|
|
7290.44.1
by Jelmer Vernooij
Don't throw an error attempting to read the parent of a ref. |
55 |
def test_open_ref_parent(self): |
56 |
r = GitRepo.init(".") |
|
|
7290.44.2
by Jelmer Vernooij
Use bytestrings. |
57 |
cid = r.do_commit(message=b"message", ref=b'refs/heads/foo/bar') |
|
7290.44.1
by Jelmer Vernooij
Don't throw an error attempting to read the parent of a ref. |
58 |
gd = controldir.ControlDir.open('.') |
59 |
self.assertRaises(errors.NotBranchError, gd.open_branch, 'foo') |
|
60 |
||
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
61 |
def test_open_workingtree(self): |
|
7290.44.1
by Jelmer Vernooij
Don't throw an error attempting to read the parent of a ref. |
62 |
r = GitRepo.init(".") |
|
7290.44.2
by Jelmer Vernooij
Use bytestrings. |
63 |
r.do_commit(message=b"message") |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
64 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
65 |
gd = controldir.ControlDir.open('.') |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
66 |
wt = gd.open_workingtree() |
|
0.200.94
by Jelmer Vernooij
Eliminate (duplicate) git_ prefix. |
67 |
self.assertIsInstance(wt, workingtree.GitWorkingTree) |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
68 |
|
69 |
def test_open_workingtree_bare(self): |
|
|
0.200.992
by Jelmer Vernooij
Avoid invoking git directly. |
70 |
GitRepo.init_bare(".") |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
71 |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
72 |
gd = controldir.ControlDir.open('.') |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
73 |
self.assertRaises(errors.NoWorkingTree, gd.open_workingtree) |
74 |
||
|
0.398.1
by Jelmer Vernooij
Support reading .git files. |
75 |
def test_git_file(self): |
76 |
gitrepo = GitRepo.init("blah", mkdir=True) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
77 |
self.build_tree_contents( |
78 |
[('foo/', ), ('foo/.git', b'gitdir: ../blah/.git\n')]) |
|
|
0.398.1
by Jelmer Vernooij
Support reading .git files. |
79 |
|
80 |
gd = controldir.ControlDir.open('foo') |
|
81 |
self.assertEqual(gd.control_url.rstrip('/'), |
|
82 |
urlutils.local_path_to_url(os.path.abspath(gitrepo.controldir()))) |
|
83 |
||
|
7385.2.2
by Jelmer Vernooij
Raise exception when requesting shared repository be created. |
84 |
def test_shared_repository(self): |
85 |
t = get_transport('.') |
|
86 |
self.assertRaises( |
|
87 |
errors.SharedRepositoriesUnsupported, |
|
88 |
dir.LocalGitControlDirFormat().initialize_on_transport_ex, t, |
|
89 |
shared_repo=True) |
|
90 |
||
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
91 |
|
|
0.200.977
by Jelmer Vernooij
Implement GitBzrDirFormat.__eq__. |
92 |
class TestGitDirFormat(tests.TestCase): |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
93 |
|
94 |
def setUp(self): |
|
95 |
super(TestGitDirFormat, self).setUp() |
|
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
96 |
self.format = dir.LocalGitControlDirFormat() |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
97 |
|
98 |
def test_get_format_description(self): |
|
|
6964.2.3
by Jelmer Vernooij
Review comments. |
99 |
self.assertEqual("Local Git Repository", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
100 |
self.format.get_format_description()) |
|
0.200.69
by Jelmer Vernooij
Implement GitBzrDirFormat.get_format_description. |
101 |
|
|
0.200.977
by Jelmer Vernooij
Implement GitBzrDirFormat.__eq__. |
102 |
def test_eq(self): |
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
103 |
format2 = dir.LocalGitControlDirFormat() |
|
6964.2.3
by Jelmer Vernooij
Review comments. |
104 |
self.assertEqual(self.format, format2) |
105 |
self.assertEqual(self.format, self.format) |
|
|
0.200.1648
by Jelmer Vernooij
Fix compatibility with newer versions of breezy. |
106 |
bzr_format = controldir.format_registry.make_controldir("default") |
|
6939.3.7
by Jelmer Vernooij
Don't use deprecated assertNotEquals. |
107 |
self.assertNotEqual(self.format, bzr_format) |