Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svn subprocess environment customization #75

Merged
merged 3 commits into from
Oct 3, 2016
Merged

svn subprocess environment customization #75

merged 3 commits into from
Oct 3, 2016

Conversation

daa
Copy link
Contributor

@daa daa commented Sep 30, 2016

Here I've added possibility to pass custom set of environment variables to underlying svn command. Sometimes it's desirable to customize environment at use time but not desirable or possible to change global environment. For example my use case is setting SVN_SSH to use login not matching current user and ssh identity located at non-standard path.

@coveralls
Copy link

coveralls commented Sep 30, 2016

Coverage Status

Coverage increased (+0.3%) to 60.584% when pulling 40503df on daa:environment-customization into cfaabe8 on dsoprea:master.

@@ -22,12 +22,32 @@ def __init__(self, message):


class CommonClient(object):
"""Subversion client
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of the documentation-level commenting. It's not clear what documentation convention you are using and almost nothing else is has such comprehensive documentation-level commenting (ergo, it should be done everywhere, not just in one place).

Copy link
Owner

@dsoprea dsoprea Oct 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also encourages people to use CommonClient directly (which I've seen before), which is not correct.

def __init__(self, url_or_path, type_, *args, **kwargs):
self.__url_or_path = url_or_path
self.__username = kwargs.pop('username', None)
self.__password = kwargs.pop('password', None)
self.__svn_filepath = kwargs.pop('svn_filepath', 'svn')
self.__trust_cert = kwargs.pop('trust_cert', None)
self._env = kwargs.get('env', {})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we don't use the convention of single-underscore prefixed variables, certainly not in all of the other parameters here. You should carry the convention of the surrounding code. Rename _env to __env.

@coveralls
Copy link

coveralls commented Oct 2, 2016

Coverage Status

Coverage increased (+0.3%) to 60.584% when pulling 7d726fd on daa:environment-customization into cfaabe8 on dsoprea:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 60.584% when pulling 7d726fd on daa:environment-customization into cfaabe8 on dsoprea:master.

@@ -73,7 +54,7 @@ def run_command(self, subcommand, args, success_code=0,

environment_variables = os.environ.copy()
environment_variables['LANG'] = 'en_US.UTF-8'
environment_variables.update(self._env)
environment_variables.update(self.__env)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this before the "LANG" assignment and you have a deal. Since that's an explicit parameter and the environment collection just provides support for something that is general in nature, the latter can't be allowed to potentially overwrite the former. Thanks.

@coveralls
Copy link

coveralls commented Oct 2, 2016

Coverage Status

Coverage increased (+0.3%) to 60.584% when pulling bc2e3a6 on daa:environment-customization into cfaabe8 on dsoprea:master.

@dsoprea dsoprea merged commit ee9d7fa into dsoprea:master Oct 3, 2016
@daa daa deleted the environment-customization branch October 3, 2016 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants