Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4df4159

Browse files
committed
Removed Git.sshkey() as it couldn't be distributed properly.
However, I kept information on how to achieve the same thing with`custom_environment()` in the test.Related togitpython-developers#234
1 parentf3d91ca commit4df4159

File tree

8 files changed

+14
-44
lines changed

8 files changed

+14
-44
lines changed

‎MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include CHANGES
44
include AUTHORS
55
include README
66
include requirements.txt
7-
include git/scripts/ssh_wrapper.sh
87

98
graft git/test/fixtures
109
graft git/test/performance

‎doc/source/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ You can easily access configuration information for a remote by accessing option
331331
:start-after: # [26-test_references_and_objects]
332332
:end-before: # ![26-test_references_and_objects]
333333

334-
You can also specifyan SSH key to use for any operations on theremotes
334+
You can also specifyper-call custom environments using a new context manager on theGit command
335335

336336
..literalinclude::../../git/test/test_docs.py
337337
:language: python

‎git/cmd.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,6 @@ def _set_cache_(self, attr):
439439
super(Git,self)._set_cache_(attr)
440440
# END handle version info
441441

442-
def_sshkey_script_path(self):
443-
this_dir=os.path.dirname(__file__)
444-
returnos.path.join(this_dir,'scripts','ssh_wrapper.sh')
445-
446442
@property
447443
defworking_dir(self):
448444
""":return: Git directory we are working on"""
@@ -670,23 +666,6 @@ def custom_environment(self, **kwargs):
670666
finally:
671667
self.update_environment(**old_env)
672668

673-
@contextmanager
674-
defsshkey(self,sshkey_file_path):
675-
"""
676-
A context manager to temporarily set an SSH key for all operations that
677-
run inside it.
678-
679-
``Examples``::
680-
681-
with self.sshkey('deployment_key'):
682-
repo.remotes.origin.fetch()
683-
684-
:param sshkey_file_path: Path to a private SSH key file
685-
"""
686-
ssh_wrapper=self._sshkey_script_path()
687-
withself.custom_environment(GIT_SSH_KEY_FILE=sshkey_file_path,GIT_SSH=ssh_wrapper):
688-
yield
689-
690669
deftransform_kwargs(self,split_single_char_options=False,**kwargs):
691670
"""Transforms Python style kwargs into git command line options."""
692671
args=list()

‎git/ext/gitdb

Submodulegitdb updated1 file

‎git/scripts/ssh_wrapper.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎git/test/test_docs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ def test_references_and_objects(self, rw_dir):
438438
# ![31-test_references_and_objects]
439439

440440
# [32-test_references_and_objects]
441-
private_key_file=os.path.join(rw_dir,'id_rsa_deployment_key')
442-
withrepo.git.sshkey(private_key_file):
441+
ssh_executable=os.path.join(rw_dir,'my_ssh_executable.sh')
442+
withrepo.git.custom_environment(GIT_SSH=ssh_executable):
443443
# Note that we don't actually make the call here, as our test-setup doesn't permit it to
444444
# succeed.
445445
# It will in your case :)

‎git/test/test_git.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,23 +181,17 @@ def test_environment(self, rw_dir):
181181
assertnew_env== {'VARKEY':'VARVALUE'}
182182
assertself.git.environment()== {}
183183

184-
classTestRepo(Repo):
185-
classGitCommandWrapperType(Git):
186-
def_sshkey_script_path(self):
187-
path=os.path.join(rw_dir,'failing-script.sh')
188-
stream=open(path,'wt')
189-
stream.write("#!/usr/bin/env sh\n"+
190-
"echo FOO\n")
191-
stream.close()
192-
os.chmod(path,0o555)
193-
returnpath
194-
# end Git
195-
# end Repo
196-
197-
rw_repo=TestRepo.init(os.path.join(rw_dir,'repo'))
184+
path=os.path.join(rw_dir,'failing-script.sh')
185+
stream=open(path,'wt')
186+
stream.write("#!/usr/bin/env sh\n"+
187+
"echo FOO\n")
188+
stream.close()
189+
os.chmod(path,0o555)
190+
191+
rw_repo=Repo.init(os.path.join(rw_dir,'repo'))
198192
remote=rw_repo.create_remote('ssh-origin',"ssh://git@server/foo")
199193

200-
withrw_repo.git.sshkey('doesntexist.key'):
194+
withrw_repo.git.custom_environment(GIT_SSH=path):
201195
try:
202196
remote.fetch()
203197
exceptGitCommandErroraserr:

‎setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _stamp_version(filename):
8282
url="https://github.com/gitpython-developers/GitPython",
8383
packages=find_packages('.'),
8484
py_modules=['git.'+f[:-3]forfinos.listdir('./git')iff.endswith('.py')],
85-
package_data={'git.test': ['fixtures/*'],'git' : ['scripts/*']},
85+
package_data={'git.test': ['fixtures/*']},
8686
package_dir={'git':'git'},
8787
license="BSD License",
8888
requires=['gitdb (>=0.6.4)'],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp