getChangeset instead of revision number if it is possible.

This commit is contained in:
Nadya Zabrodina
2013-11-01 16:23:30 +04:00
parent a1dc7ddf8f
commit b349b8207b
4 changed files with 12 additions and 5 deletions
@@ -94,6 +94,9 @@ public class HgRevisionNumber implements VcsRevisionNumber {
}
public String asString() {
if (revision.isEmpty()) {
return changeset;
}
return revision + ":" + changeset;
}
@@ -18,6 +18,7 @@ package org.zmlx.hg4idea.action;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
@@ -110,7 +111,8 @@ public class HgMerge extends HgAbstractGlobalAction {
HgRevisionNumber otherHead = dialog.getOtherHead();
if (otherHead != null) {
hgMergeCommand.setRevision(otherHead.getRevision());
String changeset = otherHead.getChangeset();
hgMergeCommand.setRevision(StringUtil.isEmptyOrSpaces(changeset) ? otherHead.getRevision() : changeset);
incomingRevision = otherHead;
}
@@ -155,9 +155,9 @@ public class HgStatusCommand {
if (myIncludeCopySource) {
options.add("--copies");
}
if (myBaseRevision != null && !myBaseRevision.getRevision().isEmpty()) {
if (myBaseRevision != null && (!myBaseRevision.getRevision().isEmpty() || !myBaseRevision.getChangeset().isEmpty())) {
options.add("--rev");
options.add(myBaseRevision.getChangeset().isEmpty() ? myBaseRevision.getRevision() : myBaseRevision.getChangeset());
options.add(StringUtil.isEmptyOrSpaces(myBaseRevision.getChangeset()) ? myBaseRevision.getRevision() : myBaseRevision.getChangeset());
if (myTargetRevision != null) {
options.add("--rev");
options.add(myTargetRevision.getChangeset());
@@ -88,8 +88,10 @@ public class HgMergeProvider implements MergeProvider {
// Find common ancestor of two revisions : hg debugancestor rev1 rev2
// Using quotes may produce wrong escaping errors on Unix-type systems
List<String> arguments = new ArrayList<String>();
arguments.add(localRevisionNumber.getRevision());
arguments.add(serverRevisionNumber.getRevision());
String localChangeset = localRevisionNumber.getChangeset();
String serverChangeset = serverRevisionNumber.getChangeset();
arguments.add(StringUtil.isEmptyOrSpaces(localChangeset) ? localRevisionNumber.getRevision() : localChangeset);
arguments.add(StringUtil.isEmptyOrSpaces(serverChangeset) ? serverRevisionNumber.getRevision() : serverChangeset);
HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(repo, "debugancestor", arguments);
if (result != null) {
String output = result.getRawOutput();