svn2git rules regex

痞子三分冷 提交于 2020-01-05 06:35:12

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!