"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: update backout/cherrypick regress to cover worktree UUID
To:
Mark Jamsek <mark@jamsek.com>
Cc:
Game of Trees <gameoftrees@openbsd.org>
Date:
Tue, 31 Jan 2023 16:17:01 +0100

Download raw body.

Thread
On Wed, Feb 01, 2023 at 01:31:07AM +1100, Mark Jamsek wrote:
> As per the recent change to display work tree UUIDs when invoked from
> the repo and the related discussion with stsp on irc, the below diff
> updates cy/bo regress to account for work tree UUID output.

Thanks, ok!

> -----------------------------------------------
> commit 22161eb1725f8bf9ad44e52a959dac46727312c7 (main)
> from: Mark Jamsek <mark@jamsek.dev>
> date: Tue Jan 31 14:24:51 2023 UTC
>  
>  update backout/cherrypick regress for worktree UUID output
>  
>  M  regress/cmdline/backout.sh     |  35+  12-
>  M  regress/cmdline/cherrypick.sh  |  35+  12-
> 
> 2 files changed, 70 insertions(+), 24 deletions(-)
> 
> diff 3f064a827faa7f9245a6f3c0d1ea74b2d216cf87 22161eb1725f8bf9ad44e52a959dac46727312c7
> commit - 3f064a827faa7f9245a6f3c0d1ea74b2d216cf87
> commit + 22161eb1725f8bf9ad44e52a959dac46727312c7
> blob - 1a217d6ed3b9754e118aea878d1450e35c34790d
> blob + 88a6dc75585a2d1b900d0d9d747bfb9a2540b8cb
> --- regress/cmdline/backout.sh
> +++ regress/cmdline/backout.sh
> @@ -285,9 +285,9 @@ test_backout_logmsg_ref() {
>  	local short_id=$(printf '%.7s' $branch_rev)
>  	local ymd2=`date -u -r $commit_time2 +"%F"`
>  	local short_id2="newbranch"
> -	local sorted=$(printf "$branch_rev\n$branch_rev2" | sort)
> +	local wt_sorted=$(printf "$branch_rev\n$branch_rev2" | sort)
>  
> -	for r in $sorted; do
> +	for r in $wt_sorted; do
>  		echo $sep >> $testroot/stdout.expected
>  		if [ $r == $branch_rev ]; then
>  			echo "backout $r" >> $testroot/stdout.expected
> @@ -394,10 +394,10 @@ test_backout_logmsg_ref() {
>  	local b2_changeset2=" M  epsilon/new2"
>  	date=`date -u -r $b2_commit_time +"%a %b %e %X %Y UTC"`
>  	date2=`date -u -r $b2_commit_time2 +"%a %b %e %X %Y UTC"`
> -	sorted=$(printf "$branch2_rev\n$branch2_rev2" | sort)
> +	local wt2_sorted=$(printf "$branch2_rev\n$branch2_rev2" | sort)
>  
>  	echo -n > $testroot/stdout.expected
> -	for r in $sorted; do
> +	for r in $wt2_sorted; do
>  		echo $sep >> $testroot/stdout.expected
>  		if [ $r == $branch2_rev ]; then
>  			echo "backout $r" >> $testroot/stdout.expected
> @@ -429,18 +429,41 @@ test_backout_logmsg_ref() {
>  		return 1
>  	fi
>  
> -	# ensure both wt and wt2 logmsg refs can be retrieved from the repo
> -	sorted=`printf \
> -	    "$branch_rev\n$branch_rev2\n$branch2_rev\n$branch2_rev2" | sort`
> +	# ensure both wt and wt2 logmsg refs can be retrieved and the
> +	# work tree UUID is displayed when listing refs from the repo
> +	local wt_uuid=$(cat $testroot/wt/.got/uuid)
> +	local wt2_uuid=$(cat $testroot/wt2/.got/uuid)
> +	local wt_first=`printf "$wt_uuid\n$wt2_uuid" | sort | head -1`
>  
> -	echo -n > $testroot/stdout.expected
> -	for r in $sorted; do
> -		echo "backout $r" >> $testroot/stdout.expected
> +	for r in $wt_sorted; do
> +		echo -n "backout $r" >> $testroot/wt.list
> +		if [ $r == $branch_rev2 ]; then
> +			echo -n " (newbranch)" >> $testroot/wt.list
> +		fi
> +		echo >> $testroot/wt.list
> +		echo "work tree: $wt_uuid" >> $testroot/wt.list
>  	done
>  
> -	(cd $testroot/repo && got backout -l | grep ^backout | \
> -	    sort | cut -f1,2 -d' ' > $testroot/stdout)
> +	for r in $wt2_sorted; do
> +		echo -n "backout $r" >> $testroot/wt2.list
> +		if [ $r == $branch2_rev2 ]; then
> +			echo -n " (newbranch2)" >> $testroot/wt2.list
> +		fi
> +		echo >> $testroot/wt2.list
> +		echo "work tree: $wt2_uuid" >> $testroot/wt2.list
> +	done
>  
> +	if [ $wt_uuid == $wt_first ]; then
> +		mv $testroot/wt.list $testroot/stdout.expected
> +		cat $testroot/wt2.list >> $testroot/stdout.expected
> +	else
> +		mv $testroot/wt2.list $testroot/stdout.expected
> +		cat $testroot/wt.list >> $testroot/stdout.expected
> +	fi
> +
> +	(cd $testroot/repo && got backout -l | egrep "^(backout|work)" \
> +	    > $testroot/stdout)
> +
>  	cmp -s $testroot/stdout.expected $testroot/stdout
>  	ret=$?
>  	if [ $ret -ne 0 ]; then
> blob - 2cc07373cc5a1d2286aa7311f48980d94a8c0180
> blob + fac54ca43c8da9be765539a05b8b421d64c36807
> --- regress/cmdline/cherrypick.sh
> +++ regress/cmdline/cherrypick.sh
> @@ -1768,9 +1768,9 @@ test_cherrypick_logmsg_ref() {
>  	local short_id=$(printf '%.7s' $branch_rev)
>  	local ymd2=`date -u -r $commit_time2 +"%F"`
>  	local short_id2="newbranch"
> -	local sorted=$(printf "$branch_rev\n$branch_rev2" | sort)
> +	local wt_sorted=$(printf "$branch_rev\n$branch_rev2" | sort)
>  
> -	for r in $sorted; do
> +	for r in $wt_sorted; do
>  		echo $sep >> $testroot/stdout.expected
>  		if [ $r == $branch_rev ]; then
>  			echo "cherrypick $r" >> $testroot/stdout.expected
> @@ -1877,10 +1877,10 @@ test_cherrypick_logmsg_ref() {
>  	local b2_changeset2=" M  epsilon/new2"
>  	date=`date -u -r $b2_commit_time +"%a %b %e %X %Y UTC"`
>  	date2=`date -u -r $b2_commit_time2 +"%a %b %e %X %Y UTC"`
> -	sorted=$(printf "$branch2_rev\n$branch2_rev2" | sort)
> +	local wt2_sorted=$(printf "$branch2_rev\n$branch2_rev2" | sort)
>  
>  	echo -n > $testroot/stdout.expected
> -	for r in $sorted; do
> +	for r in $wt2_sorted; do
>  		echo $sep >> $testroot/stdout.expected
>  		if [ $r == $branch2_rev ]; then
>  			echo "cherrypick $r" >> $testroot/stdout.expected
> @@ -1912,18 +1912,41 @@ test_cherrypick_logmsg_ref() {
>  		return 1
>  	fi
>  
> -	# ensure both wt and wt2 logmsg refs can be retrieved from the repo
> -	sorted=`printf \
> -	    "$branch_rev\n$branch_rev2\n$branch2_rev\n$branch2_rev2" | sort`
> +	# ensure both wt and wt2 logmsg refs can be retrieved and the
> +	# work tree UUID is displayed when listing refs from the repo
> +	local wt_uuid=$(cat $testroot/wt/.got/uuid)
> +	local wt2_uuid=$(cat $testroot/wt2/.got/uuid)
> +	local wt_first=`printf "$wt_uuid\n$wt2_uuid" | sort | head -1`
>  
> -	echo -n > $testroot/stdout.expected
> -	for r in $sorted; do
> -		echo "cherrypick $r" >> $testroot/stdout.expected
> +	for r in $wt_sorted; do
> +		echo -n "cherrypick $r" >> $testroot/wt.list
> +		if [ $r == $branch_rev2 ]; then
> +			echo -n " (newbranch)" >> $testroot/wt.list
> +		fi
> +		echo >> $testroot/wt.list
> +		echo "work tree: $wt_uuid" >> $testroot/wt.list
>  	done
>  
> -	(cd $testroot/repo && got cherrypick -l | grep ^cherrypick | \
> -	    sort | cut -f1,2 -d' ' > $testroot/stdout)
> +	for r in $wt2_sorted; do
> +		echo -n "cherrypick $r" >> $testroot/wt2.list
> +		if [ $r == $branch2_rev2 ]; then
> +			echo -n " (newbranch2)" >> $testroot/wt2.list
> +		fi
> +		echo >> $testroot/wt2.list
> +		echo "work tree: $wt2_uuid" >> $testroot/wt2.list
> +	done
>  
> +	if [ $wt_uuid == $wt_first ]; then
> +		mv $testroot/wt.list $testroot/stdout.expected
> +		cat $testroot/wt2.list >> $testroot/stdout.expected
> +	else
> +		mv $testroot/wt2.list $testroot/stdout.expected
> +		cat $testroot/wt.list >> $testroot/stdout.expected
> +	fi
> +
> +	(cd $testroot/repo && got cherrypick -l | egrep "^(cherrypick|work)" \
> +	    > $testroot/stdout)
> +
>  	cmp -s $testroot/stdout.expected $testroot/stdout
>  	ret=$?
>  	if [ $ret -ne 0 ]; then
> 
> -- 
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68