| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3813bfb commit 63c62ed
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,7 +60,8 @@ | |||
| 60 | 60 | ||
| 61 | 61 | class UpdateProgress(RemoteProgress): | |
| 62 | 62 | """Class providing detailed progress information to the caller who should | |
| 63 | - derive from it and implement the ``update(...)`` message.""" | ||
| 63 | + derive from it and implement the | ||
| 64 | + :meth:`update(...) <git.util.RemoteProgress.update>` message.""" | ||
| 64 | 65 | ||
| 65 | 66 | CLONE, FETCH, UPDWKTREE = [1 << x for x in range(RemoteProgress._num_op_codes, RemoteProgress._num_op_codes + 3)] | |
| 66 | 67 | _num_op_codes: int = RemoteProgress._num_op_codes + 3 | |
@@ -76,8 +77,8 @@ class UpdateProgress(RemoteProgress): | |||
| 76 | 77 | ||
| 77 | 78 | ||
| 78 | 79 | # IndexObject comes via the util module. It's a 'hacky' fix thanks to Python's import | |
| 79 | - # mechanism, which causes plenty of trouble if the only reason for packages and | ||
| 80 | - # modules is refactoring - subpackages shouldn't depend on parent packages. | ||
| 80 | + # mechanism, which causes plenty of trouble if the only reason for packages and modules | ||
| 81 | + # is refactoring - subpackages shouldn't depend on parent packages. | ||
| 81 | 82 | class Submodule(IndexObject, TraversableIterableObj): | |
| 82 | 83 | """Implements access to a git submodule. They are special in that their sha | |
| 83 | 84 | represents a commit in the submodule's repository which is to be checked out | |
@@ -119,11 +120,19 @@ def __init__( | |||
| 119 | 120 | We only document the parameters that differ from | |
| 120 | 121 | :class:`~git.objects.base.IndexObject`. | |
| 121 | 122 | ||
| 122 | - :param repo: Our parent repository. | ||
| 123 | - :param binsha: Binary sha referring to a commit in the remote repository. See | ||
| 124 | - the ``url`` parameter. | ||
| 125 | - :param parent_commit: See :meth:`set_parent_commit`. | ||
| 126 | - :param url: The URL to the remote repository which is the submodule. | ||
| 123 | + :param repo: | ||
| 124 | + Our parent repository. | ||
| 125 | + | ||
| 126 | + :param binsha: | ||
| 127 | + Binary sha referring to a commit in the remote repository. | ||
| 128 | + See the `url` parameter. | ||
| 129 | + | ||
| 130 | + :param parent_commit: | ||
| 131 | + See :meth:`set_parent_commit`. | ||
| 132 | + | ||
| 133 | + :param url: | ||
| 134 | + The URL to the remote repository which is the submodule. | ||
| 135 | + | ||
| 127 | 136 | :param branch_path: Complete relative path to ref to checkout when cloning the | |
| 128 | 137 | remote repository. | |
| 129 | 138 | """ | |
@@ -1313,9 +1322,11 @@ def exists(self) -> bool: | |||
| 1313 | 1322 | @property | |
| 1314 | 1323 | def branch(self) -> "Head": | |
| 1315 | 1324 | """ | |
| 1316 | - :return: The branch instance that we are to checkout | ||
| 1325 | + :return: | ||
| 1326 | + The branch instance that we are to checkout | ||
| 1317 | 1327 | ||
| 1318 | - :raise InvalidGitRepositoryError: If our module is not yet checked out | ||
| 1328 | + :raise InvalidGitRepositoryError: | ||
| 1329 | + If our module is not yet checked out. | ||
| 1319 | 1330 | """ | |
| 1320 | 1331 | return mkhead(self.module(), self._branch_path) | |
| 1321 | 1332 | ||
@@ -1329,7 +1340,10 @@ def branch_path(self) -> PathLike: | |||
| 1329 | 1340 | ||
| 1330 | 1341 | @property | |
| 1331 | 1342 | def branch_name(self) -> str: | |
| 1332 | - """:return: The name of the branch, which is the shortest possible branch name""" | ||
| 1343 | + """ | ||
| 1344 | + :return: | ||
| 1345 | + The name of the branch, which is the shortest possible branch name | ||
| 1346 | + """ | ||
| 1333 | 1347 | # Use an instance method, for this we create a temporary Head instance | |
| 1334 | 1348 | # which uses a repository that is available at least (it makes no difference). | |
| 1335 | 1349 | return git.Head(self.repo, self._branch_path).name | |
@@ -1342,9 +1356,11 @@ def url(self) -> str: | |||
| 1342 | 1356 | @property | |
| 1343 | 1357 | def parent_commit(self) -> "Commit_ish": | |
| 1344 | 1358 | """ | |
| 1345 | - :return: Commit instance with the tree containing the .gitmodules file | ||
| 1359 | + :return: | ||
| 1360 | + Commit instance with the tree containing the ``.gitmodules`` file | ||
| 1346 | 1361 | ||
| 1347 | - :note: Will always point to the current head's commit if it was not set explicitly. | ||
| 1362 | + :note: | ||
| 1363 | + Will always point to the current head's commit if it was not set explicitly. | ||
| 1348 | 1364 | """ | |
| 1349 | 1365 | if self._parent_commit is None: | |
| 1350 | 1366 | return self.repo.commit() | |
@@ -1353,33 +1369,40 @@ def parent_commit(self) -> "Commit_ish": | |||
| 1353 | 1369 | @property | |
| 1354 | 1370 | def name(self) -> str: | |
| 1355 | 1371 | """ | |
| 1356 | - :return: The name of this submodule. It is used to identify it within the | ||
| 1357 | - .gitmodules file. | ||
| 1372 | + :return: | ||
| 1373 | + The name of this submodule. It is used to identify it within the | ||
| 1374 | + ``.gitmodules`` file. | ||
| 1358 | 1375 | ||
| 1359 | - :note: By default, this is the name is the path at which to find the submodule, | ||
| 1360 | - but in GitPython it should be a unique identifier similar to the identifiers | ||
| 1376 | + :note: | ||
| 1377 | + By default, this is the name is the path at which to find the submodule, but | ||
| 1378 | + in GitPython it should be a unique identifier similar to the identifiers | ||
| 1361 | 1379 | used for remotes, which allows to change the path of the submodule easily. | |
| 1362 | 1380 | """ | |
| 1363 | 1381 | return self._name | |
| 1364 | 1382 | ||
| 1365 | 1383 | def config_reader(self) -> SectionConstraint[SubmoduleConfigParser]: | |
| 1366 | 1384 | """ | |
| 1367 | - :return: ConfigReader instance which allows you to query the configuration | ||
| 1368 | - values of this submodule, as provided by the .gitmodules file. | ||
| 1385 | + :return: | ||
| 1386 | + ConfigReader instance which allows you to query the configuration values of | ||
| 1387 | + this submodule, as provided by the ``.gitmodules`` file. | ||
| 1369 | 1388 | ||
| 1370 | - :note: The config reader will actually read the data directly from the | ||
| 1371 | - repository and thus does not need nor care about your working tree. | ||
| 1389 | + :note: | ||
| 1390 | + The config reader will actually read the data directly from the repository | ||
| 1391 | + and thus does not need nor care about your working tree. | ||
| 1372 | 1392 | ||
| 1373 | - :note: Should be cached by the caller and only kept as long as needed. | ||
| 1393 | + :note: | ||
| 1394 | + Should be cached by the caller and only kept as long as needed. | ||
| 1374 | 1395 | ||
| 1375 | - :raise IOError: If the .gitmodules file/blob could not be read. | ||
| 1396 | + :raise IOError: | ||
| 1397 | + If the ``.gitmodules`` file/blob could not be read. | ||
| 1376 | 1398 | """ | |
| 1377 | 1399 | return self._config_parser_constrained(read_only=True) | |
| 1378 | 1400 | ||
| 1379 | 1401 | def children(self) -> IterableList["Submodule"]: | |
| 1380 | 1402 | """ | |
| 1381 | - :return: IterableList(Submodule, ...) an iterable list of submodules instances | ||
| 1382 | - which are children of this submodule or 0 if the submodule is not checked out. | ||
| 1403 | + :return: | ||
| 1404 | + IterableList(Submodule, ...) An iterable list of submodules instances which | ||
| 1405 | + are children of this submodule or 0 if the submodule is not checked out. | ||
| 1383 | 1406 | """ | |
| 1384 | 1407 | return self._get_intermediate_items(self) | |
| 1385 | 1408 | ||
@@ -1395,7 +1418,10 @@ def iter_items( | |||
| 1395 | 1418 | *Args: Any, | |
| 1396 | 1419 | **kwargs: Any, | |
| 1397 | 1420 | ) -> Iterator["Submodule"]: | |
| 1398 | - """:return: Iterator yielding Submodule instances available in the given repository""" | ||
| 1421 | + """ | ||
| 1422 | + :return: | ||
| 1423 | + Iterator yielding Submodule instances available in the given repository | ||
| 1424 | + """ | ||
| 1399 | 1425 | try: | |
| 1400 | 1426 | pc = repo.commit(parent_commit) # Parent commit instance | |
| 1401 | 1427 | parser = cls._config_parser(repo, pc, read_only=True) | |
@@ -1423,8 +1449,8 @@ def iter_items( | |||
| 1423 | 1449 | entry = index.entries[index.entry_key(p, 0)] | |
| 1424 | 1450 | sm = Submodule(repo, entry.binsha, entry.mode, entry.path) | |
| 1425 | 1451 | except KeyError: | |
| 1426 | - # The submodule doesn't exist, probably it wasn't | ||
| 1427 | - # removed from the .gitmodules file. | ||
| 1452 | + # The submodule doesn't exist, probably it wasn't removed from the | ||
| 1453 | + # .gitmodules file. | ||
| 1428 | 1454 | continue | |
| 1429 | 1455 | # END handle keyerror | |
| 1430 | 1456 | # END handle critical error | |
| Back | FazBrowse Home | New Git URL |
0 commit comments