diff options
| author | Sami Shalayel <sami.shalayel@qt.io> | 2026-06-17 11:43:54 +0200 |
|---|---|---|
| committer | Sami Shalayel <sami.shalayel@qt.io> | 2026-06-24 19:35:15 +0000 |
| commit | 38ccc89337d13bb99685a12a5ae8716ac2c2f930 (patch) | |
| tree | b9936f770e466b5257b428a949c71b54c8cd665a /tools | |
| parent | 265c9250df853df1110ca4c2545b100481b98a2e (diff) | |
dom: Remove backup machinery from dom formatting
We no longer generate backup files since commit
bc6c900b1556517e9fe20d73e40dc33d8c99a1cc.
Remove the backup parameter and machinery from:
- FileWriter::write()
- DomItem::writeOut()
- DomItem::dump()
- qmlformat
It seems that qmldomtool has a formatting option that also accepts a
backup parameter like qmlformat does. If we removed the backup
functionality from qmlformat, than it probably also makes sense to
remove the backup functionality from the qmldomtool's formatting
feature.
Change-Id: I68b005f36cc6719eb9630960e42ce16ca63b6a29
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/qmldom/qmldomtool.cpp | 24 | ||||
| -rw-r--r-- | tools/qmlformat/qmlformat.cpp | 3 |
2 files changed, 4 insertions, 23 deletions
diff --git a/tools/qmldom/qmldomtool.cpp b/tools/qmldom/qmldomtool.cpp index 9f6a194589..5c38230ba2 100644 --- a/tools/qmldom/qmldomtool.cpp +++ b/tools/qmldom/qmldomtool.cpp @@ -97,19 +97,11 @@ int main(int argc, char *argv[]) QCommandLineOption reformatDirOption( QStringList() << "reformat-dir", - QLatin1String( - "Target directory for the reformatted files, " - "if not given the files are reformatted in place (but backup files are kept)"), + QLatin1String("Target directory for the reformatted files, " + "if not given the files are reformatted in place"), QLatin1String("reformatDir")); parser.addOption(reformatDirOption); - QCommandLineOption nBackupsOption( - QStringList() << "backups", - QLatin1String("Number of backup files to generate (default is 2, the oldest, " - "and the last version are kept), "), - QLatin1String("nBackups")); - parser.addOption(nBackupsOption); - QCommandLineOption dumpAstOption(QStringList() << "dump-ast", QLatin1String("Dumps the AST of the given QML file.")); parser.addOption(dumpAstOption); @@ -158,16 +150,6 @@ int main(int argc, char *argv[]) } } - int nBackups = 2; - if (parser.isSet(nBackupsOption)) { - bool intOk; - nBackups = parser.value(nBackupsOption).toInt(&intOk); - if (!intOk) { - qDebug() << "expected an integer giving the number of backups after --backups, not " - << parser.value(nBackupsOption); - } - } - QList<Path> pathsToDump; for (const QString &pStr : parser.values(pathToDumpOption)) { pathsToDump.append(Path::fromString(pStr)); @@ -245,7 +227,7 @@ int main(int argc, char *argv[]) QDir d(rDir); target = d.filePath(f.fileName()); } - auto res = qmlFile.writeOut(target, nBackups, lwOptions, &fw, checks); + auto res = qmlFile.writeOut(target, lwOptions, &fw, checks); switch (fw.status) { case FileWriter::Status::ShouldWrite: case FileWriter::Status::SkippedDueToFailure: diff --git a/tools/qmlformat/qmlformat.cpp b/tools/qmlformat/qmlformat.cpp index ff04137388..5d325c356c 100644 --- a/tools/qmlformat/qmlformat.cpp +++ b/tools/qmlformat/qmlformat.cpp @@ -83,8 +83,7 @@ static bool parseFile(const QString &filename, const QQmlFormatOptions &options) if (options.isVerbose()) qWarning().noquote() << "Writing to file" << filename; FileWriter fw; - const unsigned numberOfBackupFiles = 0; - res = fileItem.writeOut(filename, numberOfBackupFiles, lwOptions, &fw, checks); + res = fileItem.writeOut(filename, lwOptions, &fw, checks); } else { QFile out; if (out.open(stdout, QIODevice::WriteOnly)) { |
