(testrepo: Repository)
| 134 | |
| 135 | |
| 136 | def test_refspec(testrepo: Repository) -> None: |
| 137 | remote = testrepo.remotes['origin'] |
| 138 | |
| 139 | assert remote.refspec_count == 1 |
| 140 | refspec = remote.get_refspec(0) |
| 141 | assert refspec.src == REMOTE_FETCHSPEC_SRC |
| 142 | assert refspec.dst == REMOTE_FETCHSPEC_DST |
| 143 | assert refspec.force is True |
| 144 | assert ORIGIN_REFSPEC == refspec.string |
| 145 | |
| 146 | assert list is type(remote.fetch_refspecs) |
| 147 | assert 1 == len(remote.fetch_refspecs) |
| 148 | assert ORIGIN_REFSPEC == remote.fetch_refspecs[0] |
| 149 | |
| 150 | assert refspec.src_matches('refs/heads/master') |
| 151 | assert refspec.dst_matches('refs/remotes/origin/master') |
| 152 | assert 'refs/remotes/origin/master' == refspec.transform('refs/heads/master') |
| 153 | assert 'refs/heads/master' == refspec.rtransform('refs/remotes/origin/master') |
| 154 | |
| 155 | assert list is type(remote.push_refspecs) |
| 156 | assert 0 == len(remote.push_refspecs) |
| 157 | |
| 158 | push_specs = remote.push_refspecs |
| 159 | assert list is type(push_specs) |
| 160 | assert 0 == len(push_specs) |
| 161 | |
| 162 | testrepo.remotes.add_fetch('origin', '+refs/test/*:refs/test/remotes/*') |
| 163 | remote = testrepo.remotes['origin'] |
| 164 | |
| 165 | fetch_specs = remote.fetch_refspecs |
| 166 | assert list is type(fetch_specs) |
| 167 | assert 2 == len(fetch_specs) |
| 168 | assert [ |
| 169 | '+refs/heads/*:refs/remotes/origin/*', |
| 170 | '+refs/test/*:refs/test/remotes/*', |
| 171 | ] == fetch_specs |
| 172 | |
| 173 | testrepo.remotes.add_push('origin', '+refs/test/*:refs/test/remotes/*') |
| 174 | |
| 175 | with pytest.raises(TypeError): |
| 176 | testrepo.remotes.add_fetch(['+refs/*:refs/*', 5]) # type: ignore |
| 177 | |
| 178 | remote = testrepo.remotes['origin'] |
| 179 | assert ['+refs/test/*:refs/test/remotes/*'] == remote.push_refspecs |
| 180 | |
| 181 | |
| 182 | def test_remote_list(testrepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…