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

Fixes and improvements to PersistentClient #9

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dferreyraosi
Copy link

Change Execute() so that it doesn't throw an exception saying "Unable to decode output from executing command..." for non-zero return codes and empty output. This allows regular Mercurial errors to be reported like they would in the non-persistent client. This also eliminates the exception when running the incoming and outgoing commands when there are no incoming or outgoing commits triggered by the return code of 1.

Change IsSupported() to not require the existence of a ".hg" folder under the repositoryPath. This allow the persistent client to be used in more cases, like when calling "hg init". This also allows more unit tests to use the persistent client when the "PERSISTENTCLIENT" environment variable is set to "1".

Trim quotes on arguments to "runcommand". For the non-persistent client, for arguments passed to WithAdditionalArgument() that contain spaces, you need to wrap the argument in quotes for the command processor to interpret the argument correctly. On the other hand, in the persistent client, quoted arguments can result in errors. By trimming quotes automatically in the persistent client, one set of arguments can work for both clients. This also fixes some unit test failures due to quoted arguments when the "PERSISTENTCLIENT" environment variable is set to "1".

Remove unused command encoding code that itself trimmed quotes from arguments, but was not actually being used.

Change `Execute()` so that it doesn't throw an exception saying "Unable to decode output from executing command..." for non-zero return codes and empty output.  This allows regular Mercurial errors to be reported like they would in the non-persistent client.  This also eliminates the exception when running the incoming and outgoing commands when there are no incoming or outgoing commits triggered by the return code of 1.

Change `IsSupported()` to not require the existence of a ".hg" folder under the repositoryPath.  This allow the persistent client to be used in more cases, like when calling "hg init".  This also allows more unit tests to use the persistent client when the "PERSISTENTCLIENT" environment variable is set to "1".

Trim quotes on arguments to "runcommand".  For the non-persistent client, for arguments passed to `WithAdditionalArgument()` that contain spaces, you need to wrap the argument in quotes for the command processor to interpret the argument correctly.  On the other hand, in the persistent client, quoted arguments can result in errors.  By trimming quotes automatically in the persistent client, one set of arguments can work for both clients.  This also fixes some unit test failures due to quoted arguments when the "PERSISTENTCLIENT" environment variable is set to "1".

Remove unused command encoding code that itself trimmed quotes from arguments, but was not actually being used.
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.

1 participant