Changelog-merge
Version 6 (Bor Kraljič, 10/07/2011 03:46 am) → Version 7/11 (Bor Kraljič, 10/07/2011 03:46 am)
h1. Changelog-merge
h2. Problematic ChangeLog merges
bor@bik grimoire 0 $ git log -p -1
<pre>
commit 83cac7378ad42bcd6bbcbb239c3107ee6f89bf86
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:12:21 2011 +0200
bbbbbbbbbbbbbbbbbbbbb
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..9c43442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-07 Bor Kraljič <pyrobor@ver.si>
+ * something new on "master" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git log -p -1 problematic-changelog
<pre>
commit e4490cbe10751fce61e81d6388f883b915634b9d
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:08:20 2011 +0200
ccccccccccccccc
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..036a8c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-06 Bor Kraljič <pyrobor@ver.si>
+ * some changes on one "devel" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git merge problematic-changelog
<pre>
Auto-merging ChangeLog
CONFLICT (content): Merge conflict in ChangeLog
Automatic merge failed; fix conflicts and then commit the result.
</pre>
bor@bik grimoire 1 $ head -n 10 ChangeLog
<pre>
<<<<<<< HEAD
2011-10-07 Bor Kraljič <pyrobor@ver.si>
* something new on "master" branch
=======
2011-10-06 Bor Kraljič <pyrobor@ver.si>
* some changes on one "devel" branch
>>>>>>> problematic-changelog
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
</pre>
*As we see the merge fails and we have to deal with conflicts*
h2. Lets add changelog-merge driver
bor@bik grimoire 1 $ echo "ChangeLog merge=merge-changelog" > .gitattributes
bor@bik grimoire 0 $ cat .gitattributes
<pre>
ChangeLog merge=merge-changelog
</pre>
bor@bik grimoire 0 $ grep -i change .git/config
<pre>
[merge "merge-changelog"]
name = GNU-style ChangeLog merge driver
driver = /usr/bin/git-merge-changelog %O %A %B
</pre>
Instructions for use with git (line 50):
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c;h=652b40a72d1cc87bf417484f7109632d2ae55f6e;hb=HEAD
h2. Same scenario with new merge driver
Lets first reset changes done by that ugly merge
bor@bik grimoire 0 $ git reset --hard HEAD
<pre>
HEAD is now at 83cac73 bbbbbbbbbbbbbbbbbbbbb
</pre>
bor@bik grimoire 0 $ git log -p -1
<pre>
commit 83cac7378ad42bcd6bbcbb239c3107ee6f89bf86
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:12:21 2011 +0200
bbbbbbbbbbbbbbbbbbbbb
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..9c43442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-07 Bor Kraljič <pyrobor@ver.si>
+ * something new on "master" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git log -p -1 problematic-changelog
<pre>
commit e4490cbe10751fce61e81d6388f883b915634b9d
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:08:20 2011 +0200
ccccccccccccccc
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..036a8c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-06 Bor Kraljič <pyrobor@ver.si>
+ * some changes on one "devel" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git merge problematic-changelog
<pre>
Auto-merging ChangeLog
Merge made by recursive.
ChangeLog | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
</pre>
bor@bik grimoire 0 $ head -n 10 ChangeLog
<pre>
2011-10-06 Bor Kraljič <pyrobor@ver.si>
* some changes on one "devel" branch
2011-10-07 Bor Kraljič <pyrobor@ver.si>
* something new on "master" branch
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
*Merge is done without conflict!*
h2. Conclusions Conclusion
* no more conflicts in ChangeLog
* works also with HISTORY files. with adding "HISTORY merge=merge-changelog" to _.gitattributes_ or _.git/info/attributes_
* changes from merging branch are on top... (at least in this testing)
- this could be reversed with %A %B in .git/config.
* perhaps this is good or maybe not... depends on sorcery search for date ( http://www.sourcemage.org/issues/194 )
* getting git-merge-changelog installed was is a bit pain in the ass!
-
* I have made some spell for installing gnulib modules that more or less work... works... ( https://github.com/PyroBor/pyrogrimoire/tree/master/devel/gnulib ) (haven't really tested but installs a lot of extra doc crap. Also not sure that we need any other modules as git-merge-changelog). So I think it is not good enough to be in main grimoire...
- module that git-merge-changelog
* We can package git-merge-changelog: it: http://www.mail-archive.com/bug-gnulib@gnu.org/msg09699.html
h2. How to get this improvement?
Like I wrote in conclusions. I have some basic spell to get git-merge-changelog installed. I pushed the spell into my grimoire. To get that spell just add my grimoire:
<pre>
scribe add pyrogrimoire from git://github.com/PyroBor/pyrogrimoire.git
</pre>
Cast spell gnulib. (for now it only has option to install git-merge-changelog module)
<pre>
cast gnulib
</pre>
After that you only need to configure your git clone of grimoire repository by adding lines in _.git/config_:
<pre>
[merge "merge-changelog"]
name = GNU-style ChangeLog merge driver
driver = /usr/bin/git-merge-changelog %O %A %B
</pre>
And add rule about using this new driver (for ChangeLog and HISTORY) to file _.git/info/attributes_:
<pre>
ChangeLog merge=merge-changelog
HISTORY merge=merge-changelog
</pre>
Or you can just copy & paste these lines (in your git clone grimoire directory):
<pre>
echo "[merge \"merge-changelog\"]" >> .git/config
echo -e "\tname = GNU-style ChangeLog merge driver" >> .git/config
echo -e "\tdriver = /usr/bin/git-merge-changelog %O %A %B" >> .git/config
echo "ChangeLog merge=merge-changelog" >> .git/info/attributes
echo "HISTORY merge=merge-changelog" >> .git/info/attributes
</pre>
And merging of Changelog or HISTORY will no longer be a problem. However I have few notices:
* Entry from merging branch is on top. (at least during my tests (all commits were from the same day if that matters...))
* I am not responsible if something goes wrong. But this is git. Just undo the merge @git reset --hard HEAD^@, comment line (prefixing it with #) in _.git/info/attributes_ and merge it old fashion way with resolving conflicts manually.
h2. Problematic ChangeLog merges
bor@bik grimoire 0 $ git log -p -1
<pre>
commit 83cac7378ad42bcd6bbcbb239c3107ee6f89bf86
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:12:21 2011 +0200
bbbbbbbbbbbbbbbbbbbbb
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..9c43442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-07 Bor Kraljič <pyrobor@ver.si>
+ * something new on "master" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git log -p -1 problematic-changelog
<pre>
commit e4490cbe10751fce61e81d6388f883b915634b9d
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:08:20 2011 +0200
ccccccccccccccc
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..036a8c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-06 Bor Kraljič <pyrobor@ver.si>
+ * some changes on one "devel" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git merge problematic-changelog
<pre>
Auto-merging ChangeLog
CONFLICT (content): Merge conflict in ChangeLog
Automatic merge failed; fix conflicts and then commit the result.
</pre>
bor@bik grimoire 1 $ head -n 10 ChangeLog
<pre>
<<<<<<< HEAD
2011-10-07 Bor Kraljič <pyrobor@ver.si>
* something new on "master" branch
=======
2011-10-06 Bor Kraljič <pyrobor@ver.si>
* some changes on one "devel" branch
>>>>>>> problematic-changelog
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
</pre>
*As we see the merge fails and we have to deal with conflicts*
h2. Lets add changelog-merge driver
bor@bik grimoire 1 $ echo "ChangeLog merge=merge-changelog" > .gitattributes
bor@bik grimoire 0 $ cat .gitattributes
<pre>
ChangeLog merge=merge-changelog
</pre>
bor@bik grimoire 0 $ grep -i change .git/config
<pre>
[merge "merge-changelog"]
name = GNU-style ChangeLog merge driver
driver = /usr/bin/git-merge-changelog %O %A %B
</pre>
Instructions for use with git (line 50):
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c;h=652b40a72d1cc87bf417484f7109632d2ae55f6e;hb=HEAD
h2. Same scenario with new merge driver
Lets first reset changes done by that ugly merge
bor@bik grimoire 0 $ git reset --hard HEAD
<pre>
HEAD is now at 83cac73 bbbbbbbbbbbbbbbbbbbbb
</pre>
bor@bik grimoire 0 $ git log -p -1
<pre>
commit 83cac7378ad42bcd6bbcbb239c3107ee6f89bf86
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:12:21 2011 +0200
bbbbbbbbbbbbbbbbbbbbb
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..9c43442 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-07 Bor Kraljič <pyrobor@ver.si>
+ * something new on "master" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git log -p -1 problematic-changelog
<pre>
commit e4490cbe10751fce61e81d6388f883b915634b9d
Author: Bor Kraljič <pyrobor@ver.si>
Date: Thu Oct 6 12:08:20 2011 +0200
ccccccccccccccc
diff --git a/ChangeLog b/ChangeLog
index aaaa8e9..036a8c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2011-10-06 Bor Kraljič <pyrobor@ver.si>
+ * some changes on one "devel" branch
+
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
bor@bik grimoire 0 $ git merge problematic-changelog
<pre>
Auto-merging ChangeLog
Merge made by recursive.
ChangeLog | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
</pre>
bor@bik grimoire 0 $ head -n 10 ChangeLog
<pre>
2011-10-06 Bor Kraljič <pyrobor@ver.si>
* some changes on one "devel" branch
2011-10-07 Bor Kraljič <pyrobor@ver.si>
* something new on "master" branch
2011-10-05 Vlad Glagolev <stealth@sourcemage.org>
* python-pypi/fabric: new spell, simple, Pythonic tool for remote
execution and deployment
</pre>
*Merge is done without conflict!*
h2. Conclusions Conclusion
* no more conflicts in ChangeLog
* works also with HISTORY files. with adding "HISTORY merge=merge-changelog" to _.gitattributes_ or _.git/info/attributes_
* changes from merging branch are on top... (at least in this testing)
- this could be reversed with %A %B in .git/config.
* perhaps this is good or maybe not... depends on sorcery search for date ( http://www.sourcemage.org/issues/194 )
* getting git-merge-changelog installed was is a bit pain in the ass!
-
* I have made some spell for installing gnulib modules that more or less work... works... ( https://github.com/PyroBor/pyrogrimoire/tree/master/devel/gnulib ) (haven't really tested but installs a lot of extra doc crap. Also not sure that we need any other modules as git-merge-changelog). So I think it is not good enough to be in main grimoire...
- module that git-merge-changelog
* We can package git-merge-changelog: it: http://www.mail-archive.com/bug-gnulib@gnu.org/msg09699.html
h2. How to get this improvement?
Like I wrote in conclusions. I have some basic spell to get git-merge-changelog installed. I pushed the spell into my grimoire. To get that spell just add my grimoire:
<pre>
scribe add pyrogrimoire from git://github.com/PyroBor/pyrogrimoire.git
</pre>
Cast spell gnulib. (for now it only has option to install git-merge-changelog module)
<pre>
cast gnulib
</pre>
After that you only need to configure your git clone of grimoire repository by adding lines in _.git/config_:
<pre>
[merge "merge-changelog"]
name = GNU-style ChangeLog merge driver
driver = /usr/bin/git-merge-changelog %O %A %B
</pre>
And add rule about using this new driver (for ChangeLog and HISTORY) to file _.git/info/attributes_:
<pre>
ChangeLog merge=merge-changelog
HISTORY merge=merge-changelog
</pre>
Or you can just copy & paste these lines (in your git clone grimoire directory):
<pre>
echo "[merge \"merge-changelog\"]" >> .git/config
echo -e "\tname = GNU-style ChangeLog merge driver" >> .git/config
echo -e "\tdriver = /usr/bin/git-merge-changelog %O %A %B" >> .git/config
echo "ChangeLog merge=merge-changelog" >> .git/info/attributes
echo "HISTORY merge=merge-changelog" >> .git/info/attributes
</pre>
And merging of Changelog or HISTORY will no longer be a problem. However I have few notices:
* Entry from merging branch is on top. (at least during my tests (all commits were from the same day if that matters...))
* I am not responsible if something goes wrong. But this is git. Just undo the merge @git reset --hard HEAD^@, comment line (prefixing it with #) in _.git/info/attributes_ and merge it old fashion way with resolving conflicts manually.