- Migrating the OpenFOAM repository
Migrating the OpenFOAM repository
As of December 2019, the OpenFOAM repository is available as openfoam, with an older version available as OpenFOAM-plus. The repository change does not reflect functional alterations in the code, but rather git-related maintenance and structural changes.
The time-line for the repository revamping was triggered by external circumstances - one of which being the inordinately long times required to clone the repository when packaging from sources.
With the repository updates, its size has been shrunk by 80% and is now currently around 200-210 MB instead of 900MB. The maintenance effort removed some binary bombs (e.g., simulation results that had been inadvertently added over the years) and other artefacts that caused the repository to bloat, while preserving the change history.
This benefit is unfortunately associated with a significant aggravation for those developers who have been actively working with the latest development versions. We sincerely apologize for the difficulties that this incurs. We are all too aware of how annoying this is, since we too are directly affected by the same issue.
Since all commits and branch histories in git are secured with SHA1 signatures, any changes will result in new SHA1 values for the commits. So even when file-tree contents are identical, the SHA1 of two individual commits likely are not.
To properly delineate the repositories, we have taken the
maintenance-v1812 branch as the cut-point. This branch
and older branches are essentially retired and preserved on the old
OpenFOAM-plus repository, whereas the
master branch (currently the bugfix branch for
the time of writing) and obviously the
develop branch are
both being actively worked upon within the improved OpenFOAM
To reduce confusion,
have been expunged from the old repository. This circumvents the
possibility of duplicate commits or forgotten commits that would
otherwise occur if both repositories covered the same active code
Migrating your code
The file contents of the previous
develop branches have been preserved and it should be possible to migrate any user code provided that it can be
rebased. A mapping from the old-to-new commit hashes is available here.
To migrate your code, clone the new repository (shown here using HTTPS) and change working directory into it:
cd $HOME/OpenFOAM git clone https://develop.openfoam.com/Development/openfoam.git cd openfoam
Add your local repository as a remote which will be referred to by the alias 'local-repo'
git remote add local-repo <path-to-local-repo>
git remote add local-repo $HOME/OpenFOAM/OpenFOAM-plus
Fetch the your local code changes (commits)
git fetch local-repo
At this point you can apply your local change commits to the latest
develop branches using git-format-patch and git-cherry-pick (see below). Alternatively, if you would like to re-apply your changes to the equivalent starting point in the new repository continue to the next section.
Recovering an old branching location
Skip this section if you would like to apply your local changes to the latest master/develop branches.
Use the SHA1 mapping from old-to-new to find your starting/base commit. For example, if your branching point was
XXXX identify the equivalent commit (noted
YYYY later) in the new repository using:
grep XXXX old-to-new.map
Note that git offers the
merge-base command to identify your branching point (XXXX) from your old repo/local branch to the old OpenFOAM-plus develop branch :
git merge-base HEAD origin/develop
Note: if you branched from the 'master' branch, replace 'origin/develop' by 'origin/master'.
Start by creating a new branch from the equivalent commit (YYYY) in the new repository:
git checkout -b new-base YYYY
Reintroduce your changes, e.g. using git-format-patch or git-cherry-pick (see below). These should apply relatively cleanly - if there are conflicts you will need to perform additional integration updates.
This will extract all your changes into a single text file which can then be 'replayed' onto the new repository. From your current repository (with your own code changes):
git format-patch origin/develop --stdout > new_patches.patch
Change to new repository - make sure you are on your new-base branch
git am new_patches.patch
This method enables you to introduce your change commits one at a time. This is generally preferable since it is easier to resolve any conflicts one-by-one.
git cherry-pick <commit>
If you have a range of commits to re-apply, you can also use the following syntax
git cherry-pick <oldest-commit>..<newest=commit>
Thank you for your understanding and we hope that you enjoy using the more streamlined repository
The default development version was previously designated
This has now changed to
This informal naming convention is now also noted in the bashrc file:
# [WM_PROJECT_VERSION] - A human-readable version name # A development version is often named 'com' - as in www.openfoam.com export WM_PROJECT_VERSION=com
This change affects the following directory locations:
If you have been using the
run alias in the development version,
the location will also have changed accordingly.
Copyright (C) 2019-2020 OpenCFD Ltd.