Skip to contentSkip to conversation

dim: Run gitk before tagging

PATCH In review Daniel Vetter 3 participants 9 messages Mar 21, 2017 – Mar 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dim: Run gitk before tagging

Makes it easier to not fumble this and write the changelog for the wrong thing ...

v2: use @{upstream}

---
 dim | 1 +
 1 file changed, 1 insertion(+)
dim +1 -0
index cd2fa76b1979..6a5987ac5c53 100755
@@ -1412,6 +1412,7 @@ function dim_pull_request
 		repo="drm-intel"
 	else
 		tag=$branch-$today
+		gitk "$branch@{upstream}" ^$upstream &
 		$DRY git tag -f -a $tag "$branch@{upstream}"
 		$DRY git push -f $remote $tag
 		prep_pull_mail $tag
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 dim: Stop force-pushing tags

It's evil. And if you've catastrophically screwed up a pull request it's probably better to be forced to wait 1 day.

---
 dim | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
dim +8 -8
index 6a5987ac5c53..821147510dc5 100755
@@ -1329,13 +1329,13 @@ function dim_update_next_continue
 
 	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
 	tag=drm-intel-next-$today
-	$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+	$DRY git tag -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 
 	echo "Updating drm-intel-testing to latest drm-tip"
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing
-	$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-	$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
+	$DRY git tag drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
+	$DRY git push $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
 
 	cat > ~/tmp/test-request <<-HERE
 		Hi all,
@@ -1371,8 +1371,8 @@ function dim_tag_next
 		echo "Tagging current drm-intel-next"
 
 		tag=drm-intel-next-$today
-		$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+		$DRY git tag $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 	else
 		echo "drm-intel-next not up-to-date, aborting"
 		exit
@@ -1413,8 +1413,8 @@ function dim_pull_request
 	else
 		tag=$branch-$today
 		gitk "$branch@{upstream}" ^$upstream &
-		$DRY git tag -f -a $tag "$branch@{upstream}"
-		$DRY git push -f $remote $tag
+		$DRY git tag -a $tag "$branch@{upstream}"
+		$DRY git push $remote $tag
 		prep_pull_mail $tag
 
 		repo=$(branch_to_repo $branch)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 2/2] dim: Stop force-pushing tags

Quoted 2 lines · Daniel Vetter

It's evil. And if you've catastrophically screwed up a pull request it's probably better to be forced to wait 1 day.

I have to disagree with that. When I suggested we stop overwriting tags, I meant we should check if the tag exists, and add a sequence number at the end. Or always add HHMM there too.

BR,
Jani.

Quoted 50 lines
---
 dim | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
dim +8 -8
index 6a5987ac5c53..821147510dc5 100755
@@ -1329,13 +1329,13 @@ function dim_update_next_continue
 
 	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
 	tag=drm-intel-next-$today
-	$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+	$DRY git tag -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 
 	echo "Updating drm-intel-testing to latest drm-tip"
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing
-	$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-	$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
+	$DRY git tag drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
+	$DRY git push $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
 
 	cat > ~/tmp/test-request <<-HERE
 		Hi all,
@@ -1371,8 +1371,8 @@ function dim_tag_next
 		echo "Tagging current drm-intel-next"
 
 		tag=drm-intel-next-$today
-		$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+		$DRY git tag $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 	else
 		echo "drm-intel-next not up-to-date, aborting"
 		exit
@@ -1413,8 +1413,8 @@ function dim_pull_request
 	else
 		tag=$branch-$today
 		gitk "$branch@{upstream}" ^$upstream &
-		$DRY git tag -f -a $tag "$branch@{upstream}"
-		$DRY git push -f $remote $tag
+		$DRY git tag -a $tag "$branch@{upstream}"
+		$DRY git push $remote $tag
 		prep_pull_mail $tag
 
 		repo=$(branch_to_repo $branch)
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 1/2 dim: Stop force-pushing tags

It's evil. And if you've catastrophically screwed up a pull request it's probably better to be forced to wait 1 day.

v2: Autogenerate a new tag with increasing suffice, to make Jani happy.

---
 dim | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)
dim +26 -10
index c4fb047deda2..e0c1909653b6 100755
@@ -1329,7 +1329,7 @@ function dim_update_next
 
 function dim_update_next_continue
 {
-	local remote
+	local remote suffix
 
 	assert_branch drm-intel-next-queued
 
@@ -1337,13 +1337,18 @@ function dim_update_next_continue
 
 	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
 	tag=drm-intel-next-$today
-	$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+
+	while git tag -l $tag | grep -q $tag ; do
+		tag="drm-intel-next-$today-$((++suffix))"
+	done
+
+	$DRY git tag -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 
 	echo "Updating drm-intel-testing to latest drm-tip"
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing
-	$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-	$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
+	$DRY git tag drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
+	$DRY git push $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
 
 	cat > ~/tmp/test-request <<-HERE
 		Hi all,
@@ -1372,6 +1377,8 @@ function dim_update_next_continue
 
 function dim_tag_next
 {
+	local tag suffix
+
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 	git fetch $DIM_DRM_INTEL_REMOTE
 
@@ -1379,8 +1386,12 @@ function dim_tag_next
 		echo "Tagging current drm-intel-next"
 
 		tag=drm-intel-next-$today
-		$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+		while git tag -l $tag | grep -q $tag ; do
+			tag="drm-intel-next-$today-$((++suffix))"
+		done
+
+		$DRY git tag $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 	else
 		echo "drm-intel-next not up-to-date, aborting"
 		exit
@@ -1391,7 +1402,7 @@ function dim_tag_next
 # dim_pull_request branch upstream
 function dim_pull_request
 {
-	local branch upstream remote repo url git_url
+	local branch upstream remote repo url git_url suffix tag
 
 	if [[ "x$1" = "x" || "x$2" = "x" ]]; then
 		echo "usage: $dim $subcommand branch upstream"
@@ -1420,9 +1431,14 @@ function dim_pull_request
 		repo="drm-intel"
 	else
 		tag=$branch-$today
+
+		while git tag -l $tag | grep -q $tag ; do
+			tag="$branch-$today-$((++suffix))"
+		done
+
 		gitk "$branch@{upstream}" ^$upstream &
-		$DRY git tag -f -a $tag "$branch@{upstream}"
-		$DRY git push -f $remote $tag
+		$DRY git tag -a $tag "$branch@{upstream}"
+		$DRY git push $remote $tag
 		prep_pull_mail $tag
 
 		repo=$(branch_to_repo $branch)
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 2/2 dim: really make the branch argument for dim retip optional

Some didn't work, at least here.

---
 dim | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dim +7 -1
index e0c1909653b6..d7dcea625702 100755
@@ -388,7 +388,13 @@ function dim_retip
 	local branch upstream remote
 
 	branch="$1"
-	shift
+
+	if [ -n "$branch" ] ; then
+		shift
+	else
+		branch=$(git symbolic-ref --short HEAD)
+	fi
+
 	remote=$(url_to_remote $drm_tip_ssh)
 	upstream=$(git_find_tip "$branch")
 
Signature · 6 lines
2.11.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [PATCH 2/2] dim: really make the branch argument for dim retip optional

Quoted 12 lines · Daniel Vetter

Some didn't work, at least here.

---
 dim | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dim +0 -0
index e0c1909653b6..d7dcea625702 100755

dim function dim_retip · line 396

Quoted 10 lines
dim +6 -1
@@ -388,7 +388,13 @@ function dim_retip
 	local branch upstream remote
 
 	branch="$1"
-	shift
+
+	if [ -n "$branch" ] ; then
+		shift
+	else
+		branch=$(git symbolic-ref --short HEAD)
+	fi

I guess this happens with worktrees? Ack if it works for you.

BR,
Jani.

Quoted 3 lines
dim +1 -0
+
 	remote=$(url_to_remote $drm_tip_ssh)
 	upstream=$(git_find_tip "$branch")
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 2/2] dim: really make the branch argument for dim retip optional

Quoted 15 lines · Jani Nikula
Quoted 14 lines · Daniel Vetter

Some didn't work, at least here.

---
 dim | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dim +0 -0
index e0c1909653b6..d7dcea625702 100755
@@ -388,7 +388,13 @@ function dim_retip
 	local branch upstream remote
 
Quoted 10 lines

dim function dim_retip · line 396

Quoted 8 lines
dim +6 -1
 	branch="$1"
-	shift
+
+	if [ -n "$branch" ] ; then
+		shift
+	else
+		branch=$(git symbolic-ref --short HEAD)
+	fi

I guess this happens with worktrees? Ack if it works for you.

Nah, "dim retip" alone fails. The shift doesn't have anything to shift and the cmd fails silently. This isn't on a worktree or anything, it's all in the main checkout.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 2/2] dim: really make the branch argument for dim retip optional

Quoted 27 lines · Daniel Vetter
Quoted 15 lines · Jani Nikula
Quoted 14 lines · Daniel Vetter

Some didn't work, at least here.

---
 dim | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
dim +0 -0
index e0c1909653b6..d7dcea625702 100755
@@ -388,7 +388,13 @@ function dim_retip
 	local branch upstream remote
 
Quoted 10 lines

dim function dim_retip · line 396

Quoted 8 lines
dim +6 -1
 	branch="$1"
-	shift
+
+	if [ -n "$branch" ] ; then
+		shift
+	else
+		branch=$(git symbolic-ref --short HEAD)
+	fi

I guess this happens with worktrees? Ack if it works for you.

Quoted 3 lines

Nah, "dim retip" alone fails. The shift doesn't have anything to shift and the cmd fails silently. This isn't on a worktree or anything, it's all in the main checkout.

Right. I suck. *facepalm*.

J.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH 1/2] dim: Stop force-pushing tags

In reply to Daniel Vetter
Quoted 2 lines · Daniel Vetter

It's evil. And if you've catastrophically screwed up a pull request it's probably better to be forced to wait 1 day.

Not true anymore. ;)

