git-project-core-plugins 0.0.28__tar.gz → 0.0.29__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.
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/PKG-INFO +103 -5
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/_version.py +2 -2
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/changelog.rst +26 -1
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/requirements.txt +1 -1
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/__init__.py +3 -1
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/artifact.py +4 -1
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/run.py +5 -7
- git_project_core_plugins-0.0.29/src/git_project_core_plugins/worktree.py +1715 -0
- git_project_core_plugins-0.0.29/tests/conftest.py +148 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_worktree.py +805 -0
- git_project_core_plugins-0.0.28/src/git_project_core_plugins/worktree.py +0 -828
- git_project_core_plugins-0.0.28/tests/conftest.py +0 -76
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/.gitignore +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/COPYING +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/MANIFEST.in +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/Makefile +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/authors.rst +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/commands.rst +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/conf.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/index.rst +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/intro.rst +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/license.rst +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/docs/make.bat +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/hatch_build.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/pyproject.toml +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/_commanddocs.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/branch.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/clone.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/common.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/config.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/help.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/src/git_project_core_plugins/init.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/common.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_artifact.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_branch.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_clone.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_config.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_help.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_init.py +0 -0
- {git_project_core_plugins-0.0.28 → git_project_core_plugins-0.0.29}/tests/test_run.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: git-project-core-plugins
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.29
|
|
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
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
|
-
Requires-Dist: git-project>=0.0.
|
|
17
|
+
Requires-Dist: git-project>=0.0.41
|
|
18
18
|
Requires-Dist: pytest-console-scripts
|
|
19
19
|
Provides-Extra: test
|
|
20
20
|
Requires-Dist: git-project; extra == 'test'
|
|
@@ -76,7 +76,9 @@ fails if ``.git`` resolves to a directory there. A repository that is already
|
|
|
76
76
|
bare when ``init --worktree`` runs keeps its name and gets no ``.git`` file,
|
|
77
77
|
and its parent directory holds the worktrees. Any conversion will abort if
|
|
78
78
|
the worktree is dirty. Typically, an ordinary ``git clone`` is followed
|
|
79
|
-
immediately by ``git <project> init --worktree``.
|
|
79
|
+
immediately by ``git <project> init --worktree``. A clone already in use, with
|
|
80
|
+
its own branches and linked worktrees, is converted with ``git <project>
|
|
81
|
+
worktree migrate`` instead, which keeps them all.
|
|
80
82
|
|
|
81
83
|
Either route also creates a worktree for the project's main branch, so the
|
|
82
84
|
layout is usable straight away. The main branch is taken from the repository
|
|
@@ -145,7 +147,10 @@ Summary::
|
|
|
145
147
|
associated file-system object. The ``artifact rm`` command simply removes
|
|
146
148
|
an artifact association, it does not remove the artifact itself. A
|
|
147
149
|
<subsection> may hold several paths. With <path>, ``artifact rm`` removes
|
|
148
|
-
only that association.
|
|
150
|
+
only that association. <path> is a regular expression that git matches
|
|
151
|
+
against each path as it was added, before substitution. Escape characters
|
|
152
|
+
such as ``{`` and ``.`` to match them literally. A <path> that matches
|
|
153
|
+
more than one path removes none of them.
|
|
149
154
|
|
|
150
155
|
For example::
|
|
151
156
|
|
|
@@ -474,6 +479,7 @@ Summary::
|
|
|
474
479
|
git <project> worktree rm [-f] [--keep-branch] [--keep-remote-branch]
|
|
475
480
|
<name>
|
|
476
481
|
git <project> worktree config <ident> [--add] [--unset] <name> [<value>]
|
|
482
|
+
git <project> worktree migrate [--apply]
|
|
477
483
|
|
|
478
484
|
``worktree add`` creates a worktree at <name-or-path> and checks out a
|
|
479
485
|
branch in it. The worktree's name is the last component of <name-or-path>.
|
|
@@ -570,12 +576,104 @@ itself as the top-level directory, where a plain clone makes a new one.
|
|
|
570
576
|
be clean. The conversion deletes every file in the top-level directory
|
|
571
577
|
except the git directory, so preserve anything there that is not part of
|
|
572
578
|
the repository. Only the main branch gets a worktree, so a different
|
|
573
|
-
checked-out branch gets none, though one is easy to add afterward.
|
|
579
|
+
checked-out branch gets none, though one is easy to add afterward. To
|
|
580
|
+
convert a clone you work in, with its branches and linked worktrees, use
|
|
581
|
+
``worktree migrate`` instead.
|
|
574
582
|
|
|
575
583
|
On a repository that is already bare, ``init --worktree`` deletes nothing.
|
|
576
584
|
It refuses to run while a branch other than the main one exists, because it
|
|
577
585
|
cannot know which remote each branch should go to.
|
|
578
586
|
|
|
587
|
+
``worktree migrate`` converts a flat clone, one whose ``.git`` is a
|
|
588
|
+
directory, to the worktree layout. Every branch, ref, stash and config
|
|
589
|
+
value stays. Each linked worktree moves into the top-level directory. The
|
|
590
|
+
files of the main worktree, ignored ones too, move into a worktree named
|
|
591
|
+
for the main branch. Without ``--apply`` it prints each step and changes
|
|
592
|
+
nothing. One exception applies to every git-project command: before the
|
|
593
|
+
command runs, git-project may set ``<project>.branch`` and
|
|
594
|
+
``<project>.remote`` when they are unset.
|
|
595
|
+
|
|
596
|
+
The main branch is the first branch the project configures that exists
|
|
597
|
+
locally. Failing that, it is ``main``, then ``master``, then the only
|
|
598
|
+
local branch. The main clone must have it checked out. A linked worktree
|
|
599
|
+
named ``<top>-<rest>``, where <top> is the name of the top-level
|
|
600
|
+
directory, moves to ``<rest>``. Any other moves to a directory named for
|
|
601
|
+
its branch, with each ``/`` turned into ``-``. So ``proj-topic`` beside
|
|
602
|
+
``proj`` becomes ``proj/topic``, and a worktree on ``user/feature``
|
|
603
|
+
becomes ``proj/user-feature``.
|
|
604
|
+
|
|
605
|
+
It refuses when a worktree has changes or untracked files, is locked,
|
|
606
|
+
prunable or missing, or has a detached HEAD. It refuses during a merge,
|
|
607
|
+
cherry-pick, revert, rebase or bisect. It refuses a worktree with
|
|
608
|
+
submodules, a sparse checkout, or assume-unchanged or skip-worktree
|
|
609
|
+
files. It refuses a linked worktree inside <top> or on another
|
|
610
|
+
filesystem, and a mount point in <top>. It refuses when two worktrees
|
|
611
|
+
get the same target directory or worktree name, and when a target
|
|
612
|
+
directory exists. It refuses when ``core.worktree`` is set, or when the
|
|
613
|
+
main worktree's ``config.worktree`` sets ``core.bare``. It refuses when
|
|
614
|
+
``extensions.relativeWorktrees`` or ``worktree.useRelativePaths`` is
|
|
615
|
+
true, because the repair writes absolute links. It also refuses when the
|
|
616
|
+
project remote has no url, when GIT_DIR or a variable like it is set,
|
|
617
|
+
with git older than 2.36, and on a clone already converted. It reports
|
|
618
|
+
every reason it finds and makes no change of its own. Some basic checks,
|
|
619
|
+
such as the git version, stop it before the rest run.
|
|
620
|
+
|
|
621
|
+
Each worktree's config moves with it. A ``worktreepath`` entry for an
|
|
622
|
+
old path stays and is reported, so remove it by hand. A project value
|
|
623
|
+
that holds an old path, such as ``<project>.builddir`` set to
|
|
624
|
+
``<old>/build``, gets a warning that names its key and not its value. The
|
|
625
|
+
warning does not stop the migration, so fix the value by hand. A tool
|
|
626
|
+
that records absolute paths, such as a Python virtualenv, may need to be
|
|
627
|
+
made again.
|
|
628
|
+
|
|
629
|
+
``--apply`` writes the plan to ``git-project-migrate.json`` in the git
|
|
630
|
+
directory. Before each step runs, its name goes in ``current_step``.
|
|
631
|
+
When the step finishes, it is added to the ``steps_done`` list. The
|
|
632
|
+
migration stops at the first failure and names the step in
|
|
633
|
+
``failed_step``. A hard stop, such as a kill, leaves no
|
|
634
|
+
``failed_step``, so read ``current_step``. The error names the
|
|
635
|
+
manifest. After a stop in ``rename_store`` it is at either
|
|
636
|
+
<top>/.git or <store_new>.
|
|
637
|
+
|
|
638
|
+
Manual rollback. Undo the steps that ``steps_done`` lists, in the order
|
|
639
|
+
below. The failed step, or the current step after a hard stop, may be
|
|
640
|
+
fully done, partly done, or not done. Check it as its comment below
|
|
641
|
+
says, and undo it when it is done or partly done. Take <top>,
|
|
642
|
+
<store_new>, <main> and the other values from the manifest. <main> is
|
|
643
|
+
``main.new`` and each <new> and <old> is a ``linked`` entry. The steps
|
|
644
|
+
``verify``, ``repair``, ``reset_index`` and ``copy_main_state`` need
|
|
645
|
+
nothing::
|
|
646
|
+
|
|
647
|
+
# write_pointer: done when <top>/.git is a file
|
|
648
|
+
rm <top>/.git
|
|
649
|
+
# rename_store: done when <store_new> exists
|
|
650
|
+
mv <store_new> <top>/.git
|
|
651
|
+
git -C <top> worktree repair <new>...
|
|
652
|
+
# detach_head: undo it either way
|
|
653
|
+
git --git-dir=<top>/.git symbolic-ref HEAD <head_ref>
|
|
654
|
+
# set_bare: done when this prints true
|
|
655
|
+
git --git-dir=<top>/.git config core.bare
|
|
656
|
+
# set_bare, when core_bare is not null
|
|
657
|
+
git --git-dir=<top>/.git config core.bare <core_bare>
|
|
658
|
+
# set_bare, when core_bare is null
|
|
659
|
+
git --git-dir=<top>/.git config --unset core.bare
|
|
660
|
+
# each move_entry <entry>: done when <main>/<entry> exists
|
|
661
|
+
mv <main>/<entry> <top>/<entry>
|
|
662
|
+
# add_main: done when <main> exists
|
|
663
|
+
rm -f <main>/.git
|
|
664
|
+
rmdir <main>
|
|
665
|
+
git -C <top> worktree prune
|
|
666
|
+
# each move_linked: done when <new> exists
|
|
667
|
+
git -C <top> worktree repair <new>
|
|
668
|
+
git -C <top> worktree move <new> <old>
|
|
669
|
+
# then, if any move_linked was undone
|
|
670
|
+
git -C <top> worktree repair <old>...
|
|
671
|
+
# write_config: undo it either way. Set each config_writes key
|
|
672
|
+
# back to its prior value, or unset it when prior is null.
|
|
673
|
+
# last, remove the manifest
|
|
674
|
+
rm -f <top>/.git/git-project-migrate.json
|
|
675
|
+
rm -f <top>/.git/git-project-migrate.json.tmp
|
|
676
|
+
|
|
579
677
|
See also::
|
|
580
678
|
|
|
581
679
|
artifact
|
|
@@ -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.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
21
|
+
__version__ = version = '0.0.29'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 0, 29)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -31,6 +31,30 @@ ChangeLog
|
|
|
31
31
|
`Unreleased`_
|
|
32
32
|
-------------
|
|
33
33
|
|
|
34
|
+
`0.0.29`_ - 2026-10-06
|
|
35
|
+
----------------------
|
|
36
|
+
Added
|
|
37
|
+
.....
|
|
38
|
+
- ``worktree migrate`` converts a flat clone and its linked worktrees to the
|
|
39
|
+
worktree layout. It keeps every branch, ref, stash and config, and changes
|
|
40
|
+
nothing without ``--apply``.
|
|
41
|
+
|
|
42
|
+
Changed
|
|
43
|
+
.......
|
|
44
|
+
- core-plugins now needs git-project 0.0.41 or later. That release no
|
|
45
|
+
longer evaluates a config value as Python, so an expression such as
|
|
46
|
+
``{branch.replace(...)}`` in a config value stays as written. Only a
|
|
47
|
+
plain ``{name}`` is replaced.
|
|
48
|
+
- The ``artifact`` manual says that the <path> given to ``artifact rm`` is
|
|
49
|
+
a regular expression. Escape characters such as ``{`` and ``.`` to match
|
|
50
|
+
them literally.
|
|
51
|
+
|
|
52
|
+
Fixed
|
|
53
|
+
.....
|
|
54
|
+
- ``worktree rm`` stopped removing directories at the first one it could
|
|
55
|
+
not remove. A worktree with no builddir kept its prefix and installdir.
|
|
56
|
+
Each directory is now removed on its own.
|
|
57
|
+
|
|
34
58
|
`0.0.28`_ - 2026-10-05
|
|
35
59
|
----------------------
|
|
36
60
|
Changed
|
|
@@ -144,7 +168,8 @@ Fixed
|
|
|
144
168
|
404. Issues named ``unknown/greened``, a leftover from hatch's project
|
|
145
169
|
template, and Documentation misspelled the package name.
|
|
146
170
|
|
|
147
|
-
.. _Unreleased: https://github.com/greened/git-project-core-plugins/compare/v0.0.
|
|
171
|
+
.. _Unreleased: https://github.com/greened/git-project-core-plugins/compare/v0.0.29...HEAD
|
|
172
|
+
.. _0.0.29: https://github.com/greened/git-project-core-plugins/compare/v0.0.28...v0.0.29
|
|
148
173
|
.. _0.0.28: https://github.com/greened/git-project-core-plugins/compare/v0.0.27...v0.0.28
|
|
149
174
|
.. _0.0.27: https://github.com/greened/git-project-core-plugins/compare/v0.0.26...v0.0.27
|
|
150
175
|
.. _0.0.26: https://github.com/greened/git-project-core-plugins/compare/v0.0.25...v0.0.26
|
|
@@ -73,7 +73,9 @@ fails if ``.git`` resolves to a directory there. A repository that is already
|
|
|
73
73
|
bare when ``init --worktree`` runs keeps its name and gets no ``.git`` file,
|
|
74
74
|
and its parent directory holds the worktrees. Any conversion will abort if
|
|
75
75
|
the worktree is dirty. Typically, an ordinary ``git clone`` is followed
|
|
76
|
-
immediately by ``git <project> init --worktree``.
|
|
76
|
+
immediately by ``git <project> init --worktree``. A clone already in use, with
|
|
77
|
+
its own branches and linked worktrees, is converted with ``git <project>
|
|
78
|
+
worktree migrate`` instead, which keeps them all.
|
|
77
79
|
|
|
78
80
|
Either route also creates a worktree for the project's main branch, so the
|
|
79
81
|
layout is usable straight away. The main branch is taken from the repository
|
|
@@ -241,7 +241,10 @@ class ArtifactPlugin(Plugin):
|
|
|
241
241
|
associated file-system object. The ``artifact rm`` command simply removes
|
|
242
242
|
an artifact association, it does not remove the artifact itself. A
|
|
243
243
|
<subsection> may hold several paths. With <path>, ``artifact rm`` removes
|
|
244
|
-
only that association.
|
|
244
|
+
only that association. <path> is a regular expression that git matches
|
|
245
|
+
against each path as it was added, before substitution. Escape characters
|
|
246
|
+
such as ``{`` and ``.`` to match them literally. A <path> that matches
|
|
247
|
+
more than one path removes none of them.
|
|
245
248
|
|
|
246
249
|
For example::
|
|
247
250
|
|
|
@@ -362,8 +362,7 @@ class RunPlugin(Plugin):
|
|
|
362
362
|
translation_table = dict.fromkeys(map(ord, "{}"), None)
|
|
363
363
|
|
|
364
364
|
# An option may name a value, such as {branch}. Only a plain
|
|
365
|
-
# {name} is looked up
|
|
366
|
-
# given as Python, so anything else in braces stays text.
|
|
365
|
+
# {name} is looked up, so anything else in braces stays text.
|
|
367
366
|
def substitute_names(option):
|
|
368
367
|
return re.sub(
|
|
369
368
|
r"\{([A-Za-z_][A-Za-z0-9_]*)\}",
|
|
@@ -382,11 +381,10 @@ class RunPlugin(Plugin):
|
|
|
382
381
|
|
|
383
382
|
# The command runs through a shell, so each word from the
|
|
384
383
|
# command line is shell-quoted, or a ';' in one would run as
|
|
385
|
-
# shell. The
|
|
386
|
-
#
|
|
387
|
-
#
|
|
388
|
-
# word
|
|
389
|
-
# afterward.
|
|
384
|
+
# shell. The quoted words stay out of the substitution, which
|
|
385
|
+
# would expand braces in them again. So a plain placeholder
|
|
386
|
+
# stands in for each word during substitution, and the quoted
|
|
387
|
+
# word replaces it afterward.
|
|
390
388
|
token = secrets.token_hex(8)
|
|
391
389
|
|
|
392
390
|
def placeholder(name):
|