[PATCH] dim: Move to more readable fixup patch naming scheme

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Thu Dec 7 11:11:54 UTC 2017


Because branch and repo already contain '-', move to use '__' as
the delimiter between the two for more readability.

While at it, allow explicitly specifying the branch where the
fixup should be applied in the case of a non-conflicting merge
issue.

Fixing the merge commit of drm-misc-next after noticing drm-tip
not to build would be done in the following way:

$ git diff | dim cat-to-fixup drm-misc-next

Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 dim | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index 8b8621d157b2..5c43edd9f8c2 100755
--- a/dim
+++ b/dim
@@ -595,6 +595,23 @@ function fetch_all
 	done
 }
 
+function find_fixup_file # repo branch
+{
+	local file_paths repo branch rerere
+	repo=$1
+	branch=$2
+	rerere=$DIM_PREFIX/drm-rerere
+
+	file_paths="$rerere/${repo}-${branch//\//-}-fixup.patch
+	            $rerere/${repo}__${branch//\//-}-fixup.patch"
+
+	for file_path in $file_paths; do
+		[ -f "$file_path" ] && break
+	done
+
+	echo "$file_path"
+}
+
 function dim_rebuild_tip
 {
 	local integration_branch specfile first rerere repo remote
@@ -652,8 +669,8 @@ function dim_rebuild_tip
 			echo "Fast-forward. Done."
 			true
 		else
-			fixup_file=$rerere/$repo-${branch//\//-}-fixup.patch
-			echo $fixup_file > .fixup_file_path
+			fixup_file=$(find_fixup_file $repo $branch)
+			echo $branch > .fixup_branch
 
 			git merge --rerere-autoupdate --no-commit $sha1 >& /dev/null || true
 			# normalize conflict markers
@@ -1909,10 +1926,22 @@ function dim_list_aliases
 		sed 's/^dim_alias_//;s/=/\t/;s/_/-/g'
 }
 
-function dim_cat_to_fixup
+function dim_cat_to_fixup # [branch]
 {
+	local fixup_file repo branch
+	branch=$1
+
 	cd $DIM_PREFIX/drm-tip
-	cat > $(cat .fixup_file_path)
+
+	if [ -z "$branch" ]; then
+		branch=$(cat .fixup_branch)
+	fi
+
+	repo=$(branch_to_repo $branch)
+	fixup_file=$(find_fixup_file $repo $branch)
+
+	cat > $fixup_file
+	echo "Applied fixup for $branch"
 }
 
 function dim_tc
-- 
2.14.3



More information about the dim-tools mailing list