Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[engine] CSM 개요 및 구현 #191

Closed
anpaul0615 opened this issue Sep 16, 2022 · 2 comments
Closed

[engine] CSM 개요 및 구현 #191

anpaul0615 opened this issue Sep 16, 2022 · 2 comments

Comments

@anpaul0615
Copy link
Contributor

개요

  • CSM 이란, 커밋의 단순성을 위해 연관된 커밋을 하나로 묶어준 장치입니다.

  • 묶음의 기준이 되는 커밋을 CSM Base 라고 부르고,
    묶여진 커밋들을 CSM Source 라고 부릅니다.

  • "연관되어 있는 커밋" 의 기준은
    해당 커밋이 머지커밋인 경우만 해당되며,
    머지커밋의 부모커밋으로부터 순회가능한 모든 커밋을 대상으로 봅니다.

  • PR을 통해 병합된 커밋인 경우,
    PR정보 내 포함되어있는 참조커밋들을 CSM Source 대상으로 봅니다.

이론 및 생성원리

image
image
image
(자료 출처: https://ieeexplore.ieee.org/document/9222261)

  • main브랜치의 루트노드부터 시작하여 top-down 방향으로 탐색합니다.

    • 탐색한 커밋이 머지커밋이면, 연관 커밋을 찾아 CSM Source 로 묶어줍니다
    • 탐색한 커밋이 머지커밋이 아니면, 통과합니다.
  • 탐색과정에서 특정 커밋의 child 를 찾아내려가기 위해서 stem 을 사용합니다.

    • stem 은 커밋의 배열 형태이므로, 배열인덱스를 통한 child 이동할수있습니다.
  • 탐색과정에서 특정 커밋의 머지커밋부모를 찾아올라가기 위해서 stem 을 사용합니다.

    • CSM 생성단계에서는 커밋정보가 자신이 어떤 stem 에 소속되어있는지 알고있습니다. (stemId)
    • stemId 를 통해 stem사전에서 해당 stem을 가져올 수 있습니다.

구현

  • CSM 생성의 의사코드는 아래와 같습니다.
parameter stems

variable csms

loop when stems are empty {
  take a stem from stems
  buildCSM ( stem )
}

func buildCSM ( stem ) {
  variable csm
  variable csm-base
  variable csm-source

  while ( stem has commit ) {
    take out a commit from stem (t-commit)

    if t-commit is merge-commit then 
      get t-commit's merge-parent-commit (aka p-commit)
      get p-commit's stem (aka p-stem)
      take commits between p-stem-last-commit to p-commit (aka squash-targets)

    set csm-base by t-commit
    set csm-source by squash-targets
  }

  add csm to csms
}
@ansrlm
Copy link
Contributor

ansrlm commented Sep 16, 2022

좋습니다~ 고생하셨습니다!!

@ytaek
Copy link
Contributor

ytaek commented Mar 12, 2023

knowledge 이슈들 재정리하겠습니다. 우선 close할께요~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants