* [maintainer-tools PATCH] dim: Add apply and push shorthands for current branch @ 2017-07-31 14:17 Thierry Reding 2017-07-31 15:51 ` Daniel Vetter 2017-07-31 17:15 ` [maintainer-tools PATCH v2 1/2] " Thierry Reding 0 siblings, 2 replies; 6+ messages in thread From: Thierry Reding @ 2017-07-31 14:17 UTC (permalink / raw) To: intel-gfx; +Cc: dri-devel From: Thierry Reding <treding@nvidia.com> The new apply and push commands are shorthands for applying patches to and pushing the current branch, respectively. Signed-off-by: Thierry Reding <treding@nvidia.com> --- dim | 27 +++++++++++++++++++++++++++ dim.rst | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/dim b/dim index c0cbe352b165..036cb092557e 100755 --- a/dim +++ b/dim @@ -326,6 +326,20 @@ function git_fetch_helper # remote fi } +function git_current_branch +{ + local line branch + + git branch --list | while read line; do + branch="${line#* }" + + if test "$branch" != "$line"; then + echo "$branch" + break + fi + done +} + function git_is_current_branch # branch { git branch --list $1 | grep -q '\*' @@ -739,6 +753,11 @@ function dim_push_fixes dim_push_branch drm-intel-fixes "$@" } +function dim_push +{ + dim_push_branch $(git_current_branch) "$@" +} + # ensure we're on branch $1, and apply patches. the rest of the arguments are # passed to git am. dim_alias_ab=apply-branch @@ -930,6 +949,14 @@ function dim_apply_next_fixes dim_apply_branch drm-intel-next-fixes "$@" } +# apply patch to current branch, the rest of the arguments are passed to +# git am +dim_alias_am=apply +function dim_apply +{ + dim_apply_branch $(git_current_branch) "$@" +} + function commit_list_references { local commit remote log diff --git a/dim.rst b/dim.rst index c004c30ada17..fa9b587d73bb 100644 --- a/dim.rst +++ b/dim.rst @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +apply [*git am arguments*] +-------------------------- +**apply-branch** shorthand for the current branch. + extract-tags *branch* [*git-rangeish*] -------------------------------------- This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the @@ -232,6 +236,10 @@ push-queued [*git push arguments*] **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +push [*git push arguments*] +--------------------------- +**push** shorthand for the current branch. + rebuild-tip ----------- Rebuild and push the integration tree. -- 2.13.3 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [maintainer-tools PATCH] dim: Add apply and push shorthands for current branch 2017-07-31 14:17 [maintainer-tools PATCH] dim: Add apply and push shorthands for current branch Thierry Reding @ 2017-07-31 15:51 ` Daniel Vetter 2017-07-31 17:15 ` [maintainer-tools PATCH v2 1/2] " Thierry Reding 1 sibling, 0 replies; 6+ messages in thread From: Daniel Vetter @ 2017-07-31 15:51 UTC (permalink / raw) To: Thierry Reding; +Cc: intel-gfx, dri-devel On Mon, Jul 31, 2017 at 04:17:56PM +0200, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > The new apply and push commands are shorthands for applying patches to > and pushing the current branch, respectively. > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > dim | 27 +++++++++++++++++++++++++++ > dim.rst | 8 ++++++++ > 2 files changed, 35 insertions(+) > > diff --git a/dim b/dim > index c0cbe352b165..036cb092557e 100755 > --- a/dim > +++ b/dim > @@ -326,6 +326,20 @@ function git_fetch_helper # remote > fi > } > > +function git_current_branch > +{ > + local line branch > + > + git branch --list | while read line; do > + branch="${line#* }" > + > + if test "$branch" != "$line"; then > + echo "$branch" > + break > + fi > + done > +} git symbolic-ref -q --short HEAD is a much shorter way to type this. Can you respin, maybe also updating the other helper right below here? Otherwise I think this is perfect, I think I'll add this shorthand for some of the maintainer commands for handling pull requests too. Thanks, Daniel > + > function git_is_current_branch # branch > { > git branch --list $1 | grep -q '\*' > @@ -739,6 +753,11 @@ function dim_push_fixes > dim_push_branch drm-intel-fixes "$@" > } > > +function dim_push > +{ > + dim_push_branch $(git_current_branch) "$@" > +} > + > # ensure we're on branch $1, and apply patches. the rest of the arguments are > # passed to git am. > dim_alias_ab=apply-branch > @@ -930,6 +949,14 @@ function dim_apply_next_fixes > dim_apply_branch drm-intel-next-fixes "$@" > } > > +# apply patch to current branch, the rest of the arguments are passed to > +# git am > +dim_alias_am=apply > +function dim_apply > +{ > + dim_apply_branch $(git_current_branch) "$@" > +} > + > function commit_list_references > { > local commit remote log > diff --git a/dim.rst b/dim.rst > index c004c30ada17..fa9b587d73bb 100644 > --- a/dim.rst > +++ b/dim.rst > @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] > **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +apply [*git am arguments*] > +-------------------------- > +**apply-branch** shorthand for the current branch. > + > extract-tags *branch* [*git-rangeish*] > -------------------------------------- > This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the > @@ -232,6 +236,10 @@ push-queued [*git push arguments*] > **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +push [*git push arguments*] > +--------------------------- > +**push** shorthand for the current branch. > + > rebuild-tip > ----------- > Rebuild and push the integration tree. > -- > 2.13.3 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands for current branch 2017-07-31 14:17 [maintainer-tools PATCH] dim: Add apply and push shorthands for current branch Thierry Reding 2017-07-31 15:51 ` Daniel Vetter @ 2017-07-31 17:15 ` Thierry Reding 2017-07-31 17:15 ` [maintainer-tools PATCH 2/2] dim: Simplify test " Thierry Reding 2017-08-03 10:50 ` [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands " Jani Nikula 1 sibling, 2 replies; 6+ messages in thread From: Thierry Reding @ 2017-07-31 17:15 UTC (permalink / raw) To: intel-gfx; +Cc: dri-devel From: Thierry Reding <treding@nvidia.com> The new apply and push commands are shorthands for applying patches to and pushing the current branch, respectively. v2: use git symbolic-ref to find current branch (Daniel Vetter) Signed-off-by: Thierry Reding <treding@nvidia.com> --- dim | 18 ++++++++++++++++++ dim.rst | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/dim b/dim index c0cbe352b165..1422b35e2471 100755 --- a/dim +++ b/dim @@ -326,6 +326,11 @@ function git_fetch_helper # remote fi } +function git_current_branch +{ + git symbolic-ref -q --short HEAD +} + function git_is_current_branch # branch { git branch --list $1 | grep -q '\*' @@ -739,6 +744,11 @@ function dim_push_fixes dim_push_branch drm-intel-fixes "$@" } +function dim_push +{ + dim_push_branch $(git_current_branch) "$@" +} + # ensure we're on branch $1, and apply patches. the rest of the arguments are # passed to git am. dim_alias_ab=apply-branch @@ -930,6 +940,14 @@ function dim_apply_next_fixes dim_apply_branch drm-intel-next-fixes "$@" } +# apply patch to current branch, the rest of the arguments are passed to +# git am +dim_alias_am=apply +function dim_apply +{ + dim_apply_branch $(git_current_branch) "$@" +} + function commit_list_references { local commit remote log diff --git a/dim.rst b/dim.rst index c004c30ada17..fa9b587d73bb 100644 --- a/dim.rst +++ b/dim.rst @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +apply [*git am arguments*] +-------------------------- +**apply-branch** shorthand for the current branch. + extract-tags *branch* [*git-rangeish*] -------------------------------------- This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the @@ -232,6 +236,10 @@ push-queued [*git push arguments*] **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +push [*git push arguments*] +--------------------------- +**push** shorthand for the current branch. + rebuild-tip ----------- Rebuild and push the integration tree. -- 2.13.3 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [maintainer-tools PATCH 2/2] dim: Simplify test for current branch 2017-07-31 17:15 ` [maintainer-tools PATCH v2 1/2] " Thierry Reding @ 2017-07-31 17:15 ` Thierry Reding 2017-08-03 10:50 ` [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands " Jani Nikula 1 sibling, 0 replies; 6+ messages in thread From: Thierry Reding @ 2017-07-31 17:15 UTC (permalink / raw) To: intel-gfx; +Cc: dri-devel From: Thierry Reding <treding@nvidia.com> Instead of listing branches and grepping for the current branch, simply read the name of the current branch and compare. Suggested-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Thierry Reding <treding@nvidia.com> --- dim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dim b/dim index 1422b35e2471..ebb1da05662d 100755 --- a/dim +++ b/dim @@ -333,7 +333,7 @@ function git_current_branch function git_is_current_branch # branch { - git branch --list $1 | grep -q '\*' + test "$(git_current_branch)" = "$1" } function git_branch_exists # branch -- 2.13.3 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands for current branch 2017-07-31 17:15 ` [maintainer-tools PATCH v2 1/2] " Thierry Reding 2017-07-31 17:15 ` [maintainer-tools PATCH 2/2] dim: Simplify test " Thierry Reding @ 2017-08-03 10:50 ` Jani Nikula 2017-08-03 12:39 ` Daniel Vetter 1 sibling, 1 reply; 6+ messages in thread From: Jani Nikula @ 2017-08-03 10:50 UTC (permalink / raw) To: Thierry Reding, intel-gfx; +Cc: dri-devel On Mon, 31 Jul 2017, Thierry Reding <thierry.reding@gmail.com> wrote: > From: Thierry Reding <treding@nvidia.com> > > The new apply and push commands are shorthands for applying patches to > and pushing the current branch, respectively. There's been some talk about moving further in the direction of using the current branch and current directory, like git does. I think the historical reason for having to explicitly specify the branch is to avoid shooting oneself in the foot. To avoid that oops from a quick apply and push. The safety catch. I'm not opposed, but this is the reason. One comment below. BR, Jani. > > v2: use git symbolic-ref to find current branch (Daniel Vetter) > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > dim | 18 ++++++++++++++++++ > dim.rst | 8 ++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/dim b/dim > index c0cbe352b165..1422b35e2471 100755 > --- a/dim > +++ b/dim > @@ -326,6 +326,11 @@ function git_fetch_helper # remote > fi > } > > +function git_current_branch > +{ > + git symbolic-ref -q --short HEAD > +} > + > function git_is_current_branch # branch > { > git branch --list $1 | grep -q '\*' > @@ -739,6 +744,11 @@ function dim_push_fixes > dim_push_branch drm-intel-fixes "$@" > } > > +function dim_push > +{ > + dim_push_branch $(git_current_branch) "$@" > +} > + > # ensure we're on branch $1, and apply patches. the rest of the arguments are > # passed to git am. > dim_alias_ab=apply-branch > @@ -930,6 +940,14 @@ function dim_apply_next_fixes > dim_apply_branch drm-intel-next-fixes "$@" > } > > +# apply patch to current branch, the rest of the arguments are passed to > +# git am > +dim_alias_am=apply > +function dim_apply > +{ > + dim_apply_branch $(git_current_branch) "$@" > +} > + > function commit_list_references > { > local commit remote log > diff --git a/dim.rst b/dim.rst > index c004c30ada17..fa9b587d73bb 100644 > --- a/dim.rst > +++ b/dim.rst > @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] > **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +apply [*git am arguments*] > +-------------------------- > +**apply-branch** shorthand for the current branch. > + > extract-tags *branch* [*git-rangeish*] > -------------------------------------- > This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the > @@ -232,6 +236,10 @@ push-queued [*git push arguments*] > **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +push [*git push arguments*] > +--------------------------- > +**push** shorthand for the current branch. I think you mean **push-branch** shorthand. > + > rebuild-tip > ----------- > Rebuild and push the integration tree. -- Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands for current branch 2017-08-03 10:50 ` [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands " Jani Nikula @ 2017-08-03 12:39 ` Daniel Vetter 0 siblings, 0 replies; 6+ messages in thread From: Daniel Vetter @ 2017-08-03 12:39 UTC (permalink / raw) To: Jani Nikula; +Cc: intel-gfx, Thierry Reding, dri-devel On Thu, Aug 03, 2017 at 01:50:12PM +0300, Jani Nikula wrote: > On Mon, 31 Jul 2017, Thierry Reding <thierry.reding@gmail.com> wrote: > > From: Thierry Reding <treding@nvidia.com> > > > > The new apply and push commands are shorthands for applying patches to > > and pushing the current branch, respectively. > > There's been some talk about moving further in the direction of using > the current branch and current directory, like git does. I think the > historical reason for having to explicitly specify the branch is to > avoid shooting oneself in the foot. To avoid that oops from a quick > apply and push. The safety catch. > > I'm not opposed, but this is the reason. Yeah, I think with all the new committer the common use-case has shifted a bit, where applying to the current branch is a reasonable thing to do. Also, worktrees help a bunch with that too. If it causes more troubles than it helps we can always go back to forcing explicit branch names. > One comment below. > > BR, > Jani. > > > > > > v2: use git symbolic-ref to find current branch (Daniel Vetter) > > > > Signed-off-by: Thierry Reding <treding@nvidia.com> > > --- > > dim | 18 ++++++++++++++++++ > > dim.rst | 8 ++++++++ > > 2 files changed, 26 insertions(+) > > > > diff --git a/dim b/dim > > index c0cbe352b165..1422b35e2471 100755 > > --- a/dim > > +++ b/dim > > @@ -326,6 +326,11 @@ function git_fetch_helper # remote > > fi > > } > > > > +function git_current_branch > > +{ > > + git symbolic-ref -q --short HEAD > > +} > > + > > function git_is_current_branch # branch > > { > > git branch --list $1 | grep -q '\*' > > @@ -739,6 +744,11 @@ function dim_push_fixes > > dim_push_branch drm-intel-fixes "$@" > > } > > > > +function dim_push > > +{ > > + dim_push_branch $(git_current_branch) "$@" > > +} > > + > > # ensure we're on branch $1, and apply patches. the rest of the arguments are > > # passed to git am. > > dim_alias_ab=apply-branch > > @@ -930,6 +940,14 @@ function dim_apply_next_fixes > > dim_apply_branch drm-intel-next-fixes "$@" > > } > > > > +# apply patch to current branch, the rest of the arguments are passed to > > +# git am > > +dim_alias_am=apply > > +function dim_apply > > +{ > > + dim_apply_branch $(git_current_branch) "$@" > > +} > > + > > function commit_list_references > > { > > local commit remote log > > diff --git a/dim.rst b/dim.rst > > index c004c30ada17..fa9b587d73bb 100644 > > --- a/dim.rst > > +++ b/dim.rst > > @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] > > **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > > *drm-intel-next-queued* branches respectively. > > > > +apply [*git am arguments*] > > +-------------------------- > > +**apply-branch** shorthand for the current branch. > > + > > extract-tags *branch* [*git-rangeish*] > > -------------------------------------- > > This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the > > @@ -232,6 +236,10 @@ push-queued [*git push arguments*] > > **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > > *drm-intel-next-queued* branches respectively. > > > > +push [*git push arguments*] > > +--------------------------- > > +**push** shorthand for the current branch. > > I think you mean **push-branch** shorthand. I'll fix this while applying. -Daniel > > > + > > rebuild-tip > > ----------- > > Rebuild and push the integration tree. > > -- > Jani Nikula, Intel Open Source Technology Center > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-03 12:39 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-31 14:17 [maintainer-tools PATCH] dim: Add apply and push shorthands for current branch Thierry Reding 2017-07-31 15:51 ` Daniel Vetter 2017-07-31 17:15 ` [maintainer-tools PATCH v2 1/2] " Thierry Reding 2017-07-31 17:15 ` [maintainer-tools PATCH 2/2] dim: Simplify test " Thierry Reding 2017-08-03 10:50 ` [maintainer-tools PATCH v2 1/2] dim: Add apply and push shorthands " Jani Nikula 2017-08-03 12:39 ` Daniel Vetter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox