43
43
def extract_status (value ):
44
44
"""Returns ``git status -sb --porcelain=2`` extracted to a dict
45
45
46
- :returns: Dictionary of git repo's status
47
- :rtype: dict
46
+ Returns
47
+ -------
48
+ dict :
49
+ Dictionary of git repo's status
48
50
"""
49
51
pattern = re .compile (
50
52
r"""[\n\r]?
@@ -360,7 +362,9 @@ def remotes(self, flat=False):
360
362
This used to return a dict of tuples, it now returns a dict of dictionaries
361
363
with ``name``, ``fetch_url``, and ``push_url``.
362
364
363
- :rtype: dict
365
+ Returns
366
+ -------
367
+ dict
364
368
"""
365
369
remotes = {}
366
370
@@ -393,10 +397,15 @@ def remotes_get(self):
393
397
def remote (self , name , ** kwargs ):
394
398
"""Get the fetch and push URL for a specified remote name.
395
399
396
- :param name: the remote name used to define the fetch and push URL
397
- :type name: str
398
- :returns: remote name and url in tuple form
399
- :rtype: :class:`libvcs.git.GitRemote`
400
+ Parameters
401
+ ----------
402
+ name : str
403
+ The remote name used to define the fetch and push URL
404
+
405
+ Returns
406
+ -------
407
+ :class:`libvcs.git.GitRemote` :
408
+ Remote name and url in tuple form
400
409
401
410
.. versionchanged:: 0.4.0
402
411
@@ -482,11 +491,15 @@ def remote_set(self, url, name='origin', overwrite=False, **kwargs):
482
491
def chomp_protocol (url ):
483
492
"""Return clean VCS url from RFC-style url
484
493
485
- :param url: url
486
- :type url: str
487
- :rtype: str
488
- :returns: url as VCS software would accept it
489
- :seealso: #14
494
+ Parameters
495
+ ----------
496
+ url : str
497
+ PIP-style url
498
+
499
+ Returns
500
+ -------
501
+ str :
502
+ URL as VCS software would accept it
490
503
"""
491
504
if '+' in url :
492
505
url = url .split ('+' , 1 )[1 ]
@@ -506,7 +519,9 @@ def chomp_protocol(url):
506
519
def get_git_version (self ):
507
520
"""Return current version of git binary
508
521
509
- :rtype: str
522
+ Returns
523
+ -------
524
+ str
510
525
"""
511
526
VERSION_PFX = 'git version '
512
527
version = self .run (['version' ])
@@ -521,7 +536,10 @@ def status(self):
521
536
522
537
Wraps ``git status --sb --porcelain=2``. Does not include changed files, yet.
523
538
524
- .. code-block:: python
539
+ Examples
540
+ --------
541
+
542
+ ::
525
543
526
544
print(git_repo.status())
527
545
{
@@ -533,15 +551,21 @@ def status(self):
533
551
"branch_behind": '0',
534
552
}
535
553
536
- :returns: Status of current checked out repository
537
- :rtype: dict
554
+ Returns
555
+ -------
556
+ dict :
557
+ Status of current checked out repository
538
558
"""
539
559
return extract_status (self .run (['status' , '-sb' , '--porcelain=2' ]))
540
560
541
561
def get_current_remote_name (self ):
542
562
"""Retrieve name of the remote / upstream of currently checked out branch.
543
563
544
- :rtype: str, None if no remote set
564
+ Returns
565
+ -------
566
+ str :
567
+ If upstream the same, returns ``branch_name``.
568
+ If upstream mismatches, returns ``remote_name/branch_name``.
545
569
"""
546
570
match = self .status ()
547
571
0 commit comments