SVNとGitを同期した話~Subgit~

D36c4c82c7535af1d46ef731a8c0275c?s=47 Skycat
September 20, 2017

 SVNとGitを同期した話~Subgit~

GitLab Meetup Fukuoka #1 でLTをさせていただいたときの資料です。
https://gitlab-jp.connpass.com/event/64349/

D36c4c82c7535af1d46ef731a8c0275c?s=128

Skycat

September 20, 2017
Tweet

Transcript

  1. SVNͱGITΛಉظͨ͠࿩ ʙ Subgit ʙ 2017/09/19

  2. ࣗݾ঺հ দຊ ୓໵ ▸ גࣜձࣾϋγΰ ▸ αʔόʔαΠυΤϯδχΞ ▸ Twitter: skycat_me

    ▸ Facebook: takuya.matsumoto.cat
  3. ๭ϓϩδΣΫτ ▸ SVN؅ཧ ▸ ίʔυϨϏϡʔͭΒ͍ ▸ hook͕࢖͑ͳ͍ʢେਓͷࣄ৘

  4. ͳʹΑΓ Git Ͱ΍Γ͍ͨ GitlabͰιʔεϨϏϡʔ΍Γ͍ͨ… GitlabCIͰࣗಈςετ΍Γ͍ͨ… GitlabͷWebhookͰChatOpsతͳͷ΍Γ͍ͨ…

  5. Ͱ΋େਓͷࣄ৘Ͱ ׬શҠߦ͸Ͱ͖ͳ͍

  6. Subgitͬͯ΍͕ͭΑͦ͞͏ʂ

  7. ׬શಉظʂ Subversion <=> Git

  8. ίετ͸… খن໛ͳνʔϜͳΒແྉʢSubgitࣗମͷ

  9. ָͪΜಋೖ ▸ Java੡ͳͷͰJava͕ඞਢͰ͢ʂʂ ▸ vagrantbox ubuntu/trusty64؀ڥ # java8 install $

    sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer # Subgit install $ wget https://subgit.com/download/subgit_3.2.4_all.deb $ sudo dpkg -i subgit_3.2.4_all.deb $ sudo apt-get install -f
  10. ָͪΜಋೖ ▸ GitRepositoryΛੜ੒ͯ͠SubgitίϚϯυΛଧ͚ͭͩʂ $ subgit configure {svn_repository_url} {git_repository} # sugitσΟϨΫτϦ͕ੜ੒͞ΕΔʂ

    # SVNͱGitͷϢʔβϚοϐϯάઃఆ $ vim {git_repository}/subgit/authors.txt matsumoto_takuya = skycat <matsumoto_takuya@hasigo.co.jp> # SVNಉظઃఆʢྫͩͱSVNͷtrunk͕GitͷmasterʹͳΓ·͢) $ vim {git_repository}/subgit/config trunk = :refs/heads/master branches = branches/*:refs/heads/feature/* # SVNΞΫηε৘ใ sshKeyFile = svn private Key userName =UserName
  11. ࡉ͔͍ઃఆ # SVNಉظઃఆʢྫͩͱSVNͷtrunk͕GitͷmasterʹͳΓ·͢) $ vim {git_repository}/subgit/config minimalRevision=630000 SVNͷϦϙδτϦ͕ංେԽͯ͠͠·͍ͬͯΔ৔߹͸ɺ ಛఆͷϦϏδϣϯ͔Βಉظ͢Δ͜ͱ͕Մೳʂ Revision630000Ҏ͔߱Βಉظʂ

  12. Քಇʂ # SVNΠϯετʔϧ $ subgit install {git_repository}/subgit/config SVNͷϦϙδτϦ͕ංେԽͯ͠͠·͍ͬͯΔ৔߹͸ɺ ಛఆͷϦϏδϣϯ͔Βಉظ͢Δ͜ͱ͕Մೳʂ ੒ޭͨ͠ΒDaemonىಈͯ͠ಉظ͠·͢ʂ

  13. ෭࢈෺͕ͨ͘͞Μʂ ▸ GitlabCEΛཱͯͯίʔυϨϏϡʔ(๑•̀ŷ•́)و✧ ▸ GitlabCIͰࣗಈςετ(๑•̀ŷ•́)و✧ ▸ WebhookͰChatOps(๑•̀ŷ•́)و✧ ▸ Gitͷ෍ڭ(๑•̀ŷ•́)و✧

  14. ͨͩɺ໰୊΋͋Δʂ ▸ Subgit͕݁ߏϝϞϦΛ৯͏ʀɻʀ ▸ ϓϩδΣΫτͷ౎߹্ɺݱࡏ12ݸͷRepositoryΛಉظத ▸ ݱࡏɺGitlabʹ͸RAMΛ8.5GׂΓ͋ͯͯΔ USER PID %CPU

    %MEM VSZ RSS git 1628 0.2 2.0 4115984 176568 ? Ssl Aug03 140:12 git 2402 0.5 4.8 4121252 423556 ? Ssl Aug14 294:30 git 12876 0.2 2.6 4118180 232660 ? Ssl Aug03 149:18 git 19817 0.2 2.2 4118304 199232 ? Ssl Aug03 146:00 git 23842 0.2 2.6 4115984 229092 ? Ssl Aug03 145:12 git 24513 0.2 2.7 4115984 238928 ? Ssl Aug03 148:40 git 25977 0.2 3.1 4115984 274436 ? Ssl Aug03 145:21 git 26915 0.5 5.4 4121116 476892 ? Ssl Aug09 308:55 git 27631 0.6 6.9 4118032 603960 ? Ssl Sep15 34:56 git 31213 0.2 2.6 4115984 233760 ? Ssl Aug03 150:43 git 31714 0.6 4.9 4121408 432184 ? Ssl Aug14 326:45 git 32111 0.2 1.9 4115984 172748 ? Ssl Aug03 152:39
  15. ͨͩɺ໰୊΋͋Δʂ ▸ SubgitͷDaemon͕ϝϞϦෆ଍Ͱ͓ͳ͘ͳΓʹ ▸ ؂ࢹͯ͠ࢮΜͰͨΒੜ͖ฦ͢Α͏ʹ͢Δ ▸ subgit install —recover {git_repository}

    ▸ ͍ͨͩͭ͜΋݁ߏ͕͔͔࣌ؒΔʀ ▸ ͦͷؒɺಉظ͕ࢭ·ͬͯ͠·͏ͷͰGitlab಺ͰϚʔδ͕Ͱ ͖ͳ͘ͳͬͨΓɺPushΠϕϯτ͕͜ͳ͘ͳΔ ▸ ݱঢ়͸ϝϞϦageageͰઓͬͯΔ͚ͲɺͲ͏ʹ͔͍ͨ͠ƅ ƅ´ωAƅ ƅŇűƅŖ
  16. ಋೖͯ͠Α͔ͬͨ͜ͱʂ ▸ Gitܦݧ͕ͳ͔ͬͨϝϯόʔ͕Gitʹ৮ΕΔ͍͍ػձ͕Ͱ͖ͨ ▸ ׬શҠߦͰ͸ͳ͘ಉظͳͷͰɺಋೖίετ͕ͱͯ΋গͳ͍ ▸ GitlabͰLGTMը૾ͰΈΜͳϫΠϫΠ΍ͬͯͯ࠷ߴʂ ▸ ΤϯδχΞ಺ͷίϛϡχέʔγϣϯ͕׆ൃʹʂ

  17. ͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