mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
assert: GitApplyChangesProcess.moveChanges
`ChangeListCommand` can be invoked twice, if CLM is being updated when `CLM.addChangeList` is called. In this case LocalChangeList that is returned by `CLM.addChangeList` and LocalChangeList that will be actually created when update is completed will have different IDs (but same names / data / etc). This broke listener in GitApplyChangesProcess and we couldn't await for the changes to be moved (as we waited for the list with different ID).
This commit is contained in:
@@ -198,19 +198,19 @@ public class ChangeListWorker {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LocalChangeList addChangeList(@NotNull String name, @Nullable String comment, @Nullable ChangeListData data) {
|
||||
return addChangeList(name, comment, false, data);
|
||||
public LocalChangeList addChangeList(@NotNull String name, @Nullable String comment, @Nullable String id, @Nullable ChangeListData data) {
|
||||
return addChangeList(name, comment, id, data, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private LocalChangeList addChangeList(@NotNull String name, @Nullable String description, boolean inUpdate,
|
||||
@Nullable ChangeListData data) {
|
||||
private LocalChangeList addChangeList(@NotNull String name, @Nullable String description, @Nullable String id,
|
||||
@Nullable ChangeListData data, boolean inUpdate) {
|
||||
if (myMap.containsKey(name)) {
|
||||
LOG.error("Attempt to create duplicate changelist " + name);
|
||||
return myMap.get(name);
|
||||
}
|
||||
|
||||
LocalChangeListImpl newList = LocalChangeListImpl.createEmptyChangeListImpl(myProject, name, null);
|
||||
LocalChangeListImpl newList = LocalChangeListImpl.createEmptyChangeListImpl(myProject, name, id);
|
||||
newList.setCommentImpl(description);
|
||||
newList.setData(data);
|
||||
|
||||
@@ -734,7 +734,7 @@ public class ChangeListWorker {
|
||||
@NotNull
|
||||
@Override
|
||||
public LocalChangeList addChangeList(@NotNull String name, @Nullable String comment) {
|
||||
return myWorker.addChangeList(name, comment, true, null).copy();
|
||||
return myWorker.addChangeList(name, comment, null, null, true).copy();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -42,9 +42,12 @@ public class AddList implements ChangeListCommand {
|
||||
public void apply(final ChangeListWorker worker) {
|
||||
LocalChangeList list = worker.getChangeListByName(myName);
|
||||
if (list == null) {
|
||||
// Create list with the same id, if we were invoked before (on "temp" worker during CLM update).
|
||||
String id = myNewListCopy != null ? myNewListCopy.getId() : null;
|
||||
|
||||
myWasListCreated = true;
|
||||
myOldComment = null;
|
||||
myNewListCopy = worker.addChangeList(myName, myComment, myData).copy();
|
||||
myNewListCopy = worker.addChangeList(myName, myComment, id, myData).copy();
|
||||
}
|
||||
else if (StringUtil.isNotEmpty(myComment)) {
|
||||
myWasListCreated = false;
|
||||
|
||||
Reference in New Issue
Block a user