diff --git a/Documentation/source/Readme/Contribution Process.rst b/Documentation/source/Readme/Contribution Process.rst index 2d507d9a4bc45926a54eb3183f281e7e2cfda336..c0cd177f80c7822ebef889f988fa253bba9ae5f0 100644 --- a/Documentation/source/Readme/Contribution Process.rst +++ b/Documentation/source/Readme/Contribution Process.rst @@ -9,48 +9,61 @@ Contribution Process Preparations ************ -* Install, configure, and use Git. For details, visit https://gitee.com/help/categories/43. -* Register an SSH public key. For details, visit https://gitee.com/help/articles/4181. +* Install, configure, and use Git. For details, visit https://docs.gitlab.com/runner/install/ +* Register an SSH public key. For details, visit https://docs.gitlab.com/ee/ci/ssh_keys/README.html#how-it-works * Find the repository that you are interested in on the code hosting platform of OpenHarmony. Downloading Code **************** Forking a Code Branch from the Cloud -************************************ +==================================== #. Find and open the homepage of the repository. #. Click the Fork button in the upper right corner, and create an individual cloud fork branch as prompted. Downloading the Fork Repository to the Local Host -************************************************* +================================================= Perform the following steps to download the code in the repository to your computer: #. Create a local working directory. -A local working directory is used for searching and managing local code. - mkdir ${your_working_dir} + A local working directory is used for searching and managing local code. -Parse the generated XML data from doxygen to generate the traceability matrix. + ``mkdir ${your_working_dir}`` #. Clone the remote repository to the local host. -* You can copy the address of the remote repository on the repository page. -* Run the following command on the local host: - git clone $remote_link +* Switch to the local path. + + ``mkdir -p ${your_working_dir}`` + + ``cd ${your_working_dir}`` + +* Clone the remote repository. + + * You can copy the address of the remote repository on the repository page. + * Run the following command on the local host: + + ``git clone $remote_link`` Using the repo Tool to Download Code Repositories in Batches -************************************************************ -* Download the repo tool. (For details, see https://gitee.com/help/articles/4316.) +============================================================ +#. Download the repo tool. For details, see `Gitlab Support <https://docs.gitlab.com/ee/user/project/repository/#download-source-code>`_. + + ``curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo`` - curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo - chmod a+x /usr/local/bin/repo - pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests + ``chmod a+x /usr/local/bin/repo`` -* Download code repositories. (There is no repo branch parameter.) - repo init -u https://gitee.com/openharmony/manifest.git -b master - repo sync -c + ``pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests`` +#. Download code repositories. (There is no **repo branch** parameter.) + + ``repo init -u https://gitee.com/openharmony/manifest.git -b master`` + + ``repo sync -c`` + + Committing Code *************** Committing a Repository (git clone) @@ -58,89 +71,104 @@ Committing a Repository (git clone) #. Update the local branch. - git fetch origin - git checkout master - git pull --rebase + ``git fetch origin`` + + ``git checkout master`` + + ``git pull --rebase`` + -Update the local debugging branch (myfeature branch) based on the remote master branch. + Update the local debugging branch (myfeature branch) based on the remote master branch. - git branch myfeature origin/master - git checkout myfeature -Then, edit and modify the code in the myfeature branch + ``git branch myfeature origin/master`` + + ``git checkout myfeature`` + + Then, edit and modify the code in the myfeature branch #. Commit the changes in the local working directory. - git add . - git commit -m "Reason" + ``git add .`` + + ``git commit -m "Reason"`` -You may continue to edit and test more content after the previous commit. You can use commit --amend to commit these changes. + You may continue to edit and test more content after the previous commit. You can use commit --amend to commit these changes. #. Push the changes to your remote directory. -If you plan to review (or just establish a remote backup of your work), push the branch to your fork repository: - git push -f origin myfeature + If you plan to review (or just establish a remote backup of your work), push the branch to your fork repository: + + ``git push -f origin myfeature`` + Committing Multiple Repositories (repo init/sync) -************************************************* +================================================= #. Configure the token of the global environment. - repo config --global repo.token {TOKEN} + ``repo config --global repo.token {TOKEN}`` -The token is generated by choosing **Settings > Security Settings > Private Token** on Gitee. Example: + The token is generated by choosing **Settings > Security Settings > Private Token** on Gitee. Example: - repo config --global repo.token 211XXXXXXXXXXXXXXXXXXXXXXXX + ``repo config --global repo.token 211XXXXXXXXXXXXXXXXXXXXXXXX`` #. Create an issue under any repository to be modified on Gitee, and record the issue number (for example, #I1TVV4 in the following figure). (The issue provides a function similar to changeID of Gerrit and is used to associate multiple repositories to be modified. Skip this step if modification of multiple repositories is not involved.) #. Create a branch in the local code workspace, modify the code, and commit the changes. - repo start branchname --all + ``repo start branchname --all`` + + After the code is modified, run the following command in multiple repositories: -After the code is modified, run the following command in multiple repositories: + ``git add .`` - git add . - git commit -m "xxxxxx" + ``git commit -m "xxxxxx"`` -Alternatively, use the repo tool to batch add or commit the changes in the root directory of the code project: + Alternatively, use the repo tool to batch add or commit the changes in the root directory of the code project: - repo forall -c 'git add .' - repo forall -c 'git commit -m "xxxxxx"' + ``repo forall -c 'git add .'`` -#. Push the code. (repo upload is not supported.) -Specify whether to directly generate a pull request (PR) during code push. The value False indicates that a PR is not directly generated and needs to be manually generated in the fork warehouse. The value True indicates that a PR is generated when the code is pushed to the fork repository. + ``repo forall -c 'git commit -m "xxxxxx"'`` - repo config repo.pullrequest {True/False} +#. Push the code (repo upload is not supported). + Specify whether to directly generate a pull request (PR) during code push. -For example, if the PR is generated when the push code is selected, run the following command: + The value False indicates that a PR is not directly generated and needs to be manually generated in the fork warehouse. - repo config repo.pullrequest True + The value True indicates that a PR is generated when the code is pushed to the fork repository. -Run the following command to push the code: + ``repo config repo.pullrequest {True/False}`` - repo push --br={BRANCH} --d={DEST_BRANCH} --content={PR_CONTENT} + For example, if the PR is generated when the push code is selected, run the following command: -BRANCH indicates the local branch, DEST_BRANCH indicates the destination branch (trunk branch), which is usually master, and PR_CONTENT indicates the PR description. If multi-repository committing is involved, the issue number must be entered. Example: + ``repo config repo.pullrequest True`` - repo push --br="20200903" --d="master" --content="#I1TVV4" + Run the following command to push the code: -On the editing page displayed, open the comment tags for the repository, branch, and commit. + ``repo push --br={BRANCH} --d={DEST_BRANCH} --content={PR_CONTENT}`` -Save the settings and exit. The repo tool automatically pushes the local branch to the remote fork repository (creates a fork repository if there is no fork repository) and generates a PR. + **BRANCH** indicates the local branch, **DEST_BRANCH** indicates the destination branch (trunk branch), which is usually master, and PR_CONTENT indicates the PR description. If multi-repository committing is involved, the issue number must be entered. Example: -The tool automatically associates the PR with the issue. + ``repo push --br="20200903" --d="master" --content="#I1TVV4"`` + + On the editing page displayed, open the comment tags for the repository, branch, and commit. + + Save the settings and exit. The repo tool automatically pushes the local branch to the remote fork repository (creates a fork repository if there is no fork repository) and generates a PR. + + The tool automatically associates the PR with the issue. Creating a Pull Request *********************** Access the fork repository on Gitee, click the button for creating a PR, and select the myfeature branch to generate a PR. (Skip this step if a PR has been automatically created using the repo tool.) -For details, visit https://gitee.com/help/articles/4128. +For details, visit https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/#how-it-works .. notice:: + How do I create PRs at the same time if multiple code repositories have compilation dependencies? During the development of the operating system (OS), it is common that multiple code repositories have compilation dependencies. Therefore, the PRs need to be created and merged at the same time. For this reason, Gitee uses issues as the dependency identifiers for code repositories with compilation dependencies to commit the PRs. Follow the operations below: #. Create an issue in any of the code repositories. -#. Associate PRs that need to be built and merged at the same time with the issue. For details, visit https://gitee.com/help/articles/4142. +#. Associate PRs that need to be built and merged at the same time with the issue. #. After the build is triggered, the build center identifies the PRs associated with the same issue, downloads the build, and merges the PRs into the code library after the code is approved. @@ -175,7 +203,9 @@ If the access control is passed, all PRs associated with the issue will be autom Reviewing Code ============== -For details, visit https://gitee.com/help/articles/4304. + +For details, visit https://docs.gitlab.com/ee/development/code_review.html#code-review-guidelines + Related topic: FAQs