@@ -207,39 +207,6 @@ findMatchRule(const MatchRuleList &matchRules, int revnum, const QString ¤
207
207
return end;
208
208
}
209
209
210
- static void splitPathName (const Rules::Match &rule, const QString &pathName, QString *svnprefix_p,
211
- QString *repository_p, QString *branch_p, QString *path_p)
212
- {
213
- QString svnprefix = pathName;
214
- svnprefix.truncate (rule.rx .matchedLength ());
215
-
216
- if (svnprefix_p) {
217
- *svnprefix_p = svnprefix;
218
- }
219
-
220
- if (repository_p) {
221
- *repository_p = svnprefix;
222
- repository_p->replace (rule.rx , rule.repository );
223
- foreach (Rules::Match::Substitution subst, rule.repo_substs ) {
224
- subst.apply (*repository_p);
225
- }
226
- }
227
-
228
- if (branch_p) {
229
- *branch_p = svnprefix;
230
- branch_p->replace (rule.rx , rule.branch );
231
- foreach (Rules::Match::Substitution subst, rule.branch_substs ) {
232
- subst.apply (*branch_p);
233
- }
234
- }
235
-
236
- if (path_p) {
237
- QString prefix = svnprefix;
238
- prefix.replace (rule.rx , rule.prefix );
239
- *path_p = prefix + pathName.mid (svnprefix.length ());
240
- }
241
- }
242
-
243
210
static int pathMode (svn_fs_root_t *fs_root, const char *pathname, apr_pool_t *pool)
244
211
{
245
212
svn_string_t *propvalue;
@@ -441,6 +408,9 @@ class SvnRevision
441
408
int recurse (const char *path, const svn_fs_path_change2_t *change,
442
409
const char *path_from, const MatchRuleList &matchRules, svn_revnum_t rev_from,
443
410
apr_hash_t *changes, apr_pool_t *pool);
411
+ private:
412
+ void splitPathName (const Rules::Match &rule, const QString &pathName, QString *svnprefix_p,
413
+ QString *repository_p, QString *effectiveRepository_p, QString *branch_p, QString *path_p);
444
414
};
445
415
446
416
int SvnPrivate::exportRevision (int revnum)
@@ -473,6 +443,51 @@ int SvnPrivate::exportRevision(int revnum)
473
443
return EXIT_SUCCESS;
474
444
}
475
445
446
+ void SvnRevision::splitPathName (const Rules::Match &rule, const QString &pathName, QString *svnprefix_p,
447
+ QString *repository_p, QString *effectiveRepository_p, QString *branch_p, QString *path_p)
448
+ {
449
+ QString svnprefix = pathName;
450
+ svnprefix.truncate (rule.rx .matchedLength ());
451
+
452
+ if (svnprefix_p) {
453
+ *svnprefix_p = svnprefix;
454
+ }
455
+
456
+ if (repository_p) {
457
+ *repository_p = svnprefix;
458
+ repository_p->replace (rule.rx , rule.repository );
459
+ foreach (Rules::Match::Substitution subst, rule.repo_substs ) {
460
+ subst.apply (*repository_p);
461
+ }
462
+ }
463
+
464
+ if (effectiveRepository_p) {
465
+ *effectiveRepository_p = svnprefix;
466
+ effectiveRepository_p->replace (rule.rx , rule.repository );
467
+ foreach (Rules::Match::Substitution subst, rule.repo_substs ) {
468
+ subst.apply (*effectiveRepository_p);
469
+ }
470
+ Repository *repository = repositories.value (*effectiveRepository_p, 0 );
471
+ if (repository) {
472
+ *effectiveRepository_p = repository->getEffectiveRepository ()->getName ();
473
+ }
474
+ }
475
+
476
+ if (branch_p) {
477
+ *branch_p = svnprefix;
478
+ branch_p->replace (rule.rx , rule.branch );
479
+ foreach (Rules::Match::Substitution subst, rule.branch_substs ) {
480
+ subst.apply (*branch_p);
481
+ }
482
+ }
483
+
484
+ if (path_p) {
485
+ QString prefix = svnprefix;
486
+ prefix.replace (rule.rx , rule.prefix );
487
+ *path_p = prefix + pathName.mid (svnprefix.length ());
488
+ }
489
+ }
490
+
476
491
int SvnRevision::prepareTransactions ()
477
492
{
478
493
// find out what was changed in this revision:
@@ -690,8 +705,8 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
690
705
const QString ¤t, const Rules::Match &rule, const MatchRuleList &matchRules)
691
706
{
692
707
needCommit = true ;
693
- QString svnprefix, repository, branch, path;
694
- splitPathName (rule, current, &svnprefix, &repository, &branch, &path);
708
+ QString svnprefix, repository, effectiveRepository, branch, path;
709
+ splitPathName (rule, current, &svnprefix, &repository, &effectiveRepository, & branch, &path);
695
710
696
711
Repository *repo = repositories.value (repository, 0 );
697
712
if (!repo) {
@@ -713,7 +728,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
713
728
}
714
729
715
730
QString previous;
716
- QString prevsvnprefix, prevrepository, prevbranch, prevpath;
731
+ QString prevsvnprefix, prevrepository, preveffectiverepository, prevbranch, prevpath;
717
732
718
733
if (path_from != NULL ) {
719
734
previous = QString::fromUtf8 (path_from);
@@ -724,7 +739,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
724
739
findMatchRule (matchRules, rev_from, previous, NoIgnoreRule);
725
740
if (prevmatch != matchRules.constEnd ()) {
726
741
splitPathName (*prevmatch, previous, &prevsvnprefix, &prevrepository,
727
- &prevbranch, &prevpath);
742
+ &preveffectiverepository, & prevbranch, &prevpath);
728
743
729
744
} else {
730
745
qWarning () << " WARN: SVN reports a \" copy from\" @" << revnum << " from" << path_from << " @" << rev_from << " but no matching rules found! Ignoring copy, treating as a modification" ;
@@ -740,7 +755,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
740
755
<< qPrintable (prevrepository) << " branch"
741
756
<< qPrintable (prevbranch) << " subdir"
742
757
<< qPrintable (prevpath);
743
- } else if (prevrepository != repository ) {
758
+ } else if (preveffectiverepository != effectiveRepository ) {
744
759
qWarning () << " WARN:" << qPrintable (current) << " rev" << revnum
745
760
<< " is a cross-repository copy (from repository"
746
761
<< qPrintable (prevrepository) << " branch"
@@ -808,7 +823,7 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change2_t *ch
808
823
// changes across directory re-organizations and wholesale branch
809
824
// imports.
810
825
//
811
- if (path_from != NULL && prevrepository == repository && prevbranch != branch) {
826
+ if (path_from != NULL && preveffectiverepository == effectiveRepository && prevbranch != branch) {
812
827
if (ruledebug)
813
828
qDebug () << " copy from branch" << prevbranch << " to branch" << branch << " @rev" << rev_from;
814
829
txn->noteCopyFromBranch (prevbranch, rev_from);
0 commit comments