GitPython 3.1.34__tar.gz → 3.1.36__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.
Files changed (70) hide show
  1. {GitPython-3.1.34 → GitPython-3.1.36}/AUTHORS +1 -0
  2. {GitPython-3.1.34 → GitPython-3.1.36}/GitPython.egg-info/PKG-INFO +92 -27
  3. GitPython-3.1.36/GitPython.egg-info/requires.txt +15 -0
  4. GitPython-3.1.34/README.md → GitPython-3.1.36/PKG-INFO +120 -26
  5. GitPython-3.1.34/PKG-INFO → GitPython-3.1.36/README.md +78 -55
  6. GitPython-3.1.36/VERSION +1 -0
  7. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/changes.rst +14 -0
  8. {GitPython-3.1.34 → GitPython-3.1.36}/git/__init__.py +2 -2
  9. {GitPython-3.1.34 → GitPython-3.1.36}/git/cmd.py +4 -5
  10. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/submodule/base.py +4 -0
  11. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/symbolic.py +2 -0
  12. {GitPython-3.1.34 → GitPython-3.1.36}/git/util.py +16 -1
  13. {GitPython-3.1.34 → GitPython-3.1.36}/pyproject.toml +1 -1
  14. {GitPython-3.1.34 → GitPython-3.1.36}/setup.py +7 -4
  15. {GitPython-3.1.34 → GitPython-3.1.36}/test-requirements.txt +3 -9
  16. GitPython-3.1.34/GitPython.egg-info/requires.txt +0 -4
  17. GitPython-3.1.34/VERSION +0 -1
  18. {GitPython-3.1.34 → GitPython-3.1.36}/CHANGES +0 -0
  19. {GitPython-3.1.34 → GitPython-3.1.36}/CONTRIBUTING.md +0 -0
  20. {GitPython-3.1.34 → GitPython-3.1.36}/GitPython.egg-info/SOURCES.txt +0 -0
  21. {GitPython-3.1.34 → GitPython-3.1.36}/GitPython.egg-info/dependency_links.txt +0 -0
  22. {GitPython-3.1.34 → GitPython-3.1.36}/GitPython.egg-info/not-zip-safe +0 -0
  23. {GitPython-3.1.34 → GitPython-3.1.36}/GitPython.egg-info/top_level.txt +0 -0
  24. {GitPython-3.1.34 → GitPython-3.1.36}/LICENSE +0 -0
  25. {GitPython-3.1.34 → GitPython-3.1.36}/MANIFEST.in +0 -0
  26. {GitPython-3.1.34 → GitPython-3.1.36}/doc/.gitignore +0 -0
  27. {GitPython-3.1.34 → GitPython-3.1.36}/doc/Makefile +0 -0
  28. {GitPython-3.1.34 → GitPython-3.1.36}/doc/requirements.txt +0 -0
  29. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/conf.py +0 -0
  30. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/index.rst +0 -0
  31. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/intro.rst +0 -0
  32. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/quickstart.rst +0 -0
  33. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/reference.rst +0 -0
  34. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/roadmap.rst +0 -0
  35. {GitPython-3.1.34 → GitPython-3.1.36}/doc/source/tutorial.rst +0 -0
  36. {GitPython-3.1.34 → GitPython-3.1.36}/git/compat.py +0 -0
  37. {GitPython-3.1.34 → GitPython-3.1.36}/git/config.py +0 -0
  38. {GitPython-3.1.34 → GitPython-3.1.36}/git/db.py +0 -0
  39. {GitPython-3.1.34 → GitPython-3.1.36}/git/diff.py +0 -0
  40. {GitPython-3.1.34 → GitPython-3.1.36}/git/exc.py +0 -0
  41. {GitPython-3.1.34 → GitPython-3.1.36}/git/index/__init__.py +0 -0
  42. {GitPython-3.1.34 → GitPython-3.1.36}/git/index/base.py +0 -0
  43. {GitPython-3.1.34 → GitPython-3.1.36}/git/index/fun.py +0 -0
  44. {GitPython-3.1.34 → GitPython-3.1.36}/git/index/typ.py +0 -0
  45. {GitPython-3.1.34 → GitPython-3.1.36}/git/index/util.py +0 -0
  46. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/__init__.py +0 -0
  47. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/base.py +0 -0
  48. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/blob.py +0 -0
  49. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/commit.py +0 -0
  50. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/fun.py +0 -0
  51. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/submodule/__init__.py +0 -0
  52. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/submodule/root.py +0 -0
  53. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/submodule/util.py +0 -0
  54. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/tag.py +0 -0
  55. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/tree.py +0 -0
  56. {GitPython-3.1.34 → GitPython-3.1.36}/git/objects/util.py +0 -0
  57. {GitPython-3.1.34 → GitPython-3.1.36}/git/py.typed +0 -0
  58. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/__init__.py +0 -0
  59. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/head.py +0 -0
  60. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/log.py +0 -0
  61. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/reference.py +0 -0
  62. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/remote.py +0 -0
  63. {GitPython-3.1.34 → GitPython-3.1.36}/git/refs/tag.py +0 -0
  64. {GitPython-3.1.34 → GitPython-3.1.36}/git/remote.py +0 -0
  65. {GitPython-3.1.34 → GitPython-3.1.36}/git/repo/__init__.py +0 -0
  66. {GitPython-3.1.34 → GitPython-3.1.36}/git/repo/base.py +0 -0
  67. {GitPython-3.1.34 → GitPython-3.1.36}/git/repo/fun.py +0 -0
  68. {GitPython-3.1.34 → GitPython-3.1.36}/git/types.py +0 -0
  69. {GitPython-3.1.34 → GitPython-3.1.36}/requirements.txt +0 -0
  70. {GitPython-3.1.34 → GitPython-3.1.36}/setup.cfg +0 -0
