git-project 0.1.0__tar.gz → 0.1.2__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 (51) hide show
  1. {git_project-0.1.0 → git_project-0.1.2}/PKG-INFO +39 -11
  2. {git_project-0.1.0 → git_project-0.1.2}/_version.py +2 -2
  3. {git_project-0.1.0 → git_project-0.1.2}/docs/changelog.rst +34 -1
  4. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/__init__.py +13 -3
  5. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/configobj.py +29 -0
  6. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/git.py +441 -58
  7. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/parsermanager.py +110 -36
  8. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/project.py +1 -1
  9. {git_project-0.1.0 → git_project-0.1.2}/tests/test_confobj.py +31 -0
  10. {git_project-0.1.0 → git_project-0.1.2}/tests/test_git.py +653 -5
  11. {git_project-0.1.0 → git_project-0.1.2}/tests/test_parsermanager.py +162 -0
  12. {git_project-0.1.0 → git_project-0.1.2}/tests/test_project.py +15 -0
  13. {git_project-0.1.0 → git_project-0.1.2}/.gitignore +0 -0
  14. {git_project-0.1.0 → git_project-0.1.2}/CONTRIBUTORS +0 -0
  15. {git_project-0.1.0 → git_project-0.1.2}/COPYING +0 -0
  16. {git_project-0.1.0 → git_project-0.1.2}/MANIFEST.in +0 -0
  17. {git_project-0.1.0 → git_project-0.1.2}/changelog.d/README.rst +0 -0
  18. {git_project-0.1.0 → git_project-0.1.2}/changelog.py +0 -0
  19. {git_project-0.1.0 → git_project-0.1.2}/docs/Makefile +0 -0
  20. {git_project-0.1.0 → git_project-0.1.2}/docs/api.rst +0 -0
  21. {git_project-0.1.0 → git_project-0.1.2}/docs/authors.rst +0 -0
  22. {git_project-0.1.0 → git_project-0.1.2}/docs/conf.py +0 -0
  23. {git_project-0.1.0 → git_project-0.1.2}/docs/contributing.rst +0 -0
  24. {git_project-0.1.0 → git_project-0.1.2}/docs/index.rst +0 -0
  25. {git_project-0.1.0 → git_project-0.1.2}/docs/intro.rst +0 -0
  26. {git_project-0.1.0 → git_project-0.1.2}/docs/license.rst +0 -0
  27. {git_project-0.1.0 → git_project-0.1.2}/docs/make.bat +0 -0
  28. {git_project-0.1.0 → git_project-0.1.2}/docs/plugins.rst +0 -0
  29. {git_project-0.1.0 → git_project-0.1.2}/pyproject.toml +0 -0
  30. {git_project-0.1.0 → git_project-0.1.2}/requirements.txt +0 -0
  31. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/commandline.py +0 -0
  32. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/exception.py +0 -0
  33. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/gitproject.py +0 -0
  34. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/main.py +0 -0
  35. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/plugin.py +0 -0
  36. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/pluginmanager.py +0 -0
  37. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/py.typed +0 -0
  38. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/runnable.py +0 -0
  39. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/scopedobj.py +0 -0
  40. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/shell.py +0 -0
  41. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/substitutable.py +0 -0
  42. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/test_support/__init__.py +0 -0
  43. {git_project-0.1.0 → git_project-0.1.2}/src/git_project/test_support/common.py +0 -0
  44. {git_project-0.1.0 → git_project-0.1.2}/tests/conftest.py +0 -0
  45. {git_project-0.1.0 → git_project-0.1.2}/tests/test_changelog.py +0 -0
  46. {git_project-0.1.0 → git_project-0.1.2}/tests/test_gitproject.py +0 -0
  47. {git_project-0.1.0 → git_project-0.1.2}/tests/test_main.py +0 -0
  48. {git_project-0.1.0 → git_project-0.1.2}/tests/test_runnable.py +0 -0
  49. {git_project-0.1.0 → git_project-0.1.2}/tests/test_scopedobj.py +0 -0
  50. {git_project-0.1.0 → git_project-0.1.2}/tests/test_shell.py +0 -0
  51. {git_project-0.1.0 → git_project-0.1.2}/tests/test_substitutable.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: git-project
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: The extensible stupid project manager
5
5
  Author-email: "David A. Greene" <dag@obbligato.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -171,9 +171,19 @@ full manual.
171
171
  ``--menu`` lists a command's subcommands, arguments and options in a form meant
172
172
  for tools. ``--menu=json`` prints them as one JSON object and adds each
173
173
  subcommand's aliases and each argument's ``nargs`` and ``choices``. An option's
174
- ``name`` is its long flag when it has one. The ``version`` field changes only
175
- when a key is removed or changes meaning, so a reader should ignore keys it
176
- does not know.
174
+ ``name`` is its long flag when it has one. ``--menu=json-tree`` prints the same
175
+ object with each subcommand's own object nested under its ``menu`` key, so one
176
+ call returns every level. The ``version`` field changes only when a key is
177
+ removed or changes meaning, so a reader should ignore keys it does not know.
178
+
179
+ ``nargs`` is null when the argument takes argparse's default, one value or none
180
+ for a switch. Otherwise it is a count such as ``"2"``, or ``"?"``, ``"*"``,
181
+ ``"+"`` or ``"..."``, which takes every remaining word as written. Three keys help a tool offer values. ``complete``
182
+ names the kind of value: ``branch``, ``committish``, ``directory``, ``file``,
183
+ ``remote`` or ``worktree``, a git-project worktree name. A null or unknown
184
+ ``complete`` means free text. ``candidates`` lists values to suggest, which
185
+ unlike ``choices`` the command does not enforce. ``repeatable`` is true when
186
+ each use of an option adds to its value rather than replacing it.
177
187
 
178
188
  License
179
189
  =======
@@ -218,14 +228,32 @@ Authors
218
228
  .. _David Greene: https://github.com/greened
219
229
 
220
230
 
221
- `0.1.0`_ - 2026-10-15
231
+ `0.1.2`_ - 2026-10-22
222
232
  ---------------------
223
- Changed
224
- .......
225
- - ``--menu=json`` names an option by its long flag when it has one, and lists its other flags as aliases, whatever order they were declared in.
226
- - Versions follow semantic versioning from 0.1.0. Before 1.0.0 a breaking change bumps the minor version, and a feature or a fix bumps the patch. From 1.0.0 on, a breaking change bumps the major version, a feature the minor and a fix the patch. ``--menu=json`` version 1 is part of that contract.
227
-
228
- .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.0...HEAD
233
+ Fixed
234
+ .....
235
+ - ``Git.refname_is_merged`` now resolves a target given as a short branch
236
+ name to that branch, and ``Project.branch_is_merged`` and
237
+ ``Project.branch_is_pushed`` look up each project branch as a branch. A tag
238
+ with the same name, such as a tag ``master``, was taken in its place. A
239
+ branch could then be reported merged when only the tag contained it, or
240
+ unmerged or unpushed when the project branch contained it.
241
+ - ``Git.clone`` and ``Git.fetch_remote`` run the git CLI for an ssh url
242
+ without a password, so they use the ssh agent, ``~/.ssh/config`` and
243
+ ``known_hosts`` as plain git does, and a Host alias now resolves. An ssh
244
+ clone has the same branches, upstream config and remote ``HEAD`` as a
245
+ libgit2 clone. A failure is a one-line ``GitProjectError`` that carries
246
+ git's error. ssh sends keepalives, so a link that stops answering fails in
247
+ about a minute. ``GIT_SSH_COMMAND`` turns that off, and so do
248
+ ``GIT_SSH`` and ``core.sshCommand`` when ``ssh.id`` is unset. An ssh clone
249
+ or fetch through git gives up after six hours. A libgit2 clone or fetch
250
+ that reached an ssh server with no key to offer died with ``TypeError:
251
+ credential does not implement interface``, and now fails with a one-line
252
+ error.
253
+
254
+ .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.2...HEAD
255
+ .. _0.1.2: https://github.com/greened/git-project/compare/v0.1.1...v0.1.2
256
+ .. _0.1.1: https://github.com/greened/git-project/compare/v0.1.0...v0.1.1
229
257
  .. _0.1.0: https://github.com/greened/git-project/compare/v0.0.44...v0.1.0
230
258
  .. _0.0.44: https://github.com/greened/git-project/compare/v0.0.43...v0.0.44
231
259
  .. _0.0.43: https://github.com/greened/git-project/compare/v0.0.42...v0.0.43
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.1.0'
22
- __version_tuple__ = version_tuple = (0, 1, 0)
21
+ __version__ = version = '0.1.2'
22
+ __version_tuple__ = version_tuple = (0, 1, 2)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -31,6 +31,37 @@ ChangeLog
31
31
  `Unreleased`_
32
32
  -------------
33
33
 
34
+ `0.1.2`_ - 2026-10-22
35
+ ---------------------
36
+ Fixed
37
+ .....
38
+ - ``Git.refname_is_merged`` now resolves a target given as a short branch
39
+ name to that branch, and ``Project.branch_is_merged`` and
40
+ ``Project.branch_is_pushed`` look up each project branch as a branch. A tag
41
+ with the same name, such as a tag ``master``, was taken in its place. A
42
+ branch could then be reported merged when only the tag contained it, or
43
+ unmerged or unpushed when the project branch contained it.
44
+ - ``Git.clone`` and ``Git.fetch_remote`` run the git CLI for an ssh url
45
+ without a password, so they use the ssh agent, ``~/.ssh/config`` and
46
+ ``known_hosts`` as plain git does, and a Host alias now resolves. An ssh
47
+ clone has the same branches, upstream config and remote ``HEAD`` as a
48
+ libgit2 clone. A failure is a one-line ``GitProjectError`` that carries
49
+ git's error. ssh sends keepalives, so a link that stops answering fails in
50
+ about a minute. ``GIT_SSH_COMMAND`` turns that off, and so do
51
+ ``GIT_SSH`` and ``core.sshCommand`` when ``ssh.id`` is unset. An ssh clone
52
+ or fetch through git gives up after six hours. A libgit2 clone or fetch
53
+ that reached an ssh server with no key to offer died with ``TypeError:
54
+ credential does not implement interface``, and now fails with a one-line
55
+ error.
56
+
57
+ `0.1.1`_ - 2026-10-19
58
+ ---------------------
59
+ Added
60
+ .....
61
+ - ``ConfigObject.iter_idents`` lists the idents of the objects recorded under a subsection, so a plugin can offer them as ``candidates``.
62
+ - ``--menu=json`` gives each argument ``complete``, ``candidates`` and ``repeatable`` keys, set from new ``complete=`` and ``candidates=`` keywords to ``add_argument`` and from the argparse action.
63
+ - ``--menu=json-tree`` prints the whole command tree in one call, with each subcommand's menu nested under its ``menu`` key.
64
+
34
65
  `0.1.0`_ - 2026-10-15
35
66
  ---------------------
36
67
  Changed
@@ -260,7 +291,9 @@ Fixed
260
291
  ``git_project``. No declared environment supplied Sphinx either, so a
261
292
  ``docs`` environment with Sphinx is now declared.
262
293
 
263
- .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.0...HEAD
294
+ .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.2...HEAD
295
+ .. _0.1.2: https://github.com/greened/git-project/compare/v0.1.1...v0.1.2
296
+ .. _0.1.1: https://github.com/greened/git-project/compare/v0.1.0...v0.1.1
264
297
  .. _0.1.0: https://github.com/greened/git-project/compare/v0.0.44...v0.1.0
265
298
  .. _0.0.44: https://github.com/greened/git-project/compare/v0.0.43...v0.0.44
266
299
  .. _0.0.43: https://github.com/greened/git-project/compare/v0.0.42...v0.0.43
@@ -163,9 +163,19 @@ full manual.
163
163
  ``--menu`` lists a command's subcommands, arguments and options in a form meant
164
164
  for tools. ``--menu=json`` prints them as one JSON object and adds each
165
165
  subcommand's aliases and each argument's ``nargs`` and ``choices``. An option's
166
- ``name`` is its long flag when it has one. The ``version`` field changes only
167
- when a key is removed or changes meaning, so a reader should ignore keys it
168
- does not know.
166
+ ``name`` is its long flag when it has one. ``--menu=json-tree`` prints the same
167
+ object with each subcommand's own object nested under its ``menu`` key, so one
168
+ call returns every level. The ``version`` field changes only when a key is
169
+ removed or changes meaning, so a reader should ignore keys it does not know.
170
+
171
+ ``nargs`` is null when the argument takes argparse's default, one value or none
172
+ for a switch. Otherwise it is a count such as ``"2"``, or ``"?"``, ``"*"``,
173
+ ``"+"`` or ``"..."``, which takes every remaining word as written. Three keys help a tool offer values. ``complete``
174
+ names the kind of value: ``branch``, ``committish``, ``directory``, ``file``,
175
+ ``remote`` or ``worktree``, a git-project worktree name. A null or unknown
176
+ ``complete`` means free text. ``candidates`` lists values to suggest, which
177
+ unlike ``choices`` the command does not enforce. ``repeatable`` is true when
178
+ each use of an option adds to its value rather than replacing it.
169
179
 
170
180
  License
171
181
  =======
@@ -165,6 +165,35 @@ class ConfigObject:
165
165
  section = git.config.get_section(gitsection)
166
166
  return True if section else False
167
167
 
168
+ @classmethod
169
+ def iter_idents(cls, git, project_section, subsection):
170
+ """Yield the ident of each ConfigObject that exists under subsection.
171
+
172
+ git: An object to query the repository and make config changes.
173
+
174
+ project_section: git config section of the active project.
175
+
176
+ subsection: The subsection whose idents to list.
177
+
178
+ """
179
+ if not git.has_repo():
180
+ return
181
+
182
+ prefix = (
183
+ ConfigObject._get_full_section(
184
+ ConfigObject._map_project_section(project_section),
185
+ subsection,
186
+ None,
187
+ )
188
+ + "."
189
+ )
190
+
191
+ for name in git.config.iter_section_names():
192
+ ident = name[len(prefix) :]
193
+ # An empty ident names the subsection itself, not an object.
194
+ if name.startswith(prefix) and ident:
195
+ yield ident
196
+
168
197
  @staticmethod
169
198
  def _map_project_section(project_section):
170
199
  """Return the git config section name for project_section. get, exists and