use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgRegularUpdater method processRebase.
private void processRebase(ProgressIndicator indicator, final UpdatedFiles updatedFiles) throws VcsException {
indicator.setText2(HgVcsMessages.message("hg4idea.progress.rebase"));
HgRepository repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(repoRoot);
if (repository == null) {
throw new VcsException("Repository not found for root " + repoRoot);
}
HgRebaseCommand rebaseCommand = new HgRebaseCommand(project, repository);
HgCommandResult result = new HgRebaseCommand(project, repository).startRebase();
if (HgErrorUtil.isCommandExecutionFailed(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't rebase repository.");
return;
}
//noinspection ConstantConditions
while (result.getExitValue() == 1) {
//if result == null isAbort will be true;
resolvePossibleConflicts(updatedFiles);
if (HgConflictResolver.hasConflicts(project, repoRoot) || HgErrorUtil.isNothingToRebase(result)) {
break;
}
result = rebaseCommand.continueRebase();
if (HgErrorUtil.isAbort(result)) {
new HgCommandResultNotifier(project).notifyError(result, "Hg Error", "Couldn't continue rebasing");
break;
}
}
repository.update();
repoRoot.refresh(true, true);
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgRegularUpdater method doMerge.
private HgCommandResult doMerge(ProgressIndicator indicator) throws VcsException {
indicator.setText2(HgVcsMessages.message("hg4idea.update.progress.merging"));
HgRepository repository = HgUtil.getRepositoryManager(project).getRepositoryForRoot(repoRoot);
if (repository == null) {
LOG.error("Couldn't find repository for " + repoRoot.getName());
return null;
}
HgMergeCommand mergeCommand = new HgMergeCommand(project, repository);
// mergeCommand.setRevision(headToMerge.getRevision());
return mergeCommand.mergeSynchronously();
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgChangeProvider method process.
private Collection<HgChange> process(ChangelistBuilder builder, Collection<FilePath> files) {
final Set<HgChange> hgChanges = new HashSet<>();
for (Map.Entry<VirtualFile, Collection<FilePath>> entry : HgUtil.groupFilePathsByHgRoots(myProject, files).entrySet()) {
VirtualFile repo = entry.getKey();
final HgRevisionNumber workingRevision = new HgWorkingCopyRevisionsCommand(myProject).identify(repo).getFirst();
final HgRevisionNumber parentRevision = new HgWorkingCopyRevisionsCommand(myProject).firstParent(repo);
final Map<HgFile, HgResolveStatusEnum> list = new HgResolveCommand(myProject).getListSynchronously(repo);
hgChanges.addAll(new HgStatusCommand.Builder(true).ignored(false).build(myProject).executeInCurrentThread(repo, entry.getValue()));
final HgRepository hgRepo = HgUtil.getRepositoryForFile(myProject, repo);
if (hgRepo != null && hgRepo.hasSubrepos()) {
hgChanges.addAll(ContainerUtil.mapNotNull(hgRepo.getSubrepos(), info -> findChange(hgRepo, info)));
}
sendChanges(builder, hgChanges, list, workingRevision, parentRevision);
}
return hgChanges;
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgIgnoredFileHolder method containsFile.
@Override
public boolean containsFile(VirtualFile file) {
HgRepository repositoryForFile = HgUtil.getRepositoryForFile(myProject, file);
if (repositoryForFile == null)
return false;
HgLocalIgnoredHolder localIgnoredHolder = myVcsIgnoredHolderMap.get(repositoryForFile);
return localIgnoredHolder != null && localIgnoredHolder.contains(file);
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgCommonDialogWithChoices method updateRepository.
private void updateRepository() {
HgRepository repo = hgRepositorySelectorComponent.getRepository();
branchSelector.setModel(new DefaultComboBoxModel(repo.getOpenedBranches().toArray()));
DefaultComboBoxModel tagComboBoxModel = new DefaultComboBoxModel(HgUtil.getSortedNamesWithoutHashes(repo.getTags()).toArray());
tagComboBoxModel.addElement(//HgRepository does not store 'tip' tag because it is internal and not included in tags file
TIP_REFERENCE);
tagSelector.setModel(tagComboBoxModel);
bookmarkSelector.setModel(new DefaultComboBoxModel(HgUtil.getSortedNamesWithoutHashes(repo.getBookmarks()).toArray()));
update();
}
Aggregations