GitPython 3.1.48__tar.gz → 3.1.50__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitpython-3.1.48 → gitpython-3.1.50/GitPython.egg-info}/PKG-INFO +1 -1
- {gitpython-3.1.48/GitPython.egg-info → gitpython-3.1.50}/PKG-INFO +1 -1
- gitpython-3.1.50/VERSION +1 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/changes.rst +19 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/__init__.py +1 -1
- {gitpython-3.1.48 → gitpython-3.1.50}/git/config.py +37 -2
- {gitpython-3.1.48 → gitpython-3.1.50}/git/repo/base.py +22 -0
- gitpython-3.1.50/git/repo/fun.py +736 -0
- gitpython-3.1.48/VERSION +0 -1
- gitpython-3.1.48/git/repo/fun.py +0 -425
- {gitpython-3.1.48 → gitpython-3.1.50}/AUTHORS +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/CHANGES +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/CONTRIBUTING.md +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/GitPython.egg-info/SOURCES.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/GitPython.egg-info/dependency_links.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/GitPython.egg-info/not-zip-safe +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/GitPython.egg-info/requires.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/GitPython.egg-info/top_level.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/LICENSE +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/MANIFEST.in +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/README.md +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/.gitignore +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/Makefile +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/requirements.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/conf.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/index.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/intro.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/quickstart.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/reference.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/roadmap.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/doc/source/tutorial.rst +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/cmd.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/compat.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/db.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/diff.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/exc.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/index/__init__.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/index/base.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/index/fun.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/index/typ.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/index/util.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/__init__.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/base.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/blob.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/commit.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/fun.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/submodule/__init__.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/submodule/base.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/submodule/root.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/submodule/util.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/tag.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/tree.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/objects/util.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/py.typed +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/__init__.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/head.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/log.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/reference.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/remote.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/symbolic.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/refs/tag.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/remote.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/repo/__init__.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/types.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/git/util.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/pyproject.toml +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/requirements.txt +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/setup.cfg +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/setup.py +0 -0
- {gitpython-3.1.48 → gitpython-3.1.50}/test-requirements.txt +0 -0
gitpython-3.1.50/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.1.50
|
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
3.1.50
|
|
6
|
+
======
|
|
7
|
+
|
|
8
|
+
Save setting of configuration values, this time sections as well, as follow-up to 3.1.49.
|
|
9
|
+
|
|
10
|
+
See the following for all changes.
|
|
11
|
+
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.50
|
|
12
|
+
|
|
13
|
+
3.1.49
|
|
14
|
+
======
|
|
15
|
+
|
|
16
|
+
Save setting of configuration values,
|
|
17
|
+
which could be used to inject other more configuration.
|
|
18
|
+
|
|
19
|
+
Also more conforming `rev-parse` implementation.
|
|
20
|
+
|
|
21
|
+
See the following for all changes.
|
|
22
|
+
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.49
|
|
23
|
+
|
|
5
24
|
3.1.48
|
|
6
25
|
======
|
|
7
26
|
|
|
@@ -72,6 +72,9 @@ CONDITIONAL_INCLUDE_REGEXP = re.compile(r"(?<=includeIf )\"(gitdir|gitdir/i|onbr
|
|
|
72
72
|
See: https://git-scm.com/docs/git-config#_conditional_includes
|
|
73
73
|
"""
|
|
74
74
|
|
|
75
|
+
UNSAFE_CONFIG_CHARS_RE = re.compile(r"[\r\n\x00]")
|
|
76
|
+
"""Characters that cannot be safely written in config names or values."""
|
|
77
|
+
|
|
75
78
|
|
|
76
79
|
class MetaParserBuilder(abc.ABCMeta): # noqa: B024
|
|
77
80
|
"""Utility class wrapping base-class methods into decorators that assure read-only
|
|
@@ -778,6 +781,7 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
|
|
|
778
781
|
|
|
779
782
|
def add_section(self, section: "cp._SectionName") -> None:
|
|
780
783
|
"""Assures added options will stay in order."""
|
|
784
|
+
self._assure_config_name_safe(section, "section")
|
|
781
785
|
return super().add_section(section)
|
|
782
786
|
|
|
783
787
|
@property
|
|
@@ -882,6 +886,30 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
|
|
|
882
886
|
return str(value)
|
|
883
887
|
return force_text(value)
|
|
884
888
|
|
|
889
|
+
def _value_to_string_safe(self, value: Union[str, bytes, int, float, bool]) -> str:
|
|
890
|
+
value_str = self._value_to_string(value)
|
|
891
|
+
if UNSAFE_CONFIG_CHARS_RE.search(value_str):
|
|
892
|
+
raise ValueError("Git config values must not contain CR, LF, or NUL")
|
|
893
|
+
return value_str
|
|
894
|
+
|
|
895
|
+
def _assure_config_name_safe(self, name: "cp._SectionName", label: str) -> None:
|
|
896
|
+
if isinstance(name, str) and UNSAFE_CONFIG_CHARS_RE.search(name):
|
|
897
|
+
raise ValueError("Git config %s names must not contain CR, LF, or NUL" % label)
|
|
898
|
+
|
|
899
|
+
@needs_values
|
|
900
|
+
@set_dirty_and_flush_changes
|
|
901
|
+
def set(
|
|
902
|
+
self,
|
|
903
|
+
section: str,
|
|
904
|
+
option: str,
|
|
905
|
+
value: Union[str, bytes, int, float, bool, None] = None,
|
|
906
|
+
) -> None:
|
|
907
|
+
self._assure_config_name_safe(section, "section")
|
|
908
|
+
self._assure_config_name_safe(option, "option")
|
|
909
|
+
if value is not None:
|
|
910
|
+
value = self._value_to_string_safe(value)
|
|
911
|
+
return super().set(section, option, value)
|
|
912
|
+
|
|
885
913
|
@needs_values
|
|
886
914
|
@set_dirty_and_flush_changes
|
|
887
915
|
def set_value(self, section: str, option: str, value: Union[str, bytes, int, float, bool]) -> "GitConfigParser":
|
|
@@ -902,9 +930,12 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
|
|
|
902
930
|
:return:
|
|
903
931
|
This instance
|
|
904
932
|
"""
|
|
933
|
+
self._assure_config_name_safe(section, "section")
|
|
934
|
+
self._assure_config_name_safe(option, "option")
|
|
935
|
+
value_str = self._value_to_string_safe(value)
|
|
905
936
|
if not self.has_section(section):
|
|
906
937
|
self.add_section(section)
|
|
907
|
-
|
|
938
|
+
super().set(section, option, value_str)
|
|
908
939
|
return self
|
|
909
940
|
|
|
910
941
|
@needs_values
|
|
@@ -929,9 +960,12 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
|
|
|
929
960
|
:return:
|
|
930
961
|
This instance
|
|
931
962
|
"""
|
|
963
|
+
self._assure_config_name_safe(section, "section")
|
|
964
|
+
self._assure_config_name_safe(option, "option")
|
|
965
|
+
value_str = self._value_to_string_safe(value)
|
|
932
966
|
if not self.has_section(section):
|
|
933
967
|
self.add_section(section)
|
|
934
|
-
self._sections[section].add(option,
|
|
968
|
+
self._sections[section].add(option, value_str)
|
|
935
969
|
return self
|
|
936
970
|
|
|
937
971
|
def rename_section(self, section: str, new_name: str) -> "GitConfigParser":
|
|
@@ -948,6 +982,7 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
|
|
|
948
982
|
"""
|
|
949
983
|
if not self.has_section(section):
|
|
950
984
|
raise ValueError("Source section '%s' doesn't exist" % section)
|
|
985
|
+
self._assure_config_name_safe(new_name, "section")
|
|
951
986
|
if self.has_section(new_name):
|
|
952
987
|
raise ValueError("Destination section '%s' already exists" % new_name)
|
|
953
988
|
|
|
@@ -242,6 +242,28 @@ class Repo:
|
|
|
242
242
|
# It's important to normalize the paths, as submodules will otherwise
|
|
243
243
|
# initialize their repo instances with paths that depend on path-portions
|
|
244
244
|
# that will not exist after being removed. It's just cleaner.
|
|
245
|
+
if (
|
|
246
|
+
osp.isfile(osp.join(curpath, "gitdir"))
|
|
247
|
+
and osp.isfile(osp.join(curpath, "commondir"))
|
|
248
|
+
and osp.isfile(osp.join(curpath, "HEAD"))
|
|
249
|
+
):
|
|
250
|
+
git_dir = curpath
|
|
251
|
+
|
|
252
|
+
if "GIT_WORK_TREE" in os.environ:
|
|
253
|
+
self._working_tree_dir = os.getenv("GIT_WORK_TREE")
|
|
254
|
+
else:
|
|
255
|
+
# Linked worktree administrative directories store the path to the
|
|
256
|
+
# worktree's .git file in their gitdir file (without "gitdir: " prefix).
|
|
257
|
+
with open(osp.join(git_dir, "gitdir")) as fp:
|
|
258
|
+
worktree_gitfile = fp.read().strip()
|
|
259
|
+
|
|
260
|
+
if not osp.isabs(worktree_gitfile):
|
|
261
|
+
worktree_gitfile = osp.normpath(osp.join(git_dir, worktree_gitfile))
|
|
262
|
+
|
|
263
|
+
self._working_tree_dir = osp.dirname(worktree_gitfile)
|
|
264
|
+
|
|
265
|
+
break
|
|
266
|
+
|
|
245
267
|
if is_git_dir(curpath):
|
|
246
268
|
git_dir = curpath
|
|
247
269
|
# from man git-config : core.worktree
|