1

I'm trying to migrate an SVN repository with over 26,000 revisions to multiple Git repositories using (Kde) SVN2GIT. One specific repository generates an error while migrating. This is why I reduced rules for migration to this specific repository.

Here are the rules for generating the repository:

create repository my_repo
end repository

#
# Declare the rules
# Note: rules must end in a slash
#
#
# my_repo
#

match /Project/trunk/dir_1/
repository my_repo
branch master
end match
match /Project/branches/([^/]+)/dir_1/
repository my_repo
branch \1
end match
match /Project/tags/([^/]+)/dir_1/
repository my_repo
branch refs/tags/tag/\1
annotated true
end match

match /
end match

SVN2Git was executed using the docker image option provided in the documentation on a Linux server. Some of the alternatives I tried included the user of the parameter "action recurse" in the rules, which is described in here. The rules would look like this:

create repository my_repo
end repository

#
# Declare the rules
# Note: rules must end in a slash
#
#
# my_repo
#

match /Project/trunk/dir_1/
repository my_repo
branch master
min revision 18800
end match
match /Project/branches/([^/]+)/dir_1/
repository my_repo
branch \1
min revision 18800
action recurse
end match
match /Project/tags/([^/]+)/dir_1/
repository my_repo
branch refs/tags/tag/\1
min revision 18800
action recurse
annotated true
end match

match /
end match

I also played a bit with the rules but none of my approaches worked.

Here is a snippet of the logs:

Exporting revision 18840  done
Exporting revision 18841     /Project/branches/branch_2/dir_1 was copied from /Project/branches/branch_1/dir_1 rev 18840
    /Project/branches/branch_2/dir_2 was copied from /Project/branches/branch_1/dir_2 rev 18840
rev 18841 /Project/branches/branch_2/dir_2/ matched rule: "/tmp/conf/Project.rules:22 /Project/branches/([^/]+)/dir_2/"    exporting.
.my_repo : branch branch_2 is branching from branch_1
"branch_2" in repository "my_repo" is branching from branch "branch_1" but the latter doesn't exist. Can't continue.
rev 18841 /Project/branches/branch_2/dir_2/ matched rule: "/tmp/conf/Project.rules:22 /Project/branches/([^/]+)/dir_2/"

My question is if someone had this error before and if yes, how did you deal with it?

Any help will be really appreciated. I'm have being dealing with this problem for over a week.

Thanks and hope someone can help.

jeka_gompa
  • 61
  • 7
  • 1
    You're ruleset doesn't include `/Project/branches/branch_1/dir_2/` or `/Project/branches/([^/]+)/dir_2/`. It could be in the real version vs the genericized version you posted. Also anytime you use `action recurse` you want to put a `$` at the end of the match line otherwise it will match indefinitely. In regex `$` mean end of line. – EncryptedWatermelon Nov 07 '19 at 15:12

2 Answers2

4

I'm going to take a stab at this here. I may see your issue. Assuming you dir1 and dir2 are on the same trunk/branch/tag and not different. Let me know otherwise.

create repository my_repo
end repository

#
# Declare the rules
# Note: rules must end in a slash
#
#
# my_repo
#

match /Project/$
action recurse
end match

match /Project/trunk/$
action recurse
end match

match /Project/branches/$
action recurse
end match

match /Project/tags/$
action recurse
end match

# Recurse into branches
match /Project/branches/([^/]+)/$
action recurse
end match

# Recurse into tags
match /Project/tags/([^/]+)/$
action recurse
end match


# Start matching

match /Project/trunk/
repository my_repo
branch master
end match

match /Project/branches/([^/]+)/
repository my_repo
branch \1
end match

match /Project/tags/([^/]+)/
repository my_repo
branch refs/tags/\1
annotated true
end match

match /
end match
EncryptedWatermelon
  • 4,788
  • 1
  • 12
  • 28
1

Hello @EncryptedWatermelon, Thank you very much for your reply, it was very helpful.

I tested your recommendations on my rules and after some tuning it worked. The following rule alone solved the error:

# Recurse into branches
match /Project/branches/([^/]+)/$
 action recurse
end match

My current problem is that the tags are not being fetched. In my SVN reposotory the tags names is the same as the branches names. To solve this it was added an extra tag directory (refs/tags/tag/) and the original tag rules look like this:

match /Project/tags/([^/]+)/dir_1/
 repository my_repo
 branch refs/tags/tag/\1
 annotated true
end match

Following your advice I includes these rules:

match /Project/tags/$
 action recurse
end match

# Recurse into tags
match /Project/tags/([^/]+)/dir_1/$
 action recurse
end match

But the tags are still not there.

Have you seen something like this? Could it be a problem, that the names of the tags is the same as the name of the branches?

Thanks in advance and hope you can help.

Cheers!

jeka_gompa
  • 61
  • 7
  • You shouldn't need the extra tag on the branch line. `branch refs/tags/\1` . Also remove dir_1 from the match line.`match /Project/tags/([^/]+)/`. When it gets to that commit is it using that rule or a different rule? The rules are executed in order so the first one that match is used. – EncryptedWatermelon Nov 08 '19 at 12:48
  • The original problem with the revision was already solved using the action recurse in the rules of the branch. I also tried the rules without the Extra 'tag/' and it didn't work. For the tags rules it is necessary to specify 'dir_1' because I'm splitting one single svn repo into multiple git repos and I have to specify which directory is relevant for 'my_repo'. Do you think this coud be a problem? – jeka_gompa Nov 08 '19 at 14:36
  • Got it. Specifying dir_1 is not an issue. When you run `svn2git` are you enabling logs? This is my command: `svn-all-fast-export --identity=authors.txt --rules=IRULE.txt --stats --commit-interval=1 --add-meta --fast-import-timeout=0 --debug-rules /PATH/TO/REPO` It may help solve the issue. Does dir2 end up in another repo? – EncryptedWatermelon Nov 08 '19 at 14:44
  • I'm using the docker option and the command looks like this: `svn-all-fast-export --identity-map /tmp/conf/authors.txt --rules /tmp/conf/rules.txt --svn-branches --debug-rules --svn-ignore --empty-dirs /tmp/svn/` – jeka_gompa Nov 08 '19 at 14:48
  • This is the problem it is not failing, it runs till the end but I cannot find the tags in: `my_repo.git/refs/tags/`. I even added the rule: `match /Project/tags/tag_name/dir_1/$` and the tag (tag_name) is not being fetched. – jeka_gompa Nov 08 '19 at 15:00
  • You may need to tell it to resume from a certain revision or run it again from the begining. `--resume-from`. Also I'm not sure how `--svn-branches` effects the output. I didn't use that option. – EncryptedWatermelon Nov 08 '19 at 15:03
  • Hi @EncryptedWatermelon. I posted a new question for the problem with the Tags. There is some further description. I would really appreciated if you could have a look at it. Here is the link: https://stackoverflow.com/questions/58802738/kde-svn2git-tags-not-fetched-completely Thanks! – jeka_gompa Nov 11 '19 at 14:03