Index: utils/tests/pub/test_pub.dart |
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart |
index 6fbee3042af1a98159cd708834f84d8c76837ba9..b70f25b123151374dfc95d3c15142e3878e640b5 100644 |
--- a/utils/tests/pub/test_pub.dart |
+++ b/utils/tests/pub/test_pub.dart |
@@ -292,9 +292,9 @@ DirectoryDescriptor packageCacheDir(String name, String version) { |
/** |
* Describes a directory for a Git package. This directory is of the form found |
- * in the global package cache. |
+ * in the revision cache of the global package cache. |
*/ |
-DirectoryDescriptor gitPackageCacheDir(String name, [int modifier]) { |
+DirectoryDescriptor gitPackageRevisionCacheDir(String name, [int modifier]) { |
var value = name; |
if (modifier != null) value = "$name $modifier"; |
return dir(new RegExp("$name${@'-[a-f0-9]+'}"), [ |
@@ -303,6 +303,20 @@ DirectoryDescriptor gitPackageCacheDir(String name, [int modifier]) { |
} |
/** |
+ * Describes a directory for a Git package. This directory is of the form found |
+ * in the repo cache of the global package cache. |
+ */ |
+DirectoryDescriptor gitPackageRepoCacheDir(String name) { |
+ return dir(new RegExp("$name${@'-[a-f0-9]+'}"), [ |
+ dir('branches'), |
+ dir('hooks'), |
+ dir('info'), |
+ dir('objects'), |
+ dir('refs') |
+ ]); |
+} |
+ |
+/** |
* Describes the `packages/` directory containing all the given [packages], |
* which should be name/version pairs. The packages will be validated against |
* the format produced by the mock package server. |
@@ -815,7 +829,9 @@ class DirectoryDescriptor extends Descriptor { |
*/ |
final List<Descriptor> contents; |
- DirectoryDescriptor(Pattern name, this.contents) : super(name); |
+ DirectoryDescriptor(Pattern name, List<Descriptor> contents) |
+ : this.contents = contents == null ? <Descriptor>[] : contents, |
+ super(name); |
/** |
* Creates the file within [dir]. Returns a [Future] that is completed after |
@@ -958,6 +974,14 @@ class GitRepoDescriptor extends DirectoryDescriptor { |
return completer.future; |
} |
+ /// Schedule a Git command to run in this repository. |
+ void scheduleGit(List<String> args) { |
+ _schedule((parentDir) { |
+ var gitDir = new Directory(join(parentDir, name)); |
+ return _runGit(args, gitDir); |
+ }); |
+ } |
+ |
Future<String> _runGit(List<String> args, Directory workingDir) { |
return runProcess('git', args, workingDir: workingDir.path). |
transform((result) { |