问题
I'm trying to reduce my ruleset for svn2git. My tree looks like this..
A/foo
B/foo
C/foo
D/foo
I want to put A, B, and C under a legacy folder and that works. I want D to be it's own top level folder.
My current rule is..
match /(A|B|C)/([^/]+)/
repository myrepo
branch legacy/\1/\2
end match
Is it possible to modify the rule such that D does not end up legacy without having to define another rule?
End result should be:
legacy/A/foo
legacy/B/foo
legacy/C/foo
D/foo
回答1:
Yes, it is possible. I'm not sure how svn2git RegEx might look like. However, this RegEx might create your outputs by simply keeping D/foo as is, and then only changing your other three inputs using two groups plus a middle boundary /:
^(A|B|C)\/(foo)
You can probably change your codes based on this RegEx.
I'm not really sure, but my guess is that you codes might change to something similar to:
match /^(A|B|C)\/(foo)/
repository myrepo
branch legacy/\1/\2
end match
It the code would work, it would probably work without ^:
match /(A|B|C)\/(foo)/
repository myrepo
branch legacy/\1/\2
end match
来源:https://stackoverflow.com/questions/55855091/svn2git-rules-regex