@@ -319,68 +319,6 @@ static bool wasDir(svn_fs_t *fs, int revnum, const char *pathname, apr_pool_t *p
319
319
return is_dir;
320
320
}
321
321
322
- static int recursiveDumpDir (Repository::Transaction *txn, svn_fs_t *fs, svn_fs_root_t *fs_root,
323
- const QByteArray &pathname, const QString &finalPathName,
324
- apr_pool_t *pool, svn_revnum_t revnum,
325
- const Rules::Match &rule, const MatchRuleList &matchRules,
326
- bool ruledebug)
327
- {
328
- if (!wasDir (fs, revnum, pathname.data (), pool)) {
329
- if (dumpBlob (txn, fs_root, pathname, finalPathName, pool) == EXIT_FAILURE)
330
- return EXIT_FAILURE;
331
- return EXIT_SUCCESS;
332
- }
333
-
334
- // get the dir listing
335
- apr_hash_t *entries;
336
- SVN_ERR (svn_fs_dir_entries (&entries, fs_root, pathname, pool));
337
- AprAutoPool dirpool (pool);
338
-
339
- // While we get a hash, put it in a map for sorted lookup, so we can
340
- // repeat the conversions and get the same git commit hashes.
341
- QMap<QByteArray, svn_node_kind_t > map;
342
- for (apr_hash_index_t *i = apr_hash_first (pool, entries); i; i = apr_hash_next (i)) {
343
- const void *vkey;
344
- void *value;
345
- apr_hash_this (i, &vkey, NULL , &value);
346
- svn_fs_dirent_t *dirent = reinterpret_cast <svn_fs_dirent_t *>(value);
347
- map.insertMulti (QByteArray (dirent->name ), dirent->kind );
348
- }
349
-
350
- QMapIterator<QByteArray, svn_node_kind_t > i (map);
351
- while (i.hasNext ()) {
352
- dirpool.clear ();
353
- i.next ();
354
- QByteArray entryName = pathname + ' /' + i.key ();
355
- QString entryFinalName = finalPathName + QString::fromUtf8 (i.key ());
356
-
357
- if (i.value () == svn_node_dir) {
358
- entryFinalName += ' /' ;
359
- QString entryNameQString = entryName + ' /' ;
360
-
361
- MatchRuleList::ConstIterator match = findMatchRule (matchRules, revnum, entryNameQString);
362
- if (match == matchRules.constEnd ()) continue ; // no match of parent repo? (should not happen)
363
-
364
- const Rules::Match &matchedRule = *match;
365
- if (matchedRule.action != Rules::Match::Export || matchedRule.repository != rule.repository ) {
366
- if (ruledebug)
367
- qDebug () << " recursiveDumpDir:" << entryNameQString << " skip entry for different/ignored repository" ;
368
- continue ;
369
- }
370
-
371
- if (recursiveDumpDir (txn, fs, fs_root, entryName, entryFinalName, dirpool, revnum, rule, matchRules, ruledebug) == EXIT_FAILURE)
372
- return EXIT_FAILURE;
373
- } else if (i.value () == svn_node_file) {
374
- printf (" +" );
375
- fflush (stdout);
376
- if (dumpBlob (txn, fs_root, entryName, entryFinalName, dirpool) == EXIT_FAILURE)
377
- return EXIT_FAILURE;
378
- }
379
- }
380
-
381
- return EXIT_SUCCESS;
382
- }
383
-
384
322
time_t get_epoch (const char * svn_date)
385
323
{
386
324
struct tm tm ;
@@ -450,6 +388,11 @@ class SvnRevision
450
388
private:
451
389
void splitPathName (const Rules::Match &rule, const QString &pathName, QString *svnprefix_p,
452
390
QString *repository_p, QString *effectiveRepository_p, QString *branch_p, QString *path_p);
391
+ int recursiveDumpDir (Repository::Transaction *txn, svn_fs_t *fs, svn_fs_root_t *fs_root,
392
+ const QByteArray &pathname, const QString &finalPathName,
393
+ apr_pool_t *pool, svn_revnum_t revnum,
394
+ const Rules::Match &rule, const MatchRuleList &matchRules,
395
+ bool ruledebug, int ignoreSet);
453
396
};
454
397
455
398
int SvnPrivate::exportRevision (int revnum)
@@ -876,7 +819,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
876
819
qDebug () << " Create a true SVN copy of branch (" << key << " ->" << branch << path << " )" ;
877
820
txn->deleteFile (path);
878
821
checkParentNotEmpty (pool, key, path, fs_root, txn);
879
- recursiveDumpDir (txn, fs, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug);
822
+ recursiveDumpDir (txn, fs, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug, false );
880
823
}
881
824
if (rule.annotate ) {
882
825
// create an annotated tag
@@ -959,7 +902,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
959
902
}
960
903
}
961
904
962
- recursiveDumpDir (txn, fs, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug);
905
+ recursiveDumpDir (txn, fs, fs_root, key, path, pool, revnum, rule, matchRules, ruledebug, ignoreSet );
963
906
}
964
907
965
908
if (rule.annotate ) {
@@ -972,6 +915,77 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
972
915
return EXIT_SUCCESS;
973
916
}
974
917
918
+ int SvnRevision::recursiveDumpDir (Repository::Transaction *txn, svn_fs_t *fs, svn_fs_root_t *fs_root,
919
+ const QByteArray &pathname, const QString &finalPathName,
920
+ apr_pool_t *pool, svn_revnum_t revnum,
921
+ const Rules::Match &rule, const MatchRuleList &matchRules,
922
+ bool ruledebug, int ignoreSet)
923
+ {
924
+ if (!wasDir (fs, revnum, pathname.data (), pool)) {
925
+ if (dumpBlob (txn, fs_root, pathname, finalPathName, pool) == EXIT_FAILURE)
926
+ return EXIT_FAILURE;
927
+ return EXIT_SUCCESS;
928
+ }
929
+
930
+ if ((ignoreSet == false ) && CommandLineParser::instance ()->contains (" svn-ignore" )) {
931
+ QString svnignore;
932
+ if (fetchIgnoreProps (&svnignore, pool, pathname, fs_root) != EXIT_SUCCESS) {
933
+ qWarning () << " Error fetching svn-properties (" << pathname << " )" ;
934
+ } else if (!svnignore.isNull ()) {
935
+ addGitIgnore (pool, pathname, finalPathName, fs_root, txn, svnignore.toStdString ().c_str ());
936
+ }
937
+ }
938
+
939
+ // get the dir listing
940
+ apr_hash_t *entries;
941
+ SVN_ERR (svn_fs_dir_entries (&entries, fs_root, pathname, pool));
942
+ AprAutoPool dirpool (pool);
943
+
944
+ // While we get a hash, put it in a map for sorted lookup, so we can
945
+ // repeat the conversions and get the same git commit hashes.
946
+ QMap<QByteArray, svn_node_kind_t > map;
947
+ for (apr_hash_index_t *i = apr_hash_first (pool, entries); i; i = apr_hash_next (i)) {
948
+ const void *vkey;
949
+ void *value;
950
+ apr_hash_this (i, &vkey, NULL , &value);
951
+ svn_fs_dirent_t *dirent = reinterpret_cast <svn_fs_dirent_t *>(value);
952
+ map.insertMulti (QByteArray (dirent->name ), dirent->kind );
953
+ }
954
+
955
+ QMapIterator<QByteArray, svn_node_kind_t > i (map);
956
+ while (i.hasNext ()) {
957
+ dirpool.clear ();
958
+ i.next ();
959
+ QByteArray entryName = pathname + ' /' + i.key ();
960
+ QString entryFinalName = finalPathName + QString::fromUtf8 (i.key ());
961
+
962
+ if (i.value () == svn_node_dir) {
963
+ entryFinalName += ' /' ;
964
+ QString entryNameQString = entryName + ' /' ;
965
+
966
+ MatchRuleList::ConstIterator match = findMatchRule (matchRules, revnum, entryNameQString);
967
+ if (match == matchRules.constEnd ()) continue ; // no match of parent repo? (should not happen)
968
+
969
+ const Rules::Match &matchedRule = *match;
970
+ if (matchedRule.action != Rules::Match::Export || matchedRule.repository != rule.repository ) {
971
+ if (ruledebug)
972
+ qDebug () << " recursiveDumpDir:" << entryNameQString << " skip entry for different/ignored repository" ;
973
+ continue ;
974
+ }
975
+
976
+ if (recursiveDumpDir (txn, fs, fs_root, entryName, entryFinalName, dirpool, revnum, rule, matchRules, ruledebug, false ) == EXIT_FAILURE)
977
+ return EXIT_FAILURE;
978
+ } else if (i.value () == svn_node_file) {
979
+ printf (" +" );
980
+ fflush (stdout);
981
+ if (dumpBlob (txn, fs_root, entryName, entryFinalName, dirpool) == EXIT_FAILURE)
982
+ return EXIT_FAILURE;
983
+ }
984
+ }
985
+
986
+ return EXIT_SUCCESS;
987
+ }
988
+
975
989
int SvnRevision::recurse (const char *path, const svn_fs_path_change2_t *change,
976
990
const char *path_from, const MatchRuleList &matchRules, svn_revnum_t rev_from,
977
991
apr_hash_t *changes, apr_pool_t *pool)
0 commit comments