-
Notifications
You must be signed in to change notification settings - Fork 313
Home
Cloning this repository is the same as with any other git repository.
git clone https://github.com/wch/r-source.git
cd r-source
To clone the repository without fetching the entire history of the project, you can do a shallow clone, with:
# Get just the last commit
git clone https://github.com/wch/r-source.git --depth 1
These are some useful commands on your local clone of the repository:
git branch -a # Show all branches (including remote branches)
git checkout origin/R-2-15-branch # Checkout a branch
git checkout origin/tags/R-2-15-1 # Checkout a tag (this is how svn tags are represented)
git checkout trunk # 'trunk' is the only local branch; it tracks origin/trunk
R can't be built from a bare git repository because it needs SVN information. You'll need to transform the fresh git clone into a proper git-svn repository. Because you have cloned from wch/r-source
, the following command automatically sets your repo to track that remote for new SVN revisions:
# Prefix should match remote repo name with a trailing slash
git svn init --prefix=origin/ -s https://svn.r-project.org/R/
Git-SVN repositories work a little differently than normal git repos because SVN has no support for non-linear history. To work around this, git-svn commands avoid any pulling or merging. The main command to know about is git svn rebase
which fetches from wch
new revisions for the current branch (typically trunk), and rebase any unpushed commits on top of it[^1]. In normal workflows, we don't have any unpushed commits on trunk
, so the net effect of rebasing is to set our local trunk
branch to point to the latest revisions fetched from wch
:
git svn rebase
[^1]: In other words, this is equivalent to git pull --rebase
, or git pull --ff-only
on a clean directory.
Check that git-svn is correctly initialised:
git svn info
Rebasing automatically fetches revisions for the current branch, which you can do manually with:
git svn fetch --parent
To fetch for all branches, remove --parent
. The first time will take a long time because it needs to build the mappings from SVN revisions to git SHA-1's for all SVN branches and tags. Also, this command fetches all unfetched branches and thus will take an even longer time if you've cloned with --depth=1
(unless you've also passed --no-single-branch
to git clone
):
git svn fetch
Here is the minimal procedure for building an R:
# Download recommended packages
tools/rsync-recommended
./configure && make all && make install
However, building in the repo root is not optimal because all the build files (autotools files, compiled object files, test artifacts, ...) are created in place and end up cluttering the working directory. It is recommended to create all build artifacts in a separate directory. To do so, just call the configure script from that location. Here we're going to create a build
directory inside the repository and gitignore it, but it could just as well be located outside the repo:
mkdir build
echo "build/" >> .git/info/exclude
cd build
../configure && make all && make install
There is another r-source repository on GitHub, which has one commit per R release. This can be useful if you're just interested in seeing the changes between versions: https://github.com/SurajGupta/r-source