# # # patch "src/model/Inventory.cpp" # from [eb71059b947b91d707385bcf01aae715a6318756] # to [34a728d73f166c666e54d902b676f74903f8e2a7] # # patch "src/model/InventoryWatcher.cpp" # from [d70ebb30de4bc237cb3a2df7ec9756966ab1e04d] # to [49820cb854646c8e31bcbd76dbea63a08cb28dfb] # # patch "src/view/InventoryView.cpp" # from [c10cf69bffd6833e3fe82896fbc960efa45d1d68] # to [2edeb0faf0b6174296532182fc7fd141822c704d] # ============================================================ --- src/model/Inventory.cpp eb71059b947b91d707385bcf01aae715a6318756 +++ src/model/Inventory.cpp 34a728d73f166c666e54d902b676f74903f8e2a7 @@ -79,21 +79,6 @@ void Inventory::processTaskResult(const */ void Inventory::processTaskResult(const MonotoneTask & task) { - if (task.getReturnCode() != 0) - { - if (task.getReturnCode() == 2) - { - emit invalidWorkspaceFormat( - MonotoneUtil::stripMtnPrefix(task.getOutputUtf8()) - ); - return; - } - - C(QString("Command returned with a non-zero return code (%1)") - .arg(task.getOutputUtf8())); - return; - } - QString queriedPath = ""; if (task.getArguments().size() > 1) { @@ -110,7 +95,41 @@ void Inventory::processTaskResult(const } } - BasicIOParser parser(task.getOutputUtf8()); + QString output = task.getOutputUtf8(); + + // internal errors + if (task.getReturnCode() == 1) + { + C(QString("Command returned with an error: %1").arg(output)); + return; + } + + // user errors + if (task.getReturnCode() == 2) + { + // if the path we've silently queried became unknown, + // just remove it from the model + if (output.indexOf("unknown path") != -1 && + itemMap.contains(queriedPath)) + { + D(QString("removing lost %1").arg(queriedPath)); + InventoryItem * oldItem = itemMap.value(queriedPath); + ModelItem * oldParent = oldItem->parent(); + int row = oldItem->row(); + removeRowsRecursive(oldParent, row, row); + return; + } + + // everything else _should_ be a problem with the workspace format. + // note that we do not explicitely check for this, we throw it just + // back to the user... + emit invalidWorkspaceFormat( + MonotoneUtil::stripMtnPrefix(output) + ); + return; + } + + BasicIOParser parser(output); I(parser.parse()); StanzaList stanzas = parser.getStanzas(); ============================================================ --- src/model/InventoryWatcher.cpp d70ebb30de4bc237cb3a2df7ec9756966ab1e04d +++ src/model/InventoryWatcher.cpp 49820cb854646c8e31bcbd76dbea63a08cb28dfb @@ -47,7 +47,7 @@ void InventoryWatcher::unwatchItems(cons void InventoryWatcher::unwatchItems(const QModelIndexList & indexes) { - removePaths(pathsFromIndexes(indexes)); + //removePaths(pathsFromIndexes(indexes)); } QStringList InventoryWatcher::pathsFromIndexes(const QModelIndexList & indexes) @@ -63,7 +63,6 @@ QStringList InventoryWatcher::pathsFromI InventoryItem * invitem = reinterpret_cast(item); if (!invitem) continue; if (invitem->getFSType() == InventoryItem::None) continue; -D(QString("processing %1").arg(invitem->getPath())); paths.append(workspace + "/" + invitem->getPath()); } return paths; ============================================================ --- src/view/InventoryView.cpp c10cf69bffd6833e3fe82896fbc960efa45d1d68 +++ src/view/InventoryView.cpp 2edeb0faf0b6174296532182fc7fd141822c704d @@ -819,6 +819,9 @@ void InventoryView::notifyAboutViewportC // restore it again setSelectionModel(oldSelectModel); + // convert proxy into real indexes and remove column indexes > 0 + const QSortFilterProxyModel * proxyModel = + static_cast(model()); for (int i=0; i 0) @@ -826,6 +829,7 @@ void InventoryView::notifyAboutViewportC newIndexes.removeAt(i); continue; } + newIndexes[i] = proxyModel->mapToSource(newIndexes[i]); i++; }