# # # patch "src/model/ContentDiff.cpp" # from [8ef33c0ee0df05fa76dcbe497d29dedac2059784] # to [c5480b41ffdbd25f01862f076a0dcee09fa9af28] # # patch "src/model/ContentDiff.h" # from [af86806f65f4dd445d9b86321b9ca751816e0508] # to [3d7573095014f5af6fcce851e3f4454da976009b] # ============================================================ --- src/model/ContentDiff.cpp 8ef33c0ee0df05fa76dcbe497d29dedac2059784 +++ src/model/ContentDiff.cpp c5480b41ffdbd25f01862f076a0dcee09fa9af28 @@ -25,8 +25,8 @@ #include #include -ContentDiff::ContentDiff(QObject * parent, const QString & db) - : QAbstractItemModel(parent), AutomateCommand(db) +ContentDiff::ContentDiff(QObject * parent) + : QAbstractItemModel(parent), AutomateCommand(0) { diffParser = 0; } @@ -38,9 +38,8 @@ ContentDiff::~ContentDiff() lines.clear(); } -void ContentDiff::readDiff( - const QString & fileName, const QString & base, const QString & target -) +void ContentDiff::readDatabaseDiff(const DatabaseFile & db, const QString & fileName, + const QString & base, const QString & target) { // reset the view reset(); @@ -52,9 +51,28 @@ void ContentDiff::readDiff( opts << "r" << base << "r" << target; MonotoneTask task(cmd, opts); - AutomateCommand::enqueueTask(task); + AutomateCommand::enqueueDatabaseTask(db, task); } +void ContentDiff::readWorkspaceDiff(const WorkspacePath & ws, const QString & fileName, + const QString & base) +{ + // reset the view + reset(); + + QStringList cmd; + cmd << "content_diff" << fileName; + + QStringList opts; + if (!base.isEmpty()) + { + opts << "r" << base; + } + + MonotoneTask task(cmd, opts); + AutomateCommand::enqueueWorkspaceTask(ws, task); +} + void ContentDiff::processTaskResult(const MonotoneTask & task) { if (task.getReturnCode() != 0) ============================================================ --- src/model/ContentDiff.h af86806f65f4dd445d9b86321b9ca751816e0508 +++ src/model/ContentDiff.h 3d7573095014f5af6fcce851e3f4454da976009b @@ -57,7 +57,7 @@ public: { Q_OBJECT public: - ContentDiff(QObject *, const QString &); + ContentDiff(QObject *); virtual ~ContentDiff(); // needed Qt Model methods @@ -73,7 +73,8 @@ public slots: inline FileDiffs getAllDiffs() { return diffParser->getAllDiffs(); } public slots: - void readDiff(const QString &, const QString &, const QString &); + void readDatabaseDiff(const DatabaseFile &, const QString &, const QString &, const QString &); + void readWorkspaceDiff(const WorkspacePath &, const QString &, const QString & base = QString()); signals: void diffRead();