@@ -51,4 +51,5 @@ Contributors are:
51
51
  -Luke Twist <itsluketwist@gmail.com>
52
52
  -Joseph Hale <me _at_ jhale.dev>
53
53
  -Santos Gallegos <stsewd _at_ proton.me>
54
+ -Wenhan Zhu <wzhu.cosmos _at_ gmail.com>
54
55
  Portions derived from other open source works and are clearly marked.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: GitPython
3
- Version: 3.1.34
3
+ Version: 3.1.36
4
4
  Summary: GitPython is a Python library used to interact with Git repositories
5
5
  Home-page: https://github.com/gitpython-developers/GitPython
6
6
  Author: Sebastian Thiel, Michael Trier
@@ -22,10 +22,23 @@ Classifier: Programming Language :: Python :: 3.8
22
22
  Classifier: Programming Language :: Python :: 3.9
23
23
  Classifier: Programming Language :: Python :: 3.10
24
24
  Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
25
26
  Requires-Python: >=3.7
26
27
  Description-Content-Type: text/markdown
27
28
  License-File: LICENSE
28
29
  License-File: AUTHORS
30
+ Requires-Dist: gitdb<5,>=4.0.1
31
+ Requires-Dist: typing-extensions>=3.7.4.3; python_version < "3.8"
32
+ Provides-Extra: test
33
+ Requires-Dist: black; extra == "test"
34
+ Requires-Dist: coverage[toml]; extra == "test"
35
+ Requires-Dist: ddt!=1.4.3,>=1.1.1; extra == "test"
36
+ Requires-Dist: mypy; extra == "test"
37
+ Requires-Dist: pre-commit; extra == "test"
38
+ Requires-Dist: pytest; extra == "test"
39
+ Requires-Dist: pytest-cov; extra == "test"
40
+ Requires-Dist: pytest-sugar; extra == "test"
41
+ Requires-Dist: virtualenv; extra == "test"
29
42
 
