git-project-core-plugins 0.0.22__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.
- git_project_core_plugins-0.0.23/.git +1 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/PKG-INFO +4 -4
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/_version.py +9 -4
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/PKG-INFO +4 -1
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/SOURCES.txt +9 -1
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/pyproject.toml +2 -2
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/requirements.txt +2 -2
- {git_project_core_plugins-0.0.22/build/lib → git_project_core_plugins-0.0.23/src}/git_project_core_plugins/artifact.py +5 -5
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/run.py +48 -11
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_artifact.py +7 -7
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_run.py +23 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_worktree.py +102 -4
- git_project_core_plugins-0.0.22/.git +0 -1
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/__init__.py +0 -27
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/branch.py +0 -222
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/clone.py +0 -98
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/common.py +0 -22
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/config.py +0 -169
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/help.py +0 -298
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/init.py +0 -74
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/run.py +0 -399
- git_project_core_plugins-0.0.22/build/lib/git_project_core_plugins/worktree.py +0 -643
- git_project_core_plugins-0.0.22/docs/README-template.rst +0 -104
- git_project_core_plugins-0.0.22/gen-readme.py +0 -55
- git_project_core_plugins-0.0.22/gen-readme.py~ +0 -2
- git_project_core_plugins-0.0.22/src/git_project_core_plugins/artifact.py +0 -323
- git_project_core_plugins-0.0.22/src/git_project_core_plugins/worktree.py~ +0 -647
- git_project_core_plugins-0.0.22/test.out +0 -38
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/COPYING +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/MANIFEST.in +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/Makefile +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/authors.rst +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/changelog.rst +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/conf.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/index.rst +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/intro.rst +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/license.rst +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/docs/make.bat +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/dependency_links.txt +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/entry_points.txt +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/not-zip-safe +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/requires.txt +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/git_project_core_plugins.egg-info/top_level.txt +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/__init__.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/branch.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/clone.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/common.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/config.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/help.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/init.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/src/git_project_core_plugins/worktree.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/common.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/conftest.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_branch.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_clone.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_config.py +0 -0
- {git_project_core_plugins-0.0.22 → git_project_core_plugins-0.0.23}/tests/test_help.py +0 -0
- {git_project_core_plugins-0.0.22 → 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
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: git-project-core-plugins
|
|
3
|
-
Version: 0.0.
|
|
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.
|
|
17
|
-
Requires-Dist:
|
|
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
|
|
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
|
|
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.
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
20
|
+
__version__ = version = '0.0.23'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 0, 23)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
2
|
+
Name: git_project_core_plugins
|
|
3
3
|
Version: 0.0.19
|
|
4
4
|
Summary: Core functionality for git-project
|
|
5
5
|
Home-page: http://github.com/greened/git-project-core-plugins
|
|
@@ -16,6 +16,9 @@ Classifier: Topic :: Software Development :: Version Control :: Git
|
|
|
16
16
|
Requires-Python: >=3
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
18
|
License-File: COPYING
|
|
19
|
+
Requires-Dist: git_project>=0.0.17
|
|
20
|
+
Requires-Dist: progressbar2
|
|
21
|
+
Requires-Dist: pygit2
|
|
19
22
|
|
|
20
23
|
************************
|
|
21
24
|
git-project-core-plugins
|
|
@@ -18,4 +18,12 @@ git_project_core_plugins.egg-info/dependency_links.txt
|
|
|
18
18
|
git_project_core_plugins.egg-info/entry_points.txt
|
|
19
19
|
git_project_core_plugins.egg-info/not-zip-safe
|
|
20
20
|
git_project_core_plugins.egg-info/requires.txt
|
|
21
|
-
git_project_core_plugins.egg-info/top_level.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
|
|
@@ -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.
|
|
98
|
+
python = ["3.9", "3.10", "3.11"]
|
|
99
99
|
|
|
100
100
|
[tool.hatch.envs.lint]
|
|
101
101
|
detached = true
|
|
@@ -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('
|
|
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('
|
|
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('
|
|
159
|
+
artifact.rm_item('itempath', path)
|
|
160
160
|
else:
|
|
161
|
-
artifact.rm_items('
|
|
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('
|
|
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)
|
|
@@ -90,8 +90,7 @@ class RunConfig(ConfigObject):
|
|
|
90
90
|
**kwargs)
|
|
91
91
|
|
|
92
92
|
class RunPlugin(Plugin):
|
|
93
|
-
"""
|
|
94
|
-
The run command executes commands via a shell.
|
|
93
|
+
"""The run command executes commands via a shell.
|
|
95
94
|
|
|
96
95
|
Summary:
|
|
97
96
|
|
|
@@ -108,7 +107,7 @@ class RunPlugin(Plugin):
|
|
|
108
107
|
example:
|
|
109
108
|
|
|
110
109
|
git <project> run --make-alias build
|
|
111
|
-
git <project> add build all "make -C {
|
|
110
|
+
git <project> add build all "make -C {git_workdir} all"
|
|
112
111
|
git <project> build all
|
|
113
112
|
|
|
114
113
|
Note that an alias will prevent ``run'' from invoking the command so in the
|
|
@@ -125,15 +124,15 @@ class RunPlugin(Plugin):
|
|
|
125
124
|
In general any project config {key} will be replaced with its value before
|
|
126
125
|
the command is executed. Substitution occurs recursively, so if a {key}
|
|
127
126
|
value itself contains a substitution string, it will be replaced as well.
|
|
128
|
-
There are a few special case substitutions. The {
|
|
129
|
-
by the absolute path to the root of the current workarea. The
|
|
130
|
-
will be replaced by the currently-active branch nme. In
|
|
131
|
-
(or {build}, etc. aliases) will be replaced by their
|
|
132
|
-
example will make this more clear:
|
|
127
|
+
There are a few special case substitutions. The {git_workdir} key will be
|
|
128
|
+
replaced by the absolute path to the root of the current workarea. The
|
|
129
|
+
{branch} key will be replaced by the currently-active branch nme. In
|
|
130
|
+
addition the {run} (or {build}, etc. aliases) will be replaced by their
|
|
131
|
+
names. Again, an example will make this more clear:
|
|
133
132
|
|
|
134
|
-
git <project> config cmd "make -C {
|
|
135
|
-
git project add build all "{cmd}"
|
|
136
|
-
|
|
133
|
+
git <project> config cmd "make -C {git_workdir} BLDDIR=/path/to/{build}
|
|
134
|
+
{build}" git project add build all "{cmd}" git project add build some
|
|
135
|
+
"{cmd}"
|
|
137
136
|
|
|
138
137
|
We have configured two different build flavors, each which place build
|
|
139
138
|
results in separate directories and invoke different targets. Substitution
|
|
@@ -142,6 +141,41 @@ class RunPlugin(Plugin):
|
|
|
142
141
|
git project build all -> make -C /cur/workarea BLDDIR=/path/to/all all
|
|
143
142
|
git project build some -> make -C /cur/workarea BLDDIR=/path/to/some some
|
|
144
143
|
|
|
144
|
+
Extra options passed to the run command may be referenced in the command
|
|
145
|
+
string:
|
|
146
|
+
|
|
147
|
+
git project add build extra "echo {options}"
|
|
148
|
+
git project build extra hello world! -> echo hello world!
|
|
149
|
+
|
|
150
|
+
Individual options may also be referenced:
|
|
151
|
+
|
|
152
|
+
git project add build extra "echo {options_1} {options_0}"
|
|
153
|
+
git project build extra hello world! -> echo world! hello
|
|
154
|
+
|
|
155
|
+
A special dash-separated "key" string composed of option values may be
|
|
156
|
+
generated:
|
|
157
|
+
|
|
158
|
+
git project add build any "make {option_key}"
|
|
159
|
+
git project build any target debug -> make target-debug
|
|
160
|
+
|
|
161
|
+
A special {option_keysep} substitution will result in a - if there are
|
|
162
|
+
options and the empty string otherwisa:
|
|
163
|
+
|
|
164
|
+
git project add build build any "make my{option_keysep}{option_key}"
|
|
165
|
+
git project build any target debug -> make my-target-debug
|
|
166
|
+
git project build any -> make my
|
|
167
|
+
|
|
168
|
+
Other substitutions may be used in options:
|
|
169
|
+
|
|
170
|
+
git project add build branch "make {options}"
|
|
171
|
+
git project build branch {branch} -> make dev # On the dev branch
|
|
172
|
+
|
|
173
|
+
A special substitution {option_names} is a space-separated list of option
|
|
174
|
+
values with no additional substitutions:
|
|
175
|
+
|
|
176
|
+
git project add build branch "make {option_names} {options}"
|
|
177
|
+
git project build branch {branch} -> make branch dev # On the dev branch
|
|
178
|
+
|
|
145
179
|
Some plugins may add scoping rules to the project config, such that a scope
|
|
146
180
|
nested inside the project may override the global project config key value.
|
|
147
181
|
For example the worktree plugin adds a ``worktree'' scope. The worktree may
|
|
@@ -358,6 +392,9 @@ class RunPlugin(Plugin):
|
|
|
358
392
|
'option_keysep': '-' if len(clargs.options) > 0 else ''
|
|
359
393
|
}
|
|
360
394
|
|
|
395
|
+
for i, option in enumerate(clargs.options):
|
|
396
|
+
formats[f'options_{i}'] = option
|
|
397
|
+
|
|
361
398
|
run.run(git, project, formats)
|
|
362
399
|
|
|
363
400
|
run_parser.set_defaults(func=command_run)
|
|
@@ -95,10 +95,10 @@ def test_artifact_get(reset_directory,
|
|
|
95
95
|
artifact = Artifact.get(git,
|
|
96
96
|
project.get_section(),
|
|
97
97
|
'worktree',
|
|
98
|
-
|
|
98
|
+
itempath='{builddir}')
|
|
99
99
|
|
|
100
100
|
assert artifact._section == 'project.artifact.worktree'
|
|
101
|
-
assert artifact.
|
|
101
|
+
assert artifact.itempath == '{builddir}'
|
|
102
102
|
|
|
103
103
|
def test_artifact_add(git_project_runner,
|
|
104
104
|
git):
|
|
@@ -114,7 +114,7 @@ def test_artifact_add(git_project_runner,
|
|
|
114
114
|
'{builddir}')
|
|
115
115
|
|
|
116
116
|
check_config_file('project.artifact.worktree',
|
|
117
|
-
'
|
|
117
|
+
'itempath',
|
|
118
118
|
{'{builddir}'})
|
|
119
119
|
|
|
120
120
|
def test_artifact_rm_item(git_project_runner,
|
|
@@ -138,7 +138,7 @@ def test_artifact_rm_item(git_project_runner,
|
|
|
138
138
|
'{installdir}')
|
|
139
139
|
|
|
140
140
|
check_config_file('project.artifact.worktree',
|
|
141
|
-
'
|
|
141
|
+
'itempath',
|
|
142
142
|
{'{builddir}', '{installdir}'})
|
|
143
143
|
|
|
144
144
|
git_project_runner.run('.*',
|
|
@@ -149,7 +149,7 @@ def test_artifact_rm_item(git_project_runner,
|
|
|
149
149
|
'\\\\{builddir\\\\}')
|
|
150
150
|
|
|
151
151
|
check_config_file('project.artifact.worktree',
|
|
152
|
-
'
|
|
152
|
+
'itempath',
|
|
153
153
|
{'{installdir}'})
|
|
154
154
|
|
|
155
155
|
def test_artifact_rm_items(git_project_runner,
|
|
@@ -174,7 +174,7 @@ def test_artifact_rm_items(git_project_runner,
|
|
|
174
174
|
'{installdir}')
|
|
175
175
|
|
|
176
176
|
check_config_file('project.artifact.worktree',
|
|
177
|
-
'
|
|
177
|
+
'itempath',
|
|
178
178
|
{'{builddir}', '{installdir}'})
|
|
179
179
|
|
|
180
180
|
git_project_runner.run('.*',
|
|
@@ -184,7 +184,7 @@ def test_artifact_rm_items(git_project_runner,
|
|
|
184
184
|
'worktree')
|
|
185
185
|
|
|
186
186
|
check_config_file('project.artifact.worktree',
|
|
187
|
-
'
|
|
187
|
+
'itempath',
|
|
188
188
|
{'{builddir}, ''{installdir}'},
|
|
189
189
|
section_present = False)
|
|
190
190
|
|
|
@@ -383,3 +383,26 @@ def test_run_substitute_empty_option_name_key(git_project_runner,
|
|
|
383
383
|
'.*',
|
|
384
384
|
'run',
|
|
385
385
|
'test')
|
|
386
|
+
|
|
387
|
+
def test_run_substitute_option_positions(git_project_runner,
|
|
388
|
+
git,
|
|
389
|
+
capsys):
|
|
390
|
+
workdir = git.get_working_copy_root()
|
|
391
|
+
|
|
392
|
+
git_project_runner.chdir(workdir)
|
|
393
|
+
|
|
394
|
+
# Add a run.
|
|
395
|
+
git_project_runner.run('.*',
|
|
396
|
+
'',
|
|
397
|
+
'add',
|
|
398
|
+
'run',
|
|
399
|
+
'test',
|
|
400
|
+
'{git_workdir}/buildit {options_1} {run} {options_0}')
|
|
401
|
+
|
|
402
|
+
# Check run invocation.
|
|
403
|
+
git_project_runner.run(re.escape(f'{workdir}/buildit foo test master'),
|
|
404
|
+
'.*',
|
|
405
|
+
'run',
|
|
406
|
+
'test',
|
|
407
|
+
'{branch}',
|
|
408
|
+
'foo')
|
|
@@ -456,6 +456,7 @@ def test_worktree_add(git,
|
|
|
456
456
|
assert os.path.exists(workarea.parent / 'test')
|
|
457
457
|
assert git.branch_name_to_refname('test') == 'refs/heads/test'
|
|
458
458
|
|
|
459
|
+
|
|
459
460
|
def test_worktree_add_subdir(git,
|
|
460
461
|
git_project_runner,
|
|
461
462
|
tmp_path_factory):
|
|
@@ -472,10 +473,107 @@ def test_worktree_add_subdir(git,
|
|
|
472
473
|
'',
|
|
473
474
|
'worktree',
|
|
474
475
|
'add',
|
|
475
|
-
'../user/
|
|
476
|
+
'../user/test2',
|
|
477
|
+
'master')
|
|
478
|
+
|
|
479
|
+
assert os.path.exists(workarea.parent / 'user' / 'test2')
|
|
480
|
+
os.chdir(workarea.parent / 'user' / 'test2')
|
|
481
|
+
git = git_project.Git() # Reinitialize in new workarea.
|
|
482
|
+
assert git.get_current_branch() == 'user/test2'
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
def test_worktree_rm(git, git_project_runner, tmp_path_factory):
|
|
486
|
+
workarea = git.get_working_copy_root()
|
|
487
|
+
|
|
488
|
+
os.chdir(workarea)
|
|
489
|
+
|
|
490
|
+
git = git_project.Git() # Reinitialize in new workarea.
|
|
491
|
+
|
|
492
|
+
assert os.path.exists(workarea / '.git')
|
|
493
|
+
assert os.path.exists(workarea / 'MergedRemote.txt')
|
|
494
|
+
|
|
495
|
+
git_project_runner.chdir(workarea)
|
|
496
|
+
|
|
497
|
+
git_project_runner.run('.*',
|
|
498
|
+
'',
|
|
499
|
+
'worktree',
|
|
500
|
+
'add',
|
|
501
|
+
'../user/test_rm',
|
|
502
|
+
'master')
|
|
503
|
+
|
|
504
|
+
assert os.path.exists(workarea.parent / 'user' / 'test_rm')
|
|
505
|
+
os.chdir(workarea.parent / 'user' / 'test_rm')
|
|
506
|
+
git = git_project.Git() # Reinitialize in new workarea.
|
|
507
|
+
assert git.get_current_branch() == 'user/test_rm'
|
|
508
|
+
|
|
509
|
+
assert os.path.exists(workarea.parent / 'user' / 'test_rm')
|
|
510
|
+
|
|
511
|
+
os.chdir(workarea)
|
|
512
|
+
git_project_runner.chdir(workarea)
|
|
513
|
+
|
|
514
|
+
git_project_runner.run('.*',
|
|
515
|
+
'',
|
|
516
|
+
'worktree',
|
|
517
|
+
'rm',
|
|
518
|
+
'test_rm')
|
|
519
|
+
|
|
520
|
+
assert not os.path.exists(workarea.parent / 'user' / 'test_rm')
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
def test_worktree_add_in_workarea(git,
|
|
524
|
+
git_project_runner,
|
|
525
|
+
tmp_path_factory):
|
|
526
|
+
workarea = git.get_working_copy_root()
|
|
527
|
+
|
|
528
|
+
os.chdir(workarea)
|
|
529
|
+
|
|
530
|
+
assert os.path.exists(workarea / '.git')
|
|
531
|
+
assert os.path.exists(workarea / 'MergedRemote.txt')
|
|
532
|
+
|
|
533
|
+
git_project_runner.chdir(workarea)
|
|
534
|
+
|
|
535
|
+
git_project_runner.run('.*',
|
|
536
|
+
'',
|
|
537
|
+
'worktree',
|
|
538
|
+
'add',
|
|
539
|
+
'test_workarea',
|
|
476
540
|
'master')
|
|
477
541
|
|
|
478
|
-
assert os.path.exists(workarea
|
|
479
|
-
os.chdir(workarea
|
|
542
|
+
assert os.path.exists(workarea / 'test_workarea')
|
|
543
|
+
os.chdir(workarea / 'test_workarea')
|
|
480
544
|
git = git_project.Git() # Reinitialize in new workarea.
|
|
481
|
-
assert git.get_current_branch() == '
|
|
545
|
+
assert git.get_current_branch() == 'test_workarea'
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def test_worktree_rm_in_workarea(git, git_project_runner, tmp_path_factory):
|
|
549
|
+
workarea = git.get_working_copy_root()
|
|
550
|
+
|
|
551
|
+
os.chdir(workarea)
|
|
552
|
+
|
|
553
|
+
assert os.path.exists(workarea / '.git')
|
|
554
|
+
assert os.path.exists(workarea / 'MergedRemote.txt')
|
|
555
|
+
|
|
556
|
+
git_project_runner.chdir(workarea)
|
|
557
|
+
|
|
558
|
+
git_project_runner.run('.*',
|
|
559
|
+
'',
|
|
560
|
+
'worktree',
|
|
561
|
+
'add',
|
|
562
|
+
'test_rm_workarea',
|
|
563
|
+
'master')
|
|
564
|
+
|
|
565
|
+
assert os.path.exists(workarea / 'test_rm_workarea')
|
|
566
|
+
os.chdir(workarea / 'test_rm_workarea')
|
|
567
|
+
git = git_project.Git() # Reinitialize in new workarea.
|
|
568
|
+
assert git.get_current_branch() == 'test_rm_workarea'
|
|
569
|
+
|
|
570
|
+
os.chdir(workarea)
|
|
571
|
+
git_project_runner.chdir(workarea)
|
|
572
|
+
|
|
573
|
+
git_project_runner.run('.*',
|
|
574
|
+
'',
|
|
575
|
+
'worktree',
|
|
576
|
+
'rm',
|
|
577
|
+
'test_rm_workarea')
|
|
578
|
+
|
|
579
|
+
assert not os.path.exists(workarea / 'test_rm_workarea')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
gitdir: /Users/dag/projects/git-project-core-plugins/.git/worktrees/master/
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
#
|
|
3
|
-
# Copyright 2020 David A. Greene
|
|
4
|
-
#
|
|
5
|
-
# This program is free software: you can redistribute it and/or modify it under
|
|
6
|
-
# the terms of the GNU General Public License as published by the Free Software
|
|
7
|
-
# Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
-
# version.
|
|
9
|
-
#
|
|
10
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
11
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
12
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
13
|
-
# details.
|
|
14
|
-
#
|
|
15
|
-
# You should have received a copy of the GNU General Public License along with
|
|
16
|
-
# this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
from .artifact import Artifact, ArtifactPlugin
|
|
20
|
-
from .branch import BranchPlugin
|
|
21
|
-
from .run import RunPlugin
|
|
22
|
-
from .clone import ClonePlugin
|
|
23
|
-
from .common import add_plugin_version_argument
|
|
24
|
-
from .config import ConfigPlugin
|
|
25
|
-
from .help import Help, HelpPlugin
|
|
26
|
-
from .init import InitPlugin
|
|
27
|
-
from .worktree import Worktree, WorktreePlugin
|