Last modified: 2014-02-28 13:52:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30202, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28202 - getDiff() not differentiating between connection error and empty diff.
getDiff() not differentiating between connection error and empty diff.
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
CodeReview (Other open bugs)
unspecified
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-23 12:34 UTC by Mark Clements (HappyDog)
Modified: 2014-02-28 13:52 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mark Clements (HappyDog) 2011-03-23 12:34:58 UTC
CodeRepository::getDiff() returns the diff as a string, or a numeric constant if it is unable to get the diff for any reason.  The constant describes the reason the diff failed.

Currently the function can't tell the difference between an SVN/connection failure and an empty diff, and so returns self::DIFFRESULT_NoDataReturned in both cases.

The code should be updated so that it can tell the difference and return (e.g.) DIFFRESULT_ConnectionError if there was a connection failure, and DIFFRESULT_NoDataReturned if the diff is genuinely empty.

Brion had some suggestions about how this might be implemented, in http://www.mediawiki.org/wiki/Special:Code/MediaWiki/80822#c13364.  Here is the relevant excerpt:

Re: the "can't tell difference between connection failure and empty diff", I think we can remedy that in the SubversionAdaptor classes:

* SubversionAdaptorPecl looks like it should throw an exception on failure, so already good?
* SubversionAdaptorShell should check the return code; a failure should give a non-zero return which we can parley into a nice exception ;)
* SubversionProxy should throw an exception on a bad return, but that could depend on whether the proxy actually returns an HTTP error code on error
Comment 1 Mark Clements (HappyDog) 2011-03-23 12:37:17 UTC
Actually, thinking about it, I'm not sure what a blank diff actually means.

Can it represent an error condition, or does it always mean just that there is no diff text to show - e.g. that there were only moves/renames/deletions and no content changes.

If it can mean either, is there any way we can differentiate between error conditions and valid blank diffs?

Either way, we should probably be returning an empty string rather than a constant for genuinely blank diffs, as this is not an error condition!
Comment 2 Sam Reed (reedy) 2011-03-23 12:57:46 UTC
And following onto that, when we should really be caching the errors if they are actually empty diffs etc
Comment 3 Mark Clements (HappyDog) 2011-03-23 14:05:19 UTC
We should modify the way we store the diff in the DB, so that an empty string is stored for genuine empty diffs, but that NULL is stored for error conditions.  NULL values should be retried when running svnImport, whilst blank values should be skipped as they are valid.

We could maybe even go one step further and store the error code in the DB (if we can guarantee that this won't conflict with a valid diff string, which I think we can).  If we do this then it will give better reporting in the interface, and we can decide whether to retry in a more sensible manner (e.g. DIFFRESULT_TooManyPaths probably isn't worth a retry, unless $wgCodeReviewMaxDiffPaths has changed).
Comment 4 Mark A. Hershberger 2011-04-27 05:13:20 UTC
Assigning this to Sam.  Sam, please feel free to downgrade the priority and unassign yourself if you think you shouldn't have this one.
Comment 5 Mark A. Hershberger 2011-12-20 21:09:00 UTC
Changing default assignee per IRC

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links