1+ """Run hg commands directly against a local git repo."""
12import datetime
23import pathlib
34import shlex
1112
1213
1314class Git :
15+ """Run commands directly on a git repository."""
16+
1417 progress_callback : Optional [ProgressCallbackProtocol ] = None
1518
1619 # Sub-commands
@@ -71,6 +74,7 @@ def __init__(
7174 self .stash = GitStashCmd (dir = self .dir , cmd = self )
7275
7376 def __repr__ (self ) -> str :
77+ """Representation of Git repo command object."""
7478 return f"<Git dir={ self .dir } >"
7579
7680 def run (
@@ -104,7 +108,8 @@ def run(
104108 log_in_real_time : bool = False ,
105109 ** kwargs : Any ,
106110 ) -> str :
107- """
111+ """Run a command for this git repository.
112+
108113 Passing None to a subcommand option, the flag won't be passed unless otherwise
109114 stated.
110115
@@ -1314,8 +1319,9 @@ def checkout(
13141319 check_returncode : Optional [bool ] = None ,
13151320 ** kwargs : Any ,
13161321 ) -> str :
1317- """Switches branches or checks out files. Wraps
1318- `git checkout <https://git-scm.com/docs/git-checkout>`_ (`git co`).
1322+ """Switch branches or checks out files.
1323+
1324+ Wraps `git checkout <https://git-scm.com/docs/git-checkout>`_ (`git co`).
13191325
13201326 Parameters
13211327 ----------
@@ -1438,8 +1444,9 @@ def status(
14381444 check_returncode : Optional [bool ] = None ,
14391445 ** kwargs : Any ,
14401446 ) -> str :
1441- """Status of working tree. Wraps
1442- `git status <https://git-scm.com/docs/git-status>`_.
1447+ """Return status of working tree.
1448+
1449+ Wraps `git status <https://git-scm.com/docs/git-status>`_.
14431450
14441451 `git ls-files` has similar params (e.g. `z`)
14451452
@@ -1587,7 +1594,6 @@ def config(
15871594 ) -> str :
15881595 """Get and set repo configuration.
15891596
1590- Status of working tree. Wraps
15911597 `git config <https://git-scm.com/docs/git-config>`_.
15921598
15931599 Parameters
@@ -2038,8 +2044,9 @@ def symbolic_ref(
20382044 check_returncode : Optional [bool ] = None ,
20392045 ** kwargs : Any ,
20402046 ) -> str :
2041- """symbolic-ref. Wraps `git symbolic-ref
2042- <https://git-scm.com/docs/symbolic-ref>`_.
2047+ """Return symbolic-ref.
2048+
2049+ Wraps `git symbolic-ref <https://git-scm.com/docs/symbolic-ref>`_.
20432050
20442051 Examples
20452052 --------
@@ -2162,6 +2169,8 @@ def show_ref(
21622169
21632170
21642171class GitSubmoduleCmd :
2172+ """Run submodule commands in a git repository."""
2173+
21652174 def __init__ (self , * , dir : StrPath , cmd : Optional [Git ] = None ) -> None :
21662175 """Lite, typed, pythonic wrapper for git-submodule(1).
21672176
@@ -2191,6 +2200,7 @@ def __init__(self, *, dir: StrPath, cmd: Optional[Git] = None) -> None:
21912200 self .cmd = cmd if isinstance (cmd , Git ) else Git (dir = self .dir )
21922201
21932202 def __repr__ (self ) -> str :
2203+ """Representation of a git submodule command object."""
21942204 return f"<GitSubmoduleCmd dir={ self .dir } >"
21952205
21962206 def run (
@@ -2205,7 +2215,9 @@ def run(
22052215 check_returncode : Optional [bool ] = None ,
22062216 ** kwargs : Any ,
22072217 ) -> str :
2208- """Wraps `git submodule <https://git-scm.com/docs/git-submodule>`_.
2218+ """Run a command against a git submodule.
2219+
2220+ Wraps `git submodule <https://git-scm.com/docs/git-submodule>`_.
22092221
22102222 Examples
22112223 --------
@@ -2339,6 +2351,8 @@ def update(
23392351
23402352
23412353class GitRemoteCmd :
2354+ """Run commands directly for a git remote on a git repository."""
2355+
23422356 def __init__ (self , * , dir : StrPath , cmd : Optional [Git ] = None ) -> None :
23432357 r"""Lite, typed, pythonic wrapper for git-remote(1).
23442358
@@ -2368,6 +2382,7 @@ def __init__(self, *, dir: StrPath, cmd: Optional[Git] = None) -> None:
23682382 self .cmd = cmd if isinstance (cmd , Git ) else Git (dir = self .dir )
23692383
23702384 def __repr__ (self ) -> str :
2385+ """Representation of a git remote for a git repository."""
23712386 return f"<GitRemoteCmd dir={ self .dir } >"
23722387
23732388 def run (
@@ -2381,7 +2396,9 @@ def run(
23812396 check_returncode : Optional [bool ] = None ,
23822397 ** kwargs : Any ,
23832398 ) -> str :
2384- r"""Wraps `git remote <https://git-scm.com/docs/git-remote>`_.
2399+ r"""Run command against a git remote.
2400+
2401+ Wraps `git remote <https://git-scm.com/docs/git-remote>`_.
23852402
23862403 Examples
23872404 --------
@@ -2695,6 +2712,8 @@ def set_url(
26952712
26962713
26972714class GitStashCmd :
2715+ """Run commands directly against a git stash storage for a git repo."""
2716+
26982717 def __init__ (self , * , dir : StrPath , cmd : Optional [Git ] = None ) -> None :
26992718 """Lite, typed, pythonic wrapper for git-stash(1).
27002719
@@ -2724,6 +2743,7 @@ def __init__(self, *, dir: StrPath, cmd: Optional[Git] = None) -> None:
27242743 self .cmd = cmd if isinstance (cmd , Git ) else Git (dir = self .dir )
27252744
27262745 def __repr__ (self ) -> str :
2746+ """Representation of git stash storage command object."""
27272747 return f"<GitStashCmd dir={ self .dir } >"
27282748
27292749 def run (
@@ -2738,7 +2758,9 @@ def run(
27382758 check_returncode : Optional [bool ] = None ,
27392759 ** kwargs : Any ,
27402760 ) -> str :
2741- """Wraps `git stash <https://git-scm.com/docs/git-stash>`_.
2761+ """Run a command against a git repository's stash storage.
2762+
2763+ Wraps `git stash <https://git-scm.com/docs/git-stash>`_.
27422764
27432765 Examples
27442766 --------
0 commit comments