Skip to content
Winston Chang edited this page Jul 22, 2013 · 22 revisions

Setup instructions

Cloning this repository is the same as any with 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

# To get changes - just do the usual:
git pull

# Or do a 'git fetch' to get changes without changing the local checked-out copy:
git fetch

Building R from source

Normally, you would do something like this to build R from source:

./configure
make

However, as of revision 62183, R must either be built from a svn checkout, or from the tarball generated by make dist (which must in turn be built from a svn checkout). Attempts to do otherwise will result in an error.

To work around this, add these commands between ./configure and make:

./configure

(cd doc/manual && make front-matter html-non-svn)

echo -n 'Revision: ' > SVN-REVISION
git log --format=%B -n 1 \
  | grep "^git-svn-id"    \
  | sed -E 's/^git-svn-id: https:\/\/svn.r-project.org\/R\/trunk@([0-9]+).*$/\\1/' \
  >> SVN-REVISION
echo -n 'Last Changed Date: ' >>  SVN-REVISION
git log -1 --pretty=format:"%ad" --date=iso | cut -d' ' -f1 >> SVN-REVISION

make

(This is kind of a hack -- there may well be a better method.)

If you are running Ubuntu Linux and want to install the development version of R alongside your normal R installation, see the instructions on Michael Rutter's blog.

Configuring a git clone to fetch from svn repository

Clones of this git repository can also be configured to get changes from the main R svn repository. This might be useful if you want to get the latest changes to svn that haven't yet been pushed to Github (this repository is updated once per hour).

# Set it up with svn.
# Prefix should match remote repo name with a trailing slash
git svn init --prefix=origin/ -s https://svn.r-project.org/R/

# Do 'git svn fetch' to fetch changes from the SVN repository.
# This will update the git repo, but not change the current checked-out commit.
# The first time will take a long time because it needs to match
# git commits with svn commits.
git svn fetch

# This does the same as a fetch, but also updates the current checked-out
# files to the latest revision on the branch. Unlike a fetch, it won't add
# new branches from svn to the git repository.
git svn rebase
Clone this wiki locally