private async function genCheckoutFilesAtRevToPath()

in src/shipit/repo/ShipItRepoHG.php [459:509]


  private async function genCheckoutFilesAtRevToPath(
    keyset<string> $files,
    string $rev,
    string $path,
  ): Awaitable<void> {
    /* Use a list of patterns from a file (/dev/stdin) instead
     * of specifying on the command line - otherwise, we can
     * generate a command that is larger than the maximum length
     * allowed by the system, so, exec() won't actually execute.
     *
     * In the case of zero files passed, assume that means we're exporting
     * the root, otherwise archive will fail.
     *
     * Example diff:
     *   rFBSed54f611dc0aebe17010b3416e64549d95ee3a49
     *   ... which is https://github.com/facebook/nuclide/commit/2057807d2653dd1af359f44f658eadac6eaae34b
     */
    if (C\is_empty($files)) {
      $files = keyset['.'];
    }
    $patterns = Keyset\map($files, $file ==> 'path:'.$file)
      |> Str\join($$, "\n");

    // Prefetch is needed for reasonable performance with the remote file
    // log extension
    using ($this->getSharedLock()->getExclusive()) {
      try {
        await $this->genHgPipeCommand(
          $patterns,
          'prefetch',
          '-r',
          $rev,
          'listfile:/dev/stdin',
        );
      } catch (ShipItShellCommandException $_e) {
        // ignore, not all repos are shallow
      }
    }

    await $this->genHgPipeCommand(
      $patterns,
      'archive',
      '--config',
      'ui.archivemeta=False',
      '-r',
      $rev,
      '-I',
      'listfile:/dev/stdin',
      $path,
    );
  }