[dim PATCH 1/2] dim: abstract function to look up references to commit

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

 



Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 dim | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 6d3b9734b348..621f60471697 100755
--- a/dim
+++ b/dim
@@ -660,22 +660,44 @@ function dim_apply_next_fixes
 	dim_apply_branch drm-intel-next-fixes "$@"
 }
 
-function dim_cherry_pick
+function commit_list_references
 {
-	local remote sha sha_short
+	local commit remote log
 
-	remote=`url_to_remote $drm_tip_ssh`
+	cd $DIM_PREFIX/drm-tip
+	remote=$(url_to_remote $drm_tip_ssh)
+	git fetch -q $remote || true
+
+	commit="$1"
+	log=$(mktemp)
+
+	git log --regexp-ignore-case --grep="${commit:0:8}" --oneline \
+	    $commit..$remote/drm-tip > $log
+
+	if [ "$(cat $log)" != "" ]; then
+		echo "Commit ${commit:0:8} is referenced by later commits:"
+		sed 's/^/\t/' < $log
+	fi
+
+	rm -f $log
+
+	cd - >/dev/null
+}
+
+function dim_cherry_pick
+{
+	local commit
 
 	if [[ "x$1" = "x" ]]; then
 		echo "usage: $dim $subcommand commit-ish"
 		exit 1
 	fi
-	sha=`git rev-parse $1`
-	sha_short=${sha:0:8}
+	commit=$(git rev-parse $1)
 
 	git_fetch_helper $remote
-	echo Possible fixup patches for your cherry-pick:
-	git log --grep=$sha_short --pretty=oneline $sha..$remote/drm-tip
+
+	commit_list_references $commit
+
 	$DRY git cherry-pick -s -x -e $1
 }
 
@@ -721,6 +743,7 @@ function dim_cherry_pick_branch
 			echo "Already backported as:"
 			sed 's/^/\t/' < $log
 		fi
+
 		rm -f $log
 	done
 }
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux