mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-93398 Commit file to Mercurial repository throws exception.
*How to reproduce: make one repo inside another. Inner repository has many revisions. Outer repository has no committed and created files. Next, create new file in outer repo, try to type smth or copy/past in active editor, thus base revision will be empty, but not null-> produce exception *Refactor parseChangeFromResult method for future easy debugging such exception.(remember arguments)
This commit is contained in:
@@ -125,9 +125,9 @@ public class HgStatusCommand {
|
||||
if (includeCopySource) {
|
||||
options.add("--copies");
|
||||
}
|
||||
if (baseRevision != null) {
|
||||
if (baseRevision != null && !baseRevision.getRevision().isEmpty()) {
|
||||
options.add("--rev");
|
||||
options.add(baseRevision.getChangeset().equals("") ? baseRevision.getRevision() : baseRevision.getChangeset());
|
||||
options.add(baseRevision.getChangeset().isEmpty() ? baseRevision.getRevision() : baseRevision.getChangeset());
|
||||
if (targetRevision != null) {
|
||||
options.add("--rev");
|
||||
options.add(targetRevision.getChangeset());
|
||||
@@ -143,16 +143,16 @@ public class HgStatusCommand {
|
||||
args.addAll(options);
|
||||
args.addAll(chunk);
|
||||
HgCommandResult result = executor.executeInCurrentThread(repo, "status", args);
|
||||
changes.addAll(parseChangesFromResult(repo, result));
|
||||
changes.addAll(parseChangesFromResult(repo, result, args));
|
||||
}
|
||||
} else {
|
||||
HgCommandResult result = executor.executeInCurrentThread(repo, "status", options);
|
||||
changes.addAll(parseChangesFromResult(repo, result));
|
||||
changes.addAll(parseChangesFromResult(repo, result, options));
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
private static Collection<HgChange> parseChangesFromResult(VirtualFile repo, HgCommandResult result) {
|
||||
private static Collection<HgChange> parseChangesFromResult(VirtualFile repo, HgCommandResult result, List<String> args) {
|
||||
final Set<HgChange> changes = new HashSet<HgChange>();
|
||||
HgChange previous = null;
|
||||
if (result == null) {
|
||||
@@ -166,7 +166,7 @@ public class HgStatusCommand {
|
||||
char statusChar = line.charAt(STATUS_INDEX);
|
||||
HgFileStatusEnum status = HgFileStatusEnum.parse(statusChar);
|
||||
if (status == null) {
|
||||
LOG.error("Unknown status [" + statusChar + "] in line [" + line + "]");
|
||||
LOG.error("Unknown status [" + statusChar + "] in line [" + line + "]" + "\n with arguments " + args);
|
||||
continue;
|
||||
}
|
||||
File ioFile = new File(repo.getPath(), line.substring(2));
|
||||
|
||||
Reference in New Issue
Block a user