git-project 0.0.29__tar.gz → 0.0.31__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-0.0.31/.git +1 -0
- {git_project-0.0.29 → git_project-0.0.31}/PKG-INFO +1 -1
- {git_project-0.0.29 → git_project-0.0.31}/_version.py +2 -2
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/git.py +4 -4
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/substitutable.py +3 -1
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_git.py +28 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_substitutable.py +45 -0
- git_project-0.0.29/.git +0 -1
- git_project-0.0.29/test.out +0 -131
- {git_project-0.0.29 → git_project-0.0.31}/.gitignore +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/CONTRIBUTORS +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/COPYING +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/MANIFEST.in +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/Makefile +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/authors.rst +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/changelog.rst +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/conf.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/index.rst +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/intro.rst +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/license.rst +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/docs/make.bat +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/pyproject.toml +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/requirements.txt +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/__init__.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/commandline.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/configobj.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/exception.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/gitproject.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/main.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/parsermanager.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/plugin.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/pluginmanager.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/project.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/runnable.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/scopedobj.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/shell.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/test_support/__init__.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/src/git_project/test_support/common.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/conftest.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_confobj.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_gitproject.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_main.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_project.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_runnable.py +0 -0
- {git_project-0.0.29 → git_project-0.0.31}/tests/test_scopedobj.py +0 -0
git_project-0.0.31/.git
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitdir: /home/dag/src/git-project/.git/worktrees/master/
|
|
@@ -375,10 +375,10 @@ class Git(object):
|
|
|
375
375
|
class RemoteBranchDeleteCallback(pygit2.RemoteCallbacks):
|
|
376
376
|
"""Check the result of remove branch prune operations."""
|
|
377
377
|
def credentials(self, url, username_from_url, allowed_types):
|
|
378
|
-
if allowed_types & pygit2.
|
|
378
|
+
if allowed_types & pygit2.enums.CredentialType.SSH_KEY:
|
|
379
379
|
return pygit2.Keypair(username_from_url, str(Path.home() / '.ssh' / 'id_rsa.pub'),
|
|
380
380
|
str(Path.home() / '.ssh' / 'id_rsa'), '')
|
|
381
|
-
elif allowed_types & pygit2.
|
|
381
|
+
elif allowed_types & pygit2.enums.CredentialType.USERNAME:
|
|
382
382
|
return pygit2.Username(username_from_url)
|
|
383
383
|
return None
|
|
384
384
|
|
|
@@ -389,10 +389,10 @@ class Git(object):
|
|
|
389
389
|
|
|
390
390
|
class LsRemotesCallbacks(pygit2.RemoteCallbacks):
|
|
391
391
|
def credentials(self, url, username_from_url, allowed_types):
|
|
392
|
-
if allowed_types & pygit2.
|
|
392
|
+
if allowed_types & pygit2.enums.CredentialType.SSH_KEY:
|
|
393
393
|
return pygit2.Keypair(username_from_url, str(Path.home() / '.ssh' / 'id_rsa.pub'),
|
|
394
394
|
str(Path.home() / '.ssh' / 'id_rsa'), '')
|
|
395
|
-
elif allowed_types & pygit2.
|
|
395
|
+
elif allowed_types & pygit2.enums.CredentialType.USERNAME:
|
|
396
396
|
return pygit2.Username(username_from_url)
|
|
397
397
|
return None
|
|
398
398
|
|
|
@@ -95,7 +95,9 @@ class SubstitutableConfigObject(ConfigObject):
|
|
|
95
95
|
current_branch = git.refname_to_branch_name(head_name.read_text().strip())
|
|
96
96
|
break
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
print(f'current_branch: {current_branch}')
|
|
99
|
+
if current_branch is not None:
|
|
100
|
+
formats['branch'] = current_branch
|
|
99
101
|
|
|
100
102
|
# Make sure substitutions don't reference themselves, to avoid an
|
|
101
103
|
# infinite loop substituting.
|
|
@@ -889,3 +889,31 @@ def test_git_remote_credentials(reset_directory):
|
|
|
889
889
|
|
|
890
890
|
assert isinstance(key_result, pygit2.Keypair)
|
|
891
891
|
assert isinstance(name_result, pygit2.Username)
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
def test_git_remote_branch_delete_credentials(reset_directory):
|
|
895
|
+
callback = git_project.Git.RemoteBranchDeleteCallback();
|
|
896
|
+
|
|
897
|
+
key_result = callback.credentials(
|
|
898
|
+
'ssh:me@my.org/test.git', 'me', pygit2.enums.CredentialType.SSH_KEY
|
|
899
|
+
)
|
|
900
|
+
name_result = callback.credentials(
|
|
901
|
+
'ssh:me@my.org/test.git', 'me', pygit2.enums.CredentialType.USERNAME
|
|
902
|
+
)
|
|
903
|
+
|
|
904
|
+
assert isinstance(key_result, pygit2.Keypair)
|
|
905
|
+
assert isinstance(name_result, pygit2.Username)
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def test_git_ls_remotes_credentials(reset_directory):
|
|
909
|
+
callback = git_project.Git.LsRemotesCallbacks();
|
|
910
|
+
|
|
911
|
+
key_result = callback.credentials(
|
|
912
|
+
'ssh:me@my.org/test.git', 'me', pygit2.enums.CredentialType.SSH_KEY
|
|
913
|
+
)
|
|
914
|
+
name_result = callback.credentials(
|
|
915
|
+
'ssh:me@my.org/test.git', 'me', pygit2.enums.CredentialType.USERNAME
|
|
916
|
+
)
|
|
917
|
+
|
|
918
|
+
assert isinstance(key_result, pygit2.Keypair)
|
|
919
|
+
assert isinstance(name_result, pygit2.Username)
|
|
@@ -50,6 +50,28 @@ class MySubstitutable(git_project.SubstitutableConfigObject):
|
|
|
50
50
|
command='cd {builddir}/{branch} && make {target}',
|
|
51
51
|
description='Test command')
|
|
52
52
|
|
|
53
|
+
class MyNoBranchSubstitutable(git_project.SubstitutableConfigObject):
|
|
54
|
+
def __init__(self,
|
|
55
|
+
git,
|
|
56
|
+
project_section,
|
|
57
|
+
subsection,
|
|
58
|
+
ident,
|
|
59
|
+
**kwargs):
|
|
60
|
+
super().__init__(git,
|
|
61
|
+
project_section,
|
|
62
|
+
subsection,
|
|
63
|
+
ident,
|
|
64
|
+
**kwargs)
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def get(cls, git, project_section, ident):
|
|
68
|
+
return super().get(git,
|
|
69
|
+
project_section,
|
|
70
|
+
'mysubstitutable',
|
|
71
|
+
ident,
|
|
72
|
+
command='cd {builddir} && make {target}',
|
|
73
|
+
description='Test command')
|
|
74
|
+
|
|
53
75
|
def test_substitutable_get(reset_directory, git):
|
|
54
76
|
substitutable = MySubstitutable.get(git, 'project', 'test')
|
|
55
77
|
|
|
@@ -542,3 +564,26 @@ def test_substitutable_substitute_preserve_escaped_braces(reset_directory, git):
|
|
|
542
564
|
substitutable.command)
|
|
543
565
|
|
|
544
566
|
assert command == f'cd {git.get_working_copy_root()}/{{{{}}path{{}}}}/to/build/{git.get_current_branch()} && make {project.target}'
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def test_substitutable_substitute_no_branch(reset_directory, git):
|
|
570
|
+
class MyProject(git_project.ScopedConfigObject):
|
|
571
|
+
def __init__(self):
|
|
572
|
+
super().__init__(git,
|
|
573
|
+
'project',
|
|
574
|
+
None,
|
|
575
|
+
'myproject',
|
|
576
|
+
builddir='{git_workdir}/path/to/build',
|
|
577
|
+
target='debug')
|
|
578
|
+
|
|
579
|
+
substitutable = MyNoBranchSubstitutable.get(git, 'project', 'test')
|
|
580
|
+
|
|
581
|
+
project = MyProject()
|
|
582
|
+
|
|
583
|
+
git.detach_head()
|
|
584
|
+
|
|
585
|
+
command = substitutable.substitute_value(git,
|
|
586
|
+
project,
|
|
587
|
+
substitutable.command)
|
|
588
|
+
|
|
589
|
+
assert command == f'cd {git.get_working_copy_root()}/path/to/build && make {project.target}'
|
git_project-0.0.29/.git
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
gitdir: /home/dag/src/git-project/.git/worktrees/dev/
|
git_project-0.0.29/test.out
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
============================= test session starts ==============================
|
|
2
|
-
platform linux -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0
|
|
3
|
-
rootdir: /home/dag/src/git-project/dev
|
|
4
|
-
configfile: pyproject.toml
|
|
5
|
-
plugins: anyio-4.3.0, console-scripts-1.4.1
|
|
6
|
-
collected 106 items
|
|
7
|
-
|
|
8
|
-
tests/test_confobj.py ............ [ 11%]
|
|
9
|
-
tests/test_git.py .......................FF............................ [ 61%]
|
|
10
|
-
tests/test_gitproject.py .. [ 63%]
|
|
11
|
-
tests/test_main.py . [ 64%]
|
|
12
|
-
tests/test_project.py ........... [ 74%]
|
|
13
|
-
tests/test_runnable.py ........ [ 82%]
|
|
14
|
-
tests/test_scopedobj.py ..... [ 86%]
|
|
15
|
-
tests/test_substitutable.py .............. [100%]
|
|
16
|
-
|
|
17
|
-
=================================== FAILURES ===================================
|
|
18
|
-
________________________________ test_git_clone ________________________________
|
|
19
|
-
|
|
20
|
-
reset_directory = None
|
|
21
|
-
remote_repository = pygit2.Repository('/tmp/pytest-of-dag/pytest-14/local_remote_test_git_clone.git0/')
|
|
22
|
-
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ff199ba1e50>, _basetemp=PosixPath('/tmp/pytest-of-dag/pytest-14'), _retention_count=3, _retention_policy='all')
|
|
23
|
-
|
|
24
|
-
def test_git_clone(reset_directory, remote_repository, tmp_path_factory):
|
|
25
|
-
path = tmp_path_factory.mktemp('clone-workdir')
|
|
26
|
-
|
|
27
|
-
os.chdir(path)
|
|
28
|
-
|
|
29
|
-
git = git_project.Git()
|
|
30
|
-
|
|
31
|
-
remote_url = 'file://' + remote_repository.path
|
|
32
|
-
|
|
33
|
-
> clone_path = git.clone(remote_url)
|
|
34
|
-
|
|
35
|
-
/home/dag/src/git-project/dev/tests/test_git.py:441:
|
|
36
|
-
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
37
|
-
/home/dag/src/git-project/dev/src/git_project/git.py:744: in clone
|
|
38
|
-
self._repo = pygit2.clone_repository(url, target_path, bare, callbacks=callbacks)
|
|
39
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/__init__.py:217: in clone_repository
|
|
40
|
-
payload.check_error(err)
|
|
41
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:93: in check_error
|
|
42
|
-
raise self._stored_exception
|
|
43
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:424: in wrapper
|
|
44
|
-
return f(*args)
|
|
45
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:552: in _transfer_progress_cb
|
|
46
|
-
transfer_progress(TransferProgress(stats_ptr))
|
|
47
|
-
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
48
|
-
|
|
49
|
-
self = <git_project.git.Git.RemoteCallbacks object at 0x7ff199a06950>
|
|
50
|
-
stats = <pygit2.remotes.TransferProgress object at 0x7ff199a9f790>
|
|
51
|
-
|
|
52
|
-
def transfer_progress(self, stats):
|
|
53
|
-
if not self.started_transfer:
|
|
54
|
-
self.started_transfer = True
|
|
55
|
-
print(f'Receiving objects ({stats.total_objects})...')
|
|
56
|
-
> self.progress.start(max_value=stats.total_objects)
|
|
57
|
-
E TypeError: ProgressBar.start() got an unexpected keyword argument 'max_value'
|
|
58
|
-
|
|
59
|
-
/home/dag/src/git-project/dev/src/git_project/git.py:77: TypeError
|
|
60
|
-
----------------------------- Captured stdout call -----------------------------
|
|
61
|
-
Remote: Counting objects 1
|
|
62
|
-
Remote: Counting objects 9
|
|
63
|
-
Remote: Counting objects 14
|
|
64
|
-
Remote: Counting objects 14
|
|
65
|
-
|
|
66
|
-
Remote: Compressing objects: 0% (0/14)
|
|
67
|
-
Remote: Compressing objects: 100% (14/14), done
|
|
68
|
-
|
|
69
|
-
Receiving objects (14)...
|
|
70
|
-
___________________________ test_git_clone_with_path ___________________________
|
|
71
|
-
|
|
72
|
-
reset_directory = None
|
|
73
|
-
remote_repository = pygit2.Repository('/tmp/pytest-of-dag/pytest-14/local_remote_test_git_clone_with_path.git0/')
|
|
74
|
-
tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ff199ba1e50>, _basetemp=PosixPath('/tmp/pytest-of-dag/pytest-14'), _retention_count=3, _retention_policy='all')
|
|
75
|
-
|
|
76
|
-
def test_git_clone_with_path(reset_directory,
|
|
77
|
-
remote_repository,
|
|
78
|
-
tmp_path_factory):
|
|
79
|
-
path = tmp_path_factory.mktemp('clone-workdir')
|
|
80
|
-
os.chdir(path)
|
|
81
|
-
|
|
82
|
-
git = git_project.Git()
|
|
83
|
-
|
|
84
|
-
remote_url = 'file://' + remote_repository.path
|
|
85
|
-
|
|
86
|
-
path = Path.cwd() / 'foo' / 'bar'
|
|
87
|
-
|
|
88
|
-
os.makedirs(path)
|
|
89
|
-
|
|
90
|
-
path = path / 'test-clone'
|
|
91
|
-
|
|
92
|
-
> clone_path = git.clone(remote_url, path)
|
|
93
|
-
|
|
94
|
-
/home/dag/src/git-project/dev/tests/test_git.py:482:
|
|
95
|
-
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
96
|
-
/home/dag/src/git-project/dev/src/git_project/git.py:744: in clone
|
|
97
|
-
self._repo = pygit2.clone_repository(url, target_path, bare, callbacks=callbacks)
|
|
98
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/__init__.py:217: in clone_repository
|
|
99
|
-
payload.check_error(err)
|
|
100
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:93: in check_error
|
|
101
|
-
raise self._stored_exception
|
|
102
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:424: in wrapper
|
|
103
|
-
return f(*args)
|
|
104
|
-
/home/dag/.virtualenvs/dev/lib/python3.11/site-packages/pygit2/callbacks.py:552: in _transfer_progress_cb
|
|
105
|
-
transfer_progress(TransferProgress(stats_ptr))
|
|
106
|
-
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
107
|
-
|
|
108
|
-
self = <git_project.git.Git.RemoteCallbacks object at 0x7ff198a8e350>
|
|
109
|
-
stats = <pygit2.remotes.TransferProgress object at 0x7ff198a8eb10>
|
|
110
|
-
|
|
111
|
-
def transfer_progress(self, stats):
|
|
112
|
-
if not self.started_transfer:
|
|
113
|
-
self.started_transfer = True
|
|
114
|
-
print(f'Receiving objects ({stats.total_objects})...')
|
|
115
|
-
> self.progress.start(max_value=stats.total_objects)
|
|
116
|
-
E TypeError: ProgressBar.start() got an unexpected keyword argument 'max_value'
|
|
117
|
-
|
|
118
|
-
/home/dag/src/git-project/dev/src/git_project/git.py:77: TypeError
|
|
119
|
-
----------------------------- Captured stdout call -----------------------------
|
|
120
|
-
Remote: Counting objects 1
|
|
121
|
-
Remote: Counting objects 14
|
|
122
|
-
Remote: Counting objects 14
|
|
123
|
-
|
|
124
|
-
Remote: Compressing objects: 0% (0/14)
|
|
125
|
-
Remote: Compressing objects: 100% (14/14), done
|
|
126
|
-
|
|
127
|
-
Receiving objects (14)...
|
|
128
|
-
=========================== short test summary info ============================
|
|
129
|
-
FAILED tests/test_git.py::test_git_clone - TypeError: ProgressBar.start() got...
|
|
130
|
-
FAILED tests/test_git.py::test_git_clone_with_path - TypeError: ProgressBar.s...
|
|
131
|
-
======================== 2 failed, 104 passed in 2.74s =========================
|
|
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
|
|
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
|