tree: 9d2037c80a5709a5f360e94da92aecf683cb390e [path history] [tgz]
  1. lib/
  2. test/
  3. pubspec.yaml
  4. README.md
tools/pkg/git_repo_tools/README.md

git_repo_tools

This is a repo-internal library for flutter/engine, that contains shared code for writing tools that want to interact with the git repository. For example, finding all changed files in the current branch:

import 'dart:io' as io show File, Platform;

import 'package:engine_repo_tools/engine_repo_tools.dart';
import 'package:git_repo_tools/git_repo_tools.dart';
import 'package:path/path.dart' as path;

void main() async {
  // Finds the root of the engine repository from the current script.
  final Engine engine = Engine.findWithin(path.dirname(path.fromUri(io.Platform.script)));
  final GitRepo gitRepo = GitRepo(engine.flutterDir);

  for (final io.File file in gitRepo.changedFiles) {
    print('Changed file: ${file.path}');
  }
}