aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@hurrynot.org>2010-07-12 00:46:33 +0530
committerRaja R Harinath <harinath@hurrynot.org>2010-07-12 00:46:33 +0530
commitd90465a37df3eb9769acf25294104a8c06053c30 (patch)
tree8e89a1b80e43cc68fad1f7d5bfb16e24ec108011 /src
parent2a7a37ff0f62f5dc06acf95d8084cd0521d6a651 (diff)
downloadsvn2git-d90465a37df3eb9769acf25294104a8c06053c30.tar
svn2git-d90465a37df3eb9769acf25294104a8c06053c30.tar.gz
svn2git-d90465a37df3eb9769acf25294104a8c06053c30.tar.bz2
svn2git-d90465a37df3eb9769acf25294104a8c06053c30.tar.xz
svn2git-d90465a37df3eb9769acf25294104a8c06053c30.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/svn.cpp15
1 files changed, 12 insertions, 3 deletions
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