code: public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
      {
          $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  
          $ref = $target->getSourceReference();
          $this->io->writeError(" Updating to ".$target->getSourceReference());
  
          if (!$this->hasMetadataRepository($path)) {
              throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
          }
  
          $command = function ($url) use ($ref) {
              return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
          };
  
          $hgUtils->runCommand($command, $url, $path);
      }
docs: {@inheritDoc}