diff --git a/doc/source/vcs.rst b/doc/source/vcs.rst index e79f741707ceabd93d9e6325050ae4ab8b6fe6c4..6e7cfeac4b29610799f531f48a03ab74bd409f7e 100644 --- a/doc/source/vcs.rst +++ b/doc/source/vcs.rst @@ -134,8 +134,8 @@ a code reviewer is required to merge approved code revisions into ``main`` branc .. _csst-l1: https://csst-tb.bao.ac.cn/code/csst-l1 -Code review ------------ +Code review mechanism +--------------------- Starting from C7, developers of all packages should NOT directly push any code to *main* branch which is protected. @@ -146,3 +146,76 @@ Developers should switch to a ``dev`` branch before doing anything. Then commit code and push them to ``dev`` branch. +Workflow with ``dev`` branch +---------------------------- + +.. code-block:: + :caption: As a developer: + + (base) cham@MBP16 csst_proto % git branch -a # show all branch + dev + * main + remotes/origin/main + (base) cham@MBP16 csst_proto % git checkout dev # check out dev -> then you are in dev branch + M doc/source/conf.py + M doc/source/index.rst + M doc/source/integration.rst + M doc/source/vcs.rst + Switched to branch 'dev' + (base) cham@MBP16 csst_proto % git status # view code changes + On branch dev + Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: doc/source/conf.py + modified: doc/source/index.rst + modified: doc/source/integration.rst + modified: doc/source/vcs.rst + + Untracked files: + (use "git add ..." to include in what will be committed) + doc/contents.md + + no changes added to commit (use "git add" and/or "git commit -a") + (base) cham@MBP16 csst_proto % git add doc/source/*.rst doc/source/conf.py # add your code changes + (base) cham@MBP16 csst_proto % git commit -m "updated doc: author info and docker info" # commit your changes + [dev bbed3fa] updated doc: author info and docker info + 4 files changed, 73 insertions(+), 4 deletions(-) + (base) cham@MBP16 csst_proto % git push origin dev # as a developer you are not allowed to push to main branch + Enumerating objects: 15, done. + Counting objects: 100% (15/15), done. + Delta compression using up to 10 threads + Compressing objects: 100% (8/8), done. + Writing objects: 100% (8/8), 1.67 KiB | 1.67 MiB/s, done. + Total 8 (delta 6), reused 0 (delta 0), pack-reused 0 + remote: + remote: To create a merge request for dev, visit: + remote: http://10.3.10.28/code/csst-l1/csst_proto/-/merge_requests/new?merge_request%5Bsource_branch%5D=dev + remote: + To https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto.git + * [new branch] dev -> dev + +.. code-block:: + :caption: As a code reviewer: + + (base) cham@MBP16 csst_proto % git checkout main # check out main branch + Switched to branch 'main' + Your branch is up to date with 'origin/main'. + (base) cham@MBP16 csst_proto % git merge dev # merge dev branch into main AFTER view changes + Updating d9f64d3..bbed3fa + Fast-forward + doc/source/conf.py | 2 +- + doc/source/index.rst | 11 +++++++++++ + doc/source/integration.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- + doc/source/vcs.rst | 14 ++++++++++++++ + 4 files changed, 73 insertions(+), 4 deletions(-) + (base) cham@MBP16 csst_proto % git push origin main # push to remote main branch + Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 + To https://csst-tb.bao.ac.cn/code/csst-l1/csst_proto.git + d9f64d3..bbed3fa main -> main + +.. note:: + As a developer, you can also create a merge requrest to ask code reviewers to merge your changes on GitLab. + Click ``Merge requests`` tag, click `` + +.. image:: vcs/merge_request.png diff --git a/doc/source/vcs/merge_request.png b/doc/source/vcs/merge_request.png new file mode 100644 index 0000000000000000000000000000000000000000..45575e6a5f6c4a1b7154283ac53240107265c93a Binary files /dev/null and b/doc/source/vcs/merge_request.png differ