FlightGear Git: core developers: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Update forum links)
(Update to SourceForge)
Line 1: Line 1:
{{WIP}}
{{Git}}
{{Git}}
Anyone contributing to the core of [[FlightGear]], like C and C++ code, is a '''core developer'''. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator.
Anyone contributing to the core of [[FlightGear]], like C and C++ code, is a '''core developer'''. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator.
Line 7: Line 6:


=== Cloning the repositories ===
=== Cloning the repositories ===
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 have not 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 various FlightGear repositories. These clones are where you will be working in, without touching the main repositories. To create a clone, navigate to the respective repository on https://gitorious.org/fg/ and click the Clone repository button. In general the default name is fine, but you can change it to whatever you like. Gitorious will now clone the repository. Depending on the size of the repository (especially fgdata is a large one), this can take some time.
After logging in, you can create a personal "clone" of the various FlightGear repositories. These clones are where you will be working in, without touching the main repositories. To create a clone, navigate to the respective repository on http://sourceforge.net/p/flightgear/_list/git 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 repository. Depending on the size of the repository (especially fgdata is a large one), this can take some time.


=== Obtaining the source ===
=== Obtaining the source ===
Line 17: Line 16:
# Change into that folder.
# Change into that folder.
# Clone the repositories with the following commands. This will create subfolders and put all the contents of the repositories in there.
# Clone the repositories with the following commands. This will create subfolders and put all the contents of the repositories in there.
#:<code><nowiki>git clone git://gitorious.org/fg/flightgear.git</nowiki></code>
#:<code><nowiki>git clone git://git.code.sf.net/p/flightgear/flightgear</nowiki></code>
#:<code><nowiki>git clone git://gitorious.org/fg/simgear.git</nowiki></code>
#:<code><nowiki>git clone git://git.code.sf.net/p/flightgear/simgear</nowiki></code>


== Building the simulator ==
== Building the simulator ==
Line 33: Line 32:


== Publishing edits ==
== Publishing edits ==
To push local updates to your clones on Gitorious, perform the following steps:
To push local updates to your clones 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 49: Line 48:
# 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 cloon Gitorious with the following command. Replace <code>YourUID</code> with your Gitorious account and <code>YourClone</code> with the name of your clone:
# Finally, push the commit to your clone on SourceForge with the following command. Replace <code>YourUID</code> with your SourceForge account and <code>YourClone</code> with the name of your clone:
#: <code>git push git@gitorious.org:~YourUID/fg/YourClone.git</code>
#: <code>git push ssh://YourUID@git.code.sf.net/u/YourUID/YourClone''</code>


== Requesting edits to be merged ==
== Requesting edits to be merged ==
[[File:Create merge request at Gitorious.png|thumb|270px|Creating a fgdata 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 clone page.
# Click the "Request merge" button on your clone page.
# 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 the appropriate repository (simgear, flightgear), target branch to master (fgdata) or next (FlightGear/SimGear) 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 correctly, 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 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.


Creating merge requests using this method literally means merging an entire branch into the main repository; 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 the main repository; 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 13:24, 14 March 2015

Anyone contributing to the core of FlightGear, like C and C++ code, is a core developer. This article helps those in setting up a correct workflow, to ease the inclusion of their work into the simulator.

Preparations

The in this section described steps are only required once, at the initialization of your development environment.

Cloning the repositories

The first thing to do as a prospective developer is to register at SourceForge if you have not 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 various FlightGear repositories. These clones are where you will be working in, without touching the main repositories. To create a clone, navigate to the respective repository on http://sourceforge.net/p/flightgear/_list/git 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 repository. Depending on the size of the repository (especially fgdata is a large one), this can take some time.

Obtaining the source

Before you can start editing, you first need to retrieve the source code to your computer. For FlightGear you will need SimGear, FlightGear and fgdata. The first two are covered by this article, the latter is explained in FlightGear Git: data developers#Obtaining the data.

  1. Create a directory on your computer where you'll be storing the source code.
  2. Change into that folder.
  3. Clone the repositories with the following commands. This will create subfolders and put all the contents of the repositories in there.
    git clone git://git.code.sf.net/p/flightgear/flightgear
    git clone git://git.code.sf.net/p/flightgear/simgear

Building the simulator

Now that you've setup a development environment and obtained source and data, the next step is to build FlightGear from that source. There are several articles that can help you there. They are all listed at Building FlightGear.

Making edits

It is recommended to split your new clones into separate local branches for your work. For instance, if you're working on a new radio code and performance improvements, you might create two branches named "radio" and "performance". 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>

Re-build FlightGear (and if neccessarily SimGear) after making changes, to confirm that everything works as expected.

Publishing edits

To push local updates to your clones 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 clone on SourceForge with the following command. Replace YourUID with your SourceForge account and YourClone with the name of your clone:
    git push ssh://YourUID@git.code.sf.net/u/YourUID/YourClone

Requesting edits to be merged

  1. Click the "Request merge" button on your clone page.
  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 correctly, 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 the main repository; 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.