@@ -618,16 +618,16 @@ def as_text(stdout_value):
618618 def environment (self ):
619619 return self ._environment
620620
621- def set_environment (self , ** kwargs ):
621+ def update_environment (self , ** kwargs ):
622622 """
623623 Set environment variables for future git invocations. Return all changed
624624 values in a format that can be passed back into this function to revert
625625 the changes:
626626
627627 ``Examples``::
628628
629- old_env = self.set_environment (PWD='/tmp')
630- self.set_environment (**old_env)
629+ old_env = self.update_environment (PWD='/tmp')
630+ self.update_environment (**old_env)
631631
632632 :param kwargs: environment variables to use for git processes
633633 :return: dict that maps environment variables to their old values
@@ -648,23 +648,23 @@ def set_environment(self, **kwargs):
648648 return old_env
649649
650650 @contextmanager
651- def environment (self , ** kwargs ):
651+ def with_environment (self , ** kwargs ):
652652 """
653- A context manager around the above set_environment to restore the
653+ A context manager around the above update_environment to restore the
654654 environment back to its previous state after operation.
655655
656656 ``Examples``::
657657
658- with self.environment (GIT_SSH='/bin/ssh_wrapper'):
658+ with self.with_environment (GIT_SSH='/bin/ssh_wrapper'):
659659 repo.remotes.origin.fetch()
660660
661- :param kwargs: see set_environment
661+ :param kwargs: see update_environment
662662 """
663- old_env = self .set_environment (** kwargs )
663+ old_env = self .update_environment (** kwargs )
664664 try :
665665 yield
666666 finally :
667- self .set_environment (** old_env )
667+ self .update_environment (** old_env )
668668
669669 @contextmanager
670670 def sshkey (self , sshkey_file ):
@@ -682,7 +682,7 @@ def sshkey(self, sshkey_file):
682682 this_dir = os .path .dirname (__file__ )
683683 ssh_wrapper = os .path .join (this_dir , '..' , 'scripts' , 'ssh_wrapper.py' )
684684
685- with self .environment (GIT_SSH_KEY_FILE = sshkey_file , GIT_SSH = ssh_wrapper ):
685+ with self .with_environment (GIT_SSH_KEY_FILE = sshkey_file , GIT_SSH = ssh_wrapper ):
686686 yield
687687
688688 def transform_kwargs (self , split_single_char_options = False , ** kwargs ):
0 commit comments