30
43
  ![Python package](https://github.com/gitpython-developers/GitPython/workflows/Python%20package/badge.svg)
31
44
  [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
@@ -78,30 +91,51 @@ The installer takes care of installing them for you.
78
91
 
79
92
  ### INSTALL
80
93
 
81
- If you have downloaded the source code:
94
+ GitPython and its required package dependencies can be installed in any of the following ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html).
82
95
 
83
- ```bash
84
- python setup.py install
85
- ```
96
+ #### From PyPI
86
97
 
87
- or if you want to obtain a copy from the Pypi repository:
98
+ To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run:
88
99
 
89
100
  ```bash
90
101
  pip install GitPython
91
102
  ```
92
103
 
93
- Both commands will install the required package dependencies.
104
+ (A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)
105
+
106
+ #### From downloaded source code
107
+
108
+ If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:
109
+
110
+ ```bash
111
+ pip install .
112
+ ```
94
113
 
95
- A distribution package can be obtained for manual installation at: <http://pypi.python.org/pypi/GitPython>.
114
+ #### By cloning the source code repository
96
115
 
97
- If you like to clone from source, you can do it like so:
116
+ To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so:
98
117
 
99
118
  ```bash
100
119
  git clone https://github.com/gitpython-developers/GitPython
101
- git submodule update --init --recursive
120
+ cd GitPython
121
+ git fetch --tags
102
122
  ./init-tests-after-clone.sh
103
123
  ```
104
124
 
125
+ If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`):
126
+
127
+ ```bash
128
+ gh repo clone GitPython
129
+ ```
130
+
131
+ Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
132
+
133
+ ```bash
134
+ pip install -e ".[test]"
135
+ ```
136
+
137
+ In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.
138
+
105
139
  ### Limitations
106
140
 
107
141
  #### Leakage of System Resources
@@ -122,28 +156,57 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).
122
156
 
123
157
  ### RUNNING TESTS
124
158
 
125
- _Important_: Right after cloning this repository, please be sure to have executed
126
- the `./init-tests-after-clone.sh` script in the repository root. Otherwise
127
- you will encounter test failures.
159
+ _Important_: Right after cloning this repository, please be sure to have
160
+ executed `git fetch --tags` followed by the `./init-tests-after-clone.sh`
161
+ script in the repository root. Otherwise you will encounter test failures.
128
162
 
129
163
  On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
130
164
  exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
131
165
  with MINGW's.
132
166
 
133
- Ensure testing libraries are installed.
134
- In the root directory, run: `pip install -r test-requirements.txt`
167
+ #### Install test dependencies
135
168
 
136
- To lint, run: `pre-commit run --all-files`
169
+ Ensure testing libraries are installed. This is taken care of already if you installed with:
137
170
 
138
- To typecheck, run: `mypy -p git`
171
+ ```bash
172
+ pip install -e ".[test]"
173
+ ```
139
174
 
140
- To test, run: `pytest`
175
+ Otherwise, you can run:
141
176
 
142
- For automatic code formatting run: `black git`
177
+ ```bash
178
+ pip install -r test-requirements.txt
179
+ ```
180
+
181
+ #### Test commands
182
+
183
+ To test, run:
184
+
185
+ ```bash
186
+ pytest
187
+ ```
188
+
189
+ To lint, run:
190
+
191
+ ```bash
192
+ pre-commit run --all-files
193
+ ```
194
+
195
+ To typecheck, run:
196
+
197
+ ```bash
198
+ mypy -p git
199
+ ```
200
+
201
+ For automatic code formatting, run:
202
+
203
+ ```bash
204
+ black git
205
+ ```
143
206
 
144
- Configuration for flake8 is in the ./.flake8 file.
207
+ Configuration for flake8 is in the `./.flake8` file.
145
208
 
146
- Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
209
+ Configurations for `mypy`, `pytest`, `coverage.py`, and `black` are in `./pyproject.toml`.
147
210
 
148
211
  The same linting and testing will also be performed against different supported python versions
149
212
  upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).
@@ -167,13 +230,15 @@ Please have a look at the [contributions file][contributing].
167
230
 
168
231
  ### How to make a new release
169
232
 
170
- - Update/verify the **version** in the `VERSION` file
171
- - Update/verify that the `doc/source/changes.rst` changelog file was updated
172
- - Commit everything
173
- - Run `git tag -s <version>` to tag the version in Git
174
- - Run `make release`
233
+ - Update/verify the **version** in the `VERSION` file.
234
+ - Update/verify that the `doc/source/changes.rst` changelog file was updated.
235
+ - Commit everything.
236
+ - Run `git tag -s <version>` to tag the version in Git.
237
+ - _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) using `venv` or `virtualenv`.\
238
+ (When run in a virtual environment, the next step will automatically take care of installing `build` and `twine` in it.)
239
+ - Run `make release`.
175
240
  - Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
176
- - Got to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
241
+ - Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
177
242
 
178
243
  ### How to verify a release (DEPRECATED)
179
244
 
@@ -0,0 +1,15 @@
1
+ gitdb<5,>=4.0.1
2
+
3
+ [:python_version < "3.8"]
4
+ typing-extensions>=3.7.4.3
5
+
6
+ [test]
7
+ black
8
+ coverage[toml]
9
+ ddt!=1.4.3,>=1.1.1
10
+ mypy
11
+ pre-commit
12
+ pytest
13
+ pytest-cov
14
+ pytest-sugar
15
+ virtualenv
@@ -1,3 +1,45 @@
1
+ Metadata-Version: 2.1
2
+ Name: GitPython
3
+ Version: 3.1.36
4
+ Summary: GitPython is a Python library used to interact with Git repositories
5
+ Home-page: https://github.com/gitpython-developers/GitPython
6
+ Author: Sebastian Thiel, Michael Trier
7
+ Author-email: byronimo@gmail.com, mtrier@gmail.com
8
+ License: BSD
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: MacOS :: MacOS X
17
+ Classifier: Typing :: Typed
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Requires-Python: >=3.7
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ License-File: AUTHORS
30
+ Requires-Dist: gitdb<5,>=4.0.1
31
+ Requires-Dist: typing-extensions>=3.7.4.3; python_version < "3.8"
32
+ Provides-Extra: test
33
+ Requires-Dist: black; extra == "test"
34
+ Requires-Dist: coverage[toml]; extra == "test"
35
+ Requires-Dist: ddt!=1.4.3,>=1.1.1; extra == "test"
36
+ Requires-Dist: mypy; extra == "test"
37
+ Requires-Dist: pre-commit; extra == "test"
38
+ Requires-Dist: pytest; extra == "test"
39
+ Requires-Dist: pytest-cov; extra == "test"
40
+ Requires-Dist: pytest-sugar; extra == "test"
41
+ Requires-Dist: virtualenv; extra == "test"
42
+
1
43
  ![Python package](https://github.com/gitpython-developers/GitPython/workflows/Python%20package/badge.svg)
2
44
  [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
3
45
  [![Packaging status](https://repology.org/badge/tiny-repos/python:gitpython.svg)](https://repology.org/metapackage/python:gitpython/versions)
@@ -49,30 +91,51 @@ The installer takes care of installing them for you.
49
91
 
50
92
  ### INSTALL
51
93
 
52
- If you have downloaded the source code:
94
+ GitPython and its required package dependencies can be installed in any of the following ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html).
53
95
 
54
- ```bash
55
- python setup.py install
56
- ```
96
+ #### From PyPI
57
97
 
58
- or if you want to obtain a copy from the Pypi repository:
98
+ To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run:
59
99
 
60
100
  ```bash
61
101
  pip install GitPython
62
102
  ```
63
103
 
64
- Both commands will install the required package dependencies.
104
+ (A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)
105
+
106
+ #### From downloaded source code
107
+
108
+ If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:
65
109
 
66
- A distribution package can be obtained for manual installation at: <http://pypi.python.org/pypi/GitPython>.
110
+ ```bash
111
+ pip install .
112
+ ```
113
+
114
+ #### By cloning the source code repository
67
115
 
68
- If you like to clone from source, you can do it like so:
116
+ To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so:
69
117
 
70
118
  ```bash
71
119
  git clone https://github.com/gitpython-developers/GitPython
72
- git submodule update --init --recursive
120
+ cd GitPython
121
+ git fetch --tags
73
122
  ./init-tests-after-clone.sh
74
123
  ```
75
124
 
125
+ If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`):
126
+
127
+ ```bash
128
+ gh repo clone GitPython
129
+ ```
130
+
131
+ Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
132
+
133
+ ```bash
134
+ pip install -e ".[test]"
135
+ ```
136
+
137
+ In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.
138
+
76
139
  ### Limitations
77
140
 
78
141
  #### Leakage of System Resources
@@ -93,28 +156,57 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).
93
156
 
94
157
  ### RUNNING TESTS
95
158
 
96
- _Important_: Right after cloning this repository, please be sure to have executed
97
- the `./init-tests-after-clone.sh` script in the repository root. Otherwise
98
- you will encounter test failures.
159
+ _Important_: Right after cloning this repository, please be sure to have
160
+ executed `git fetch --tags` followed by the `./init-tests-after-clone.sh`
161
+ script in the repository root. Otherwise you will encounter test failures.
99
162
 
100
163
  On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
101
164
  exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
102
165
  with MINGW's.
103
166
 
104
- Ensure testing libraries are installed.
105
- In the root directory, run: `pip install -r test-requirements.txt`
167
+ #### Install test dependencies
168
+
169
+ Ensure testing libraries are installed. This is taken care of already if you installed with:
170
+
171
+ ```bash
172
+ pip install -e ".[test]"
173
+ ```
174
+
175
+ Otherwise, you can run:
176
+
177
+ ```bash
178
+ pip install -r test-requirements.txt
179
+ ```
106
180
 
107
- To lint, run: `pre-commit run --all-files`
181
+ #### Test commands
108
182
 
109
- To typecheck, run: `mypy -p git`
183
+ To test, run:
110
184
 
111
- To test, run: `pytest`
185
+ ```bash
186
+ pytest
187
+ ```
112
188
 
113
- For automatic code formatting run: `black git`
189
+ To lint, run:
190
+
191
+ ```bash
192
+ pre-commit run --all-files
193
+ ```
194
+
195
+ To typecheck, run:
196
+
197
+ ```bash
198
+ mypy -p git
199
+ ```
200
+
201
+ For automatic code formatting, run:
202
+
203
+ ```bash
204
+ black git
205
+ ```
114
206
 
115
- Configuration for flake8 is in the ./.flake8 file.
207
+ Configuration for flake8 is in the `./.flake8` file.
116
208
 
117
- Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
209
+ Configurations for `mypy`, `pytest`, `coverage.py`, and `black` are in `./pyproject.toml`.
118
210
 
119
211
  The same linting and testing will also be performed against different supported python versions
120
212
  upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).
@@ -138,13 +230,15 @@ Please have a look at the [contributions file][contributing].
138
230
 
139
231
  ### How to make a new release
140
232
 
141
- - Update/verify the **version** in the `VERSION` file
142
- - Update/verify that the `doc/source/changes.rst` changelog file was updated
143
- - Commit everything
144
- - Run `git tag -s <version>` to tag the version in Git
145
- - Run `make release`
233
+ - Update/verify the **version** in the `VERSION` file.
234
+ - Update/verify that the `doc/source/changes.rst` changelog file was updated.
235
+ - Commit everything.
236
+ - Run `git tag -s <version>` to tag the version in Git.
237
+ - _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) using `venv` or `virtualenv`.\
238
+ (When run in a virtual environment, the next step will automatically take care of installing `build` and `twine` in it.)
239
+ - Run `make release`.
146
240
  - Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
147
- - Got to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
241
+ - Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
148
242
 
149
243
  ### How to verify a release (DEPRECATED)
150
244
 
@@ -1,32 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: GitPython
3
- Version: 3.1.34
4
- Summary: GitPython is a Python library used to interact with Git repositories
5
- Home-page: https://github.com/gitpython-developers/GitPython
6
- Author: Sebastian Thiel, Michael Trier
7
- Author-email: byronimo@gmail.com, mtrier@gmail.com
8
- License: BSD
9
- Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Environment :: Console
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: BSD License
13
- Classifier: Operating System :: OS Independent
14
- Classifier: Operating System :: POSIX
15
- Classifier: Operating System :: Microsoft :: Windows
16
- Classifier: Operating System :: MacOS :: MacOS X
17
- Classifier: Typing :: Typed
18
- Classifier: Programming Language :: Python
19
- Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.7
21
- Classifier: Programming Language :: Python :: 3.8
22
- Classifier: Programming Language :: Python :: 3.9
23
- Classifier: Programming Language :: Python :: 3.10
24
- Classifier: Programming Language :: Python :: 3.11
25
- Requires-Python: >=3.7
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- License-File: AUTHORS
29
-
30
1
  ![Python package](https://github.com/gitpython-developers/GitPython/workflows/Python%20package/badge.svg)
31
2
  [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable)
32
3
  [![Packaging status](https://repology.org/badge/tiny-repos/python:gitpython.svg)](https://repology.org/metapackage/python:gitpython/versions)
@@ -78,30 +49,51 @@ The installer takes care of installing them for you.
78
49
 
79
50
  ### INSTALL
80
51
 
81
- If you have downloaded the source code:
52
+ GitPython and its required package dependencies can be installed in any of the following ways, all of which should typically be done in a [virtual environment](https://docs.python.org/3/tutorial/venv.html).
82
53
 
83
- ```bash
84
- python setup.py install
85
- ```
54
+ #### From PyPI
86
55
 
87
- or if you want to obtain a copy from the Pypi repository:
56
+ To obtain and install a copy [from PyPI](https://pypi.org/project/GitPython/), run:
88
57
 
89
58
  ```bash
90
59
  pip install GitPython
91
60
  ```
92
61
 
93
- Both commands will install the required package dependencies.
62
+ (A distribution package can also be downloaded for manual installation at [the PyPI page](https://pypi.org/project/GitPython/).)
63
+
64
+ #### From downloaded source code
65
+
66
+ If you have downloaded the source code, run this from inside the unpacked `GitPython` directory:
94
67
 
95
- A distribution package can be obtained for manual installation at: <http://pypi.python.org/pypi/GitPython>.
68
+ ```bash
69
+ pip install .
70
+ ```
71
+
72
+ #### By cloning the source code repository
96
73
 
97
- If you like to clone from source, you can do it like so:
74
+ To clone the [the GitHub repository](https://github.com/gitpython-developers/GitPython) from source to work on the code, you can do it like so:
98
75
 
99
76
  ```bash
100
77
  git clone https://github.com/gitpython-developers/GitPython
101
- git submodule update --init --recursive
78
+ cd GitPython
79
+ git fetch --tags
102
80
  ./init-tests-after-clone.sh
103
81
  ```
104
82
 
83
+ If you are cloning [your own fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks), then replace the above `git clone` command with one that gives the URL of your fork. Or use this [`gh`](https://cli.github.com/) command (assuming you have `gh` and your fork is called `GitPython`):
84
+
85
+ ```bash
86
+ gh repo clone GitPython
87
+ ```
88
+
89
+ Having cloned the repo, create and activate your [virtual environment](https://docs.python.org/3/tutorial/venv.html). Then make an [editable install](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs):
90
+
91
+ ```bash
92
+ pip install -e ".[test]"
93
+ ```
94
+
95
+ In the less common case that you do not want to install test dependencies, `pip install -e .` can be used instead.
96
+
105
97
  ### Limitations
106
98
 
107
99
  #### Leakage of System Resources
@@ -122,28 +114,57 @@ See [Issue #525](https://github.com/gitpython-developers/GitPython/issues/525).
122
114
 
123
115
  ### RUNNING TESTS
124
116
 
125
- _Important_: Right after cloning this repository, please be sure to have executed
126
- the `./init-tests-after-clone.sh` script in the repository root. Otherwise
127
- you will encounter test failures.
117
+ _Important_: Right after cloning this repository, please be sure to have
118
+ executed `git fetch --tags` followed by the `./init-tests-after-clone.sh`
119
+ script in the repository root. Otherwise you will encounter test failures.
128
120
 
129
121
  On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
130
122
  exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
131
123
  with MINGW's.
132
124
 
133
- Ensure testing libraries are installed.
134
- In the root directory, run: `pip install -r test-requirements.txt`
125
+ #### Install test dependencies
126
+
127
+ Ensure testing libraries are installed. This is taken care of already if you installed with:
128
+
129
+ ```bash
130
+ pip install -e ".[test]"
131
+ ```
132
+
133
+ Otherwise, you can run:
134
+
135
+ ```bash
136
+ pip install -r test-requirements.txt
137
+ ```
135
138
 
136
- To lint, run: `pre-commit run --all-files`
139
+ #### Test commands
137
140
 
138
- To typecheck, run: `mypy -p git`
141
+ To test, run:
139
142
 
140
- To test, run: `pytest`
143
+ ```bash
144
+ pytest
145
+ ```
141
146
 
142
- For automatic code formatting run: `black git`
147
+ To lint, run:
148
+
149
+ ```bash
150
+ pre-commit run --all-files
151
+ ```
152
+
153
+ To typecheck, run:
154
+
155
+ ```bash
156
+ mypy -p git
157
+ ```
158
+
159
+ For automatic code formatting, run:
160
+
161
+ ```bash
162
+ black git
163
+ ```
143
164
 
144
- Configuration for flake8 is in the ./.flake8 file.
165
+ Configuration for flake8 is in the `./.flake8` file.
145
166
 
146
- Configurations for mypy, pytest and coverage.py are in ./pyproject.toml.
167
+ Configurations for `mypy`, `pytest`, `coverage.py`, and `black` are in `./pyproject.toml`.
147
168
 
148
169
  The same linting and testing will also be performed against different supported python versions
149
170
  upon submitting a pull request (or on each push if you have a fork with a "main" branch and actions enabled).
@@ -167,13 +188,15 @@ Please have a look at the [contributions file][contributing].
167
188
 
168
189
  ### How to make a new release
169
190
 
170
- - Update/verify the **version** in the `VERSION` file
171
- - Update/verify that the `doc/source/changes.rst` changelog file was updated
172
- - Commit everything
173
- - Run `git tag -s <version>` to tag the version in Git
174
- - Run `make release`
191
+ - Update/verify the **version** in the `VERSION` file.
192
+ - Update/verify that the `doc/source/changes.rst` changelog file was updated.
193
+ - Commit everything.
194
+ - Run `git tag -s <version>` to tag the version in Git.
195
+ - _Optionally_ create and activate a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment) using `venv` or `virtualenv`.\
196
+ (When run in a virtual environment, the next step will automatically take care of installing `build` and `twine` in it.)
197
+ - Run `make release`.
175
198
  - Close the milestone mentioned in the _changelog_ and create a new one. _Do not reuse milestones by renaming them_.
176
- - Got to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
199
+ - Go to [GitHub Releases](https://github.com/gitpython-developers/GitPython/releases) and publish a new one with the recently pushed tag. Generate the changelog.
177
200
 
178
201
  ### How to verify a release (DEPRECATED)
179
202
 
@@ -0,0 +1 @@
1
+ 3.1.36
@@ -2,6 +2,20 @@
2
2
  Changelog
3
3
  =========
4
4
 
5
+ 3.1.36
6
+ ======
7
+
8
+ Note that this release should be a no-op, it's mainly for testing the changed release-process.
9
+
10
+ See the following for all changes.
11
+ https://github.com/gitpython-developers/gitpython/milestone/66?closed=1
12
+
13
+ 3.1.35
14
+ ======
15
+
16
+ See the following for all changes.
17
+ https://github.com/gitpython-developers/gitpython/milestone/65?closed=1
18
+
5
19
  3.1.34
6
20
  ======
7
21
 
@@ -14,13 +14,13 @@ import os.path as osp
14
14
  from typing import Optional
15
15
  from git.types import PathLike
16
16
 
17
- __version__ = '3.1.34'
17
+ __version__ = '3.1.36'
18
18
 
19
19
 
20
20
  # { Initialization
21
21
  def _init_externals() -> None:
22
22
  """Initialize external projects by putting them into the path"""
23
- if __version__ == '3.1.34' and "PYOXIDIZER" not in os.environ:
23
+ if __version__ == '3.1.36' and "PYOXIDIZER" not in os.environ:
24
24
  sys.path.insert(1, osp.join(osp.dirname(__file__), "ext", "gitdb"))
25
25
 
26
26
  try:
@@ -14,7 +14,6 @@ from subprocess import call, Popen, PIPE, DEVNULL
14
14
  import subprocess
15
15
  import threading
16
16
  from textwrap import dedent
17
- import unittest.mock
18
17
 
19
18
  from git.compat import (
20
19
  defenc,
@@ -24,7 +23,7 @@ from git.compat import (
24
23
  is_win,
25
24
  )
26
25
  from git.exc import CommandError
27
- from git.util import is_cygwin_git, cygpath, expand_path, remove_password_if_present
26
+ from git.util import is_cygwin_git, cygpath, expand_path, remove_password_if_present, patch_env
28
27
 
29
28
  from .exc import GitCommandError, GitCommandNotFound, UnsafeOptionError, UnsafeProtocolError
30
29
  from .util import (
@@ -965,10 +964,10 @@ class Git(LazyMixin):
965
964
  '"kill_after_timeout" feature is not supported on Windows.',
966
965
  )
967
966
  # Only search PATH, not CWD. This must be in the *caller* environment. The "1" can be any value.
968
- patch_caller_env = unittest.mock.patch.dict(os.environ, {"NoDefaultCurrentDirectoryInExePath": "1"})
967
+ maybe_patch_caller_env = patch_env("NoDefaultCurrentDirectoryInExePath", "1")
969
968
  else:
970
969
  cmd_not_found_exception = FileNotFoundError # NOQA # exists, flake8 unknown @UndefinedVariable
971
- patch_caller_env = contextlib.nullcontext()
970
+ maybe_patch_caller_env = contextlib.nullcontext()
972
971
  # end handle
973
972
 
974
973
  stdout_sink = PIPE if with_stdout else getattr(subprocess, "DEVNULL", None) or open(os.devnull, "wb")
@@ -984,7 +983,7 @@ class Git(LazyMixin):
984
983
  istream_ok,
985
984
  )
986
985
  try:
987
- with patch_caller_env:
986
+ with maybe_patch_caller_env:
988
987
  proc = Popen(
989
988
  command,
990
989
  env=env,
@@ -1402,6 +1402,10 @@ class Submodule(IndexObject, TraversableIterableObj):
1402
1402
  # END handle keyerror
1403
1403
  # END handle critical error
1404
1404
 
1405
+ # Make sure we are looking at a submodule object
1406
+ if type(sm) != git.objects.submodule.base.Submodule:
1407
+ continue
1408
+
1405
1409
  # fill in remaining info - saves time as it doesn't have to be parsed again
1406
1410
  sm._name = n
1407
1411
  if pc != repo.commit():
@@ -168,6 +168,8 @@ class SymbolicReference(object):
168
168
  """Return: (str(sha), str(target_ref_path)) if available, the sha the file at
169
169
  rela_path points to, or None. target_ref_path is the reference we
170
170
  point to, or None"""
171
+ if ".." in str(ref_path):
172
+ raise ValueError(f"Invalid reference '{ref_path}'")
171
173
  tokens: Union[None, List[str], Tuple[str, str]] = None
172
174
  repodir = _git_dir(repo, ref_path)
173
175
  try:
@@ -150,6 +150,7 @@ def unbare_repo(func: Callable[..., T]) -> Callable[..., T]:
150
150
 
151
151
  @contextlib.contextmanager
152
152
  def cwd(new_dir: PathLike) -> Generator[PathLike, None, None]:
153
+ """Context manager to temporarily change directory. Not reentrant."""
153
154
  old_dir = os.getcwd()
154
155
  os.chdir(new_dir)
155
156
  try:
@@ -158,6 +159,20 @@ def cwd(new_dir: PathLike) -> Generator[PathLike, None, None]:
158
159
  os.chdir(old_dir)
159
160
 
160
161
 
162
+ @contextlib.contextmanager
163
+ def patch_env(name: str, value: str) -> Generator[None, None, None]:
164
+ """Context manager to temporarily patch an environment variable."""
165
+ old_value = os.getenv(name)
166
+ os.environ[name] = value
167
+ try:
168
+ yield
169
+ finally:
170
+ if old_value is None:
171
+ del os.environ[name]
172
+ else:
173
+ os.environ[name] = old_value
174
+
175
+
161
176
  def rmtree(path: PathLike) -> None:
162
177
  """Remove the given recursively.
163
178
 
@@ -935,7 +950,7 @@ class LockFile(object):
935
950
  )
936
951
 
937
952
  try:
938
- with open(lock_file, mode='w'):
953
+ with open(lock_file, mode="w"):
939
954
  pass
940
955
  except OSError as e:
941
956
  raise IOError(str(e)) from e
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools", "wheel"]
2
+ requires = ["setuptools"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [tool.pytest.ini_options]
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env python
2
+
1
3
  from typing import Sequence
2
4
  from setuptools import setup, find_packages
3
5
  from setuptools.command.build_py import build_py as _build_py
@@ -6,8 +8,8 @@ import fnmatch
6
8
  import os
7
9
  import sys
8
10
 
9
- with open(os.path.join(os.path.dirname(__file__), "VERSION")) as v:
10
- VERSION = v.readline().strip()
11
+ with open(os.path.join(os.path.dirname(__file__), "VERSION")) as ver_file:
12
+ VERSION = ver_file.readline().strip()
11
13
 
12
14
  with open("requirements.txt") as reqs_file:
13
15
  requirements = reqs_file.read().splitlines()
@@ -47,7 +49,7 @@ def _stamp_version(filename: str) -> None:
47
49
  with open(filename) as f:
48
50
  for line in f:
49
51
  if "__version__ =" in line:
50
- line = line.replace("\"git\"", "'%s'" % VERSION)
52
+ line = line.replace('"git"', "'%s'" % VERSION)
51
53
  found = True
52
54
  out.append(line)
53
55
  except OSError:
@@ -93,7 +95,7 @@ setup(
93
95
  package_dir={"git": "git"},
94
96
  python_requires=">=3.7",
95
97
  install_requires=requirements,
96
- tests_require=requirements + test_requirements,
98
+ extras_require={"test": test_requirements},
97
99
  zip_safe=False,
98
100
  long_description=long_description,
99
101
  long_description_content_type="text/markdown",
@@ -122,5 +124,6 @@ setup(
122
124
  "Programming Language :: Python :: 3.9",
123
125
  "Programming Language :: Python :: 3.10",
124
126
  "Programming Language :: Python :: 3.11",
127
+ "Programming Language :: Python :: 3.12",
125
128
  ],
126
129
  )
@@ -1,15 +1,9 @@
1
+ black
2
+ coverage[toml]
1
3
  ddt>=1.1.1, !=1.4.3
2
4
  mypy
3
-
4
- black
5
-
6
5
  pre-commit
7
-
8
- virtualenv
9
-
10
6
  pytest
11
7
  pytest-cov
12
- coverage[toml]
13
8
  pytest-sugar
14
-
15
- gitdb
9
+ virtualenv
@@ -1,4 +0,0 @@
1
- gitdb<5,>=4.0.1
2
-
3
- [:python_version < "3.8"]
4
- typing-extensions>=3.7.4.3
GitPython-3.1.34/VERSION DELETED
@@ -1 +0,0 @@
1
- 3.1.34
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes