Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve error detection & handling when invoking SVN #247

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

Merged
dregad merged 6 commits into mantisbt-plugins:master from bright-tools:win_exec_iss241
Sep 16, 2017

Conversation

@bright-tools
Copy link
Contributor

@bright-tools bright-tools commented Sep 16, 2017

As discussed on #241, try and be a bit more robust when executing the SVN command.

@dregad, I tried to keep my implementation close to the work that you did in the hope it would ease the review process. Please take a look & let me know if you want any changes prior to merge. I've done some basic testing.

Move the call to plugin_push_current() to be before the first call
to svn_binary() to ensure that svn_binary()'s calls to
plugin_config_get() retrieve the options from SourceSVN's config
options rather than any plugin inheriting from SourceSVN
Copy link
Member

@dregad dregad left a comment

Choose a reason for hiding this comment

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

@bright-tools many thanks for this. Here's a couple minor review comments to start with; I'll try to run a few tests here later on.

* Execute SVN command, catching & raising errors in both
* execution and output
* @param string Command and any parameters
* @param SourceRepo Repository to access
Copy link
Member

Choose a reason for hiding this comment

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

Add the param names to the PHPDoc block, i.e.

@param string $p_cmd Command and any parameters

$s_plugin_SourceSVN_error_run_svn = 'shell_exec() failed to execute Subversion.';

$s_plugin_SourceSVN_error_svn_run = 'Failed to execute Subversion. Command returned "%1$s"';
$s_plugin_SourceSVN_error_svn_cmd = 'svn execution error: "%1$s".';
Copy link
Member

Choose a reason for hiding this comment

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

The error messages are very similar - is it really worth having 2 different strings ?

Copy link
Contributor Author

@dregad , thanks for the review!

I hopefully fixed the PHPDoc block

With regard to the errors, I've tried to refine them (the redundant parameter on one of the probably did not help). Intent is that the first error is triggered in the case that proc_open() fails (i.e. not possible to execute SVN), while the other error is triggered if the SVN process returns to stderr. It seemed like a distinction worth making, but let me know what you think.

* Execute SVN command, catching & raising errors in both
* execution and output
* @param string p_cmd Command and any parameters
* @param SourceRepo p_repo Repository to access
Copy link
Member

Choose a reason for hiding this comment

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

You missed the $ in front of the param name 😉

Copy link
Member

dregad commented Sep 16, 2017

WRT the error messages, I think its good following your latest commit.

Copy link
Contributor Author

Argh! You can tell how much I've used PHPDoc mark-up, can't you? 😁

Copy link
Member

@dregad dregad left a comment

Choose a reason for hiding this comment

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

Tested OK (no real-life conditions though - just using a local SVN repo created for this purpose)

@dregad dregad added this to the 2.1.0 milestone Sep 16, 2017
@dregad dregad merged commit e02794f into mantisbt-plugins:master Sep 16, 2017
Copy link
Member

dregad commented Sep 16, 2017

@bright-tools Thanks for your contribution !

As a side note and if you don't mind, I would prefer when you submit pull requests, that you rebase your branch on top of upstream master, instead of merging it (that's in the interest of keeping a clean git history). Thanks !

Copy link
Contributor Author

Noted, will do!

@bright-tools bright-tools deleted the win_exec_iss241 branch September 16, 2017 15:15
obmsch added a commit to obmsch/source-integration that referenced this pull request Sep 19, 2017
dregad pushed a commit that referenced this pull request Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dregad dregad dregad approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.1.0

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /