[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Standardizing the layout of git packaging repositories



On 8 September 2014 04:05, Ben Hutchings <ben@decadent.org.uk> wrote:
How does git-debcherry cope with the overlapping changes when generating
debian/patches?  What can you do if it fails to linearise the changes
(as, apparently, it may sometimes do)?

Just did some fiddling.

I have no idea if this is the git-debcherry I should be using or not, so far it is the only copy I have found:  git://pivot.cs.unb.ca/gitpkg.git

I created a script that generates a some commits on different feature branches, with a deliberate conflict.

Unexpectedly, this means there is only one patch generating with both feature branches included. However the results appear to be technically correct.

My random thought: I like being able to predict what will happen to patches in git-dpm. For example, if I supply the git-debcherry produced patch file name, when upstream get around to looking at it, that patch may no longer exist because I (accidentally?) created a newer patch that conflicts.

Not sure if there is an easy way to tell if two feature branches conflict or not. This might be me and/or something that can be fixed in git-debcherry though.

Regardless, if you need to make a sequence of changes, say to one file, git-dpm would appear to be the better choice, I think.

Note the script does a "rm -rf a", so don't do this on anything important. git-debcherry location is also hard coded.


=== cut ===
#!/bin/sh

set -ex

rm -rf a

mkdir a
cd a
git init

touch readme.txt
git add readme.txt
git commit  -m "upstream"

git branch upstream

# feature a version 1
git checkout -b feature_a upstream
echo "My line 1" > readme.txt
echo "My line 1" > readme0.txt
git add readme.txt readme0.txt
git commit -m "feature a version 1"

# feature b version 1
git checkout -b feature_b upstream
echo "My line 2" > readme2.txt
git add readme2.txt
git commit -m "feature b version 1"

# merge feature a and feature b into debian
git checkout -b debian upstream
git merge feature_a -m "merge feature a"
git merge feature_b -m "merge feature b"

# modify feature a
git checkout feature_a
echo "My line 1 (modified)" > readme.txt
git add readme.txt
git commit -m "feature a version 2"

# merge feature a into debian
git checkout debian
git merge feature_a -m "merge feature a"

# modify feature b, make it conflict with feature a
git checkout feature_b
echo "My line 1 (extra modified)" > readme.txt
echo "My line 2 (extra modified)" > readme2.txt
git add readme.txt readme2.txt
git commit -m "feature b version 2"

# merge feature b into debian, resolve conflict
git checkout debian
git merge feature_b -m "merge feature b" -X theirs

# generate patch
../gitpkg/git-debcherry -o debian/patches upstream
../gitpkg/git-debcherry --stat upstream
=== cut ===

The gives me one patch file, with all the changes:

=== cut ===
From 71ed7d5182996226fdaa4c1195a3e0dd0bb3fce7 Mon Sep 17 00:00:00 2001
From: Brian May <brian@microcomaustralia.com.au>
Date: Mon, 8 Sep 2014 13:13:35 +1000
Subject: [PATCH] debcherry fixup patch

18eb718 feature b version 2
         - no changes against upstream or conflicts
558086e feature a version 2
         - extra changes or conflicts
a898018 feature b version 1
         - extra changes or conflicts
daa2cc6 feature a version 1
         - extra changes or conflicts
---
 readme.txt  | 1 +
 readme0.txt | 1 +
 readme2.txt | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 readme0.txt
 create mode 100644 readme2.txt

diff --git a/readme.txt b/readme.txt
index e69de29..2f782d4 100644
--- a/readme.txt
+++ b/readme.txt
@@ -0,0 +1 @@
+My line 1 (extra modified)
diff --git a/readme0.txt b/readme0.txt
new file mode 100644
index 0000000..d6d5ab4
--- /dev/null
+++ b/readme0.txt
@@ -0,0 +1 @@
+My line 1
diff --git a/readme2.txt b/readme2.txt
new file mode 100644
index 0000000..977df1d
--- /dev/null
+++ b/readme2.txt
@@ -0,0 +1 @@
+My line 2 (extra modified)
-- 
1.9.1
=== cut ===
--
Brian May <brian@microcomaustralia.com.au>

Reply to: