[1/2] dim: Move all rerere updating into helpers
diff mbox

Message ID 20170712121224.18522-1-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter July 12, 2017, 12:12 p.m. UTC
Just prep work.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 61 ++++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 27 deletions(-)

Comments

Sean Paul July 13, 2017, 8:14 p.m. UTC | #1
On Wed, Jul 12, 2017 at 02:12:23PM +0200, Daniel Vetter wrote:
> Just prep work.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  dim | 61 ++++++++++++++++++++++++++++++++++---------------------------
>  1 file changed, 34 insertions(+), 27 deletions(-)
> 
> diff --git a/dim b/dim
> index ca11287535cc..b788edd29653 100755
> --- a/dim
> +++ b/dim
> @@ -493,11 +493,41 @@ function rr_cache_dir
>  
>  function update_rerere_cache
>  {
> -	cd $DIM_PREFIX/drm-rerere/
> +	echo -n "Updating rerere cache... "
> +
>  	git pull
>  	mkdir $(rr_cache_dir) &> /dev/null || true
> -	cp rr-cache/* $(rr_cache_dir) -r
> +	cp rr-cache/* $(rr_cache_dir) -r --preserve=timestamps
>  	cd - > /dev/null
> +
> +	echo "Done."
> +}
> +
> +function commit_rerere_cache
> +{
> +	echo -n "Updating rerere cache... "
> +
> +	cd $DIM_PREFIX/drm-rerere/
> +	if git_is_current_branch rerere-cache ; then
> +		remote=$(branch_to_remote rerere-cache)
> +
> +		git pull >& /dev/null
> +		rm $(rr_cache_dir)/rr-cache -Rf &> /dev/null || true
> +		cp $(rr_cache_dir)/* rr-cache -r
> +		git add ./*.patch >& /dev/null || true
> +		git add rr-cache/* > /dev/null
> +		git rm rr-cache/rr-cache &> /dev/null || true
> +		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
> +			echo -n "New commit. "
> +		else
> +			echo -n "Nothing changed. "
> +		fi
> +		echo -n "Pushing rerere cache... "
> +		git push $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
> +	else
> +		echo "Fail: Branch setup for the rerere-cache is borked."
> +		exit 1
> +	fi
>  }
>  
>  function dim_revert_rerere
> @@ -528,9 +558,7 @@ function dim_rebuild_tip
>  		warn_or_fail "integration configuration file $integration_config not commited"
>  	fi
>  
> -	echo -n "Updating rerere cache... "
> -	update_rerere_cache >& /dev/null
> -	echo "Done."
> +	update_rerere_cache
>  
>  	echo -n "Reloading $integration_config... "
>  	read_integration_config
> @@ -618,28 +646,7 @@ function dim_rebuild_tip
>  	echo -n "Pushing $integration_branch... "
>  	git push $DRY_RUN $remote +HEAD >& /dev/null && echo "Done."
>  
> -	echo -n "Updating rerere cache... "
> -	cd $rerere
> -	if git_is_current_branch rerere-cache ; then
> -		remote=$(branch_to_remote rerere-cache)
> -
> -		git pull >& /dev/null
> -		rm $(rr_cache_dir)/rr-cache -Rf &> /dev/null || true
> -		cp $(rr_cache_dir)/* rr-cache -r
> -		git add ./*.patch >& /dev/null || true
> -		git add rr-cache/* > /dev/null
> -		git rm rr-cache/rr-cache &> /dev/null || true
> -		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
> -			echo -n "New commit. "
> -		else
> -			echo -n "Nothing changed. "
> -		fi
> -		echo -n "Pushing rerere cache... "
> -		git push $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
> -	else
> -		echo "Fail: Branch setup for the rerere-cache is borked."
> -		exit 1
> -	fi
> +	commit_rerere_cache
>  }
>  
>  # additional patch checks before pushing, e.g. for r-b tags
> -- 
> 2.13.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/dim b/dim
index ca11287535cc..b788edd29653 100755
--- a/dim
+++ b/dim
@@ -493,11 +493,41 @@  function rr_cache_dir
 
 function update_rerere_cache
 {
-	cd $DIM_PREFIX/drm-rerere/
+	echo -n "Updating rerere cache... "
+
 	git pull
 	mkdir $(rr_cache_dir) &> /dev/null || true
-	cp rr-cache/* $(rr_cache_dir) -r
+	cp rr-cache/* $(rr_cache_dir) -r --preserve=timestamps
 	cd - > /dev/null
+
+	echo "Done."
+}
+
+function commit_rerere_cache
+{
+	echo -n "Updating rerere cache... "
+
+	cd $DIM_PREFIX/drm-rerere/
+	if git_is_current_branch rerere-cache ; then
+		remote=$(branch_to_remote rerere-cache)
+
+		git pull >& /dev/null
+		rm $(rr_cache_dir)/rr-cache -Rf &> /dev/null || true
+		cp $(rr_cache_dir)/* rr-cache -r
+		git add ./*.patch >& /dev/null || true
+		git add rr-cache/* > /dev/null
+		git rm rr-cache/rr-cache &> /dev/null || true
+		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
+			echo -n "New commit. "
+		else
+			echo -n "Nothing changed. "
+		fi
+		echo -n "Pushing rerere cache... "
+		git push $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
+	else
+		echo "Fail: Branch setup for the rerere-cache is borked."
+		exit 1
+	fi
 }
 
 function dim_revert_rerere
@@ -528,9 +558,7 @@  function dim_rebuild_tip
 		warn_or_fail "integration configuration file $integration_config not commited"
 	fi
 
-	echo -n "Updating rerere cache... "
-	update_rerere_cache >& /dev/null
-	echo "Done."
+	update_rerere_cache
 
 	echo -n "Reloading $integration_config... "
 	read_integration_config
@@ -618,28 +646,7 @@  function dim_rebuild_tip
 	echo -n "Pushing $integration_branch... "
 	git push $DRY_RUN $remote +HEAD >& /dev/null && echo "Done."
 
-	echo -n "Updating rerere cache... "
-	cd $rerere
-	if git_is_current_branch rerere-cache ; then
-		remote=$(branch_to_remote rerere-cache)
-
-		git pull >& /dev/null
-		rm $(rr_cache_dir)/rr-cache -Rf &> /dev/null || true
-		cp $(rr_cache_dir)/* rr-cache -r
-		git add ./*.patch >& /dev/null || true
-		git add rr-cache/* > /dev/null
-		git rm rr-cache/rr-cache &> /dev/null || true
-		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
-			echo -n "New commit. "
-		else
-			echo -n "Nothing changed. "
-		fi
-		echo -n "Pushing rerere cache... "
-		git push $DRY_RUN $remote HEAD >& /dev/null && echo "Done."
-	else
-		echo "Fail: Branch setup for the rerere-cache is borked."
-		exit 1
-	fi
+	commit_rerere_cache
 }
 
 # additional patch checks before pushing, e.g. for r-b tags