void (final MovedFileInfo file) { final FilePath source = file.getOldPath(); final FilePath target = file.getNewPath(); VirtualFile sourceRoot = VcsUtil.getVcsRootFor(myProject, source); VirtualFile targetRoot = VcsUtil.getVcsRootFor(myProject, target); if (sourceRoot != null && sourceRoot.equals(targetRoot)) { HgCommandResult result; int attempt = 0; do { result = new HgMoveCommand(myProject).execute(sourceRoot, source, target); } while (HgErrorUtil.isWLockError(result) && attempt++ < 2); if (!HgErrorUtil.hasErrorsInCommandExecution(result)) { dirtyScopeManager.fileDirty(source); dirtyScopeManager.fileDirty(target); } else { failedToMove.add(file); LOG.warn("Hg rename failed:" + result.getRawError()); } } }