Quoted 32 lines

v2: Autogenerate a new tag with increasing suffice, to make Jani happy.

---
 dim | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)
dim +5 -3
index c4fb047deda2..e0c1909653b6 100755
@@ -1329,7 +1329,7 @@ function dim_update_next
 
 function dim_update_next_continue
 {
-	local remote
+	local remote suffix
 
 	assert_branch drm-intel-next-queued
 
@@ -1337,13 +1337,18 @@ function dim_update_next_continue
 
 	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next
 	tag=drm-intel-next-$today
-	$DRY git tag -f -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-	git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+
+	while git tag -l $tag | grep -q $tag ; do
+		tag="drm-intel-next-$today-$((++suffix))"
+	done

dim function dim_update_next_continue · line 1351

Quoted 10 lines
dim +5 -2
+
+	$DRY git tag -a $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 
 	echo "Updating drm-intel-testing to latest drm-tip"
 	git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing
-	$DRY git tag -f drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
-	$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today
+	$DRY git tag drm-intel-testing-$today $DIM_DRM_INTEL_REMOTE/drm-intel-testing
+	$DRY git push $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today

So this would still fail? Dunno, maybe this could use -f.

Otherwise, LGTM.

Quoted 53 lines
dim +16 -5
 	cat > ~/tmp/test-request <<-HERE
 		Hi all,
@@ -1372,6 +1377,8 @@ function dim_update_next_continue
 
 function dim_tag_next
 {
+	local tag suffix
+
 	cd $DIM_PREFIX/$DIM_DRM_INTEL
 	git fetch $DIM_DRM_INTEL_REMOTE
 
@@ -1379,8 +1386,12 @@ function dim_tag_next
 		echo "Tagging current drm-intel-next"
 
 		tag=drm-intel-next-$today
-		$DRY git tag -f $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
-		git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag
+		while git tag -l $tag | grep -q $tag ; do
+			tag="drm-intel-next-$today-$((++suffix))"
+		done
+
+		$DRY git tag $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next
+		git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag
 	else
 		echo "drm-intel-next not up-to-date, aborting"
 		exit
@@ -1391,7 +1402,7 @@ function dim_tag_next
 # dim_pull_request branch upstream
 function dim_pull_request
 {
-	local branch upstream remote repo url git_url
+	local branch upstream remote repo url git_url suffix tag
 
 	if [[ "x$1" = "x" || "x$2" = "x" ]]; then
 		echo "usage: $dim $subcommand branch upstream"
@@ -1420,9 +1431,14 @@ function dim_pull_request
 		repo="drm-intel"
 	else
 		tag=$branch-$today
+
+		while git tag -l $tag | grep -q $tag ; do
+			tag="$branch-$today-$((++suffix))"
+		done
+
 		gitk "$branch@{upstream}" ^$upstream &
-		$DRY git tag -f -a $tag "$branch@{upstream}"
-		$DRY git push -f $remote $tag
+		$DRY git tag -a $tag "$branch@{upstream}"
+		$DRY git push $remote $tag
 		prep_pull_mail $tag
 
 		repo=$(branch_to_repo $branch)
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx