use of org.zmlx.hg4idea.command.HgPushCommand 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 org.zmlx.hg4idea.command.HgPushCommand in project intellij-community by JetBrains.
the class HgPushTest method testHgPushCommand.
/**
* Testing HgPushCommand:
* 1. Create a file, add to the VCS and commit via ChangeListManager.
* 2. Push via HgPushCommand.
* 3. Natively update parent repository.
* 4. Verify that the changes appeared there.
*/
@Test
public void testHgPushCommand() throws Exception {
final VirtualFile vf = createFileInCommand(AFILE, "initial content");
myChangeListManager.addUnversionedFilesToVcs(vf);
myChangeListManager.checkFilesAreInList(true, vf);
myChangeListManager.commitFiles(vf);
new HgPushCommand(myProject, myRepo.getDir(), myParentRepo.getDir().getUrl()).executeInCurrentThread();
myParentRepo.update();
assertNotNull(myParentRepo.getDir().findChild(AFILE));
}
Aggregations