Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Issue 12310029: Allow whitespace in version constraints. (Closed)

Created:
7 years, 10 months ago by Bob Nystrom
Modified:
7 years, 10 months ago
Reviewers:
nweiz
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Allow whitespace in version constraints. BUG=http://code.google.com/p/dart/issues/detail?id=7140 Committed: https://code.google.com/p/dart/source/detail?r=18851

Patch Set 1 #

Total comments: 8

Patch Set 2 : Don't allow mixing "any" with other constraints. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -57 lines) Patch
M utils/pub/version.dart View 1 6 chunks +98 lines, -53 lines 0 comments Download
M utils/tests/pub/version_test.dart View 1 2 chunks +32 lines, -4 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Bob Nystrom
7 years, 10 months ago (2013-02-21 00:18:15 UTC) #1
nweiz
A couple comments, but LGTM. https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart File utils/pub/version.dart (right): https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart#newcode27 utils/pub/version.dart:27: final _START_COMPARISON = new ...
7 years, 10 months ago (2013-02-21 01:31:11 UTC) #2
Bob Nystrom
Committed patchset #2 manually as r18851 (presubmit successful).
7 years, 10 months ago (2013-02-21 19:47:52 UTC) #3
Bob Nystrom
7 years, 10 months ago (2013-02-21 20:00:50 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart
File utils/pub/version.dart (right):

https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart#newcode27
utils/pub/version.dart:27: final _START_COMPARISON = new RegExp(r"[<>]=?");
On 2013/02/21 01:31:11, nweiz wrote:
> This should start with "^".

Oops. Done.

https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart#newcod...
utils/pub/version.dart:251: // separate "any". So this is valid:
"anyany>1.0.0any". Is that OK?
On 2013/02/21 01:31:11, nweiz wrote:
> It's weird that we allow "any" to be alongside any other version constraints,

You're exactly right. Thinking of "any" as a constraint *part* is the error
here. It should be a standalone constraint.

> but even given that "anyany>1.0.0any" is awful and shouldn't be allowed.

Agreed. Fixed. Now the rule is a constraint is either "any" or a series of
parts.

Much cleaner now.

https://codereview.chromium.org/12310029/diff/1/utils/pub/version.dart#newcod...
utils/pub/version.dart:278: '"$originalText", got "$text".');
On 2013/02/21 01:31:11, nweiz wrote:
> I still wish these exceptions gave more context, although that's more of an
> issue with the yaml library than this code.

There's not much Version can do here. What we can (and probably should) do is
catch this exception in the pubspec parser and wrap it in that additional
context. But that's a separate change.

https://codereview.chromium.org/12310029/diff/1/utils/tests/pub/version_test....
File utils/tests/pub/version_test.dart (right):

https://codereview.chromium.org/12310029/diff/1/utils/tests/pub/version_test....
utils/tests/pub/version_test.dart:418: throwsFormatException);
On 2013/02/21 01:31:11, nweiz wrote:
> Other strings to test: "foo", "1.0.0foo", "anything".

Done.

Powered by Google App Engine
This is Rietveld 408576698