FlightGear Git: data developers: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (The git clone command is already explained. No need to create a Gitorious account.)
(Update to SourceForge)
Line 3: Line 3:


== Note about aircraft ==
== Note about aircraft ==
As of September 2014, all aircraft but those in the base package (that is shipped with a FlightGear release) have been copied over to a new [https://sourceforge.net/p/flightgear/fgaddon/ SVN repository]. Changes to those aircraft should be made there instead of in the Git fgdata repository discussed in this article. For the moment all aircraft are still present in the Git repository, but only base package aircraft are maintained in the Git repository. Before the release of FlightGear 3.4 in February 2014, all non-base package aircraft will be removed from Git.
As of September 2014, all aircraft but the Cessna 172P and the UFO have been copied over to a new [https://sourceforge.net/p/flightgear/fgaddon/ SVN repository]. Changes to those aircraft should be made there instead of in the Git fgdata repository discussed in this article.


== Preparations ==
== Preparations ==
Line 9: Line 9:


=== Cloning the repository ===
=== Cloning the repository ===
The first thing to do as a prospective developer is to [https://gitorious.org/users/new register at Gitorious] 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 https://gitorious.org/fg/ and click the [http://gitorious.org/fg/fgdata/clone Clone repository] button. In general the default name is fine, but you can change it to whatever you like. Gitorious will now clone the data repository. Due to the size of our repository, this can take some time.
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 https://sourceforge.net/p/flightgear/fgdata and click the [https://sourceforge.net/p/flightgear/fgdata/fork/ 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. There are two ways to do this. At the time of writing the data repository is over 5 GB. Continuing an interrupted cloning of a repository is not supported within Git. Therefore, if you have a slow or unstable connection to the internet, it is recommended to [[#Bundle|download the bundle]].
Before you can start editing, you first need to retrieve the data to your computer. There are two ways to do this. At the time of writing the data repository is over 1 GB. Continuing an interrupted cloning of a repository is not supported within Git. <1-- Therefore, if you have a slow or unstable connection to the internet, it is recommended to [[#Bundle|download the bundle]]. -->


For both approaches, Git must be installed. There is a lot of software available, but the following are often used:
For both approaches, Git must be installed. There is a lot of software available, but the following are often used:
Line 24: Line 24:
# Change into that folder.
# Change into that folder.
# Clone the repository with the following command. This will create a <tt>/fgdata</tt> subfolder and put all the contents of the repository in there.
# Clone the repository with the following command. This will create a <tt>/fgdata</tt> subfolder and put all the contents of the repository in there.
#:<code><nowiki>git clone git://gitorious.org/fg/fgdata.git</nowiki></code>
#:<code><nowiki>git clone http://git.code.sf.net/p/flightgear/fgdata</nowiki></code>
 
<!--
 
OLD BUNDLE FROM BEFORE THE AIRCRAFT SPLIT


==== Bundle ====
==== Bundle ====
Line 44: Line 48:


You should be suspicious if based on the printed progress during the <code>git fetch origin</code> phase you estimate the data download during the fetch will exceed 1GB (assuming the bundle is not terribly outdated).
You should be suspicious if based on the printed progress during the <code>git fetch origin</code> phase you estimate the data download during the fetch will exceed 1GB (assuming the bundle is not terribly outdated).
-->


=== Authentication ===
=== Authentication ===
In order to publish edits on Gitorious, you need to generate a secret key so you can be correctly identified.
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:
# Navigate to your newly created fgdata directory and run:
Line 53: Line 59:
# Enter your password/passphrase and press Enter. You'll have to do this twice.
# 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.
# Your key is now being generated. Open the .pub file with an editor and copy the content.
# Visit your dashboard at Gitorious and navigate to "Manage SSH keys".
# Visit your account settings at SourceForge and navigate to "SSH settings".
# Click the "Add SSH key" button and paste the content of the .pub file. Follow the instructions on the screen.
# 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 SSH on your fgdata clone page at Gitorious (something like ''git@gitorious.org:~your/fg/yours-fgdata.git''):
# 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''):
#: <code>git remote set-url origin <url></code>
#: <code>git remote set-url origin <url></code>


Line 74: Line 80:


== Publishing edits ==
== Publishing edits ==
To push local updates to your fgdata clone on Gitorious, perform the following steps:
To push local updates to your fgdata clone on SourceForge, perform the following steps:
# Switch to the branch that contains your edits:
# Switch to the branch that contains your edits:
#:<code>git checkout <branch name></code>
#:<code>git checkout <branch name></code>
Line 90: Line 96:
# Check if everything went fine, by loading Gitk:
# Check if everything went fine, by loading Gitk:
#: <code>gitk</code>
#: <code>gitk</code>
# Finally, push the commit to your fgdata clone Gitorious with the following command. Replace <code>YourUID</code> with your Gitorious account:
# Finally, push the commit to your fgdata clone SourceForge with the following command. Replace <code>YourUID</code> with your SourceForge account. Make sure you have correctly set up the clone as the origin as described under [[#Authentication]].
#: <code>git push git@gitorious.org:~YourUID/fg/YourUIDs-fgdata.git</code>
#: <code>git push</code>


== Requesting edits to be merged ==
== Requesting edits to be merged ==
[[File:Create merge request at Gitorious.png|thumb|270px|Creating a merge request at Gitorious.]]
<!--[[File:Create merge request at Gitorious.png|thumb|270px|Creating a merge request at Gitorious.]]-->
# 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!
# 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 master and source branch to the local branch with your updates.
# 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.
# 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. You can find a list of people on the right side of the [https://gitorious.org/fg/fgdata repository page].
# Everyone can see the pending request, but in order to make sure that your request gets looked at, you may contact a contributor. <!-- You can find a list of people on the right side of the [https://gitorious.org/fg/fgdata repository page]. -->


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 [http://forum.flightgear.org/viewtopic.php?f=4&t=10392&start=45#p115747 on the FlightGear Forums].
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 [http://forum.flightgear.org/viewtopic.php?f=4&t=10392&start=45#p115747 on the FlightGear Forums].


[[Category:Git]]
[[Category:Git]]

Revision as of 11:34, 8 March 2015

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 but the Cessna 172P and the UFO have been copied over to a new SVN repository. Changes to those aircraft should be made there instead of in the Git fgdata repository discussed in this article.

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 https://sourceforge.net/p/flightgear/fgdata 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. There are two ways to do this. At the time of writing the data repository is over 1 GB. Continuing an interrupted cloning of a repository is not supported within Git. <1-- Therefore, if you have a slow or unstable connection to the internet, it is recommended to download the bundle. -->

For both approaches, Git must be installed. There is a lot of software available, but the following are often used:

Single clone

  1. Create a directory on your computer where you'll be storing the data.
  2. Change into that folder.
  3. 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 http://git.code.sf.net/p/flightgear/fgdata


Authentication

In order to publish edits on SourceForge, you need to generate a secret key so you can be correctly identified.

  1. Navigate to your newly created fgdata directory and run:
    ssh-keygen
  2. Enter the name of the file in which you prefer to save the key and press Enter.
  3. Enter your password/passphrase and press Enter. You'll have to do this twice.
  4. Your key is now being generated. Open the .pub file with an editor and copy the content.
  5. Visit your account settings at SourceForge and navigate to "SSH settings".
  6. Paste the content of the .pub file and press "Save".
  7. 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:

  1. Switch to the branch that contains your edits:
    git checkout <branch name>
  2. List all the changed files:
    git status -- .
  3. 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>"
  4. Check if everything went fine, by loading Gitk:
    gitk
  5. 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

  1. 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!
  2. 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.
  3. Tick the box in front of your commit and click the "Create merge request" button.
  4. 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.