diffFile method

Future<FileDiff> diffFile(
  1. String mountId,
  2. String path
)

Compares one path on a directory mount's local copy against the node.

The bytes of both sides are only transferred for a small, textual file (see _maxInlineDiffBytes); for big or binary files the result carries just the size/hash of each side so the caller can report the difference without moving the content.

Implementation

Future<FileDiff> diffFile(String mountId, String path) async {
  final record = require(mountId);
  if (record.isGit) {
    throw DriveException('drive diff is only supported for directory mounts');
  }
  return _withSession(record, (rpc) async {
    final local = _localSource(record);
    final localManifest = await local.manifest();
    final originManifest = await ChannelContentSource(rpc).manifest();
    return _buildFileDiff(
      record,
      rpc,
      local,
      localManifest,
      originManifest,
      path,
    );
  });
}