Skip to content

Commit 6cef9c0

Browse files
authored
Merge pull request gitpython-developers#1725 from EliahKagan/strings
Revise comments, docstrings, some messages, and a bit of code
2 parents 198548f + b970d42 commit 6cef9c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3521
-3063
lines changed

Diff for: doc/source/conf.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# GitPython documentation build configuration file, created by
1+
# GitPython documentation build configuration file, originally created by
42
# sphinx-quickstart on Sat Jan 24 11:51:01 2009.
53
#
64
# This file is execfile()d with the current directory set to its containing dir.
@@ -170,7 +168,7 @@
170168
# Grouping the document tree into LaTeX files. List of tuples
171169
# (source start file, target name, title, author, document class [howto/manual]).
172170
latex_documents = [
173-
("index", "GitPython.tex", r"GitPython Documentation", r"Michael Trier", "manual"),
171+
("index", "GitPython.tex", "GitPython Documentation", "Michael Trier", "manual"),
174172
]
175173

176174
# The name of an image file (relative to this directory) to place at the top of

Diff for: doc/source/tutorial.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ If you obtained your submodule object by traversing a tree object which is not r
413413
you have to inform the submodule about its actual commit to retrieve the data from
414414
by using the ``set_parent_commit(...)`` method.
415415

416-
The special :class:`RootModule <git.objects.submodule.root.RootModule>` type allows you to treat your master repository as root of a hierarchy of submodules, which allows very convenient submodule handling. Its ``update(...)`` method is reimplemented to provide an advanced way of updating submodules as they change their values over time. The update method will track changes and make sure your working tree and submodule checkouts stay consistent, which is very useful in case submodules get deleted or added to name just two of the handled cases.
416+
The special :class:`RootModule <git.objects.submodule.root.RootModule>` type allows you to treat your superproject (master repository) as root of a hierarchy of submodules, which allows very convenient submodule handling. Its ``update(...)`` method is reimplemented to provide an advanced way of updating submodules as they change their values over time. The update method will track changes and make sure your working tree and submodule checkouts stay consistent, which is very useful in case submodules get deleted or added to name just two of the handled cases.
417417

418418
Additionally, GitPython adds functionality to track a specific branch, instead of just a commit. Supported by customized update methods, you are able to automatically update submodules to the latest revision available in the remote repository, as well as to keep track of changes and movements of these submodules. To use it, set the name of the branch you want to track to the ``submodule.$name.branch`` option of the *.gitmodules* file, and use GitPython update methods on the resulting repository with the ``to_latest_revision`` parameter turned on. In the latter case, the sha of your submodule will be ignored, instead a local tracking branch will be updated to the respective remote branch automatically, provided there are no local changes. The resulting behaviour is much like the one of svn::externals, which can be useful in times.
419419

@@ -545,4 +545,3 @@ And even more ...
545545
There is more functionality in there, like the ability to archive repositories, get stats and logs, blame, and probably a few other things that were not mentioned here.
546546

547547
Check the unit tests for an in-depth introduction on how each function is supposed to be used.
548-

Diff for: git/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: https://opensource.org/license/bsd-3-clause/
6+
67
# flake8: noqa
78
# @PydevCodeAnalysisIgnore
9+
810
from git.exc import * # @NoMove @IgnorePep8
911
from typing import List, Optional, Sequence, Tuple, Union, TYPE_CHECKING
1012
from git.types import PathLike

Diff for: git/cmd.py

+192-181
Large diffs are not rendered by default.

Diff for: git/compat.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# -*- coding: utf-8 -*-
2-
# config.py
1+
# compat.py
32
# Copyright (C) 2008, 2009 Michael Trier ([email protected]) and contributors
43
#
54
# This module is part of GitPython and is released under
65
# the BSD License: https://opensource.org/license/bsd-3-clause/
7-
"""utilities to help provide compatibility with python 3"""
6+
7+
"""Utilities to help provide compatibility with Python 3."""
8+
89
# flake8: noqa
910

1011
import locale
@@ -50,7 +51,7 @@ def safe_decode(s: AnyStr) -> str:
5051

5152

5253
def safe_decode(s: Union[AnyStr, None]) -> Optional[str]:
53-
"""Safely decodes a binary string to unicode"""
54+
"""Safely decode a binary string to Unicode."""
5455
if isinstance(s, str):
5556
return s
5657
elif isinstance(s, bytes):
@@ -72,7 +73,7 @@ def safe_encode(s: AnyStr) -> bytes:
7273

7374

7475
def safe_encode(s: Optional[AnyStr]) -> Optional[bytes]:
75-
"""Safely encodes a binary string to unicode"""
76+
"""Safely encode a binary string to Unicode."""
7677
if isinstance(s, str):
7778
return s.encode(defenc)
7879
elif isinstance(s, bytes):
@@ -94,7 +95,7 @@ def win_encode(s: AnyStr) -> bytes:
9495

9596

9697
def win_encode(s: Optional[AnyStr]) -> Optional[bytes]:
97-
"""Encode unicodes for process arguments on Windows."""
98+
"""Encode Unicode strings for process arguments on Windows."""
9899
if isinstance(s, str):
99100
return s.encode(locale.getpreferredencoding(False))
100101
elif isinstance(s, bytes):

0 commit comments

Comments
 (0)