summaryrefslogtreecommitdiff
path: root/git/cmd.py
diff options
context:
space:
mode:
authorJonas Trappenberg <jonas@trappenberg.ch>2015-01-21 21:51:10 -0800
committerJonas Trappenberg <jonas@trappenberg.ch>2015-01-21 21:51:10 -0800
commit2a9b2f22c6fb5bd3e30e674874dbc8aa7e5b00ae (patch)
treeaaabf347d0eddb3c99e8f60fc64857a6d37f04b9 /git/cmd.py
parent34c0831453355e09222ccc6665782d7070f5ddab (diff)
downloadgitpython-2a9b2f22c6fb5bd3e30e674874dbc8aa7e5b00ae.tar.gz
Rename 'environment' and 'set_environment'
Diffstat (limited to 'git/cmd.py')
-rw-r--r--git/cmd.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 65159f28..91442470 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -618,7 +618,7 @@ class Git(LazyMixin):
def environment(self):
return self._environment
- def set_environment(self, **kwargs):
+ def update_environment(self, **kwargs):
"""
Set environment variables for future git invocations. Return all changed
values in a format that can be passed back into this function to revert
@@ -626,8 +626,8 @@ class Git(LazyMixin):
``Examples``::
- old_env = self.set_environment(PWD='/tmp')
- self.set_environment(**old_env)
+ old_env = self.update_environment(PWD='/tmp')
+ self.update_environment(**old_env)
:param kwargs: environment variables to use for git processes
:return: dict that maps environment variables to their old values
@@ -648,23 +648,23 @@ class Git(LazyMixin):
return old_env
@contextmanager
- def environment(self, **kwargs):
+ def with_environment(self, **kwargs):
"""
- A context manager around the above set_environment to restore the
+ A context manager around the above update_environment to restore the
environment back to its previous state after operation.
``Examples``::
- with self.environment(GIT_SSH='/bin/ssh_wrapper'):
+ with self.with_environment(GIT_SSH='/bin/ssh_wrapper'):
repo.remotes.origin.fetch()
- :param kwargs: see set_environment
+ :param kwargs: see update_environment
"""
- old_env = self.set_environment(**kwargs)
+ old_env = self.update_environment(**kwargs)
try:
yield
finally:
- self.set_environment(**old_env)
+ self.update_environment(**old_env)
@contextmanager
def sshkey(self, sshkey_file):
@@ -682,7 +682,7 @@ class Git(LazyMixin):
this_dir = os.path.dirname(__file__)
ssh_wrapper = os.path.join(this_dir, '..', 'scripts', 'ssh_wrapper.py')
- with self.environment(GIT_SSH_KEY_FILE=sshkey_file, GIT_SSH=ssh_wrapper):
+ with self.with_environment(GIT_SSH_KEY_FILE=sshkey_file, GIT_SSH=ssh_wrapper):
yield
def transform_kwargs(self, split_single_char_options=False, **kwargs):