From d90465a37df3eb9769acf25294104a8c06053c30 Mon Sep 17 00:00:00 2001 From: Raja R Harinath Date: Mon, 12 Jul 2010 00:46:33 +0530 Subject: Handle branching better for branches that use "prefix" rules When creating branches/tags off a branch that use "prefix" rules, svn2git used to create new commits rather than just copying the git ref over. This was due to SvnRevision::exportInteral() using 'path.isEmpty()' to determine if a change related to the whole branch or not. If a "prefix" rule is used, then 'path' will not be empty. We change it to instead look at how much of the change string was chomped up by the rule match. If the whole string was chomped up, it means that the change describes the whole branch. --- src/svn.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/svn.cpp b/src/svn.cpp index 69f91af..b23e629 100644 --- a/src/svn.cpp +++ b/src/svn.cpp @@ -636,8 +636,10 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha path_from = NULL; } - if (path.isEmpty() && path_from != NULL) { - if (!prevpath.isEmpty()) { + // current == svnprefix => we're dealing with the contents of the whole branch here + if (path_from != NULL && current == svnprefix) { + if (previous != prevsvnprefix) { + // source is not the whole of its branch qDebug() << qPrintable(current) << "is a partial branch of repository" << qPrintable(prevrepository) << "branch" << qPrintable(prevbranch) << "subdir" @@ -648,11 +650,18 @@ int SvnRevision::exportInternal(const char *key, const svn_fs_path_change_t *cha << qPrintable(prevrepository) << "branch" << qPrintable(prevbranch) << "path" << qPrintable(prevpath) << "rev" << rev_from << ")"; + } else if (path != prevpath) { + qDebug() << qPrintable(current) + << "is a branch copy which renames base directory of all contents" + << qPrintable(prevpath) << "to" << qPrintable(path); + // FIXME: Handle with fast-import 'file rename' facility + // ??? Might need special handling when path == / or prevpath == / } else { if (prevbranch == branch) { // same branch and same repository qDebug() << qPrintable(current) << "rev" << revnum - << "is an SVN rename from" + << "is reseating branch" << qPrintable(branch) + << "to an earlier revision" << qPrintable(previous) << "rev" << rev_from; } else { // same repository but not same branch -- cgit v1.2.1