Skip to content

Commit f486823

Browse files
authored
Merge pull request #4650 from dart-lang/merge-cherry_pick_tag_pattern_fix
Merge cherry-pick-of-Fix tag_pattern lockfile deserialization
2 parents 469eb61 + cf01390 commit f486823

File tree

13 files changed

+8
-52
lines changed

13 files changed

+8
-52
lines changed

lib/pub.dart

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'src/entrypoint.dart';
88
import 'src/exceptions.dart';
99
import 'src/http.dart';
1010
import 'src/pub_embeddable_command.dart';
11-
import 'src/source/git.dart';
1211
import 'src/system_cache.dart';
1312

1413
export 'src/executable.dart'
@@ -68,39 +67,3 @@ class ResolutionFailedException implements Exception {
6867
String message;
6968
ResolutionFailedException._(this.message);
7069
}
71-
72-
/// Given a Git repo that contains a pub package, gets the name of the pub
73-
/// package.
74-
///
75-
/// Will download the repo to the system cache under the assumption that the
76-
/// package will be downloaded afterwards.
77-
///
78-
/// [url] points to the git repository. If it is a relative url, it is resolved
79-
/// as a file url relative to the path [relativeTo].
80-
///
81-
/// [ref] is the commit, tag, or branch name where the package should be looked
82-
/// up when fetching the name. If omitted, 'HEAD' is used.
83-
///
84-
/// [tagPattern] is a string containing `'{{version}}'` as a substring, the
85-
/// latest tag matching the pattern will be used for fetching the name.
86-
///
87-
/// Only one of [ref] and [tagPattern] can be used.
88-
///
89-
/// If [isOffline], only the already cached versions of the repo is used.
90-
Future<String> getPackageNameFromGitRepo(
91-
String url, {
92-
String? ref,
93-
String? path,
94-
String? tagPattern,
95-
String? relativeTo,
96-
bool isOffline = false,
97-
}) async {
98-
return await GitSource.instance.getPackageNameFromRepo(
99-
url,
100-
ref,
101-
path,
102-
SystemCache(isOffline: isOffline),
103-
relativeTo: relativeTo,
104-
tagPattern: tagPattern,
105-
);
106-
}

lib/src/command/add.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ For example (follow the same format including spaces):
167167
defaultsTo: true,
168168
help:
169169
'Also update dependencies in `example/` after modifying pubspec.yaml in the root package (if it exists).',
170+
hide: true,
170171
);
171172
}
172173

lib/src/command/downgrade.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class DowngradeCommand extends PubCommand {
4848
'example',
4949
defaultsTo: true,
5050
help: 'Also run in `example/` (if it exists).',
51+
hide: true,
5152
);
5253

5354
argParser.addOption(

lib/src/command/get.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class GetCommand extends PubCommand {
5656
'example',
5757
defaultsTo: true,
5858
help: 'Also run in `example/` (if it exists).',
59+
hide: true,
5960
);
6061

6162
argParser.addOption(

lib/src/command/login.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ class LoginCommand extends PubCommand {
6464
try {
6565
switch (json.decode(userInfoRequest.body)) {
6666
case {'name': final String? name, 'email': final String email}:
67-
return _UserInfo(name: name, email: email);
68-
case {'email': final String email}:
69-
return _UserInfo(name: null, email: email);
67+
return _UserInfo(name, email);
7068
default:
7169
log.fine(
7270
'Bad response from $userInfoEndpoint: ${userInfoRequest.body}',
@@ -86,7 +84,7 @@ class LoginCommand extends PubCommand {
8684
class _UserInfo {
8785
final String? name;
8886
final String email;
89-
_UserInfo({required this.name, required this.email});
87+
_UserInfo(this.name, this.email);
9088
@override
9189
String toString() => ['<$email>', name ?? ''].join(' ');
9290
}

lib/src/command/remove.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ To remove a dependency override of a package prefix the package name with
5959
'example',
6060
defaultsTo: true,
6161
help: 'Also update dependencies in `example/` (if it exists).',
62+
hide: true,
6263
);
6364

6465
argParser.addOption(

lib/src/command/upgrade.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class UpgradeCommand extends PubCommand {
8989
'example',
9090
defaultsTo: true,
9191
help: 'Also run in `example/` (if it exists).',
92+
hide: true,
9293
);
9394

9495
argParser.addOption(

lib/src/source/git.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class GitSource extends CachedSource {
290290
String? ref,
291291
String? path,
292292
SystemCache cache, {
293-
required String? relativeTo,
293+
required String relativeTo,
294294
required String? tagPattern,
295295
}) async {
296296
assert(

test/testdata/goldens/help_test/pub add --help.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ Usage: pub add [options] [<section>:]<package>[:descriptor] [<section>:]<package
4343
-n, --dry-run Report what dependencies would change but don't change any.
4444
--[no-]precompile Build executables in immediate dependencies.
4545
-C, --directory=<dir> Run this in the directory <dir>.
46-
--[no-]example Also update dependencies in `example/` after modifying pubspec.yaml in the root package (if it exists).
47-
(defaults to on)
4846

4947
Run "pub help" to see global options.
5048
See https://dart.dev/tools/pub/cmd/pub-add for detailed documentation.

test/testdata/goldens/help_test/pub downgrade --help.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Usage: pub downgrade [dependencies...]
1010
-h, --help Print this usage information.
1111
--[no-]offline Use cached packages instead of accessing the network.
1212
-n, --dry-run Report what dependencies would change but don't change any.
13-
--[no-]example Also run in `example/` (if it exists).
14-
(defaults to on)
1513
-C, --directory=<dir> Run this in the directory <dir>.
1614
--tighten Updates lower bounds in pubspec.yaml to match the resolved version.
1715

0 commit comments

Comments
 (0)