use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgRepositorySelectorComponent method setRoots.
public void setRoots(Collection<HgRepository> roots) {
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (HgRepository repo : roots) {
model.addElement(repo);
}
repositorySelector.setModel(model);
mainPanel.setVisible(roots.size() > 1);
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgRegularUpdater method commitOrWarnAboutConflicts.
private void commitOrWarnAboutConflicts(List<VcsException> exceptions, HgCommandResult mergeResult) throws VcsException {
if (mergeResult.getExitValue() == 0) {
//operation successful and no conflicts
try {
HgRepository hgRepository = HgUtil.getRepositoryForFile(project, repoRoot);
if (hgRepository == null) {
LOG.warn("Couldn't find repository info for " + repoRoot.getName());
return;
}
new HgCommitCommand(project, hgRepository, "Automated merge").executeInCurrentThread();
} catch (HgCommandException e) {
throw new VcsException(e);
}
} else {
reportWarning(exceptions, HgVcsMessages.message("hg4idea.update.warning.merge.conflicts", repoRoot.getPath()));
}
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgTaskBranchesTest method initRepository.
@NotNull
@Override
protected Repository initRepository(@NotNull String name) {
String tempDirectory = FileUtil.getTempDirectory();
String root = tempDirectory + "/" + name;
assertTrue(new File(root).mkdirs());
HgPlatformTest.initRepo(root);
touch("a.txt");
hg("add a.txt");
hg("commit -m another -u abc");
hg("up -r 0");
ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(myProject);
HgVcs hgVcs = HgVcs.getInstance(myProject);
assert hgVcs != null;
hgVcs.getProjectSettings().setCheckIncomingOutgoing(false);
vcsManager.setDirectoryMapping(root, HgVcs.VCS_NAME);
VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(root));
HgRepository repository = HgUtil.getRepositoryManager(myProject).getRepositoryForRoot(file);
assertNotNull("Couldn't find repository for root " + root, repository);
return repository;
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgBookmarkCommand method createBookmarkAsynchronously.
public static void createBookmarkAsynchronously(@NotNull List<HgRepository> repositories, @NotNull String name, boolean isActive) {
final Project project = ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(repositories)).getProject();
if (StringUtil.isEmptyOrSpaces(name)) {
VcsNotifier.getInstance(project).notifyError("Hg Error", "Bookmark name is empty");
return;
}
new Task.Backgroundable(project, HgVcsMessages.message("hg4idea.progress.bookmark", name)) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
for (HgRepository repository : repositories) {
executeBookmarkCommandSynchronously(project, repository.getRoot(), name, isActive ? emptyList() : singletonList("--inactive"));
}
}
}.queue();
}
use of org.zmlx.hg4idea.repo.HgRepository in project intellij-community by JetBrains.
the class HgQGotoFromLogAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
VcsLog log = e.getRequiredData(VcsLogDataKeys.VCS_LOG);
log.requestSelectedDetails(new Consumer<List<VcsFullCommitDetails>>() {
@Override
public void consume(List<VcsFullCommitDetails> selectedDetails) {
VcsFullCommitDetails fullCommitDetails = ContainerUtil.getFirstItem(selectedDetails);
assert fullCommitDetails != null;
final HgRepository repository = getRepositoryForRoot(project, fullCommitDetails.getRoot());
assert repository != null;
actionPerformed(repository, fullCommitDetails);
}
}, null);
}
Aggregations