Skip to contentSkip to conversation

dim: Accept .mbox and .patch files as apply-branch optional argument.

PATCH In review Rodrigo Vivi 4 participants 13 messages Aug 16, 2017 – Aug 17, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dim: Accept .mbox and .patch files as apply-branch optional argument.

Instead of forcing users to cat .patch or .mbox let's accept them as optional argument for dim apply-branches.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim     | 10 +++++++++-
 dim.rst |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
dim +9 -1
index 11aa675cc3bc..e98d23b24ec0 100755
@@ -771,7 +771,15 @@ function dim_apply_branch
 	assert_branch $branch
 	assert_repo_clean
 
-	cat > $file
+	case $1 in
+		*".patch" | *".mbox")
+			cat $1 > $file
+			shift
+			;;
+		*)
+			cat > $file
+			;;
+	esac
 
 	message_id=$(message_get_id $file)
 
dim.rst +1 -1
index 802c776e03f9..7f492edc4c04 100644
@@ -79,7 +79,7 @@ first need to check out the right branch using::
 
 Applying patches is done in the main repository with::
 
-    $ cat patch.mbox | dim apply-branch <branch>
+    $ dim apply-branch <branch> patch.mbox
 
 This works like a glorified version of git apply-mbox and does basic patch
 checking and adds stuff like patchwork links of the merged patch. It is
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/2 dim: Accept patchwork URLs as apply-branch optional argument.

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +18 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
 	dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+	wget -q --spider ${1}
+	if [ $? -ne "0" ]; then
+	    echoerr "URL ${1} not found."
+	    exit 1
+	fi
+	wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
 	assert_repo_clean
 
 	case $1 in
+		*"patchwork.freedesktop.org"*"mbox")
+			download_mbox $1 $file
+			shift
+			;;
+		*"patchwork.freedesktop.org"*)
+			download_mbox $1/mbox $file
+			shift
+			;;
 		*".patch" | *".mbox")
 			cat $1 > $file
 			shift
Signature · 6 lines
2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

Quoted 32 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +10 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
        dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+       wget -q --spider ${1}
+       if [ $? -ne "0" ]; then
+           echoerr "URL ${1} not found."
+           exit 1
+       fi
+       wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch

dim function dim_apply_branch · line 789

Quoted 8 lines
dim +5 -0
@@ -772,6 +782,14 @@ function dim_apply_branch
        assert_repo_clean
 
        case $1 in
+               *"patchwork.freedesktop.org"*"mbox")
+                       download_mbox $1 $file
+                       shift
+                       ;;
+               *"patchwork.freedesktop.org"*)

Another thing that I'd like to do is to be able to give the patchwork id directly, but I don't want to mess with the $@ going to git directly so I'm not sure which way would be better... maybe parse for something like
"pw="*)
download_mbox ${1#pw=} $file
so we could use
dim aq pw=170802

?
suggestions?

Quoted 13 lines
dim +3 -1
+                       download_mbox $1/mbox $file
+                       shift
+                       ;;
                *".patch" | *".mbox")
                        cat $1 > $file
                        shift
--

2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

Quoted 35 lines · Rodrigo Vivi
Quoted 34 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +10 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
        dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+       wget -q --spider ${1}
+       if [ $? -ne "0" ]; then
+           echoerr "URL ${1} not found."
+           exit 1
+       fi
+       wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
        assert_repo_clean
 
Quoted 10 lines

dim function dim_apply_branch · line 789

Quoted 6 lines
dim +5 -0
        case $1 in
+               *"patchwork.freedesktop.org"*"mbox")
+                       download_mbox $1 $file
+                       shift
+                       ;;
+               *"patchwork.freedesktop.org"*)

Another thing that I'd like to do is to be able to give the patchwork id directly, but I don't want to mess with the $@ going to git directly so I'm not sure which way would be better...

Personally I prefer using message-id based patchwork references:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 8 lines

maybe parse for something like
"pw="*)
download_mbox ${1#pw=} $file
so we could use
dim aq pw=170802

?
suggestions?

The ways around this are argument parsing in apply-branch or adding another dim subcommand.

Btw one missing piece is handling series mboxes, which do apply, but only the last commit from an mbox gets all the checks and Link: tags etc.

BR,
Jani.

Quoted 15 lines
Quoted 15 lines
dim +3 -1
+                       download_mbox $1/mbox $file
+                       shift
+                       ;;
                *".patch" | *".mbox")
                        cat $1 > $file
                        shift
--

2.13.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

Quoted 47 lines · Jani Nikula
Quoted 35 lines · Rodrigo Vivi
Quoted 34 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +10 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
        dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+       wget -q --spider ${1}
+       if [ $? -ne "0" ]; then
+           echoerr "URL ${1} not found."
+           exit 1
+       fi
+       wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
        assert_repo_clean
 
Quoted 10 lines

dim function dim_apply_branch · line 789

Quoted 6 lines
dim +5 -0
        case $1 in
+               *"patchwork.freedesktop.org"*"mbox")
+                       download_mbox $1 $file
+                       shift
+                       ;;
+               *"patchwork.freedesktop.org"*)

Another thing that I'd like to do is to be able to give the patchwork id directly, but I don't want to mess with the $@ going to git directly so I'm not sure which way would be better...

Quoted 3 lines

Personally I prefer using message-id based patchwork references:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

well remembered...
in the end it gets converted to
https://patchwork.freedesktop.org/patch/171432/

so we can get
https://patchwork.freedesktop.org/patch/171432/mbox

Quoted 7 lines
Quoted 7 lines

maybe parse for something like
"pw="*)
download_mbox ${1#pw=} $file
so we could use
dim aq pw=170802

Quoted 5 lines
Quoted 2 lines

?
suggestions?

The ways around this are argument parsing in apply-branch or adding another dim subcommand.

Usage: dim apply-branch [apply-branch options] branch [--] [git options]

-i <patchwork-id>
-m <Message-id>
-u <url>

hmm but not sure it goes well with the aliases were we would need to convert

dim aq -m [email protected] [git options] to
dim apply-branch -m [email protected] drm-intel-next-queued [git options]

Quoted 4 lines

Btw one missing piece is handling series mboxes, which do apply, but only the last commit from an mbox gets all the checks and Link: tags etc.

yeap! well remembered! I suffered from this behaviour already and seen other folks also complaining about it.

So, for this should we iterate over patches inside mbox somehow and git apply one by one or should we apply and then rebase && amend ? not sure how to deal whit this in a cleaner way...

Quoted 24 lines

BR,
Jani.

Quoted 11 lines
Quoted 11 lines
dim +3 -1
+                       download_mbox $1/mbox $file
+                       shift
+                       ;;
                *".patch" | *".mbox")
                        cat $1 > $file
                        shift
--

2.13.2

Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Jani Nikula, Intel Open Source Technology Center

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

Quoted 78 lines · Rodrigo Vivi
Quoted 47 lines · Jani Nikula
Quoted 35 lines · Rodrigo Vivi
Quoted 34 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +10 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
        dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+       wget -q --spider ${1}
+       if [ $? -ne "0" ]; then
+           echoerr "URL ${1} not found."
+           exit 1
+       fi
+       wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
        assert_repo_clean
 
Quoted 10 lines

dim function dim_apply_branch · line 789

Quoted 6 lines
dim +5 -0
        case $1 in
+               *"patchwork.freedesktop.org"*"mbox")
+                       download_mbox $1 $file
+                       shift
+                       ;;
+               *"patchwork.freedesktop.org"*)

Another thing that I'd like to do is to be able to give the patchwork id directly, but I don't want to mess with the $@ going to git directly so I'm not sure which way would be better...

Quoted 3 lines

Personally I prefer using message-id based patchwork references:

http://patchwork.freedesktop.org/patch/msgid/[email protected]

well remembered...
in the end it gets converted to
https://patchwork.freedesktop.org/patch/171432/

so we can get
https://patchwork.freedesktop.org/patch/171432/mbox

Quoted 7 lines
Quoted 7 lines

