private void updateToPulledHead(
      VirtualFile repo,
      UpdatedFiles updatedFiles,
      HgRevisionNumber newHead,
      ProgressIndicator indicator) {
    indicator.setText2(HgVcsMessages.message("hg4idea.update.progress.updating.to.pulled.head"));
    HgRevisionNumber parentBeforeUpdate =
        new HgWorkingCopyRevisionsCommand(project).firstParent(repo);
    HgUpdateCommand updateCommand = new HgUpdateCommand(project, repoRoot);
    updateCommand.setRevision(newHead.getChangeset());
    updateCommand.setClean(true);
    updateCommand.execute();

    HgRevisionNumber commonParent = findCommonParent(newHead, parentBeforeUpdate);
    addUpdatedFiles(repo, updatedFiles, commonParent, newHead);
  }
 private void addUpdatedFiles(
     VirtualFile repo,
     UpdatedFiles updatedFiles,
     HgRevisionNumber parentBeforeUpdate,
     HgRevisionNumber parentAfterUpdate) {
   if (parentAfterUpdate == null || parentBeforeUpdate == null) {
     return;
   }
   if (parentAfterUpdate.equals(
       parentBeforeUpdate)) { // nothing to update => returning not to capture local uncommitted
                              // changes
     return;
   }
   HgStatusCommand statusCommand =
       new HgStatusCommand.Builder(true)
           .ignored(false)
           .unknown(false)
           .baseRevision(parentBeforeUpdate)
           .targetRevision(parentAfterUpdate)
           .build(project);
   Set<HgChange> changes = statusCommand.execute(repo);
   for (HgChange change : changes) {
     HgFileStatusEnum status = change.getStatus();
     switch (status) {
       case ADDED:
         addToGroup(updatedFiles, change, FileGroup.CREATED_ID);
         break;
       case MODIFIED:
         addToGroup(updatedFiles, change, FileGroup.UPDATED_ID);
         break;
       case DELETED:
         addToGroup(updatedFiles, change, FileGroup.REMOVED_FROM_REPOSITORY_ID);
         break;
       case COPY:
         addToGroup(updatedFiles, change, FileGroup.CHANGED_ON_SERVER_ID);
         break;
       default:
         // do nothing
         break;
     }
   }
 }