forum.webdiplomacy.net

webDip dev coordination forum / public access todo list
It is currently Sun Nov 19, 2017 5:38 pm

All times are UTC




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: Git repo
PostPosted: Fri Dec 30, 2011 10:14 pm 
Offline
Site Admin

Joined: Sat Jun 28, 2008 6:24 am
Posts: 892
I've set up a dev branch to use with beta.webdiplomacy.net as a test area for submitted code and new releases, and I've also tried out tags (which will at least be useful for marking versions, if not more)


I'm still getting my head around git, but here's my understanding:

- You can merge branches / tags into your current code. I think this is an all or nothing thing, which will automatically merge all commits if possible (but I'm still hazy here, and I'm hoping there's a way to selectively ignore commits).


- You can use the cherry-pick command from within a certain branch to selectively merge the changes in a certain commit (e.g. alderian's profile.php changes into the official master, without taking the forum change):
Code:
[kestas@gateway webdiplomacy-dev]$ git clone git://github.com/kestasjk/webDiplomacy.git kestasjk-master
Cloning into 'kestasjk-master'...
remote: Counting objects: 813, done.
remote: Compressing objects: 100% (569/569), done.
remote: Total 813 (delta 244), reused 749 (delta 219)
Receiving objects: 100% (813/813), 3.01 MiB | 14 KiB/s, done.
Resolving deltas: 100% (244/244), done.
[kestas@gateway webdiplomacy-dev]$ cd kestasjk-master/
[kestas@gateway kestasjk-master]$ git remote add alderian git://github.com/Alderian33/webDiplomacy.git
[kestas@gateway kestasjk-master]$ git fetch alderian
From git://github.com/Alderian33/webDiplomacy
 * [new branch]      master     -> alderian/master
[kestas@gateway kestasjk-master]$ git cherry-pick af9849652f87d01add0e4cc8d7879234f422165b # from the github pull request
[master f5551b9] various profile.php fixes
 Author: Philip Thoennes <alderian.webdip@gmail.com>
 1 files changed, 26 insertions(+), 20 deletions(-)
[kestas@gateway kestasjk-master]$




Wrote this last one before I discovered the cherry-pick thing, which makes it a bit redundant really:
Quote:
- You can generate patch sets which are based on individual commits, and can be selected from. These patches can then be applied selectively, and once committed they'll no longer show up as a difference after that, and that'll basically be a difference that's no longer there.


Taking alderian's recent changes as an example; if I want to incorporate the profile.php fixes but not the forum change I would just have to load up alderian's repo, and generate a patch set against the official branch:

Code:
[kestas@gateway webdiplomacy-dev]$ git clone git://github.com/Alderian33/webDiplomacy.git alderians-branch
Cloning into 'alderians-branch'...
remote: Counting objects: 796, done.
remote: Compressing objects: 100% (562/562), done.
remote: Total 796 (delta 235), reused 730 (delta 209)
Receiving objects: 100% (796/796), 3.01 MiB | 40 KiB/s, done.
Resolving deltas: 100% (235/235), done.
[kestas@gateway alderians-branch]$ git remote add official git://github.com/kestasjk/webDiplomacy.git # link to official repo
[kestas@gateway alderians-branch]$ git fetch official # fetch the newly added repo data (makes the data available e.g. for comparison/merging)
remote: Counting objects: 22, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 17 (delta 8), reused 16 (delta 7)
Unpacking objects: 100% (17/17), done.
From git://github.com/kestasjk/webDiplomacy
 * [new branch]      dev        -> official/dev
 * [new branch]      master     -> official/master
 * [new tag]         1.04       -> 1.04
 * [new tag]         1.04-dev-test -> 1.04-dev-test
From git://github.com/kestasjk/webDiplomacy
 * [new tag]         1.04-dev-test2 -> 1.04-dev-test2
[kestas@gateway alderians-branch]$ git format-patch official/master # generate patch list against main official branch
0001-Separate-summary-and-message-boxes-for-new-forum-thr.patch
0002-various-profile.php-fixes.patch

That patch could then be applied and committed to the main official branch, after which it wouldn't be generated any more (and if it came time to merge it would detect that original commit and corresponding patch are the same, I would expect)



I guess we'll have to see how it works out in practice though


Top
 Profile  
 
 Post subject: Re: Git repo
PostPosted: Fri Dec 30, 2011 10:44 pm 
Offline

Joined: Wed Jul 29, 2009 10:22 am
Posts: 841
It's possible to generate "patch"-files from your own repository/version.
So for example I could export the patch for the new colormanagement in drawmap:
Code:
From 30aedc5ab6c32668bc7f965bb9646e8a77111138 Mon Sep 17 00:00:00 2001
From: Sleepcap <Oliver.Auth@rhoen.de>
Date: Wed, 5 Oct 2011 23:25:56 +0200
Subject: [PATCH] A better function for color management.

---
 map/drawMap.php |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/map/drawMap.php b/map/drawMap.php
index 14fa8bf..7227f1d 100755
--- a/map/drawMap.php
+++ b/map/drawMap.php
@@ -817,15 +817,19 @@ abstract class drawMap
    protected function color(array $color, $image=false)
    {
       if ( ! is_array($image) )
-      {
          $image = $this->map;
-      }
-
+      
       list($r, $g, $b) = $color;
-
-      $colorRes = imageColorAllocate($image['image'], $r, $g, $b);
-
-      return $colorRes;
+      
+      $colorRes = imagecolorexact($image['image'], $r, $g, $b);
+      if ($colorRes == -1)
+      {
+         $colorRes = imageColorAllocate($image['image'], $r, $g, $b);
+         if (!$colorRes)
+            $colorRes = imageColorClosest($image['image'], $r, $g, $b);
+      }
+      
+      return $colorRes;
    }
 
    /**
--
1.7.6.msysgit.0


Top
 Profile  
 
 Post subject: Re: Git repo
PostPosted: Fri Dec 30, 2011 11:49 pm 
Offline
Site Admin

Joined: Sat Jun 28, 2008 6:24 am
Posts: 892
Neat sleepcap, also found a couple of other options here: http://help.github.com/send-pull-requests/


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

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:  
cron
Powered by phpBB® Forum Software © phpBB Group