maybe parse for something like
"pw="*)
download_mbox ${1#pw=} $file
so we could use
dim aq pw=170802

Quoted 5 lines
Quoted 2 lines

?
suggestions?

The ways around this are argument parsing in apply-branch or adding another dim subcommand.

Usage: dim apply-branch [apply-branch options] branch [--] [git options]

(quoted diff) +0 -3
-i  <patchwork-id>
-m <Message-id>
-u <url>
Quoted 6 lines

hmm but not sure it goes well with the aliases were we would need to convert

dim aq -m [email protected] [git options] to
dim apply-branch -m [email protected] drm-intel-next-queued [git options]

nevermind... please entirely ignore this..

I solved my own needs with:

dim_pwaq()

{
        if [ -n "$1" ]; then
                curl https://patchwork.freedesktop.org/patch/$1/mbox/

| dim_apply_queued
else
echo "Give me a patchwork id"
fi
}

using as:

$ dim pwaq 172141
Quoted 6 lines
Quoted 5 lines

Btw one missing piece is handling series mboxes, which do apply, but only the last commit from an mbox gets all the checks and Link: tags etc.

Quoted 6 lines

yeap! well remembered! I suffered from this behaviour already and seen other folks also complaining about it.

So, for this should we iterate over patches inside mbox somehow and git apply one by one or should we apply and then rebase && amend ? not sure how to deal whit this in a cleaner way...

this part is still valid..

Quoted 31 lines
Quoted 18 lines

BR,
Jani.

Quoted 11 lines
Quoted 11 lines
dim +3 -1
+                       download_mbox $1/mbox $file
+                       shift
+                       ;;
                *".patch" | *".mbox")
                        cat $1 > $file
                        shift
--

2.13.2

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Jani Nikula, Intel Open Source Technology Center

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

In reply to Rodrigo Vivi
Quoted 15 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +0 -0
index e98d23b24ec0..73b48da7f436 100755

dim function dim_push · line 761

Quoted 6 lines
dim +3 -0
@@ -756,6 +756,16 @@ function dim_push
 	dim_push_branch $(git_current_branch) "$@"
 }
 
+function download_mbox
+{
+	wget -q --spider ${1}

What's the benefit of doing this first?

dim function dim_push · line 764

Quoted 3 lines
dim +3 -0
+	if [ $? -ne "0" ]; then
+	    echoerr "URL ${1} not found."
+	    exit 1

Always just return 1 on errors, and set -e will handle the abort. This way the caller can decide to use foo || true to ignore the error.

Quoted 9 lines
dim +4 -0
+	fi
+	wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
 	assert_repo_clean

dim function dim_apply_branch · line 792

Quoted 10 lines
dim +8 -0
 
 	case $1 in
+		*"patchwork.freedesktop.org"*"mbox")
+			download_mbox $1 $file
+			shift
+			;;
+		*"patchwork.freedesktop.org"*)
+			download_mbox $1/mbox $file
+			shift
+			;;

Really, the interface gets worse and worse here!

---

I may sound like a pedant looking after style and consistency in a shell script, but this one has grown beyond the size where we can just ignore its maintenance. I've put in quite a bit of effort since the user base went from 1 to 2 to keep it together.

BR,
Jani.

Quoted 3 lines
dim +0 -0
 		*".patch" | *".mbox")
 			cat $1 > $file
 			shift
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [maintainer-tools PATCH 2/2] dim: Accept patchwork URLs as apply-branch optional argument.

Quoted 19 lines · Jani Nikula
Quoted 18 lines · Rodrigo Vivi

Instead of having to manually download mbox from patchwork let's make dim to do it directly.

Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
dim +0 -0
index e98d23b24ec0..73b48da7f436 100755
@@ -756,6 +756,16 @@ function dim_push
      dim_push_branch $(git_current_branch) "$@"
 }
 
Quoted 5 lines

dim function dim_push · line 761

Quoted 3 lines
dim +3 -0
+function download_mbox
+{
+     wget -q --spider ${1}

What's the benefit of doing this first?

it check if links exist before trying to download anything. at least it returns fast when link is not valid....

Quoted 7 lines

dim function dim_push · line 764

Quoted 4 lines
dim +3 -0
+     if [ $? -ne "0" ]; then
+         echoerr "URL ${1} not found."
+         exit 1

Always just return 1 on errors, and set -e will handle the abort. This way the caller can decide to use foo || true to ignore the error.

oh of course!

Quoted 11 lines
Quoted 11 lines
dim +4 -0
+     fi
+     wget -q ${1} -O $2
+}
+
 # ensure we're on branch $1, and apply patches. the rest of the arguments are
 # passed to git am.
 dim_alias_ab=apply-branch
@@ -772,6 +782,14 @@ function dim_apply_branch
      assert_repo_clean
 
Quoted 11 lines

dim function dim_apply_branch · line 792

Quoted 9 lines
dim +8 -0
      case $1 in
+             *"patchwork.freedesktop.org"*"mbox")
+                     download_mbox $1 $file
+                     shift
+                     ;;
+             *"patchwork.freedesktop.org"*)
+                     download_mbox $1/mbox $file
+                     shift
+                     ;;

Really, the interface gets worse and worse here!

actually was the other way around...
I made this bad one and decided to extend to files :P

Quoted 7 lines

---

I may sound like a pedant looking after style and consistency in a shell script, but this one has grown beyond the size where we can just ignore its maintenance. I've put in quite a bit of effort since the user base went from 1 to 2 to keep it together.

you are absolutely right. it is not just a shell script... it is our tool and we should care!

Quoted 16 lines

BR,
Jani.

dim function dim_apply_branch · line 795

Quoted 3 lines
dim +0 -0
              *".patch" | *".mbox")
                      cat $1 > $file
                      shift

--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw
In reply to Rodrigo Vivi
Quoted 2 lines · Rodrigo Vivi

Instead of forcing users to cat .patch or .mbox let's accept them as optional argument for dim apply-branches.

Well, that's a useless use of cat anyway. You could do

$ dim apply-branch branch < patch.mbox
Quoted 16 lines
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim     | 10 +++++++++-
 dim.rst |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
dim +0 -0
index 11aa675cc3bc..e98d23b24ec0 100755
@@ -771,7 +771,15 @@ function dim_apply_branch
 	assert_branch $branch
 	assert_repo_clean
 

dim function dim_apply_branch · line 782

Quoted 10 lines
dim +9 -1
-	cat > $file
+	case $1 in
+		*".patch" | *".mbox")
+			cat $1 > $file
+			shift
+			;;
+		*)
+			cat > $file
+			;;
+	esac

This would really be a surprising interface, argument parsing based on file suffixes. I don't approve.

You'll need to make this handle options before the branch argument, something like:

Usage: dim apply-branch [apply-branch options] branch [--] [git options]

Is stdin redirection really such a bad thing?

BR,
Jani.

Quoted 16 lines
dim +0 -0
 	message_id=$(message_get_id $file)
 
dim.rst +1 -1
index 802c776e03f9..7f492edc4c04 100644
@@ -79,7 +79,7 @@ first need to check out the right branch using::
 
 Applying patches is done in the main repository with::
 
-    $ cat patch.mbox | dim apply-branch <branch>
+    $ dim apply-branch <branch> patch.mbox
 
 This works like a glorified version of git apply-mbox and does basic patch
 checking and adds stuff like patchwork links of the merged patch. It is
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 38 lines · Jani Nikula
Quoted 2 lines · Rodrigo Vivi

Instead of forcing users to cat .patch or .mbox let's accept them as optional argument for dim apply-branches.

Well, that's a useless use of cat anyway. You could do

$ dim apply-branch branch < patch.mbox
Quoted 16 lines
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim     | 10 +++++++++-
 dim.rst |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
dim +0 -0
index 11aa675cc3bc..e98d23b24ec0 100755
@@ -771,7 +771,15 @@ function dim_apply_branch
 	assert_branch $branch
 	assert_repo_clean
 

dim function dim_apply_branch · line 782

Quoted 10 lines
dim +9 -1
-	cat > $file
+	case $1 in
+		*".patch" | *".mbox")
+			cat $1 > $file
+			shift
+			;;
+		*)
+			cat > $file
+			;;
+	esac

This would really be a surprising interface, argument parsing based on file suffixes. I don't approve.

Quoted 6 lines

You'll need to make this handle options before the branch argument, something like:

Usage: dim apply-branch [apply-branch options] branch [--] [git options]

Is stdin redirection really such a bad thing?

+1 on that. If I pick it from patchwork or an mbox, I just < patch.mbox or curl patchwork.url | dim apply. I don't see the value in baking that into the script ...

What we could do (and we have a jira for that already) is to check patchwork for the updated .mbox with all the r-b/t-b/a-b tags auto-added. That would greatly improve at least my workflow.

And I also agree with Jani on keeping the dim design clean. We can add stuff where it makes sense, and where dim really can add value (with additional safety checks and convenience features).

One thing we maybe could be doing is a more fancy aliasing feature, along the lines of git aliases, where you can do whatever you want. Then you could do a dim apply-curl alias which resolves to curl $arg | dim apply. Not sure how to implement that though ...
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw
Quoted 4 lines · Daniel Vetter

One thing we maybe could be doing is a more fancy aliasing feature, along the lines of git aliases, where you can do whatever you want. Then you could do a dim apply-curl alias which resolves to curl $arg | dim apply. Not sure how to implement that though ...

We *already* have a fancy aliasing feature. You can add arbitrary subcommands of your own, and you can override existing subcommands. Try this in your ~/.dimrc:

dim_my_fancy_list_aliases()
{
echo "Hello world!"
dim_list_aliases
}

dim_alias_list_aliases=my-fancy-list-aliases

This first part will give you a new "dim my-fancy-list-aliases" subcommand, and the second part will use it for "dim list-aliases".

Go wild. ;)

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw
Quoted 16 lines · Jani Nikula
Quoted 4 lines · Daniel Vetter

One thing we maybe could be doing is a more fancy aliasing feature, along the lines of git aliases, where you can do whatever you want. Then you could do a dim apply-curl alias which resolves to curl $arg | dim apply. Not sure how to implement that though ...

We *already* have a fancy aliasing feature. You can add arbitrary subcommands of your own, and you can override existing subcommands. Try this in your ~/.dimrc:

dim_my_fancy_list_aliases()
{
echo "Hello world!"
dim_list_aliases
}

Quoted 6 lines

dim_alias_list_aliases=my-fancy-list-aliases

This first part will give you a new "dim my-fancy-list-aliases" subcommand, and the second part will use it for "dim list-aliases".

Go wild. ;)

Maybe we just need to document this better? Rodrigo, you're up for a patch to dim.rst, with the above example in a new ALIASES sections? I'd put it right above ENVIRONMENT.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw
In reply to Daniel Vetter
Quoted 42 lines · Daniel Vetter
Quoted 41 lines · Jani Nikula
Quoted 2 lines · Rodrigo Vivi

Instead of forcing users to cat .patch or .mbox let's accept them as optional argument for dim apply-branches.

Well, that's a useless use of cat anyway. You could do

$ dim apply-branch branch < patch.mbox
Quoted 16 lines
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 dim     | 10 +++++++++-
 dim.rst |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
dim +0 -0
index 11aa675cc3bc..e98d23b24ec0 100755
@@ -771,7 +771,15 @@ function dim_apply_branch
    assert_branch $branch
    assert_repo_clean
 

dim function dim_apply_branch · line 782

Quoted 10 lines
dim +9 -1
-   cat > $file
+   case $1 in
+           *".patch" | *".mbox")
+                   cat $1 > $file
+                   shift
+                   ;;
+           *)
+                   cat > $file
+                   ;;
+   esac

This would really be a surprising interface, argument parsing based on file suffixes. I don't approve.

You'll need to make this handle options before the branch argument, something like:

Quoted 7 lines
Quoted 3 lines

Usage: dim apply-branch [apply-branch options] branch [--] [git options]

Is stdin redirection really such a bad thing?

+1 on that. If I pick it from patchwork or an mbox, I just < patch.mbox or curl patchwork.url | dim apply. I don't see the value in baking that into the script ...

oh, I had missed this before I commented on the other one. good idea to use curl...

Quoted 8 lines

What we could do (and we have a jira for that already) is to check patchwork for the updated .mbox with all the r-b/t-b/a-b tags auto-added. That would greatly improve at least my workflow.

And I also agree with Jani on keeping the dim design clean. We can add stuff where it makes sense, and where dim really can add value (with additional safety checks and convenience features).

agree!

Quoted 5 lines

One thing we maybe could be doing is a more fancy aliasing feature, along the lines of git aliases, where you can do whatever you want. Then you could do a dim apply-curl alias which resolves to curl $arg | dim apply. Not sure how to implement that though ...

I will try to use and to create my own alias and document it..

Quoted 9 lines

-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx