use of com.intellij.dvcs.push.PushSpec in project intellij-community by JetBrains.
the class HgPusher method push.
@Override
public void push(@NotNull Map<HgRepository, PushSpec<HgPushSource, HgTarget>> pushSpecs, @Nullable VcsPushOptionValue vcsPushOptionValue, boolean force) {
for (Map.Entry<HgRepository, PushSpec<HgPushSource, HgTarget>> entry : pushSpecs.entrySet()) {
HgRepository repository = entry.getKey();
PushSpec<HgPushSource, HgTarget> hgSpec = entry.getValue();
HgTarget destination = hgSpec.getTarget();
HgPushSource source = hgSpec.getSource();
Project project = repository.getProject();
final HgPushCommand pushCommand = new HgPushCommand(project, repository.getRoot(), destination.myTarget);
// set always true, because it just allow mercurial to create a new one if needed
pushCommand.setIsNewBranch(true);
pushCommand.setForce(force);
String branchName = source.getBranch();
if (branchName.equals(repository.getCurrentBookmark())) {
if (vcsPushOptionValue == HgVcsPushOptionValue.Current) {
pushCommand.setBookmarkName(branchName);
} else {
pushCommand.setRevision(branchName);
}
} else {
pushCommand.setBranchName(branchName);
}
pushSynchronously(project, pushCommand);
}
}
use of com.intellij.dvcs.push.PushSpec in project intellij-community by JetBrains.
the class GitPusher method rememberTargets.
private void rememberTargets(@NotNull Map<GitRepository, PushSpec<GitPushSource, GitPushTarget>> pushSpecs) {
for (Map.Entry<GitRepository, PushSpec<GitPushSource, GitPushTarget>> entry : pushSpecs.entrySet()) {
GitRepository repository = entry.getKey();
GitPushSource source = entry.getValue().getSource();
GitPushTarget target = entry.getValue().getTarget();
GitPushTarget defaultTarget = myPushSupport.getDefaultTarget(repository);
if (defaultTarget == null || !target.getBranch().equals(defaultTarget.getBranch())) {
mySettings.setPushTarget(repository, source.getBranch().getName(), target.getBranch().getRemote().getName(), target.getBranch().getNameForRemoteOperations());
}
}
}
Aggregations