[PATCH v2] dim: Move to more readable fixup patch naming scheme
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Tue Dec 12 13:56:06 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>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> #v1
---
bash_completion | 1 +
dim | 37 +++++++++++++++++++++++++++++++++----
dim.rst | 6 ++++--
3 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/bash_completion b/bash_completion
index 1bdc3915c389..dba2f644ad4d 100644
--- a/bash_completion
+++ b/bash_completion
@@ -63,6 +63,7 @@ _dim ()
push-queued|push-fixes|push-next-fixes)
COMPREPLY=( $( compgen -W "-f" -- $cur ) )
;;
+ cat-to-fixup)
apply-branch)
COMPREPLY=( $( compgen -W "-s $nightly_branches" -- $cur ) )
;;
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
diff --git a/dim.rst b/dim.rst
index ba834192785f..246be1a6f0a0 100644
--- a/dim.rst
+++ b/dim.rst
@@ -259,9 +259,11 @@ Rebuild and push the integration tree.
ADVANCED COMMANDS FOR COMMITTERS AND MAINTAINERS
================================================
-cat-to-fixup
+cat-to-fixup [*branch*]
------------
-Pipes stdin into the fixup patch file for the current drm-tip merge.
+Pipes stdin into the fixup patch file for the current drm-tip merge. A
+branch can be explicitly specified to fix up a non-conflicting tree that
+fails to build.
magic-patch [-a]
----------------
--
2.14.3
More information about the dim-tools
mailing list