Skip to content

Fixes and improvements to PersistentClient#9

Open
dferreyraosi wants to merge 1 commit into
hgtools:developfrom
dferreyraosi:persistent-client
Open

Fixes and improvements to PersistentClient#9
dferreyraosi wants to merge 1 commit into
hgtools:developfrom
dferreyraosi:persistent-client

Conversation

@dferreyraosi

Copy link
Copy Markdown

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