[PATCH] dim: switch to dry-run in warn_or_fail

Dave Airlie airlied at gmail.com
Fri May 4 06:06:52 UTC 2018


Yeah this seems useful after doing my first -f pull today.

Acked-by: Dave Airlie <airlied at redhat.com>

On 4 May 2018 at 15:21, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> When merging a pull requests there's potentially a long list of
> problematic patches. By switching to dry-run mode we can dump them
> all.
>
> The upside here is that without this patch the workflow when
> processing a pull is:
>
> $ dim apply-pull ...
> -> dim refuses, only reports first problem
> $ dim -d apply-pull
> -> you see all the issues, make up your mind to merge or not
> $ dim -f apply-pull
>
> With this patch we have one step less:
>
> $ dim apply-pull
> -> refuses pull, but with the auto-switch to dry-run reports
> everything and you can immediately make up your mind to merge or not
> $ dim -f apply-pull
>
> Cc: Dave Airlie <airlied at gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> ---
>  dim | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/dim b/dim
> index d8288a342352..499ffcfdd807 100755
> --- a/dim
> +++ b/dim
> @@ -144,6 +144,12 @@ function echoerr
>         echo "$dim: $*" >&2
>  }
>
> +function enable_dry_run
> +{
> +       DRY_RUN=--dry-run
> +       DRY="echo"
> +}
> +
>  function warn_or_fail
>  {
>         if [[ $FORCE ]] ; then
> @@ -151,8 +157,8 @@ function warn_or_fail
>         elif [[ $DRY ]] ; then
>                 echoerr "WARNING: $1, but continuing dry-run"
>         else
> -               echoerr "ERROR: $1, aborting"
> -               exit 1
> +               echoerr "ERROR: $1, switching to dry-run mode"
> +               enable_dry_run
>         fi
>  }
>
> @@ -2261,8 +2267,7 @@ HELP=
>  while getopts hdfis opt; do
>         case "$opt" in
>                 d)
> -                       DRY_RUN=--dry-run
> -                       DRY="echo"
> +                       enable_dry_run
>                         ;;
>                 f)
>                         FORCE=1
> --
> 2.17.0
>


More information about the dim-tools mailing list