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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/descriptor/git.dart

Issue 937243002: Revert "Revert "Use native async/await support in pub."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library descriptor.git;
6
7 import 'dart:async';
8
9 import 'package:path/path.dart' as path;
10 import 'package:scheduled_test/scheduled_test.dart';
11 import 'package:scheduled_test/descriptor.dart';
12
13 import '../../lib/src/git.dart' as git;
14
15 /// Describes a Git repository and its contents.
16 class GitRepoDescriptor extends DirectoryDescriptor {
17 GitRepoDescriptor(String name, List<Descriptor> contents)
18 : super(name, contents);
19
20 /// Creates the Git repository and commits the contents.
21 Future create([String parent]) => schedule(() {
22 return super.create(parent).then((_) {
23 return _runGitCommands(
24 parent,
25 [['init'], ['add', '.'], ['commit', '-m', 'initial commit']]);
26 });
27 }, 'creating Git repo:\n${describe()}');
28
29 /// Writes this descriptor to the filesystem, than commits any changes from
30 /// the previous structure to the Git repo.
31 ///
32 /// [parent] defaults to [defaultRoot].
33 Future commit([String parent]) => schedule(() {
34 return super.create(parent).then((_) {
35 return _runGitCommands(
36 parent,
37 [['add', '.'], ['commit', '-m', 'update']]);
38 });
39 }, 'committing Git repo:\n${describe()}');
40
41 /// Return a Future that completes to the commit in the git repository
42 /// referred to by [ref] at the current point in the scheduled test run.
43 ///
44 /// [parent] defaults to [defaultRoot].
45 Future<String> revParse(String ref, [String parent]) => schedule(() {
46 return _runGit(['rev-parse', ref], parent).then((output) => output[0]);
47 }, 'parsing revision $ref for Git repo:\n${describe()}');
48
49 /// Schedule a Git command to run in this repository.
50 ///
51 /// [parent] defaults to [defaultRoot].
52 Future runGit(List<String> args, [String parent]) => schedule(() {
53 return _runGit(args, parent);
54 }, "running 'git ${args.join(' ')}' in Git repo:\n${describe()}");
55
56 Future _runGitCommands(String parent, List<List<String>> commands) =>
57 Future.forEach(commands, (command) => _runGit(command, parent));
58
59 Future<List<String>> _runGit(List<String> args, String parent) {
60 // Explicitly specify the committer information. Git needs this to commit
61 // and we don't want to rely on the buildbots having this already set up.
62 var environment = {
63 'GIT_AUTHOR_NAME': 'Pub Test',
64 'GIT_AUTHOR_EMAIL': 'pub@dartlang.org',
65 'GIT_COMMITTER_NAME': 'Pub Test',
66 'GIT_COMMITTER_EMAIL': 'pub@dartlang.org'
67 };
68
69 if (parent == null) parent = defaultRoot;
70 return git.run(
71 args,
72 workingDir: path.join(parent, name),
73 environment: environment);
74 }
75 }
76
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub_generated/test/descriptor.dart ('k') | sdk/lib/_internal/pub_generated/test/descriptor/tar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698