FlightGear Git: data developers: Difference between revisions
m (Link to the Windows Git release now that it's officially supported) |
(Add boilerplate cloning method) |
||
Line 1: | Line 1: | ||
{{WIP}} | |||
{{Git}} | {{Git}} | ||
Anyone contributing data to FlightGear, like aircraft models, dialogs or textures, is a '''data developer'''. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator. | Anyone contributing data to FlightGear, like aircraft models, dialogs or textures, is a '''data developer'''. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator. | ||
Line 11: | Line 12: | ||
The first thing to do as a prospective developer is to [https://sourceforge.net/user/registration register at SourceForge] if you haven't already done so. This will enable you to publish your edits and have them incorporated into the main project. | The first thing to do as a prospective developer is to [https://sourceforge.net/user/registration register at SourceForge] if you haven't already done so. This will enable you to publish your edits and have them incorporated into the main project. | ||
After logging in, you can create a personal "clone" of the data repository. This clone is where you will be working in, without touching the main repository. To create a clone, navigate to the fgdata repository on | After logging in, you can create a personal "clone" of the data repository. This clone is where you will be working in, without touching the main repository. To create a clone, navigate to the fgdata repository on {{fgdata source}} and click the '''Fork''' button. In general the default name is fine, but you can change it to whatever you like. SourceForge will now clone the data repository. Due to the size of our repository, this can take some time. | ||
=== Obtaining the data === | === Obtaining the data === | ||
Before you can start editing, you first need to retrieve the data to your computer | Before you can start editing, you first need to retrieve the data to your computer. As of March 2015, the size of the fgdata repository is about 1.3 GB<ref>{{cite web | ||
|url = http://sourceforge.net/p/flightgear/mailman/message/33562630/ | |url = http://sourceforge.net/p/flightgear/mailman/message/33562630/ | ||
|title = <nowiki>Re: [Flightgear-devel] FGData - The Next Generation is ready.</nowiki> | |title = <nowiki>Re: [Flightgear-devel] FGData - The Next Generation is ready.</nowiki> | ||
|author = Anders Gidenstam | |author = Anders Gidenstam | ||
|date = 2015-03-07 | |date = 2015-03-07 | ||
}}</ref>. | }}</ref>. There are three ways to do this. | ||
For | For all approaches, Git must be installed. There is a lot of software available, but the following are often used: | ||
* ''' | * '''Microsoft Windows:''' [https://git-scm.com/download/win Git for Windows] | ||
* ''' | * '''OS X:''' [http://sourceforge.net/projects/git-osx-installer/ Git for OSX] | ||
==== Single clone ==== | ==== Single clone ==== | ||
# Create a directory on your computer where you'll be storing the data. | # Create a directory on your computer where you'll be storing the data. | ||
# Run/Open the GIT command editor (GIT CMD or GIT GUI in Windows Start Menu) and navigate to that folder. | # Run/Open the GIT command editor (GIT CMD or GIT GUI in Windows Start Menu) and navigate to that folder. | ||
# Clone the repository with the following command. This will create a <code>/fgdata</code> subfolder and put all the contents of the repository in there. | # Clone the repository with the following command. This will create a <code>/fgdata</code> subfolder and put all the contents of the repository in there. | ||
#:{{#tag:code|{{fgdata clone}}}} | #:{{#tag:code|{{fgdata clone}}}} | ||
{{Note|Continuing an interrupted cloning of a repository is not supported within Git. If you can not complete cloning due to connection issues, use one of the alternative methods below.}} | |||
==== Cloning using a boilerplate tarball ==== | |||
# Create a directory on your computer where you'll be storing the data. | |||
# Download the [https://sourceforge.net/projects/flightgear/files/fgdata-ng-boilerplate.git.tar/download FGData boilerplate tarball]. | |||
# Run/Open the GIT command editor (GIT CMD or GIT GUI in Windows Start Menu) and navigate to the directory you created in point 1. | |||
# Uncompress the FGData boilerplate tarball in that directory. On Windows, you can use a file archiver like [http://www.7-zip.org/ 7-Zip]. On OS X and Linux, you can issue the following command: | |||
<syntaxhighlight lang="shell"> | |||
$ tar xvf path-to-boilerplate-tarball | |||
</syntaxhighlight> | |||
where ''path-to-boilerplate-tarball'' is the path to the file you downloaded in step 2. | |||
# Fetch the latest changes in the Git repository by running: | |||
<syntaxhighlight lang="shell"> | |||
$ git pull | |||
</syntaxhighlight> | |||
# Check out the files to get the updated copy of FGData: | |||
<syntaxhighlight lang="shell"> | |||
$ git checkout -- . | |||
</syntaxhighlight> | |||
<!-- TODO Set the upstream --> | |||
<!-- | <!-- |
Revision as of 14:43, 1 May 2016
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
Git |
---|
Git is a version control system, used to store all files required to build FlightGear. |
Anyone contributing data to FlightGear, like aircraft models, dialogs or textures, is a data developer. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator.
Note about aircraft
As of September 2014, all aircraft excluding the Cessna 172P and the UFO have been migrated into the FGAddon SVN repository.
Preparations
The steps described in this section are only required once, at the initialization of your development environment.
Cloning the repository
The first thing to do as a prospective developer is to register at SourceForge if you haven't already done so. This will enable you to publish your edits and have them incorporated into the main project.
After logging in, you can create a personal "clone" of the data repository. This clone is where you will be working in, without touching the main repository. To create a clone, navigate to the fgdata repository on flightgear/fgdata/next and click the Fork button. In general the default name is fine, but you can change it to whatever you like. SourceForge will now clone the data repository. Due to the size of our repository, this can take some time.
Obtaining the data
Before you can start editing, you first need to retrieve the data to your computer. As of March 2015, the size of the fgdata repository is about 1.3 GB[1]. There are three ways to do this.
For all approaches, Git must be installed. There is a lot of software available, but the following are often used:
- Microsoft Windows: Git for Windows
- OS X: Git for OSX
Single clone
- Create a directory on your computer where you'll be storing the data.
- Run/Open the GIT command editor (GIT CMD or GIT GUI in Windows Start Menu) and navigate to that folder.
- Clone the repository with the following command. This will create a
/fgdata
subfolder and put all the contents of the repository in there.git clone git://git.code.sf.net/p/flightgear/fgdata/
Note Continuing an interrupted cloning of a repository is not supported within Git. If you can not complete cloning due to connection issues, use one of the alternative methods below. |
Cloning using a boilerplate tarball
- Create a directory on your computer where you'll be storing the data.
- Download the FGData boilerplate tarball.
- Run/Open the GIT command editor (GIT CMD or GIT GUI in Windows Start Menu) and navigate to the directory you created in point 1.
- Uncompress the FGData boilerplate tarball in that directory. On Windows, you can use a file archiver like 7-Zip. On OS X and Linux, you can issue the following command:
$ tar xvf path-to-boilerplate-tarball
where path-to-boilerplate-tarball is the path to the file you downloaded in step 2.
- Fetch the latest changes in the Git repository by running:
$ git pull
- Check out the files to get the updated copy of FGData:
$ git checkout -- .
Authentication
In order to publish edits on SourceForge, you need to generate a secret key so you can be correctly identified.
- Navigate to your newly created fgdata directory and run:
ssh-keygen
- or, if using GIT CMD in windows:
git -c alias.ssh-keygen=!ssh-keygen ssh-keygen
- Enter the name of the file in which you prefer to save the key and press Enter.
- Enter your password/passphrase and press Enter. You'll have to do this twice.
- Your key is now being generated. Open the .pub file with an editor and copy the content.
- Visit your account settings at SourceForge and navigate to "SSH settings".
- Paste the content of the .pub file and press "Save".
- Now run the following, again in your fgdata directory, with <url> as the line that you get by clicking RW on your fgdata clone page at SourceForge (something like
ssh://~you-user-name~@git.code.sf.net/u/~you-user-name~/flightgear/
):git remote set-url origin <url>
Obtaining the simulator
In order to test your work, you'll need the FlightGear version that matches the data. Since FlightGear is under constant development, data from Git does not work with previous releases. Fortunately obtaining the latest development version of the simulator is fairly straightforward for most operating systems.
- Mac: Download the .dmg
- Windows: Download the 32-bits or 64-bits installer and follow its instructions. Let it install the binary into a clean directory.
Point $FG_ROOT to your freshly obtained fgdata directory. When using the launcher, this can be done on the first page, previous from the aircraft selection.
Making edits
It is recommended to split your new fgdata clone into separate local branches for your work. For instance, if you're working on the Boeing 747-400 and the aircraft reflection shader, you might create 2 branches named "747-400" and "reflect-shader". To do this, run the following commands:
git checkout master
git checkout -b <branch name>
Then you can make your changes to the new local branch(es), which will make merge requests easier for both yourself and committers. To switch in between branches, simply use
git checkout <branch name>
Publishing edits
To push local updates to your fgdata clone on SourceForge, perform the following steps:
- Switch to the branch that contains your edits:
git checkout <branch name>
- List all the changed files:
git status -- .
- Now it's time to commit the changed files.
- If you want to commit all changed files, run the following and type your commit message.
git commit -a
- If you only want to commit a selection of files, run the following:
git add <path/to/file>
(for single files)git add --all <path/to/folder>
(to add all files within a certain folder)git rm <path/to/file>
(to remove files that you've removed)
- Followed by
git commit -m "<commit message>"
- If you want to commit all changed files, run the following and type your commit message.
- Check if everything went fine, by loading Gitk:
gitk
- Finally, push the commit to your fgdata clone SourceForge with the following command. Replace
YourUID
with your SourceForge account. Make sure you have correctly set up the clone as the origin as described under #Authentication.git push
Requesting edits to be merged
- Click the "Request merge" button on your fgdata clone page. Loading the next page can take a while, as it will list all commits of the past years!
- Once again write a short summary (could be the same as used with git commit), but this time, also write an explanation of your merge request (what does it do?). Make sure you set the target repository to fgdata, target branch to next and source branch to the local branch with your updates.
- Tick the box in front of your commit and click the "Create merge request" button.
- Everyone can see the pending request, but in order to make sure that your request gets looked at, you may contact a contributor.
Creating merge requests using this method literally means merging an entire branch into fgdata; this may not be desirable for some situations, such as small changes that only require one little commit. There's a neat method to only push certain commits to a merge request discussed by Anders Gidenstam on the FlightGear Forums.
References
|