Difference between pages "Git Merging Guide" and "Template:DisplayBuilds"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
This page is here to show Funtoo Linux developers different techniques that can be used to merge various things.
<includeonly>
 
{{#get_web_data:url=http://build.funtoo.org/index.xml|format=xml|use xpath|data=build=/subarches/subarch[@name='{{#var:subarch}}']/build[@id='{{{1}}}']/@build,variant=/subarches/subarch[@name='{{#var:subarch}}']/build[@id='{{{1}}}']/@variant,latest=/subarches/subarch[@name='{{#var:subarch}}']/build[@id='{{{1}}}']/@latest,path=/subarches/subarch[@name='{{#var:subarch}}']/build[@id='{{{1}}}']/@path,download=/subarches/subarch[@name='{{#var:subarch}}']/build[@id='{{{1}}}']/@download}}
== Comparing Experimental and Master ==
<tr>
 
<td>{{#external_value:build}}</td>
The best way to get a quick and dirty understanding of the differences between experimental and master is to do this:
<td>{{#vardefine:v|{{#external_value:variant}}}}{{#if:{{#var:v}}|{{#var:v}}|<span style="color: #888;">standard</span>}}</td>
 
<td>{{#external_value:latest}}</td>
<console>
<td>*'''[http://ftp.osuosl.org/pub/funtoo{{#external_value:download}} osuosl.org]'''
# ##i##cd /root/git/funtoo-overlay
* '''[http://build.funtoo.org{{#external_value:download}} funtoo.org]'''</td>
# ##i##git diff --stat origin/master origin/experimental
<td>* [http://ftp.osuosl.org/pub/funtoo{{#external_value:path}} osuosl.org]
</console>
* [http://build.funtoo.org{{#external_value:path}} funtoo.org]</td>
 
</tr>
This will show a summary of what modifications where made on a file-by-file basis.
</includeonly>
 
== Package Replacement: Funtoo Overlay (branch to branch) ==
 
When merging in funtoo-overlay, we might want to merge things from experimental to master. To do this, first pick a specific package to compare changes:
 
<console>
# ##i##cd /root/git/funtoo-overlay
# ##i##git diff --stat origin/master origin/experimental app-shells/bash
app-shells/bash/bash-3.1_p17.ebuild  |  150 -------------------------
app-shells/bash/bash-3.2_p51.ebuild  | 199 ---------------------------------
app-shells/bash/bash-4.0_p37.ebuild  | 193 --------------------------------
app-shells/bash/bash-4.0_p38.ebuild  | 193 --------------------------------
app-shells/bash/bash-4.1_p10.ebuild  |  191 -------------------------------
app-shells/bash/bash-4.1_p7-r1.ebuild |  189 -------------------------------
app-shells/bash/bash-4.1_p9-r1.ebuild |  189 -------------------------------
app-shells/bash/bash-4.2_p10.ebuild  |    5 +-
8 files changed, 2 insertions(+), 1307 deletions(-)</console>
 
The "----" in the diff above shows that several ebuilds were removed ("----" means many lines were removed) in the experimental branch, and <tt>bash-4.2_p10.ebuild</tt> had slight modifications. This looks like a good candidate for grabbing from experimental to replace entirely what is in master. Here's an example of something that is ''not'' a good candidate for a wholesale replacement:
 
<console>
# ##i##git diff --stat origin/master origin/experimental sys-apps/pciutils
sys-apps/pciutils/Manifest                        |    3 -
sys-apps/pciutils/files/conf.d-pciparm            |  28 -------
sys-apps/pciutils/files/init.d-pciparm            |  80 --------------------
.../files/pciutils-3.1.4-install-lib.patch        |  40 ----------
sys-apps/pciutils/files/pciutils-3.1.7-fbsd.patch  |  11 ---
.../files/pciutils-3.1.7-install-lib.patch        |  41 ----------
.../pciutils-3.1.8-avoid-segfault-on-init.patch    |  16 ----
sys-apps/pciutils/files/pciutils.cron              |    2 -
sys-apps/pciutils/pciutils-3.1.8-r1.ebuild        |  76 -------------------
9 files changed, 0 insertions(+), 297 deletions(-)
</console>
 
In this example above, <tt>sys-apps/pciutils</tt> had a lot of cleanups in experimental, but the output above indicates that there is a new <tt>pciutils-3.1.8-1.ebuild</tt> in master that is not experimental. If we replace what is in master with that in experimental, we will lose the new ebuild! So we wouldn't want to do a wholesale replacement in this case. Old ebuilds that disappear are cleanups, but new ebuilds that disappear are not. Be sure to pay attention to whether the ebuilds that are being removed are old or new.
 
Back to our bash example. To inspect changes in more detail to make sure they are acceptable, specify the modified ebuild directly and drop the <tt>--stat</tt> option:
 
<console>
# ##i##git diff origin/master origin/experimental app-shells/bash/bash-4.2_p10.ebuild
diff --git a/app-shells/bash/bash-4.2_p10.ebuild b/app-shells/bash/bash-4.2_p10.ebuild
index 0c497ea..e603c15 100644
--- a/app-shells/bash/bash-4.2_p10.ebuild
+++ b/app-shells/bash/bash-4.2_p10.ebuild
@@ -37,7 +37,7 @@ SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)
LICENSE="GPL-3"
SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+KEYWORDS="*"
IUSE="afs bashlogger examples mem-scramble +net nls plugins vanilla"
DEPEND=">=sys-libs/ncurses-5.2-r2
@@ -69,7 +69,6 @@ src_unpack() {
        cd lib/readline
        [[ ${READLINE_PLEVEL} -gt 0 ]] && epatch $(patches -s ${READLINE_PLEVEL} readline ${READLINE_VER})
        cd ../..
-     
        epatch "${FILESDIR}"/${PN}-4.1-document-system-bashrc.patch
}
@@ -104,7 +103,7 @@ src_compile() {
        myconf="${myconf} --with-curses"
        myconf="${myconf} --without-lispdir" #335896
-     
+
        use plugins && append-ldflags -Wl,-rpath,/usr/$(get_libdir)/bash
        econf \
                $(use_with afs) \
</console>
 
OK, these look like changes we want to merge into the master branch. Actually, we want to basically 'adopt' all these bash changes into master -- a wholesale import so that <tt>app-shells/bash</tt> in master looks exactly like that in experimental. To do this, we want to wipe out what is currently in the master branch related to <tt>app-shells/bash</tt>, and replace it entirely with the exact contents of <tt>app-shells/bash</tt> in the experimental branch.
 
This can be done as follows:
 
<console>
# ##i##git rm -rf app-shells/bash
# ##i##git checkout origin/experimental -- app-shells/bash
</console>
 
Now, let's review the changes git made. These are not yet committed:
<console>
# ##i##git diff --cached --stat
app-shells/bash/bash-3.1_p17.ebuild  |  150 -------------------------
app-shells/bash/bash-3.2_p51.ebuild  |  199 ---------------------------------
app-shells/bash/bash-4.0_p37.ebuild  |  193 --------------------------------
app-shells/bash/bash-4.0_p38.ebuild  |  193 --------------------------------
app-shells/bash/bash-4.1_p10.ebuild  |  191 -------------------------------
app-shells/bash/bash-4.1_p7-r1.ebuild |  189 -------------------------------
app-shells/bash/bash-4.1_p9-r1.ebuild |  189 -------------------------------
app-shells/bash/bash-4.2_p10.ebuild  |    5 +-
8 files changed, 2 insertions(+), 1307 deletions(-)
</console>
 
Looks good. These changes are already staged for commit -- notice the <tt>--cached</tt> option above. If you don't use <tt>--cached</tt>, you won't see any changes, because they're already cached for commit. Let's commit them:
 
<console>
# ##i##git commit -m "bash updates from experimental"
# ##i##git push origin master
</console>
 
If we made any local changes to existing files that had not yet been added, and wanted to include those with the commit, we could use the <tt>-a</tt> option with <tt>git commit</tt>, above. Once the commit has been made, you should no longer see anything related to <tt>app-shells/bash</tt> listed when doing a diff of the branches.
 
[[Category:Development]]
[[Category:Tutorial]]

Revision as of 04:21, January 15, 2015