dim: refer to the script itself by basename without path
PATCH 1/6 dim: refer to the script itself by basename without path
Add $dim for the basename of the script and use it.
--- dim | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
dim +13 -11
@@ -87,6 +87,8 @@ DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature} # Internal configuration. # +dim=$(basename $0) + today=`date +%Y-%m-%d` drm_intel_ssh=ssh://git.freedesktop.org/git/drm-intel
@@ -140,7 +142,7 @@ while getopts hdfi opt; do HELP=1 ;; *) - echo "See '$0 help' for more information." >&2 + echo "See '$dim help' for more information." >&2 exit esac done
@@ -373,7 +375,7 @@ function dim_nightly_forget function dim_push_branch { if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand branch" + echo "usage: $dim $subcommand branch" exit 1 fi
@@ -463,7 +465,7 @@ function dim_apply_next_fixes function dim_cherry_pick { if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand commit-ish" + echo "usage: $dim $subcommand commit-ish" exit 1 fi sha=`git rev-parse $1`
@@ -583,7 +585,7 @@ function dim_magic_patch function dim_create_branch { if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand branch [commit-ish]" + echo "usage: $dim $subcommand branch [commit-ish]" exit 1 fi branch=$1
@@ -607,7 +609,7 @@ function dim_create_branch function dim_remove_branch { if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand branch" + echo "usage: $dim $subcommand branch" exit 1 fi branch=$1
@@ -650,7 +652,7 @@ dim_alias_co=checkout function dim_checkout { if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand branch" + echo "usage: $dim $subcommand branch" exit 1 fi
@@ -791,7 +793,7 @@ function dim_create_workdir local branches if [[ "x$1" = "x" ]]; then - echo "usage: $0 $subcommand branch|all" + echo "usage: $dim $subcommand branch|all" exit 1 elif [[ "$1" = "all" ]] ; then branches=$dim_branches
@@ -923,7 +925,7 @@ function dim_tag_next function dim_pull_request { if [[ "x$1" = "x" || "x$2" = "x" ]]; then - echo "usage: $0 $subcommand branch upstream" + echo "usage: $dim $subcommand branch upstream" exit 1 fi
@@ -1236,12 +1238,12 @@ function dim_help function dim_usage { - echo "usage: $0 [OPTIONS] SUBCOMMAND [ARGUMENTS]" + echo "usage: $dim [OPTIONS] SUBCOMMAND [ARGUMENTS]" echo echo "The available subcommands are:" dim_list_commands | sed 's/^/\t/' echo - echo "See '$0 help' for more information." + echo "See '$dim help' for more information." } # dim subcommand aliases
@@ -1255,6 +1257,6 @@ subcmd_func=dim_${subcmd//-/_} if declare -f $subcmd_func >/dev/null; then $subcmd_func "$@" else - echo "$0: '$subcommand' is not a dim command." >&2 + echo "$dim: '$subcommand' is not a dim command." >&2 dim_usage fi
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 dim: columnize usage output if column(1) is available
The usage has become a bit unwieldy with the command list.
--- dim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
dim +5 -1
@@ -1241,7 +1241,11 @@ function dim_usage echo "usage: $dim [OPTIONS] SUBCOMMAND [ARGUMENTS]" echo echo "The available subcommands are:" - dim_list_commands | sed 's/^/\t/' + if hash column 2>/dev/null; then + dim_list_commands | column -c 72 | sed 's/^/\t/' + else + dim_list_commands | sed 's/^/\t/' + fi echo echo "See '$dim help' for more information." }
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 dim: clean up the rm's in dim checker
In reply to Jani NikulaThe -f option does what the doctor orders.
--- dim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
dim +1 -2
@@ -730,8 +730,7 @@ function dim_checkpatch function dim_checker { - rm drivers/gpu/drm/i915/*.o &> /dev/null || true - rm drivers/gpu/drm/i915/*.ko &> /dev/null || true + rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko make C=1 drivers/gpu/drm/i915/i915.ko }
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 dim: add DIM_MAKE_OPTIONS configuration
In reply to Jani NikulaDefaults to -j20.
--- dim | 7 +++++-- dim.rst | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-)
dim +5 -2
@@ -74,6 +74,9 @@ DIM_DRM_UPSTREAM_REMOTE=${DIM_DRM_UPSTREAM_REMOTE:-airlied} # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...] DIM_MUA=${DIM_MUA:-mutt} +# make options (not used for C=1) +DIM_MAKE_OPTIONS=${DIM_MAKE_OPTIONS:--j20} + # command to run after dim apply DIM_POST_APPLY_ACTION=${DIM_POST_APPLY_ACTION:-}
@@ -539,7 +542,7 @@ function dim_cherry_pick_next_fixes dim_alias_ar=apply-resolved function dim_apply_resolved { - make -j 20 && git add -u && git am --resolved + make $DIM_MAKE_OPTIONS && git add -u && git am --resolved checkpatch_commit HEAD git commit --amend & }
@@ -549,7 +552,7 @@ function dim_magic_rebase_resolve { git diff HEAD | patch -p1 -R cat .git/rebase-merge/patch | dim mp - make -j 20 + make $DIM_MAKE_OPTIONS git add -u git rebase --continue }
dim.rst +4 -0
@@ -348,6 +348,10 @@ DIM_MUA Mail user agent. Must support the following subset of **mutt(1)** command line options: \$DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...] +DIM_MAKE_OPTIONS +---------------- +Additional options to pass to **make(1)**. Defaults to "-j20". + DIM_TEMPLATE_HELLO ------------------ Path to a file containing a greeting template for pull request mails.
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 dim: add dim sparse subcommand to run sparse on a commit range
In reply to Jani NikulaRun sparse only on files that have changed in the range.
--- dim | 9 +++++++++ dim.rst | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-)
dim +9 -0
@@ -731,6 +731,15 @@ function dim_checkpatch done } +function dim_sparse +{ + local range=$(rangeish "$1") + + make $DIM_MAKE_OPTIONS + touch --no-create `git diff --name-only $range` `git diff --name-only` + make C=1 +} + function dim_checker { rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.ko
dim.rst +15 -7
@@ -186,12 +186,6 @@ fixes *commit-ish* Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel CodingStyle approved format. -check-patch|cp [*commit-ish* [.. *commit-ish*]] ------------------------------------------------ -Runs the given commit range commit-ish..commit-ish through the check tools. If -no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed -instead of a range, the range commit-ish..HEAD is used. - cherry-pick *commit-ish* [*git cherry-pick arguments*] ------------------------------------------------------
@@ -259,9 +253,23 @@ remote is up-to-date. Useful if drm-intel-next has been changed since the last run of the update-next command (e.g. to apply a hotfix before sending out the pull request). +checkpatch|check-patch|cp [*commit-ish* [.. *commit-ish*]] +---------------------------------------------------------- +Runs the given commit range commit-ish..commit-ish through the check tools. + +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed +instead of a range, the range commit-ish..HEAD is used. + +sparse [*commit-ish* [.. *commit-ish*]] +--------------------------------------- +Run sparse on the files changed by the given commit range. + +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed +instead of a range, the range commit-ish..HEAD is used. + checker ------- -Run sparse on the kernel. +Run sparse on drm/i915. create-branch *branch* [*commit-ish*] -------------------------------------
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [maintainer-tools PATCH 5/6] dim: add dim sparse subcommand to run sparse on a commit range
Quoted 48 lines · Jani Nikula
Run sparse only on files that have changed in the range.
Signed-off-by Jani Nikula <[email protected]>--- dim | 9 +++++++++ dim.rst | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-)dim +9
-0@@ -731,6 +731,15 @@ function dim_checkpatch done } +function dim_sparse +{ + local range=$(rangeish "$1") + + make $DIM_MAKE_OPTIONS + touch --no-create `git diff --name-only $range` `git diff --name-only` + make C=1 +} + function dim_checker { rm -f drivers/gpu/drm/i915/*.o drivers/gpu/drm/i915/*.kodim.rst +0
-6@@ -186,12 +186,6 @@ fixes *commit-ish* Print the Fixes: and Cc: lines for the supplied *commit-ish* in the linux kernel CodingStyle approved format. -check-patch|cp [*commit-ish* [.. *commit-ish*]] ------------------------------------------------ -Runs the given commit range commit-ish..commit-ish through the check tools. If -no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed -instead of a range, the range commit-ish..HEAD is used. - cherry-pick *commit-ish* [*git cherry-pick arguments*] ------------------------------------------------------@@ -259,9 +253,23 @@ remote is up-to-date. Useful if drm-intel-next has been changed since the last run of the update-next command (e.g. to apply a hotfix before sending out the pull request).
dim.rst remote is up-to-date. Useful if drm-intel-next has been changed since the last · line 264
Quoted 10 lines
dim.rst +9
-0+checkpatch|check-patch|cp [*commit-ish* [.. *commit-ish*]] +---------------------------------------------------------- +Runs the given commit range commit-ish..commit-ish through the check tools. + +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed +instead of a range, the range commit-ish..HEAD is used. + +sparse [*commit-ish* [.. *commit-ish*]] +---------------------------------------
Since we have this nice rangeish helper, should we change the synopsis to [rangeish], with a separate section explaining what a dim rangeish is? Just a drive-by bikeshed really, ok as-is.
-Daniel
Quoted 15 lines
dim.rst +6
-1+Run sparse on the files changed by the given commit range. + +If no commit-ish is passed, defaults to HEAD^..HEAD. If one commit-ish is passed +instead of a range, the range commit-ish..HEAD is used. + checker ------- -Run sparse on the kernel. +Run sparse on drm/i915. create-branch *branch* [*commit-ish*] -------------------------------------Signature · 1 line
2.1.4
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
PATCH 6/6 dim: add command to check for dim updates
In reply to Jani NikulaAdd a command to check if the user is running an up-to-date version of dim.
--- dim | 21 +++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 25 insertions(+)
dim +21 -0
@@ -179,6 +179,27 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'` fi +function dim_uptodate +{ + local using="${BASH_SOURCE[0]}" + + if [[ ! -e "$using" ]]; then + echo "$dim: could not figure out the version being used ($using)." >&2 + exit 1 + fi + + if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then + echo "$dim: could not find the upstream repo for $dim." >&2 + exit 1 + fi + + if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\ + diff "$using" - >& /dev/null; then + echo "$dim: not running upstream version of the script." >&2 + exit 1 + fi +} + # get message id from file # $1 = file message_get_id ()
dim.rst +4 -0
@@ -317,6 +317,10 @@ list-upstreams List of all upstreams commonly used for pull requests. Useful for autocompletion scripts. +uptodate +-------- +Try to check if you're running an up-to-date version of **dim**. + help ---- Show this help. Install **rst2man(1)** for best results.
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
Quoted 27 lines · Jani Nikula
Add a command to check if the user is running an up-to-date version of dim.
Signed-off-by Jani Nikula <[email protected]>--- dim | 21 +++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 25 insertions(+)dim +10
-0@@ -179,6 +179,27 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'` fi +function dim_uptodate +{ + local using="${BASH_SOURCE[0]}" + + if [[ ! -e "$using" ]]; then + echo "$dim: could not figure out the version being used ($using)." >&2 + exit 1 + fi + + if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then
dim if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us · line 201
Quoted 10 lines
dim +10
-0+ echo "$dim: could not find the upstream repo for $dim." >&2 + exit 1 + fi + + if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\ + diff "$using" - >& /dev/null; then + echo "$dim: not running upstream version of the script." >&2 + exit 1 + fi +}
Should we run this at startup every once in a while? Something like
if [[ "$((date +%s % 100))" -eq "0" ]] ; then
dim_uptodate
fi
at the top? date-based rng tested, otherwise not ...
With or without these bikesheds Acked-by: me on the entire series. -Daniel
Quoted 22 lines
dim +1
-0+ # get message id from file # $1 = file message_get_id ()dim.rst +4
-0@@ -317,6 +317,10 @@ list-upstreams List of all upstreams commonly used for pull requests. Useful for autocompletion scripts. +uptodate +-------- +Try to check if you're running an up-to-date version of **dim**. + help ---- Show this help. Install **rst2man(1)** for best results.Signature · 1 line
2.1.4
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
Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
Quoted 41 lines · Daniel Vetter
Quoted 27 lines · Jani Nikula
Add a command to check if the user is running an up-to-date version of dim.
Signed-off-by Jani Nikula <[email protected]>--- dim | 21 +++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 25 insertions(+)dim +10
-0@@ -179,6 +179,27 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'` fi +function dim_uptodate +{ + local using="${BASH_SOURCE[0]}" + + if [[ ! -e "$using" ]]; then + echo "$dim: could not figure out the version being used ($using)." >&2 + exit 1 + fi + + if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; thendim if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us · line 201
Quoted 10 lines
dim +10
-0+ echo "$dim: could not find the upstream repo for $dim." >&2 + exit 1 + fi + + if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\ + diff "$using" - >& /dev/null; then + echo "$dim: not running upstream version of the script." >&2 + exit 1 + fi +}Should we run this at startup every once in a while? Something like
Quoted 5 lines
if [[ "$((
date +%s% 100))" -eq "0" ]] ; then
dim_uptodate
fiat the top? date-based rng tested, otherwise not ...
I had something like that in mind at first, but decided to be less obnoxious for starters. ;)
Quoted 1 line
With or without these bikesheds Acked-by: me on the entire series.
I'll get back to the bikesheds later, pushed as-is now. Thanks.
BR,
Jani.
Quoted 24 lines
-Daniel
Quoted 22 lines
dim +1
-0+ # get message id from file # $1 = file message_get_id ()dim.rst +4
-0@@ -317,6 +317,10 @@ list-upstreams List of all upstreams commonly used for pull requests. Useful for autocompletion scripts. +uptodate +-------- +Try to check if you're running an up-to-date version of **dim**. + help ---- Show this help. Install **rst2man(1)** for best results.Signature · 1 line
2.1.4
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [maintainer-tools PATCH 6/6] dim: add command to check for dim updates
Quoted 42 lines · Jani Nikula
Quoted 41 lines · Daniel Vetter
Quoted 27 lines · Jani Nikula
Add a command to check if the user is running an up-to-date version of dim.
Signed-off-by Jani Nikula <[email protected]>--- dim | 21 +++++++++++++++++++++ dim.rst | 4 ++++ 2 files changed, 25 insertions(+)dim +10
-0@@ -179,6 +179,27 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'` fi +function dim_uptodate +{ + local using="${BASH_SOURCE[0]}" + + if [[ ! -e "$using" ]]; then + echo "$dim: could not figure out the version being used ($using)." >&2 + exit 1 + fi + + if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; thendim if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != "us · line 201
Quoted 10 lines
dim +10
-0+ echo "$dim: could not find the upstream repo for $dim." >&2 + exit 1 + fi + + if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\ + diff "$using" - >& /dev/null; then + echo "$dim: not running upstream version of the script." >&2 + exit 1 + fi +}Should we run this at startup every once in a while? Something like
Quoted 8 lines
Quoted 5 lines
if [[ "$((
date +%s% 100))" -eq "0" ]] ; then
dim_uptodate
fiat the top? date-based rng tested, otherwise not ...
I had something like that in mind at first, but decided to be less obnoxious for starters. ;)
Oh, the real obnoxious version would auto-update dim if it's not up-to-date ;-)
-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