[dim PATCH 5/7] dim: optionally launch gitk with changelog on dim tag-branch

Jani Nikula jani.nikula at intel.com
Wed Dec 5 15:02:57 UTC 2018


Similar to what pull-request currently does. Try to be clever about not
including all unmerged changes, just the ones that haven't been tagged
yet.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim     | 15 +++++++++++++--
 dim.rst |  6 ++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dim b/dim
index e0f96f78c858..5081e9ac4a34 100755
--- a/dim
+++ b/dim
@@ -1898,9 +1898,10 @@ function dim_update_next_continue
 
 function dim_tag_branch
 {
-	local branch remote tag
+	local branch upstream remote tag unmerged_tags
 
-	branch=$1
+	branch=${1:?$usage}
+	upstream=$2
 	assert_branch $branch
 	remote=$(branch_to_remote $branch)
 
@@ -1915,6 +1916,16 @@ function dim_tag_branch
 
 	echo "Tagging current $branch"
 
+	if [[ -n "$upstream" ]]; then
+		# If there are unmerged tags, show changes since last
+		unmerged_tags=$(git_unmerged_tags "$branch" "$upstream")
+		if [[ -n "$unmerged_tags" ]]; then
+			upstream="${unmerged_tags%% *}"
+		fi
+
+		gitk --first-parent "$branch" "^$upstream" &
+	fi
+
 	tag=$(tag_name "$branch")
 	tag_branch $tag $branch
 	git push $DRY_RUN $remote $tag
diff --git a/dim.rst b/dim.rst
index 7aa90e659983..792c99f324fa 100644
--- a/dim.rst
+++ b/dim.rst
@@ -374,13 +374,15 @@ When **update-next** fails to push the special release commit (because it raced
 another committer) rebase and push manually, and then continue using this
 command.
 
-tag-branch *branch*
--------------------
+tag-branch *branch* [*upstream*]
+--------------------------------
 Pushes a new tag for the specified branch after checking that the remote is 
 up-to-date.
 
 The tag will be signed using the key specified by \$DIM_GPG_KEYID, if set.
 
+If upstream is provided, launch gitk to show the changes to be tagged.
+
 tag-next
 --------
 **tag-branch** shorthand for drm-intel-next.
-- 
2.11.0



More information about the dim-tools mailing list