git-project-core-plugins 0.0.21__tar.gz → 0.0.23__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 (52) hide show
  1. git_project_core_plugins-0.0.23/.git +1 -0
  2. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/PKG-INFO +5 -5
  3. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/_version.py +9 -4
  4. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/PKG-INFO +496 -0
  5. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/SOURCES.txt +29 -0
  6. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/dependency_links.txt +1 -0
  7. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/entry_points.txt +9 -0
  8. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/not-zip-safe +1 -0
  9. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/requires.txt +3 -0
  10. git_project_core_plugins-0.0.23/git_project_core_plugins.egg-info/top_level.txt +1 -0
  11. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/pyproject.toml +2 -2
  12. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/requirements.txt +2 -2
  13. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/artifact.py +5 -5
  14. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/branch.py +3 -0
  15. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/run.py +48 -11
  16. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/worktree.py +40 -3
  17. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_artifact.py +8 -8
  18. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_branch.py +4 -0
  19. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_run.py +39 -16
  20. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_worktree.py +129 -13
  21. git_project_core_plugins-0.0.21/.#test.out +0 -1
  22. git_project_core_plugins-0.0.21/.git +0 -1
  23. git_project_core_plugins-0.0.21/docs/authors.rst~ +0 -36
  24. git_project_core_plugins-0.0.21/docs/changelog.rst~ +0 -39
  25. git_project_core_plugins-0.0.21/docs/conf.py~ +0 -57
  26. git_project_core_plugins-0.0.21/docs/index.rst~ +0 -46
  27. git_project_core_plugins-0.0.21/docs/intro.rst~ +0 -29
  28. git_project_core_plugins-0.0.21/pyproject.toml~ +0 -260
  29. git_project_core_plugins-0.0.21/requirements.txt~ +0 -22
  30. git_project_core_plugins-0.0.21/test.out +0 -1804
  31. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/COPYING +0 -0
  32. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/MANIFEST.in +0 -0
  33. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/Makefile +0 -0
  34. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/authors.rst +0 -0
  35. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/changelog.rst +0 -0
  36. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/conf.py +0 -0
  37. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/index.rst +0 -0
  38. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/intro.rst +0 -0
  39. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/license.rst +0 -0
  40. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/docs/make.bat +0 -0
  41. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/__init__.py +0 -0
  42. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/clone.py +0 -0
  43. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/common.py +0 -0
  44. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/config.py +0 -0
  45. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/help.py +0 -0
  46. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/init.py +0 -0
  47. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/common.py +0 -0
  48. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/conftest.py +0 -0
  49. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_clone.py +0 -0
  50. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_config.py +0 -0
  51. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_help.py +0 -0
  52. {git_project_core_plugins-0.0.21 → git_project_core_plugins-0.0.23}/tests/test_init.py +0 -0
@@ -0,0 +1 @@
1
+ gitdir: /home/dag/src/git-project-core-plugins/.git/worktrees/master/
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: git-project-core-plugins
3
- Version: 0.0.21
3
+ Version: 0.0.23
4
4
  Summary: The extensible stupid project manager - core functionality
5
5
  Author-email: "David A. Greene" <dag@obbligato.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -12,9 +12,9 @@ Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Topic :: Software Development :: Version Control :: Git
15
- Requires-Python: >=3
16
- Requires-Dist: git-project>=0.0.24
17
- Requires-Dist: progressbar
15
+ Requires-Python: >=3.9
16
+ Requires-Dist: git-project>=0.0.30
17
+ Requires-Dist: pytest-console-scripts
18
18
  Provides-Extra: test
19
19
  Requires-Dist: git-project; extra == 'test'
20
20
  Requires-Dist: pytest; extra == 'test'
@@ -1,8 +1,13 @@
1
- # file generated by setuptools_scm
1
+ # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
3
6
  TYPE_CHECKING = False
4
7
  if TYPE_CHECKING:
5
- from typing import Tuple, Union
8
+ from typing import Tuple
9
+ from typing import Union
10
+
6
11
  VERSION_TUPLE = Tuple[Union[int, str], ...]
7
12
  else:
8
13
  VERSION_TUPLE = object
@@ -12,5 +17,5 @@ __version__: str
12
17
  __version_tuple__: VERSION_TUPLE
13
18
  version_tuple: VERSION_TUPLE
14
19
 
15
- __version__ = version = '0.0.21'
16
- __version_tuple__ = version_tuple = (0, 0, 21)
20
+ __version__ = version = '0.0.23'
21
+ __version_tuple__ = version_tuple = (0, 0, 23)
@@ -0,0 +1,496 @@
1
+ Metadata-Version: 2.1
2
+ Name: git_project_core_plugins
3
+ Version: 0.0.19
4
+ Summary: Core functionality for git-project
5
+ Home-page: http://github.com/greened/git-project-core-plugins
6
+ Author: David A. Greene
7
+ Author-email: dag@obbligato.org
8
+ License: GPLv3+
9
+ Keywords: git project development
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
14
+ Classifier: Programming Language :: Python :: 3.6
15
+ Classifier: Topic :: Software Development :: Version Control :: Git
16
+ Requires-Python: >=3
17
+ Description-Content-Type: text/x-rst
18
+ License-File: COPYING
19
+ Requires-Dist: git_project>=0.0.17
20
+ Requires-Dist: progressbar2
21
+ Requires-Dist: pygit2
22
+
23
+ ************************
24
+ git-project-core-plugins
25
+ ************************
26
+
27
+ Plugins for `git-project <http://www.github.com/greened/git-project>`_
28
+
29
+ This is a set of basic plugins to manage several aspects of projects kept within
30
+ git repositories. These plugins include commands to:
31
+
32
+ #. Configure git-project and its various plugins
33
+ #. Clone repositories
34
+ #. Manage branches
35
+ #. Manage worktrees
36
+ #. Run commands (e.g configure/build/install)
37
+
38
+ Setup
39
+ =====
40
+
41
+ ``pip install git-project-core-plugins``
42
+
43
+ Commands
44
+ ========
45
+
46
+ These plugins add a number of commands to git-project. Each command has an
47
+ associated ``--help`` option to describe its function and options. There is
48
+ also a `help` command that accesses more extensive manpage-like descriptions of
49
+ commands.
50
+
51
+ * ``git <project> config``
52
+
53
+ Configure git-project or any git config sections added by projects. This will
54
+ add ``config`` subcommands to plugin commands that manipulate git config
55
+ sections (e.g. ``git project build config``).
56
+
57
+ * ``git <project> clone [--worktree]``
58
+
59
+ Clone a repository. Other plugins may hook into this command to provide
60
+ additional functionality. With ``--worktree``, set up a worktree environment.
61
+
62
+ * ``git <project> init [--worktree]``
63
+
64
+ Initialize a ``git-project`` config in an existing cloed repository. With
65
+ ``--worktree``, setup a worktree environment.
66
+
67
+ * ``git <project> branch status``
68
+
69
+ Report whether local branches are merged to a project branch and whether the
70
+ local branch head is pushed to a remote.
71
+
72
+ * ``git <project> branch prune``
73
+
74
+ Delete branches that are merged to a project branch and pushed to a remote.
75
+
76
+ * ``git <project> run <command> [<args>]``
77
+
78
+ Run a pre-configured commandm, passing ``<args>`` to it.
79
+
80
+ * ``git <project> worktree``
81
+
82
+ Create and manage worktrees for the project. This plugin gives ``git
83
+ <project> clone`` an option to create a special directory layout and a master
84
+ worktree when performing a bare clone.
85
+
86
+ Worktrees can be referenced to set up per-worktree build and install trees
87
+ such that switching from worktree to worktree does not result in "rebuilding
88
+ the world."
89
+
90
+ Worktree environment
91
+ ====================
92
+
93
+ A number of commands can have knowledge of a "worktree environment" with a
94
+ specific layout:
95
+
96
+ <path>
97
+ .git
98
+ worktree1
99
+ worktree2
100
+ worktree3
101
+
102
+ That is, either a bare clone is done, or an existing clone is converted to a
103
+ bare clone via ``git <project> init --worktree``. Any conversion will abort if
104
+ the worktree is dirty. Typically, an ordinary ``git clone`` is followed
105
+ immediately by ``git <project> init --worktree``.
106
+
107
+ Examples
108
+ ========
109
+
110
+ Initial setup
111
+ -------------
112
+
113
+ git clone <url>
114
+ git <project> init --worktree
115
+
116
+ Add convenience substitution variables
117
+ --------------------------------------
118
+
119
+ Adding custom commands
120
+ ----------------------
121
+
122
+ git <project> run --make-alias configure
123
+ git <project> run --make-alias build
124
+ git <project> run --make-alias install
125
+
126
+ git <project> add configure debug "cd {builddir} && "
127
+
128
+ Command Reference
129
+ -----------------
130
+
131
+ artifact
132
+ --------
133
+ The artifact command adds or removes associations between git config objects
134
+ and file-system objects.
135
+
136
+ Summary:
137
+
138
+ git <project> artifact add <subsection> <path>
139
+ git <project> artifact rm <subsection> [<path>]
140
+
141
+ <subsection> is a git config section which will appear under the
142
+ <project>.artifact section. Artifacts look up objects associated with
143
+ <subsection> and perform substitutions on paths to yield the final
144
+ associated file-system object. The ``artifact rm`` command simply removes
145
+ an artifact association, it does not remove the artifact itself. Multiple
146
+ artifact paths may be associated under a single <subsection> and the option
147
+ <path> argument to ``artifact rm`` allows us to remove a single association
148
+ rather than all of them at once.
149
+
150
+ For example:
151
+
152
+ git <project> artifact add worktree.myworktree /path/to/artifact
153
+
154
+ Presumably, /path/to/artifact is in some way created in association with
155
+ myworktree, for example by the ``run`` command. When we delete myworktree,
156
+ the artifact association causes /path/to/artifact to also be removed.
157
+ Substitutions can make artifact associations easier to manage:
158
+
159
+ git <project> artifact add worktree /path/to/{worktree}/artifact
160
+
161
+ Notice that we've added the artifact under the more general ``worktree``
162
+ subsection instead of naming a worktree explicitly as before. Because the
163
+ {worktree} substitution appears in the artifact path, deleting any worktree
164
+ will cause the worktree's name to be substituted into the artifact path,
165
+ forming a unique artifact path to remove.
166
+
167
+ We may make this even more general:
168
+
169
+ git <project> config srcdir "{path}"
170
+ git <project> config builddir "{srcdir}/build/{worktree}"
171
+ git <project> config make "make -C {srcdir} BUILDDIR={builddir} {build}"
172
+ git <project> run --make-alias build
173
+ git <project> add build debug "{make}"
174
+ git <project> add build release "{make}"
175
+ git <project> add build check "{make}"
176
+ git <project> artifact add worktree "{builddir}"
177
+
178
+ We've added a single artifact association that will handle any worktree and
179
+ all of our different build types. When we delete the worktree, all
180
+ artifacts related to debug, release and check builds will also be removed.
181
+
182
+ The worktree plugin also modifies the clone and init commands, adding a
183
+ --worktree option to both. With --worktree, clone will create a ``worktree
184
+ layout`` as so:
185
+
186
+ clonedir
187
+ .git
188
+ master
189
+
190
+ Here, ``master`` is a worktree created from the master branch. ``clonedir``
191
+ becames a bare repository, though with refspecs that make it operate like a
192
+ regular clone for fetch and push operations. That is, the cloned repository
193
+ will still have refs/heads and refs/remotes namespaces.
194
+
195
+ With --worktree, init will take an existing local clone and convert it to a
196
+ bare repository, removing all checked out files and creating a master
197
+ worktree:
198
+
199
+ clonedir
200
+ .git
201
+ master
202
+
203
+ Conversion will abort if the workarea is not in a clean state. Note that
204
+ all files in clonedir will be deleted so if there are important files not
205
+ part of the underlying repository, the user must take care to preserve them.
206
+ If the workarea hd a branch other than master checked out, no worktree for
207
+ it will be created automatically, though the user may easily create one
208
+ after conversion.
209
+
210
+ See also:
211
+
212
+ clone
213
+ config
214
+ init
215
+ run
216
+ worktree
217
+
218
+ branch
219
+ ------
220
+ The branch command queries the status of branches against known project
221
+ branches and provides methods to prune old branches.
222
+
223
+ Summary:
224
+
225
+ git <project> branch status [--all] [<refish>]
226
+ git <project> branch prune [--force] [--no-ask]
227
+
228
+ The branch status command checks the given <refish> (or all local branches
229
+ with the --all option) against the project-configured branches. The command
230
+ outputs a table of branches and whether they are merged to a project branch
231
+ and/or pushed to a remote. For example:
232
+
233
+ git <project> config --add branch release
234
+ git <project> branch status mybranch
235
+
236
+ The report will show whether mybranch is merged to the release or master
237
+ branches (master is always a configured project branch) and whether the
238
+ commit pointed to mybranch is pushed to a remote.
239
+
240
+ The branch prune command computes the same information and if the branch is
241
+ merged to a project branch and that project branch is pushed to a remote,
242
+ will ask whether mybranch should be deleted. If the user indicates yes,
243
+ both the local mybranch and its remote counterpart, if any, will be deleted.
244
+
245
+ With --force, branches will be pruneed regardless of merge/push status.
246
+ With --no-ask branch prune operates in batch mode, assuming all merged and
247
+ pushed branches should be pruned.
248
+
249
+ See also:
250
+
251
+ config
252
+
253
+ clone
254
+ -----
255
+ The clone command clones a repository.
256
+
257
+ Summary:
258
+
259
+ git <project> clone <url> [<path>] [--bare]
260
+
261
+ By itself clone has just the very basic funcionality of the built-in git
262
+ clone command. Plugins may add options to give the clone command more
263
+ features. For example, the woktree command adds a --worktree option to have
264
+ clone create a ``worktree layout.``
265
+
266
+ See also:
267
+
268
+ worktree
269
+
270
+ config
271
+ ------
272
+ The config command manages git config settings under the <project> section.
273
+
274
+ Summary:
275
+
276
+ git <project> config [--add] [--unset] <name> [<value>]
277
+
278
+ The config command operates much like git's built-in config command, except
279
+ all configuration keys are prefixed with <project>, keeping values under a
280
+ single project namespace. This is a convenient way to store parameters for
281
+ other commands. For example:
282
+
283
+ git <project> config builddir /path/to/build
284
+ git <project> add run build "make BUILDDIR={builddir} all"
285
+
286
+ Configuration kays may have their values substituted into other
287
+ configuration values via the {key} specifier. Special commands like build
288
+ perform the substitution recursively, so configuration vaalues may contain
289
+ substitutions of other configuration values which themselves contain
290
+ substitutions, and so on. Importantly, substitution only happens when
291
+ commands are run. Commands should document whether or not they perform
292
+ substitutions.
293
+
294
+ A git config ``sub-section`` may be substituted with its identifier. For
295
+ example:
296
+
297
+ git <project> worktree add myworktree
298
+ git <project> config builddir /path/to/{worktree}/build
299
+
300
+ Here, myworktree is the identifier of a specific worktree sub-section. If
301
+ myworktree is the currently active worktree (that is, the current directory
302
+ is under the myworktree root), then ``myworktree`` will substitute for
303
+ {woktree}.
304
+
305
+ See also:
306
+
307
+ run
308
+ worktree
309
+
310
+ help
311
+ ----
312
+ The help command displays tutorial-style help for commands.
313
+
314
+ Summary:
315
+
316
+ git <project> add help [--manpage] <subsection> <text>
317
+ git <project> help <command>
318
+
319
+ Users may add help to any project config section. For example:
320
+
321
+ git <project> add help run.build "Perform a build"
322
+ git <project> add help run.check "Run tests"
323
+
324
+ All help is stored under a <project>.help config sub-section. If a command
325
+ supports it, such help may appear in the command's own help output by
326
+ querying the appropriate <project>.help sub-section:
327
+
328
+ git <project> run --help
329
+
330
+ <standard help text>
331
+
332
+ build -- Perform a build
333
+ check -- Run tests
334
+
335
+ In this way projects can self-document their configurations. Normally
336
+ <text> is stored in <project>.help.<subsection>.short. With --manpage,
337
+ <text> is stored in <project>.help.<subsection>.manpage. Commands may
338
+ reference short help or manpages in various ways to present help.
339
+
340
+ See also:
341
+
342
+ run
343
+
344
+ init
345
+ ----
346
+ The init command initializes project state.
347
+
348
+ Summary:
349
+
350
+ git <project> init
351
+
352
+ Basic config entries are added to name the project and default branches.
353
+ Plugins may add options to enhance functionality. For example the worktree
354
+ command adds a --worktree option to convert an existing local clone to a
355
+ ``worktree layout.``
356
+
357
+ See also:
358
+
359
+ worktree
360
+
361
+ run
362
+ ---
363
+ The run command executes commands via a shell.
364
+
365
+ Summary:
366
+
367
+ git <project> add run <name> <command>
368
+ git <project> run --make-alias <name>
369
+ git <project> run <name>
370
+
371
+ Full shell substitution is supported, as well as config {key} substitution,
372
+ where the text ``{key}`` is replaced by key's value.
373
+
374
+ The add run command associates a command string with a name. The run
375
+ command itself invokes the command string via a shell. With --make-alias,
376
+ the run comand instead registers an alternative name for ``run.`` For
377
+ example:
378
+
379
+ git <project> run --make-alias build
380
+ git <project> add build all "make -C {path} all"
381
+ git <project> build all
382
+
383
+ Note that an alias will prevent ``run`` from invoking the command so in the
384
+ above example we could not invoke the build as such:
385
+
386
+ git <project> run all
387
+
388
+ In this way we may use the same <name> for different registered run aliases,
389
+ which can be convenient:
390
+
391
+ git <project> build all
392
+ git <project> check all
393
+
394
+ In general any project config {key} will be replaced with its value before
395
+ the command is executed. Substitution occurs recursively, so if a {key}
396
+ value itself contains a substitution string, it will be replaced as well.
397
+ There are a few special case substitutions. The {path} key will be replaced
398
+ by the absolute path to the root of the current workarea. The {branch} key
399
+ will be replaced by the currently-active branch nme. In addition the {run}
400
+ (or {build}, etc. aliases) will be replaced by their names. Again, an
401
+ example will make this more clear:
402
+
403
+ git <project> config cmd "make -C {path} BLDDIR=/path/to/{build} {build}"
404
+ git project add build all "{cmd}"
405
+ git project add build some "{cmd}"
406
+
407
+ We have configured two different build flavors, each which place build
408
+ results in separate directories and invoke different targets. Substitution
409
+ proceeds as follows:
410
+
411
+ git project build all -> make -C /cur/workarea BLDDIR=/path/to/all all
412
+ git project build some -> make -C /cur/workarea BLDDIR=/path/to/some some
413
+
414
+ Some plugins may add scoping rules to the project config, such that a scope
415
+ nested inside the project may override the global project config key value.
416
+ For example the worktree plugin adds a ``worktree`` scope. The worktree may
417
+ contain key values that override similar keys in the project config.
418
+
419
+ See also:
420
+
421
+ config
422
+ worktree
423
+
424
+ worktree
425
+ --------
426
+ The worktree command manages worktrees and connects them to projects.
427
+
428
+ Summary:
429
+
430
+ git <project> worktree add [-b <branch>] <name-or-path> [<committish>]
431
+ git <project> worktree rm <name-or-path>
432
+ git <project> worktree config <key> [<value>]
433
+ git <project> worktree config [--unset] <key> [<value>]
434
+
435
+ ``worktree add`` creates a new git worktree named via <name-or-path> with
436
+ <committish> checked out. If we pass -b <branch> we'll get a new branch at
437
+ HEAD or <committish> if it is given. The worktree name is either the given
438
+ name or if name-or-path is a path, the worktree name will be the same as the
439
+ last path component. If <name-or-path> is a simple name with no directory
440
+ separators, the worktree will be created as a sub-directory of the current
441
+ directory.
442
+
443
+ To keep things simple, we'll usually always name worktrees similarly (or
444
+ identically) to the branches they reference, though it is not strictly
445
+ necessary to do so.
446
+
447
+ The key idea behind project worktrees is that they are connected to various
448
+ ``artifacts.`` Worktrees are managed together with this artifacts to
449
+ provide a project-level view of various tasks. For example, a ``run``
450
+ command can create artifacts associated with a worktree. Removing the
451
+ worktree implicitly removes thee artifacts, making build cleanups easy and
452
+ convenient. Commands may use the {worktree} substitution to create
453
+ worktree-unique artifacts. Other substitutions may also referece {worktree}
454
+ in a recursive manner.
455
+
456
+ Here is a concrete example:
457
+
458
+ git <project> config srcdir "{path}"
459
+ git <project> config builddir "{srcdir}/build/{worktree}"
460
+ git <project> config make "make -C {srcdir} BUILDDIR={builddir} {build}"
461
+ git <project> run --make-alias build
462
+ git <project> add build release "{make}"
463
+
464
+ Assuming the build system uses BUILDDIR to determine where build artifacts
465
+ go, each worktree will get a unique set of build artifacts, via the
466
+ {builddir} and, recursively., {worktree} substitutions. When we delete the
467
+ worktree, we'll also delete the associoated build directory.
468
+
469
+ We associate artifacts with worktrees via the artifact commands.
470
+
471
+ Another important benefit of worktrees and associated builds is that
472
+ switching to work on a new worktree (by simply editing sources in a
473
+ different worktree directory) will not result in build artifacts from thte
474
+ previous worktree being overwritten. Thus we avoid the ``rebuild the
475
+ world`` problems of switching branches within the same workarea. Generally,
476
+ each created branch will have its own worktree and we will rarely, if ever,
477
+ switch branches within a worktree.
478
+
479
+ A worktree layers a config scope on top of the global project scope, so that
480
+ configuring a key in the worktree with the same name as a key in the project
481
+ will cause the worktree key's value to override the project key's value:
482
+
483
+ git <project> config buildwidth 16
484
+ git <project> worktree config buildwidth 32
485
+
486
+ If we are in a worktree configured with buildwidth=32, then wherever
487
+ {buildwidth} apeears (say, in a run command), the value 32 will be
488
+ substituted instead of 16. If we are outside the worktree (for example a
489
+ worktree without a buildwidth configured), then {buildwidth} will be
490
+ substituted with 16.
491
+
492
+ See also:
493
+
494
+ artifact
495
+ config
496
+ run
@@ -0,0 +1,29 @@
1
+ COPYING
2
+ MANIFEST.in
3
+ README.rst
4
+ setup.py
5
+ git_project_core_plugins/__init__.py
6
+ git_project_core_plugins/artifact.py
7
+ git_project_core_plugins/branch.py
8
+ git_project_core_plugins/clone.py
9
+ git_project_core_plugins/common.py
10
+ git_project_core_plugins/config.py
11
+ git_project_core_plugins/help.py
12
+ git_project_core_plugins/init.py
13
+ git_project_core_plugins/run.py
14
+ git_project_core_plugins/worktree.py
15
+ git_project_core_plugins.egg-info/PKG-INFO
16
+ git_project_core_plugins.egg-info/SOURCES.txt
17
+ git_project_core_plugins.egg-info/dependency_links.txt
18
+ git_project_core_plugins.egg-info/entry_points.txt
19
+ git_project_core_plugins.egg-info/not-zip-safe
20
+ git_project_core_plugins.egg-info/requires.txt
21
+ git_project_core_plugins.egg-info/top_level.txt
22
+ tests/test_artifact.py
23
+ tests/test_branch.py
24
+ tests/test_clone.py
25
+ tests/test_config.py
26
+ tests/test_help.py
27
+ tests/test_init.py
28
+ tests/test_run.py
29
+ tests/test_worktree.py
@@ -0,0 +1,9 @@
1
+ [git_project.plugins]
2
+ artifact = git_project_core_plugins.artifact:ArtifactPlugin
3
+ branch = git_project_core_plugins.branch:BranchPlugin
4
+ clone = git_project_core_plugins.clone:ClonePlugin
5
+ config = git_project_core_plugins.config:ConfigPlugin
6
+ help = git_project_core_plugins.help:HelpPlugin
7
+ init = git_project_core_plugins.init:InitPlugin
8
+ run = git_project_core_plugins.run:RunPlugin
9
+ worktree = git_project_core_plugins.worktree:WorktreePlugin
@@ -0,0 +1,3 @@
1
+ git_project>=0.0.17
2
+ progressbar2
3
+ pygit2
@@ -0,0 +1 @@
1
+ git_project_core_plugins
@@ -31,7 +31,7 @@ name = "git-project-core-plugins"
31
31
  dynamic = ["dependencies", "readme", "version"]
32
32
  description = "The extensible stupid project manager - core functionality"
33
33
  license = "AGPL-3.0-or-later"
34
- requires-python = ">=3"
34
+ requires-python = ">=3.9"
35
35
  authors = [
36
36
  { name = "David A. Greene", email = "dag@obbligato.org" },
37
37
  ]
@@ -95,7 +95,7 @@ cov = [
95
95
  ]
96
96
 
97
97
  [[tool.hatch.envs.all.matrix]]
98
- python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
98
+ python = ["3.9", "3.10", "3.11"]
99
99
 
100
100
  [tool.hatch.envs.lint]
101
101
  detached = true
@@ -18,5 +18,5 @@
18
18
  # You should have received a copy of the GNU Affero General Public License along
19
19
  # with git-project. If not, see <https://www.gnu.org/licenses/>.
20
20
 
21
- git-project >= 0.0.24
22
- progressbar
21
+ git-project >= 0.0.30
22
+ pytest-console-scripts
@@ -137,7 +137,7 @@ class Artifact(SubstitutableConfigObject):
137
137
  string: The string on which to perform substitution.
138
138
 
139
139
  """
140
- for path in self.iter_multival('path'):
140
+ for path in self.iter_multival('itempath'):
141
141
  path = self.substitute_value(git, poject, clargs, path)
142
142
 
143
143
  def command_artifact_add(git, gitproject, project, clargs):
@@ -146,7 +146,7 @@ def command_artifact_add(git, gitproject, project, clargs):
146
146
  path = clargs.path
147
147
 
148
148
  artifact = Artifact.get(git, project.get_section(), ident)
149
- artifact.add_item('path', path)
149
+ artifact.add_item('itempath', path)
150
150
 
151
151
  def command_artifact_rm(git, gitproject, project, clargs):
152
152
  """Implement git-project artifact rm."""
@@ -156,9 +156,9 @@ def command_artifact_rm(git, gitproject, project, clargs):
156
156
 
157
157
  if hasattr(clargs, 'path') and clargs.path:
158
158
  path = clargs.path
159
- artifact.rm_item('path', path)
159
+ artifact.rm_item('itempath', path)
160
160
  else:
161
- artifact.rm_items('path')
161
+ artifact.rm_items('itempath')
162
162
 
163
163
  class ArtifactPlugin(Plugin):
164
164
  """
@@ -328,7 +328,7 @@ the final git config section that will hold the artifact path.
328
328
  self._subsection)
329
329
 
330
330
  if artifact:
331
- for path in artifact.iter_multival('path'):
331
+ for path in artifact.iter_multival('itempath'):
332
332
  fullpath = artifact.substitute_value(self._git, project, path)
333
333
  run_command_with_shell(f'rm -rf {fullpath}',
334
334
  show_command=True)
@@ -131,6 +131,9 @@ def command_branch_prune(git, gitproject, project, clargs):
131
131
  branch_width=branch_width, status_width=status_width))
132
132
  print('-' * separator_width)
133
133
 
134
+ # FIXME: Prunes all branchs that start with the given name becuase
135
+ # iterrefnames does a startswith match. This is probably not what we should
136
+ # do.
134
137
  for branch in git.iterrefnames([ref]):
135
138
  status = 'merged' if project.branch_is_merged(branch) else 'unmerged'
136
139