| 168 | } |
| 169 | |
| 170 | void TestBazaar::commitFiles() |
| 171 | { |
| 172 | prepareWhoamiInformations(); |
| 173 | qDebug() << "Committing..."; |
| 174 | //we start it after addFiles, so we just have to commit |
| 175 | VcsJob* j = m_plugin->commit(QStringLiteral("Test commit"), QList<QUrl>() << QUrl::fromLocalFile(bazaarTest_BaseDir)); |
| 176 | VERIFYJOB(j); |
| 177 | |
| 178 | //test bzr-status exitCode one more time. |
| 179 | j = m_plugin->status(QList<QUrl>() << QUrl::fromLocalFile(bazaarTest_BaseDir)); |
| 180 | VERIFYJOB(j); |
| 181 | |
| 182 | //since we committed the file to the "pure" repository, .bzr/repository/indices should exist |
| 183 | //TODO: maybe other method should be used |
| 184 | QString headRefName(bazaarRepo + "/repository/indices"); |
| 185 | QVERIFY(QFileInfo::exists(headRefName)); |
| 186 | |
| 187 | //Test the results of the "bzr add" |
| 188 | auto* jobLs = new DVcsJob(bazaarTest_BaseDir, m_plugin); |
| 189 | *jobLs << "bzr" << "ls" << "-R"; |
| 190 | |
| 191 | if (jobLs->exec() && jobLs->status() == KDevelop::VcsJob::JobSucceeded) { |
| 192 | QStringList files = jobLs->output().split('\n'); |
| 193 | QVERIFY(files.contains(bazaarTest_FileName)); |
| 194 | QVERIFY(files.contains(bazaarTest_FileName2)); |
| 195 | QVERIFY(files.contains("src/" + bazaarTest_FileName3)); |
| 196 | } |
| 197 | |
| 198 | qDebug() << "Committing one more time"; |
| 199 | //let's try to change the file and test "bzr commit" |
| 200 | QFile f(bazaarTest_BaseDir + bazaarTest_FileName); |
| 201 | |
| 202 | if (f.open(QIODevice::WriteOnly)) { |
| 203 | QTextStream input(&f); |
| 204 | input << "Just another HELLO WORLD\n"; |
| 205 | } |
| 206 | |
| 207 | f.close(); |
| 208 | |
| 209 | //add changes |
| 210 | j = m_plugin->add(QList<QUrl>() << QUrl::fromLocalFile(bazaarTest_BaseDir + bazaarTest_FileName)); |
| 211 | VERIFYJOB(j); |
| 212 | |
| 213 | j = m_plugin->commit(QStringLiteral("KDevelop's Test commit2"), QList<QUrl>() << QUrl::fromLocalFile(bazaarTest_BaseDir)); |
| 214 | VERIFYJOB(j); |
| 215 | } |
| 216 | |
| 217 | void TestBazaar::testInit() |
| 218 | { |