]> andersk Git - svn-all-fast-export.git/blobdiff - src/svn.cpp
Beautify the rule debug output
[svn-all-fast-export.git] / src / svn.cpp
index b283ba0dad3f193d1ac8131c92ddb55f8c0237d8..615f9e14d7292c42838cba891c69d4b0ca4d40c3 100644 (file)
@@ -477,7 +477,7 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change
         case Rules::Match::Ignore:
             // ignore rule
             qDebug() << "   " << qPrintable(current) << "rev" << revnum
-                     << "-> ignored (rule line" << rule.lineNumber << ")";
+                     << "-> ignored (rule" << rule << ")";
             return EXIT_SUCCESS;
 
         case Rules::Match::Recurse:
@@ -485,7 +485,7 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change
             if (is_dir)
                 return recurse(key, change, path_from, rev_from, revpool);
             if (change->change_kind != svn_fs_path_change_delete)
-                qWarning() << "   recurse rule " << rule.rx.pattern() << "line" << rule.lineNumber
+                qWarning() << "   recurse rule" << rule
                            << "applied to non-directory:" << qPrintable(current);
             return EXIT_SUCCESS;
 
@@ -494,7 +494,10 @@ int SvnRevision::exportEntry(const char *key, const svn_fs_path_change_t *change
         }
     }
 
-    if (wasDir(fs, revnum - 1, key, revpool)) {
+    if (is_dir && path_from != NULL) {
+        qDebug() << current << "is a copy-with-history, auto-recursing";
+        return recurse(key, change, path_from, rev_from, revpool);
+    } else if (wasDir(fs, revnum - 1, key, revpool)) {
         qDebug() << current << "was a directory; ignoring";
     } else if (change->change_kind == svn_fs_path_change_delete) {
         qDebug() << current << "is being deleted but I don't know anything about it; ignoring";
@@ -553,7 +556,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
 
                 Repository *repo = repositories.value(repository, 0);
                 if (!repo) {
-                    qCritical() << "Rule" << rule.rx.pattern() << "line" << rule.lineNumber
+                    qCritical() << "Rule" << rule
                                 << "references unknown repository" << repository;
                     return EXIT_FAILURE;
                 }
@@ -567,7 +570,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
     if (!txn) {
         Repository *repo = repositories.value(repository, 0);
         if (!repo) {
-            qCritical() << "Rule" << rule.rx.pattern() << "line" << rule.lineNumber
+            qCritical() << "Rule" << rule
                         << "references unknown repository" << repository;
             return EXIT_FAILURE;
         }
@@ -579,12 +582,14 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha
         transactions.insert(repository, txn);
     }
 
-    if (change->change_kind == svn_fs_path_change_delete)
+    if (change->change_kind == svn_fs_path_change_delete) {
         txn->deleteFile(path);
-    else if (!current.endsWith('/'))
+    } else if (!current.endsWith('/')) {
         dumpBlob(txn, fs_root, key, path, pool);
-    else
+    } else {
+        txn->deleteFile(path);
         recursiveDumpDir(txn, fs_root, key, path, pool);
+    }
 
     return EXIT_SUCCESS;
 }
@@ -606,7 +611,9 @@ int SvnRevision::recurse(const char *path, const svn_fs_path_change_t *change,
 
         svn_fs_dirent_t *dirent = reinterpret_cast<svn_fs_dirent_t *>(value);
         QByteArray entry = path + QByteArray("/") + dirent->name;
-        QByteArray entryFrom = path_from + QByteArray("/") + dirent->name;
+        QByteArray entryFrom;
+        if (path_from)
+            entryFrom = path_from + QByteArray("/") + dirent->name;
 
         QString current = QString::fromUtf8(entry);
         if (dirent->kind == svn_node_dir)
@@ -615,7 +622,8 @@ int SvnRevision::recurse(const char *path, const svn_fs_path_change_t *change,
         // find the first rule that matches this pathname
         MatchRuleList::ConstIterator match = findMatchRule(matchRules, revnum, current);
         if (match != matchRules.constEnd()) {
-            if (exportInternal(entry, change, entryFrom, rev_from, current, *match) == EXIT_FAILURE)
+            if (exportInternal(entry, change, entryFrom.isNull() ? 0 : entryFrom.constData(),
+                               rev_from, current, *match) == EXIT_FAILURE)
                 return EXIT_FAILURE;
         } else {
             qCritical() << current << "did not match any rules; cannot continue";
This page took 0.030822 seconds and 4 git commands to generate.