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 <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
---
 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

_______________________________________________
dim-tools mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dim-tools

Reply via email to