svn repository ๋ฅผ git ์œผ๋กœ ์ „ํ™˜

svn2git ์„ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ๋” ๋‚˜์Œ. ์„œ๋ธŒ๋ฒ„์ „ ์ €์žฅ์†Œ(subversion repository)๋ฅผ git ์œผ๋กœ ์ด๊ด€ํ•˜๊ธฐ ์ฐธ์กฐ

ย 

์•„ํ‹€๋ผ์‹œ์•ˆ์ด ์ž‘์„ฑํ•œ svn ์ €์žฅ์†Œ๋ฅผ git ์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ •๋ฆฌ(https://www.atlassian.com/git/migration)

ย 

ย 

Prepare

  1. ๋‹ค์šด๋กœ๋“œ ย (https://bitbucket.org/atlassian/svn-migration-scripts/downloads)

  2. migration ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ์‹œ์Šคํ…œ์ด ๊ตฌ์„ฑ(git, svn, perl ์„ค์น˜ ์—ฌ๋ถ€)๋˜์—ˆ๋Š”์ง€ ๊ฒ€์ฆ

    java -jar svn-migration-scripts.jar verify
  3. svn author ์ •๋ณด ์ถ”์ถœ - svn ์€ id ์ง€๋งŒ git ์€ ์ด๋ฆ„๊ณผ email ์ด๋ฏ€๋กœ ๋ณ€ํ™˜ ํ•„์š”

    java -jar ~/svn-migration-scripts.jar authors <svn-repo> > authors.txt

    <svn-repo. ๋Š” ์ €์žฅ์†Œ์˜ URI ๋กœ ์™ธ๋ถ€์— ์žˆ๋‹ค๋ฉด ์ „์ฒด URL ๋ช…์‹œ

    java -jar ~/svn-migration-scripts.jar authors https://svn.example.com > authors.txt
  4. ์ €์ž ์ •๋ณด ํŒŒ์ผ ํŽธ์ง‘. ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ์ƒ์„ฑ์ด ๋œ๋‹ค. ย ์ขŒ์ธก์€ id ์ด๊ณ  ์šฐ์ธก์€ full name ๊ณผ email ์ฃผ์†Œ์ด๋‹ค.

    j.doe = j.doe <j.doe@mycompany.com> 
    m.smith = m.smith <m.smith@mycompany.com>

    ์ขŒ์ธก์˜ id๋Š” ๊ทธ๋Œ€๋กœ ๋‘๊ณ  ์šฐ์ธก์˜ full name ๊ณผ email ์„ ์‚ฌ์šฉ์ž์— ๋งž๊ฒŒ ์ˆ˜์ •ํ•œ๋‹ค.

    j.doe = John Doe <john.doe@atlassian.com>
    m.smith = Mary Smith <mary.smith@atlassian.com>

ย 

๋ณ€ํ™˜

  1. svn repos ์ฒดํฌ์•„์›ƒ. ์ €์žฅ์†Œ๊ฐ€ trunk, tags, branches ๊ฐ€ ๋ถ™๋Š” ํ‘œ์ค€ ๊ตฌ์กฐ๋ผ๋ฉดย --stdlayout ์˜ต์…˜์„ ์‚ฌ์šฉํ•œ๋‹ค. <svn-repo> ๋Š” URI ๋กœ ๋ช…์‹œํ•ด์•ผ ํ•œ๋‹ค.ย 

    git svn clone --stdlayout --authors-file=authors.txt <svn-repo>/<project> <git-repo-name>

    svn ์ €์žฅ์†Œ์˜ URI ๊ฐ€ย https://svn.example.comย ์ด๊ณ  ํ”„๋กœ์ ํŠธ๊ฐ€ test-proj ์ผ ๊ฒฝ์šฐ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‹คํ–‰ํ•œ๋‹ค.

    git svn clone --stdlayout --authors-file=authors.txt https://svn.example.com/test-proj test-proj-git

    ์ €์žฅ์†Œ๊ฐ€ ํ‘œ์ค€ ๊ตฌ์กฐ๊ฐ€ ์•„๋‹ˆ๋ฉด ์˜ต์…˜์œผ๋กœ ์ง€์ •ํ•ด์•ผ ํ•œ๋‹ค.

    git svn clone --trunk=/trunk --branches=/branches --branches=/bugfixes --tags=/tags --authors-file=authors.txt https://svn.example.com/test-proj test-proj-git
  2. clean

    java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git
  3. a

ย 

Ref

ย