[PATCH] qf: Add more wiggle helpers.

Lucas De Marchi lucas.demarchi at intel.com
Tue Jan 30 01:31:58 UTC 2018


On Fri, Jan 26, 2018 at 04:40:37PM -0800, Rodrigo Vivi wrote:
> When working with wiggle to easily solve rebasing
> conflicts we also need to be able to easily continue,
> easily see the impacted files and easily clean the
> repo to avoid ending up with many .rej and .porig files.
> 
> v2: Remove -r from rm. (Lucas)
>     Use -z instead of '== ""' comparison. (Lucas)
>     Add documentation to the helpers. (Required by make check).
> 
> Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> Cc: Michel Thierry <michel.thierry at intel.com>
> Cc: James Ausmus <james.ausmus at intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
>  qf     | 32 ++++++++++++++++++++++++++++++++
>  qf.rst | 16 ++++++++++++++++
>  2 files changed, 48 insertions(+)
> 
> diff --git a/qf b/qf
> index b28ca70ddcfd..b504b3ae7c44 100755
> --- a/qf
> +++ b/qf
> @@ -432,6 +432,38 @@ function qf_stage
>  	echo All applied patches successfully staged
>  }
>  
> +function qf_wiggle_clean
> +{
> +	cd_toplevel
> +	conflict_files=$(git status --porcelain | grep "\.rej" | cut -c4-)

I think you didn't get all my suggestion from previous patch. We could
remove the first grep and let git deal with paths:

	conflict_files=$(git status --porcelain -- '*.rej' | cut -c4-)

Not likely, but in your version it would fail if the file itself had a
.rej in the middle of the name :)

I also think we should force the porcelain version to avoid changes in
the default version breaking our tools: --porcelain=2. And that we
should cut based on fields, not number of characters: cut -d' ' -f2

Lastly, what I didn't say before, we should limit this to untracked
files and tell git-status to display them regardless of
status.showUntrackedFiles.

conflict_files=$(git status -u --porcelain=2 -- '*.rej' | grep -E "^?" | cut -d' ' -f2)




> +	for file in $conflict_files ; do
> +		echo cleaning $file ${file%.rej}.porig
> +		rm -f $file ${file%.rej}.porig
> +	done
> +}
> +
> +function qf_conflict_files
> +{
> +	cd_toplevel
> +	conflict_files=$(git status --porcelain | grep "\.rej" | cut -c4-)

ditto.

> +
> +	if [[ -z $conflict_files ]] ; then
> +		echo No conflicted files found!
> +	else
> +		echo Conflict found on:
> +		for file in $conflict_files ; do
> +			echo ${file%.rej}
> +		done
> +	fi
> +}
> +
> +function qf_continue
> +{
> +	cd_toplevel

cd_toplevel is already done on qf_wiggle_clean... but maybe it's good to
keep it consistent here.



Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

Lucas De Marchi



> +	qf_wiggle_clean
> +	quilt push -a
> +}
> +
>  qf_alias_wp=wiggle_push
>  function qf_wiggle_push
>  {
> diff --git a/qf.rst b/qf.rst
> index 9dac6b9e1eaa..092902bdde75 100644
> --- a/qf.rst
> +++ b/qf.rst
> @@ -199,6 +199,22 @@ Resets the git index and then (re-)applies all currently applied
>  quilt patches to it. Useful to use git tools like git diff to
>  compare changes against the quilt patch state.
>  
> +conflict-files
> +--------------
> +List the files that are probably in a unresolved stage of conflict.
> +Wiggle push will leave .rej and .porig files behind.
> +This is useful for manual conflict solving during the quilt rebase.
> +
> +continue
> +--------
> +Clean up after wiggle and continue with quilt push -a to continue
> +applying and rebasing all the following patches.
> +
> +wiggle-clean
> +------------
> +Clean up all .rej and .porig files that wiggle probably
> +left behind.
> +
>  wiggle-push|wp
>  --------------
>  Force-push the next patch and then wiggle in any conflicts. Does
> -- 
> 2.13.6
> 


More information about the dim-tools mailing list