Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions docs/tutorials/git_r_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
This guide briefly covers using **git-r** inside the
r-dev-env container to develop, build, and push changes
to R source.

#### 1. Update Your Local Source

- Open a terminal in the container.
- Clone the R SVN mirror repository if you haven’t already:

```bash
git clone https://github.com/r-devel/r-svn.git /workspaces/r-dev-env/r-source
```

- Navigate to your cloned R SVN mirror repository:

```bash
cd /workspaces/r-dev-env/r-source
```

- Fetch the latest commits:

```bash
git fetch origin
```

- Synchronize the internal SVN metadata used by R’s build system:

```bash
git r svn-revision
```

#### 2. Build R from Source

- Use `git-r` commands to configure, build, and install R:

```bash
git r configure --enable-R-shlib --enable-memory-profiling --without-recommended-packages
git r build
git r install
```

- To include recommended packages:

```bash
git r pull-recommended
git r build-recommended
```

#### 3. Make Your Code Changes

- Make edits or additions within the source tree (`src/`, `R/`, etc.).
For example:

```bash
echo "// Fix for bug 12345" >> src/main/arithmetic.c
```

- Commit your changes locally to track them with Git:

```bash
git add src/main/arithmetic.c
git commit -m "Fix arithmetic bug (12345)"
```

#### 4. Push Your Changes to Your Fork of r-svn

- Add your personal fork as a remote (replace YOUR-USERNAME):

```bash
git remote add myfork https://github.com/YOUR-USERNAME/r-svn.git
```

- Create a feature branch based on `main`, the branch name used here is for reference:

```bash
git checkout -b feature/12345-arithmetic-fix
```

- Push your branch to your fork:

```bash
git push myfork feature/12345-arithmetic-fix
```

- Create a pull request on GitHub to propose your changes to the
official repository. You can initiate the PR by visiting the URL
below (replace YOUR-USERNAME and branch name accordingly):

```bash
https://github.com/YOUR-USERNAME/r-svn/pull/new/feature/12345-arithmetic-fix
```

#### 5. Submit Your Patch to R’s Bugzilla

- Use `git-r` to generate an SVN-compatible patch file for Bugzilla submission:

```bash
git r svn-diff > ../patches/12345-arithmetic-fix.diff
```

- Upload this patch file to [R’s Bugzilla](https://bugs.r-project.org/) under
the corresponding bug report.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ nav:
- 'Creating a Patch File' : 'tutorials/patch_update.md'
- 'Multiple R Versions' : 'tutorials/multi_r_compilation.md'
- 'SVN Help' : 'tutorials/svn_help.md'
- 'Alternate Workflow using git-r': 'tutorials/git_r_workflow.md'
- 'Contributor Guide' :
- 'contributor_guide/contributing_to_docs.md'
- 'contributor_guide/contributing_to_codebase.md'
Expand Down