Show More
@@ -1,4 +1,3 b'' | |||
|
1 | ||
|
2 | 1 |
|
|
3 | 2 | # |
|
4 | 3 | # This program is free software: you can redistribute it and/or modify |
@@ -27,16 +26,15 b' from rhodecode.tests.vcs.conftest import' | |||
|
27 | 26 | |
|
28 | 27 | @pytest.mark.usefixtures("vcs_repository_support") |
|
29 | 28 | class TestBranches(BackendTestMixin): |
|
30 | ||
|
31 | 29 | def test_empty_repository_has_no_branches(self, vcsbackend): |
|
32 | 30 | empty_repo = vcsbackend.create_repo() |
|
33 | 31 | assert empty_repo.branches == {} |
|
34 | 32 | |
|
35 | 33 | def test_branches_all(self, vcsbackend): |
|
36 | 34 | branch_count = { |
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
35 | "git": 1, | |
|
36 | "hg": 1, | |
|
37 | "svn": 0, | |
|
40 | 38 | } |
|
41 | 39 | assert len(self.repo.branches_all) == branch_count[vcsbackend.alias] |
|
42 | 40 | |
@@ -45,82 +43,79 b' class TestBranches(BackendTestMixin):' | |||
|
45 | 43 | |
|
46 | 44 | def test_simple(self, local_dt_to_utc): |
|
47 | 45 | tip = self.repo.get_commit() |
|
48 |
assert tip.message == |
|
|
46 | assert tip.message == "Changes..." | |
|
49 | 47 | assert tip.date == local_dt_to_utc(datetime.datetime(2010, 1, 1, 21)) |
|
50 | 48 | |
|
51 | 49 | @pytest.mark.backends("git", "hg") |
|
52 | 50 | def test_new_branch(self): |
|
53 | 51 | # This check must not be removed to ensure the 'branches' LazyProperty |
|
54 | 52 | # gets hit *before* the new 'foobar' branch got created: |
|
55 |
assert |
|
|
56 | self.imc.add( | |
|
57 | FileNode(b'docs/index.txt', content=b'Documentation\n') | |
|
58 | ) | |
|
53 | assert "foobar" not in self.repo.branches | |
|
54 | self.imc.add(FileNode(b"docs/index.txt", content=b"Documentation\n")) | |
|
59 | 55 | foobar_tip = self.imc.commit( |
|
60 |
message= |
|
|
61 |
author= |
|
|
62 |
branch= |
|
|
56 | message="New branch: foobar", | |
|
57 | author="joe <joe@rhodecode.com>", | |
|
58 | branch="foobar", | |
|
63 | 59 | ) |
|
64 |
assert |
|
|
65 |
assert foobar_tip.branch == |
|
|
60 | assert "foobar" in self.repo.branches | |
|
61 | assert foobar_tip.branch == "foobar" | |
|
66 | 62 | |
|
67 | 63 | @pytest.mark.backends("git", "hg") |
|
68 | 64 | def test_new_head(self): |
|
69 | 65 | tip = self.repo.get_commit() |
|
66 | ||
|
70 | 67 | self.imc.add( |
|
71 |
FileNode(b |
|
|
72 | content=b'Documentation\n') | |
|
68 | FileNode(b"docs/index.txt", content=b"Documentation\n") | |
|
73 | 69 | ) |
|
74 | 70 | foobar_tip = self.imc.commit( |
|
75 |
message= |
|
|
76 |
author= |
|
|
77 |
branch= |
|
|
71 | message="New branch: foobar", | |
|
72 | author="joe <joe@rhodecode.com>", | |
|
73 | branch="foobar", | |
|
78 | 74 | parents=[tip], |
|
79 | 75 | ) |
|
80 |
self.imc.change( |
|
|
81 | b'docs/index.txt', | |
|
82 | content=b'Documentation\nand more...\n')) | |
|
76 | self.imc.change( | |
|
77 | FileNode(b"docs/index.txt", content=b"Documentation\nand more...\n") | |
|
78 | ) | |
|
79 | assert foobar_tip.branch == "foobar" | |
|
83 | 80 | newtip = self.imc.commit( |
|
84 |
message= |
|
|
85 |
author= |
|
|
81 | message="At foobar_tip branch", | |
|
82 | author="joe <joe@rhodecode.com>", | |
|
86 | 83 | branch=foobar_tip.branch, |
|
87 | 84 | parents=[foobar_tip], |
|
88 | 85 | ) |
|
89 | 86 | |
|
90 | 87 | newest_tip = self.imc.commit( |
|
91 |
message= |
|
|
92 |
author= |
|
|
88 | message=f"Merged with {foobar_tip.raw_id}", | |
|
89 | author="joe <joe@rhodecode.com>", | |
|
93 | 90 | branch=self.backend_class.DEFAULT_BRANCH_NAME, |
|
94 |
parents=[ |
|
|
91 | parents=[tip, newtip], | |
|
95 | 92 | ) |
|
96 | 93 | |
|
97 |
assert newest_tip.branch == |
|
|
98 | self.backend_class.DEFAULT_BRANCH_NAME | |
|
94 | assert newest_tip.branch == self.backend_class.DEFAULT_BRANCH_NAME | |
|
99 | 95 | |
|
100 | 96 | @pytest.mark.backends("git", "hg") |
|
101 | 97 | def test_branch_with_slash_in_name(self): |
|
102 |
self.imc.add(FileNode(b |
|
|
98 | self.imc.add(FileNode(b"extrafile", content=b"Some data\n")) | |
|
103 | 99 | self.imc.commit( |
|
104 |
|
|
|
105 | branch='issue/123') | |
|
106 |
assert |
|
|
100 | "Branch with a slash!", author="joe <joe@rhodecode.com>", branch="issue/123" | |
|
101 | ) | |
|
102 | assert "issue/123" in self.repo.branches | |
|
107 | 103 | |
|
108 | 104 | @pytest.mark.backends("git", "hg") |
|
109 | 105 | def test_branch_with_slash_in_name_and_similar_without(self): |
|
110 |
self.imc.add(FileNode(b |
|
|
106 | self.imc.add(FileNode(b"extrafile", content=b"Some data\n")) | |
|
111 | 107 | self.imc.commit( |
|
112 |
|
|
|
113 | branch='issue/123') | |
|
114 |
self.imc.add(FileNode(b |
|
|
108 | "Branch with a slash!", author="joe <joe@rhodecode.com>", branch="issue/123" | |
|
109 | ) | |
|
110 | self.imc.add(FileNode(b"extrafile II", content=b"Some data\n")) | |
|
115 | 111 | self.imc.commit( |
|
116 |
|
|
|
117 | branch='123') | |
|
118 |
assert |
|
|
119 |
assert |
|
|
112 | "Branch without a slash...", author="joe <joe@rhodecode.com>", branch="123" | |
|
113 | ) | |
|
114 | assert "issue/123" in self.repo.branches | |
|
115 | assert "123" in self.repo.branches | |
|
120 | 116 | |
|
121 | 117 | |
|
122 | 118 | class TestSvnBranches(object): |
|
123 | ||
|
124 | 119 | def test_empty_repository_has_no_tags_and_branches(self, vcsbackend_svn): |
|
125 | 120 | empty_repo = vcsbackend_svn.create_repo() |
|
126 | 121 | assert empty_repo.branches == {} |
@@ -132,16 +127,15 b' class TestSvnBranches(object):' | |||
|
132 | 127 | assert repo.tags == {} |
|
133 | 128 | |
|
134 | 129 | def test_discovers_ordered_branches(self, vcsbackend_svn): |
|
135 |
repo = vcsbackend_svn[ |
|
|
130 | repo = vcsbackend_svn["svn-simple-layout"] | |
|
136 | 131 | expected_branches = [ |
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
132 | "branches/add-docs", | |
|
133 | "branches/argparse", | |
|
134 | "trunk", | |
|
140 | 135 | ] |
|
141 | 136 | assert list(repo.branches.keys()) == expected_branches |
|
142 | 137 | |
|
143 | 138 | def test_discovers_ordered_tags(self, vcsbackend_svn): |
|
144 |
repo = vcsbackend_svn[ |
|
|
145 | expected_tags = [ | |
|
146 | 'tags/v0.1', 'tags/v0.2', 'tags/v0.3', 'tags/v0.5'] | |
|
139 | repo = vcsbackend_svn["svn-simple-layout"] | |
|
140 | expected_tags = ["tags/v0.1", "tags/v0.2", "tags/v0.3", "tags/v0.5"] | |
|
147 | 141 | assert list(repo.tags.keys()) == expected_tags |
General Comments 0
You need to be logged in to leave comments.
Login now