FreeOrion

Forums for the FreeOrion project
It is currently Tue Jun 19, 2018 4:23 pm

All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Jul 24, 2014 8:41 am 
Offline
Space Floater

Joined: Tue Mar 18, 2008 5:42 am
Posts: 36
Location: Australia
OK, thanks for your helpful replies. I'll give PyCharm and Visual Studio C++ or Express Edition further attention. Muchas gracias.

How to Install Visual C++ 2010 Express


Top
 Profile  
 
PostPosted: Sat Jul 26, 2014 2:50 pm 
Offline
Dyson Forest

Joined: Sun May 11, 2008 10:50 am
Posts: 231
Note: I'm trying the following to get a working Eclipse CDT Project in Linux:

Checkout the SVN repo to somewhere/FreeOrion
create a build directory under that directory, e.g. somewhere/FreeOrion/eclipsebuild
enter that build directory
cmake -G "Eclipse CDT4 - Unix Makefiles" ..
ln -s ../default default

That gives me a directory that I can import in Eclipse with import project, and which seems to work. I did not edit any cmake files as adrian_brother suggested, since I am using the build directory to seperate that stuff. I could build the project with eclipse and start it. What takes ages is the C++ indexer for the project. I had to increased some memory parameters for the eclipse java vm, otherwise it would not finish.

_________________
Attached patches are released under GPL 2.0 or later.


Top
 Profile  
 
PostPosted: Sat Jul 26, 2014 4:05 pm 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1072
Location: Germany
Chriss wrote:
I did not edit any cmake files as adrian_brother suggested, since I am using the build directory to seperate that stuff.


I use the following layout:

~/Projekte/freeorion/
freeorion.git-svn/ < checked out sources as git repository with svn bridge
freeorion.gcc/ < build directory with gcc compiler set up
freeorion.clang/ < build directory with clang compiler set up
freeorion.msbuild/ < build directory with cl.exe compiler set up (wine magic)
... and many many directories containing unrelated testing stuff for freeorion

If you botching up the build setup you don't taint the source directory.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Last edited by adrian_broher on Sat Jul 26, 2014 9:07 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Jul 26, 2014 7:43 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4646
adrian - since it looks like you prefer working with git rather than svn, I was wondering if you might have some advice on the best setup & tools (for both Linux and Windows would be nice if you have the info), and any misc tips or advice.

As you may have noticed, our new python contributor Cjkjfnby strongly prefers git, and organizes his work via branches at github. Besides any advice for him re the best way to make svn-friendly patches (on Windows), I'm thinking I would like to also set up a git-oriented FO buildtree to facilitate being able to work with his branches without him necessarily having to package and post patches. So any advice for me in setting that up would be appreciated as well. I've just worked with git a small amount in the past, so am pretty much a novice with it.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Sat Jul 26, 2014 10:00 pm 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1072
Location: Germany
Dilvish wrote:
adrian - since it looks like you prefer working with git rather than svn, I was wondering if you might have some advice on the best setup & tools (for both Linux and Windows would be nice if you have the info), and any misc tips or advice.


I don't use anything particular special for linux, git command line for the repostory usage, gitk (graphical) or tig (cli) for viewing the history.

For the repostitory itself I use the git-svn remote branch to follow the svn repository and master branch tracks exactly that remote branch. For development topics I create branches that track master. To commit stuff I checkout master, pull the svn changes, rebase master on top of git-svn, rebase the topic branches on top of master, reset the master to the top of the commits I want to push and dcommit then master to the svn repostory so I have a flat history without merging locally.

For development I use vim, make and the makefiles created by cmake. For debugging I use DDD.

Can't say much about Windows as I avoid it as much as possible. TortoiseGIT is like TortoiseSVN a repository managment software that is embedded into the Windows explorer. I you can't handle cli it's probably your best bet but I find it rather complex and unintuitive to find the right action in the context menu instead of doing 'git <subcommand here> <--flags there> <files or commit or treeish here>'. There is also msysGit, which packs a minimal unixish command line interface together with a bash shell, the gnu utils, git and gitk. I prefer to use that and push changes between my windows vm git repository and my linux host repository.

Dilvish wrote:
Besides any advice for him re the best way to make svn-friendly patches (on Windows), I'm thinking I would like to also set up a git-oriented FO buildtree to facilitate being able to work with his branches without him necessarily having to package and post patches.


