Difference between pages "File:Nginx.gif" and "Git Merging Guide"

(Difference between pages)
(Maintenance script uploaded "File:Nginx.gif": Importing image file)
 
(Package Replacement: Funtoo Overlay (branch to branch))
 
Line 1: Line 1:
 +
This page is here to show Funtoo Linux developers different techniques that can be used to merge various things.
  
 +
== Comparing Experimental and Master ==
 +
 +
The best way to get a quick and dirty understanding of the differences between experimental and master is to do this:
 +
 +
<console>
 +
# ##i##cd /root/git/funtoo-overlay
 +
# ##i##git diff --stat origin/master origin/experimental
 +
</console>
 +
 +
This will show a summary of what modifications where made on a file-by-file basis.
 +
 +
== 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:Featured]]
 +
[[Category:Tutorial]]

Latest revision as of 01:22, January 22, 2013

This page is here to show Funtoo Linux developers different techniques that can be used to merge various things.

Comparing Experimental and Master

The best way to get a quick and dirty understanding of the differences between experimental and master is to do this:

# cd /root/git/funtoo-overlay
# git diff --stat origin/master origin/experimental

This will show a summary of what modifications where made on a file-by-file basis.

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:

# cd /root/git/funtoo-overlay
# 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(-)

The "----" in the diff above shows that several ebuilds were removed ("----" means many lines were removed) in the experimental branch, and bash-4.2_p10.ebuild 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:

# 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(-)

In this example above, sys-apps/pciutils had a lot of cleanups in experimental, but the output above indicates that there is a new pciutils-3.1.8-1.ebuild 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 --stat option:

# 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) \

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 app-shells/bash 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 app-shells/bash, and replace it entirely with the exact contents of app-shells/bash in the experimental branch.

This can be done as follows:

# git rm -rf app-shells/bash
# git checkout origin/experimental -- app-shells/bash

Now, let's review the changes git made. These are not yet committed:

# 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(-)

Looks good. These changes are already staged for commit -- notice the --cached option above. If you don't use --cached, you won't see any changes, because they're already cached for commit. Let's commit them:

# git commit -m "bash updates from experimental"
# git push origin master

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 -a option with git commit, above. Once the commit has been made, you should no longer see anything related to app-shells/bash listed when doing a diff of the branches.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current06:04, April 27, 2014Thumbnail for version as of 06:04, April 27, 2014121 × 32 (377 B)Maintenance script (Talk)Importing file
05:55, April 27, 2014Thumbnail for version as of 05:55, April 27, 2014121 × 32 (377 B)Maintenance script (Talk)Importing file
  • You cannot overwrite this file.

The following file is a duplicate of this file (more details):

The following page links to this file: