0

Following up on this question: svn2git rules regex

I'm migrating our code from SVN to git using svn2git (KDE version). Source tree looks like this:

A/foo
B/foo
C/foo
D/foo

I'm trying to write a rule that will match on all A,B,C, and D. For A,B, and C I want it to prepend legacy.

legacy/A/foo
legacy/B/foo
legacy/C/foo
D/foo

([A|B|C]+) almost does it with legacy/\1. but it doesn't match on D.
https://regex101.com/r/pVZi3e/4

@Emma

EncryptedWatermelon
  • 4,788
  • 1
  • 12
  • 28
  • I'm just starting to learn how to use regex. I realize D is missing but I wasn't sure how to incorporate it without adding `legacy/D/foo` to the output. I only want `D/foo` Is there a way to do variable substitution without a pool or dictionary? – EncryptedWatermelon Apr 26 '19 at 17:52
  • The problem is I need a 'rule' that match A,B,C,D and only prepends legacy to A,B,C. D should not be modified. – EncryptedWatermelon Apr 26 '19 at 18:01
  • 2
    Also, aren't you getting the same behavior as you wanted? Your A,B and C folders are getting changed and D one remains same, which is what you wanted? Is it necessary for D to match? If yes, then the only option I see is to have another rule that matches D where you don't append legacy string. – Pushpesh Kumar Rajwanshi Apr 26 '19 at 18:12
  • I could have 2 rules but I was trying to cut down. I already have a couple hundred rules. – EncryptedWatermelon Apr 26 '19 at 18:13
  • 1
    Well, I don't see a way with simple regex replacement for applying to two different kind of rules, so feel like you will have to add one. Seems its unavoidable given current circumstances. – Pushpesh Kumar Rajwanshi Apr 26 '19 at 18:17
  • 1
    Ok. That's what I feared. More rules here I come :( Thanks! – EncryptedWatermelon Apr 26 '19 at 18:18

0 Answers0