The problem here is that TortioseSVN doesn't understand patches with additional git metainfo (files added, deleted, filemode changes, just renamed etc) and the developers decided it would be a good idea to stop the patching instead of ignoring this metadata. GNU patch for example can handle any patch without problems.

Running `git --no-pager diff --no-prefix fromcommit..tocommit > somefile.diff` would create a difffile without the metadata.

But the general problem shouldn't be there for you. patch applies the patches just fine. It's only TortoiseSVN specific. I personally used a small script, that did just some string replacements within the patch to make Geoff happy.

Code:
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch

# Get the highest revision number
REV=$(git svn info | grep 'Last Changed Rev:' | sed -E 's/^.*: ([[:digit:]]*)/\1/')

git --no-pager diff --no-prefix --no-color "$@" | sed \
    -e "s/^diff --git [^[:space:]]*/Index:/" \
    -e "/^--- \/dev\/null/{ N; s/^--- \/dev\/null\n+++ \(.*\)/--- \1   (revision 0)\n+++ \1   (working copy)/; p ; d ; }" \
    -e "/^--- .*$/{ h ; };/^+++ \/dev\/null/{ x ; G ; s/^--- \(.*\)\n+++ \/dev\/null/+++ \1   (working copy)/; p ; d ; x ; d ; }" \
    -e "s/^--- .*/&   (revision $REV)/" \
    -e "s/^+++ .*/&   (working copy)/" \
    -e "/^new file mode [[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]$/d" \
    -e "/^deleted file mode [[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]$/d" \
    -e "s/^index.*/===================================================================/" \
    -e "s/^\(@@ -[[:digit:]]\+,[[:digit:]]\+ +[[:digit:]]\+,[[:digit:]]\+ @@\).*$/\1/"


This script needs to be placed somewhere in PATH, called git-sdiff so you can do

`git sdiff fromcommit..tocommit > patch.diff` to create something that looks like a `svn patch` and makes TortoiseSVN happy.

Dilvish wrote:
I've just worked with git a small amount in the past, so am pretty much a novice with it.


I can only suggest that you set up a new git-svn repository and work a bit with it.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
PostPosted: Sun Jul 27, 2014 6:34 pm 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4646
Adrian, Thanks a bunch for writing that all up. Let me double check my understanding of a few key parts of this:

Code:
freeorion.git-svn/ < checked out sources as git repository with svn bridge
It seems there are a couple possible ways to set this up. The simplest seems to be something like
Code:
cd freeorion.git-svn; git svn clone -s -r 7200:HEAD https://svn.code.sf.net/p/freeorion
though that would get a limited amount of history (though instead of 7200 an earlier rev could be chosen as the start). Alternatively, a full history could be gotten, I think, by doing a
Code:
cd freeorion.git-svn; git clone git://github.com/freeorion/freeorion.git
and then adding [svn-remote "svn"] metadata to the git .config, plus a few additional steps. It's seeming the git svn clone would be good enough for me -- any comments?

Quote:
To commit stuff I checkout master, pull the svn changes, rebase master on top of git-svn, rebase the topic branches on top of master
ok, so,
Code:
$ git checkout master
$ git svn rebase
$ git checkout topic
$ git rebase master
Is that right so far?

Quote:
reset the master to the top of the commits I want to push
Could you elaborate on how to do this step?

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Sun Jul 27, 2014 7:43 pm 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1072
Location: Germany
Dilvish wrote:
any comments?


I would suggest to pull the complete history. I find it pretty useful to track changes and use git blame to get a rough idea of how code was intended or why it was commented out or written the way it is. Some of the changes only have a meaning in the context of the code history. The only drawback is IMO the long download time. The actual repository size is acceptable in my opinion.

Code:
$ du -sh .git/
591M   .git/


Dilvish wrote:
nd then adding [svn-remote "svn"] metadata to the git .config, plus a few additional steps. It's seeming the git svn clone would be good enough for me -- any comments?


That's okay. I personally pulled the repository from svn. One thing that maybe could cause troubles when you pull from svn is the missing transformation of commit authors name. Git expects the author name to look like 'name <email@host>'. To fix this I have a local svn-authors file to map the svn to git author names placed within the repositories .git directory.

To enable this I use the following .git/config snipplet. The svn-remote is just for reference, the interesting part is the 'svn' section:
Code:
[svn-remote "svn"]
   url = svn+ssh://svn.code.sf.net/p/freeorion/code/trunk/FreeOrion
   fetch = :refs/remotes/git-svn
[svn]
   authorsfile = .git/svn-authors


The actual 'svn-authors' looks like this:
Code:
marcel_metz = Marcel Metz <mmetz@adrian-broher.net>
geoffthemedio = Geoff Topping <geoffthemedio@users.sourceforge.net>
vezzra = Vezzra <vezzra@users.sourceforge.net>
dilvish-fo = Dilvish <dilvish-fo@users.sourceforge.net>
bigjoe5 = Isaac Supeene <bigjoe5@users.sourceforge.net>
eleazzaar = J. W. Bjerk <eleazzaar@user.sourceforge.net>
nagilum23 = Alexander Kuehn <github@nagilum.org>


Dilvish wrote:
Could you elaborate on how to do this step?

Not in this post. I will wrap a dedicated post with images for that but that will take some time.

Also some other points I forgot:

you need to set up the email and author name like:

git config --global user.name "Marcel Metz"
git config --global user.name "mmetz@adrian-broher.net"

The '--global' sets the user name for any user directory. If you want to set it specifically for this repository enter the repo dir and call the same git config without --global

Also I have instructed the svn bridge to delete empty directories when commiting. Git and SVN handle directories differently. For git the don't exist, for SVN they do.

git config --global svn.rmdir=true

Also in the case I push a merge-commit I want to set the svn:mergeinfo attribute within svn. Git-SVN does this when setting:

git config --global svn.pushmergeinfo=true

Also I have set up vim as difftool to make diff and merges. If you want to use some other tool you can adapt the command line of course. I can help you with that if you want to.

git config --global diff.tool=vimdiff # set vimdiff as diff tool
git config --global difftool.prompt=false # please don't bother me with stupid informations and start the difftool immediately.
git config --global merge.tool=vimdiff # set vimdiff as merge tool
git config --global mergetool.vimdiff3.cmd=''vim -f -R -d -c \"wincmd J\" \"$MERGED\" \"$REMOTE\" \"$BASE\" \"$LOCAL\" # sometimes I want to use a special config of vim when doing a three way merge so I aliased the commandline to do this as vimdifff3 'tool'

Now about the usage:

git difftool <treeish> # would now show the difference within vimdiff.
git mergetool # in case of a conflict you would now be thrown into vimdiff to resolve the conflict
git mergetool -t vimdiff3 # start the conflict resolving with my special vimdiff3 view.

The -t flag can also be used to call other applications with the difftool or mergetool verb. For example I use meld sometimes because once in a time it's better than vimdiff and more pleasing to the eye.

I have also enable color output for git

git --global color.ui=true

And finally I added a compact way to watch logs as an alias:

git --global alias.tree='log --decorate --graph --pretty=oneline --abbrev-commit'

Usage:

git tree <Any parameter that log also understands>

For example:

Code:
git tree -20 -all #20 most recent commits for all branches


Results in:

Code:
* daa64f7 (HEAD, master) Removed position parameters from CUIButton constructor.
* 58581dd Removed position parameters from SettableInWindowCUIButton constructor.
* f0f2ae1 Removed position parameters from CUIStateButton constructor.
* 40b1098 Removed position parameters from ProductionInfoPanel constructor.
* 05d39a1 Removed position parameters from CUIMultiEdit constructor.
* c56ec4e Removed position parameters from CUILinkTextMultiEdit constructor.
* be2dbf6 Removed position parameters from ColorSelector constructor.
* 67e98bf Removed position parameters from MultiTurnProgressBar constructor.
* 6787f58 Removed position parameters from ShadowedTextControl constructor.
* 82a4150 Removed position parameters from MultiTextureStaticGraphic constructor.
* f611a9b StatisticIcon layout
* e48a87f Added DoLayout method to StatisticIcon widget.
| * 63131b8 (git-svn) -Made clicking the background of the main design panel (the hull) show the hull i
| * de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
| * 28bc862 grooming
| * c6ec32c Set multiplayer autosave option setting default to true.
| * 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
|/ 
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r


Keep in mind that git honors the EDITOR environment variable if you prefer a different text editor than vim to write commit messages or doing an interactive rebase you need to change or set it.

Code:
$ echo $EDITOR
/usr/bin/vim

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Last edited by adrian_broher on Mon Jul 28, 2014 10:14 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Mon Jul 28, 2014 6:14 am 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4646
thanks tremendously for taking the time for this; hopefully others here might find it useful as well. No worries on taking more time on that resetting master step -- this is already a lot for me to chew on for a while.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
PostPosted: Mon Jul 28, 2014 11:13 am 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1072
Location: Germany
Lets assume the following state:

Code:
$ git tree -35 --all
* c244f96 (HEAD, dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d Don't create more planets than there are supported orbits in Systems within the CombatWnd.
| * 5ce0556 (git-svn, master) Fixed unusable lower drop down menus in multiplayer lobby.
| * 170adde Commented out auto lab/trader/factory ship parts to remove their categories from the design
| * 400bd05 Universe generation scripts: fixed a log message
| * d552ff5 content adjustment -- substantially reduced monster spawn rate on Low, somewhat reduced mon
| * 63600f4 AI adjustment to deserialization so that AI patch r[7304] won't break previous savegames
| * 6359307 AI update to tech preferences and overall empire priorities assessment
| * 375c92b revised AI cleanup patch by Cjkjfnby
| * 610b9d4 Patch by vincele hiding the X close button on not closable pedia windows.
| * 944c6ab Patch based on small patch by vincele disabling sorting of empty object list wnd columns.
| * 63131b8 -Made clicking the background of the main design panel (the hull) show the hull in the pedi
| * de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
| * 28bc862 grooming
| * c6ec32c Set multiplayer autosave option setting default to true.
| * 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
|/ 
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r
* 765f199 Universe generation scripts: some more minor PEP8 cleanup
* d4fd965 Scripted universe generation: PEP8 adjustments: - Renamed C++ modules for Python, foLogger an


HEAD is the currently checked out commit, which is actually the branch called 'dolayout'.
The branch 'master' is currently the same as the branch 'git-svn', which represents the last known state of the svn repository.

Also dolayout is set to track master. And master is set to track git-svn. Tracking is nothing more than saying git that the contents of a branch should be applied on top of another branch and also that git should inform us how much branches have diverted. This is relevant for rebasing and merging operations.

You can set up a branch for tracking when you create or edit it with:

Code:
git branch --set-upstream-to=<branch to track> <the branch you create or if left out the current branch>


Now I want to fetch all recent changes done from the SVN repository. This can be done with:

Code:
git svn fetch


Assuming there was a commit the repository would now look like:

Code:
$ git tree -35 --all
* c244f96 (dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d Don't create more planets than there are supported orbits in Systems within the CombatWnd.
| * abcdefg (git-svn) I made a change.
| * 5ce0556 (HEAD,master) Fixed unusable lower drop down menus in multiplayer lobby.
| * 170adde Commented out auto lab/trader/factory ship parts to remove their categories from the design
| * 400bd05 Universe generation scripts: fixed a log message
| * d552ff5 content adjustment -- substantially reduced monster spawn rate on Low, somewhat reduced mon
| * 63600f4 AI adjustment to deserialization so that AI patch r[7304] won't break previous savegames
| * 6359307 AI update to tech preferences and overall empire priorities assessment
| * 375c92b revised AI cleanup patch by Cjkjfnby
| * 610b9d4 Patch by vincele hiding the X close button on not closable pedia windows.
| * 944c6ab Patch based on small patch by vincele disabling sorting of empty object list wnd columns.
| * 63131b8 -Made clicking the background of the main design panel (the hull) show the hull in the pedi
| * de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
| * 28bc862 grooming
| * c6ec32c Set multiplayer autosave option setting default to true.
| * 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
|/ 
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r
* 765f199 Universe generation scripts: some more minor PEP8 cleanup
* d4fd965 Scripted universe generation: PEP8 adjustments: - Renamed C++ modules for Python, foLogger an


As you can see the 'git-svn' branch contains now a new commit with the id 'abcdefg' and master is one commit behind.

Now we check out master:

Code:
git checkout master


Which tells that master is 1 commit behind git-svn (a consequence of the tracking mentioned above).

Now rebase master to be equal to git-svn

Code:
git rebase


No special name needed, the tracking provides all informations necessary to do a proper rebase.

The current state now looks like:

Code:
$ git tree -35 --all
* c244f96 (dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d Don't create more planets than there are supported orbits in Systems within the CombatWnd.
| * abcdefg (HEAD,master,git-svn) I made a change.
| * 5ce0556 Fixed unusable lower drop down menus in multiplayer lobby.
| * 170adde Commented out auto lab/trader/factory ship parts to remove their categories from the design
| * 400bd05 Universe generation scripts: fixed a log message
| * d552ff5 content adjustment -- substantially reduced monster spawn rate on Low, somewhat reduced mon
| * 63600f4 AI adjustment to deserialization so that AI patch r[7304] won't break previous savegames
| * 6359307 AI update to tech preferences and overall empire priorities assessment
| * 375c92b revised AI cleanup patch by Cjkjfnby
| * 610b9d4 Patch by vincele hiding the X close button on not closable pedia windows.
| * 944c6ab Patch based on small patch by vincele disabling sorting of empty object list wnd columns.
| * 63131b8 -Made clicking the background of the main design panel (the hull) show the hull in the pedi
| * de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
| * 28bc862 grooming
| * c6ec32c Set multiplayer autosave option setting default to true.
| * 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
|/ 
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r
* 765f199 Universe generation scripts: some more minor PEP8 cleanup
* d4fd965 Scripted universe generation: PEP8 adjustments: - Renamed C++ modules for Python, foLogger an


Now checkout dolayout

Code:
git checkout dolayout


which tell us that dolayout has diverted by 16 commits and is 15 commits behind master. The repo now looks like:

Code:
$ git tree -35 --all
* c244f96 (HEAD,dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d Don't create more planets than there are supported orbits in Systems within the CombatWnd.
| * abcdefg (master,git-svn) I made a change.
| * 5ce0556 Fixed unusable lower drop down menus in multiplayer lobby.
| * 170adde Commented out auto lab/trader/factory ship parts to remove their categories from the design
| * 400bd05 Universe generation scripts: fixed a log message
| * d552ff5 content adjustment -- substantially reduced monster spawn rate on Low, somewhat reduced mon
| * 63600f4 AI adjustment to deserialization so that AI patch r[7304] won't break previous savegames
| * 6359307 AI update to tech preferences and overall empire priorities assessment
| * 375c92b revised AI cleanup patch by Cjkjfnby
| * 610b9d4 Patch by vincele hiding the X close button on not closable pedia windows.
| * 944c6ab Patch based on small patch by vincele disabling sorting of empty object list wnd columns.
| * 63131b8 -Made clicking the background of the main design panel (the hull) show the hull in the pedi
| * de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
| * 28bc862 grooming
| * c6ec32c Set multiplayer autosave option setting default to true.
| * 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
|/ 
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r
* 765f199 Universe generation scripts: some more minor PEP8 cleanup
* d4fd965 Scripted universe generation: PEP8 adjustments: - Renamed C++ modules for Python, foLogger an


Now we put the whole dolayout branch on top of master by rebasing. This means that git takes evey commit of the dolayout branch and reapplies the change it contains on top of the master branch creating new commits. If this works without conflicts the old dolayout branch is deleted and recreated at the tip of those new commits.

In case there is a conflict git will stop at the conflicting commit and ask you to resolve the conflict. Usually you will merge the changes with 'git mergetool', decide if the THEIR change in the file YOU deleted is relevant or not and fix other possible conflicts.Then you will continue the rebase with 'git rebase --continue'. But this is a whole topic by itself so I won't go into detail here.

Starting the rebase is done by

Code:
git rebase


Again, all relevant informations are pulled out from the tracking data.

Finally we have

Code:
$ git tree -35 --all
* c244f96 (HEAD,dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d Don't create more planets than there are supported orbits in Systems within the CombatWnd.
* abcdefg (master,git-svn) I made a change.
* 5ce0556 Fixed unusable lower drop down menus in multiplayer lobby.
* 170adde Commented out auto lab/trader/factory ship parts to remove their categories from the design
* 400bd05 Universe generation scripts: fixed a log message
* d552ff5 content adjustment -- substantially reduced monster spawn rate on Low, somewhat reduced mon
* 63600f4 AI adjustment to deserialization so that AI patch r[7304] won't break previous savegames
* 6359307 AI update to tech preferences and overall empire priorities assessment
* 375c92b revised AI cleanup patch by Cjkjfnby
* 610b9d4 Patch by vincele hiding the X close button on not closable pedia windows.
* 944c6ab Patch based on small patch by vincele disabling sorting of empty object list wnd columns.
* 63131b8 -Made clicking the background of the main design panel (the hull) show the hull in the pedi
* de9522d Added dragging hulls and complete designs from the list to the main design panel. (Annoying
* 28bc862 grooming
* c6ec32c Set multiplayer autosave option setting default to true.
* 46a59ec Removed string lookup from ShipDesign::Dump to make it (hopefully) compatible with ship des
* 6af283a Added code to set size of hulls list column to 0 so that it will properly resize when the enc
* 9d4d3d8 Universe generation scripts: reworked starting home system selection, home systems should be
* 42ded9d adjustment to colonization process, so that colonization of an empire-owned planet does not r
* 765f199 Universe generation scripts: some more minor PEP8 cleanup
* d4fd965 Scripted universe generation: PEP8 adjustments: - Renamed C++ modules for Python, foLogger an


Now we want to commit '266481d' to SVN to fix a bug we found while developing but not the other commits of 'dolayout' because they aren't tested well enough yet.

So check out master again

Code:
git checkout master


and the that master isn't pointing to the commit 'abcdefg' but instead pointing to '266481d'.

Code:
git reset --hard 266481d


This will result into:

Code:
$ git tree -35 --all
* c244f96 (HEAD,dolayout) Removed position parameters from CUIListBox constructor.
* 11caaea Removed position parameters from CUISpin constructor.
* 712cb83 Removed position parameters from CUIEdit constructor.
* ddf1c54 Removed position parameters from CUIButton constructor.
* 4917d30 Removed position parameters from SettableInWindowCUIButton constructor.
* f63023d Removed position parameters from CUIStateButton constructor.
* 4cfd444 Removed position parameters from ProductionInfoPanel constructor.
* 4ca3630 Removed position parameters from CUIMultiEdit constructor.
* 07a3210 Removed position parameters from CUILinkTextMultiEdit constructor.
* 1f686d4 Removed position parameters from ColorSelector constructor.
* f906f33 Removed position parameters from MultiTurnProgressBar constructor.
* 45829b5 Removed position parameters from ShadowedTextControl constructor.
* 348ade3 Removed position parameters from MultiTextureStaticGraphic constructor.
* eccf3dc StatisticIcon layout
* 3e8324e Added DoLayout method to StatisticIcon widget.
* 266481d (HEAD, master)Don't create more planets than there are supported orbits in Systems within the CombatWnd.
* abcdefg (git-svn) I made a change.
* 5ce0556 Fixed unusable lower drop down menus in multiplayer lobby.


Finally we want to commit master to the svn repository:

Code:
git svn dcommit


Now we can continue working on any branch we want by checking out the respective branch. When you want to commit something again you do the whole procedure again.

It maybe looks complex to do it that way, but I find it easier to follow a shallow non branching history with local merges than having merge commits all over the place in the public repository. Also you could skip the master branch and directly check out commits by thier commit id but that's a matter of preference.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
PostPosted: Mon Jul 28, 2014 11:35 am 
Offline
Programmer
User avatar

Joined: Fri Mar 01, 2013 9:52 am
Posts: 1072
Location: Germany
Another feature that can help you a lot it bisecting. It allows the developer find offending commits that introduced a bug or unintended behaviour by using a binary search. Lets take for example the unusable drop-down menus in the multiplayer lobby:

I started by checking out master, and telling git that I want to start a bisect:

Code:
git bisect start


I also knew that master was broken (non-responsible drop-down menus, which I verified beforhand) so I marked the commit master is pointing to as broken:

Code:
git bisect bad


After that I checked out an old commit and tested if it was working properly (assuming abcdfeg is this commit)

Code:
git checkout abcdefg
make
./freeorion # yup, that runs just fine


So I marked as working

Code:
git bisect good


Now git will check out the commit that is roughly in the middle between those two and ask you to verify if the error exist. If it does exist you issue 'git bisect bad', if it doesn't you issue 'git bisect good'. This will continue until there are no more commits to test. git will tag the first bad version as 'bisect/bad', which you can check out.

Code:
git checkout -b fixup bisect/bad


The command above will checkout a new branch called 'fixup' placed on top of 'bisect/bad'.

After creating the branch you disable the bisect mode by doing:

Code:
git bisect reset


Now you can take a look into gitk and check what was changed and how this could have caused the bug. You write your fix, verify it, commit it and rebase the fixup branch on top of master so you can finally commit it to SVN and have one less bug to care about.

_________________
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz


Top
 Profile  
 
PostPosted: Tue Jul 29, 2014 6:18 am 
Offline
AI Lead, Programmer
User avatar

Joined: Sat Sep 22, 2012 6:25 pm
Posts: 4646
Those example histories really helped a lot in making that all clear; I think I have it well enough to give it a go.
Thanks again.

_________________
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group