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

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

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
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; 1 library descriptor.git;
6
7 import 'dart:async'; 2 import 'dart:async';
8
9 import 'package:path/path.dart' as path; 3 import 'package:path/path.dart' as path;
10 import 'package:scheduled_test/scheduled_test.dart'; 4 import 'package:scheduled_test/scheduled_test.dart';
11 import 'package:scheduled_test/descriptor.dart'; 5 import 'package:scheduled_test/descriptor.dart';
12
13 import '../../lib/src/git.dart' as git; 6 import '../../lib/src/git.dart' as git;
14
15 /// Describes a Git repository and its contents.
16 class GitRepoDescriptor extends DirectoryDescriptor { 7 class GitRepoDescriptor extends DirectoryDescriptor {
17 GitRepoDescriptor(String name, List<Descriptor> contents) 8 GitRepoDescriptor(String name, List<Descriptor> contents)
18 : super(name, contents); 9 : super(name, contents);
19
20 /// Creates the Git repository and commits the contents.
21 Future create([String parent]) => schedule(() { 10 Future create([String parent]) => schedule(() {
22 return super.create(parent).then((_) { 11 return super.create(parent).then((_) {
23 return _runGitCommands(parent, [ 12 return _runGitCommands(
24 ['init'], 13 parent,
25 ['add', '.'], 14 [['init'], ['add', '.'], ['commit', '-m', 'initial commit']]);
26 ['commit', '-m', 'initial commit']
27 ]);
28 }); 15 });
29 }, 'creating Git repo:\n${describe()}'); 16 }, 'creating Git repo:\n${describe()}');
30
31 /// Writes this descriptor to the filesystem, than commits any changes from
32 /// the previous structure to the Git repo.
33 ///
34 /// [parent] defaults to [defaultRoot].
35 Future commit([String parent]) => schedule(() { 17 Future commit([String parent]) => schedule(() {
36 return super.create(parent).then((_) { 18 return super.create(parent).then((_) {
37 return _runGitCommands(parent, [ 19 return _runGitCommands(
38 ['add', '.'], 20 parent,
39 ['commit', '-m', 'update'] 21 [['add', '.'], ['commit', '-m', 'update']]);
40 ]);
41 }); 22 });
42 }, 'committing Git repo:\n${describe()}'); 23 }, 'committing Git repo:\n${describe()}');
43
44 /// Return a Future that completes to the commit in the git repository
45 /// referred to by [ref] at the current point in the scheduled test run.
46 ///
47 /// [parent] defaults to [defaultRoot].
48 Future<String> revParse(String ref, [String parent]) => schedule(() { 24 Future<String> revParse(String ref, [String parent]) => schedule(() {
49 return _runGit(['rev-parse', ref], parent).then((output) => output[0]); 25 return _runGit(['rev-parse', ref], parent).then((output) => output[0]);
50 }, 'parsing revision $ref for Git repo:\n${describe()}'); 26 }, 'parsing revision $ref for Git repo:\n${describe()}');
51
52 /// Schedule a Git command to run in this repository.
53 ///
54 /// [parent] defaults to [defaultRoot].
55 Future runGit(List<String> args, [String parent]) => schedule(() { 27 Future runGit(List<String> args, [String parent]) => schedule(() {
56 return _runGit(args, parent); 28 return _runGit(args, parent);
57 }, "running 'git ${args.join(' ')}' in Git repo:\n${describe()}"); 29 }, "running 'git ${args.join(' ')}' in Git repo:\n${describe()}");
58
59 Future _runGitCommands(String parent, List<List<String>> commands) => 30 Future _runGitCommands(String parent, List<List<String>> commands) =>
60 Future.forEach(commands, (command) => _runGit(command, parent)); 31 Future.forEach(commands, (command) => _runGit(command, parent));
61
62 Future<List<String>> _runGit(List<String> args, String parent) { 32 Future<List<String>> _runGit(List<String> args, String parent) {
63 // Explicitly specify the committer information. Git needs this to commit
64 // and we don't want to rely on the buildbots having this already set up.
65 var environment = { 33 var environment = {
66 'GIT_AUTHOR_NAME': 'Pub Test', 34 'GIT_AUTHOR_NAME': 'Pub Test',
67 'GIT_AUTHOR_EMAIL': 'pub@dartlang.org', 35 'GIT_AUTHOR_EMAIL': 'pub@dartlang.org',
68 'GIT_COMMITTER_NAME': 'Pub Test', 36 'GIT_COMMITTER_NAME': 'Pub Test',
69 'GIT_COMMITTER_EMAIL': 'pub@dartlang.org' 37 'GIT_COMMITTER_EMAIL': 'pub@dartlang.org'
70 }; 38 };
71
72 if (parent == null) parent = defaultRoot; 39 if (parent == null) parent = defaultRoot;
73 return git.run(args, 40 return git.run(
41 args,
74 workingDir: path.join(parent, name), 42 workingDir: path.join(parent, name),
75 environment: environment); 43 environment: environment);
76 } 44 }
77 } 45 }
78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698