dim: some repo/remote refactoring
I have more in store, but here's the first batch.
BR,
Jani.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/6 dim: require explicit repo in create-branch
No longer consider drm-intel as the default. All repos need to be explicitly specified. Improve error reporting in repo_to_remote for unknown repos.
--- dim | 20 ++++++++++++++++---- dim.rst | 12 +++++------- 2 files changed, 21 insertions(+), 11 deletions(-)
dim +16 -4
@@ -335,7 +335,17 @@ function branch_to_remote # branch function repo_to_remote # repo { - url_to_remote ${drm_tip_repos[$1]} + local repo url_list + + repo=$1 + url_list=${drm_tip_repos[$repo]} + + if [[ -z "$url_list" ]]; then + echoerr "unknown repo $repo" + return 1 + fi + + url_to_remote $url_list } function branch_to_repo # branch
@@ -1208,9 +1218,11 @@ function dim_create_branch cd $DIM_PREFIX/$DIM_DRM_INTEL - if ( repo_to_remote ${branch%%/*} ) &> /dev/null ; then - repo=${branch%%/*} - branch=${branch#*/} + repo=${branch%%/*} + branch=${branch#*/} + if [[ "$repo" = "$branch" ]]; then + echoerr "give branch in format repo/branch" + return 1 fi remote=$(repo_to_remote $repo)
dim.rst +5 -7
@@ -298,13 +298,11 @@ Compile-test the current tree and if successful resolve a conflicted git am. Also runs the patch checker afterwards. This fails to add the Link: tag, so you'll need to add it manually or use the **add-link** subcommand. -create-branch *branch* [*commit-ish*] -------------------------------------- -Create a new topic branch with the given name. Note that topic/ is not -automatically prepended. The branch starts at HEAD or the given commit-ish. Note -that by default the new branch is created in the drm-intel.git repository. If -you want to create a branch somewhere else, then you need to prepend the remote -name from nightly.conf, e.g. "drm-misc/topic/branch". +create-branch *repo*/*branch* [*commit-ish*] +-------------------------------------------- +Create a new topic branch in the given *repo* named *branch*. The branch starts +at HEAD or the given *commit-ish*. Note that topic/ is not automatically added +to the branch name. Branch names should be unique across repos. remove-branch *branch* ----------------------
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 dim: url_to_remote can't normally fail
In reply to Jani NikulaSince commit cad37e1910f9 ("dim: auto-add remotes") url_to_remote can't really fail. Same for repo_to_remote when the repo exists. Redirecting their output when the remote isn't there leads to url_to_remote waiting for user input without prompting, giving an appearance of a hang.
While at it, change the exit to a return. set -e at the top takes care of aborting.
--- dim | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
dim +8 -16
@@ -282,7 +282,7 @@ function url_to_remote # url [url ...] echoerr "Please set it up yourself using:" echoerr " $ git remote add <name> $url" echoerr "with a name of your choice." - exit 1 + return 1 fi git remote add $remote $url
@@ -1749,10 +1749,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - # Handle failures gracefully - if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then - return 0 - fi + dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) echo origin/master echo $dim_drm_upstream_remote/drm-next
@@ -1772,17 +1769,14 @@ function dim_update_branches cd $DIM_PREFIX/$DIM_DRM_INTEL - if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then - echo -n "Fetching linux (local remote $remote)... " - git_fetch_helper $remote - echo "Done." - fi + remote=$(url_to_remote $linux_upstream_git) + echo -n "Fetching linux (local remote $remote)... " + git_fetch_helper $remote + echo "Done." for repo in "${!drm_tip_repos[@]}"; do url_list=${drm_tip_repos[$repo]} - if ! remote=$(url_to_remote $url_list 2>/dev/null); then - continue - fi + remote=$(url_to_remote $url_list) echo -n "Fetching $repo (local remote $remote)... " git_fetch_helper $remote echo "Done."
@@ -1826,9 +1820,7 @@ function dim_status for branch in $dim_branches ; do repo=$(branch_to_repo $branch) - if ! remote=$(repo_to_remote $repo) ; then - continue - fi + remote=$(repo_to_remote $repo) patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [dim PATCH 2/6] dim: url_to_remote can't normally fail
Quoted 4 lines · Jani Nikula
Since commit
cad37e1910f9("dim: auto-add remotes")url_to_remotecan't really fail. Same forrepo_to_remotewhen the repo exists. Redirecting their output when the remote isn't there leads tourl_to_remotewaiting for user input without prompting, giving an appearance of a hang.
Wah. I've been going back and forth with this, but I'm now leaning towards reverting cad37e1910f9 ("dim: auto-add remotes") and going back to the drawing board with it.
The problem is, url_to_remote, repo_to_remote and friends are low-level helpers in the script. That kind of things are better off returning true/false status instead of going out of their way to interactively fix stuff up. The *caller*, where applicable, should auto-add remotes, depending on the case.
I hit the problem first on one machine which doesn't use worktrees. I conceded we could make worktrees a requirement. However, I have a strict separation between maintainer and developer repos, with no push access at all to the remotes from the developer repo. I have no desire to give up on that safety measure. However, dim is helpful in the developer repo too.
Also, there's been requests to move dim more towards working in the CWD instead of cd to predefined repo. I'm not sure it's reasonable to require that all of them have all of the remotes available, for no particularly good reason. With worktrees the remotes are shared, but if you don't use a common tree for all of them, that benefit is lost.
BR,
Jani.
Quoted 70 lines
While at it, change the exit to a return. set -e at the top takes care of aborting.
Cc Rodrigo Vivi <[email protected]>Cc Sean Paul <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- dim | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)dim +8
-16@@ -282,7 +282,7 @@ function url_to_remote # url [url ...] echoerr "Please set it up yourself using:" echoerr " $ git remote add <name> $url" echoerr "with a name of your choice." - exit 1 + return 1 fi git remote add $remote $url@@ -1749,10 +1749,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - # Handle failures gracefully - if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then - return 0 - fi + dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) echo origin/master echo $dim_drm_upstream_remote/drm-next@@ -1772,17 +1769,14 @@ function dim_update_branches cd $DIM_PREFIX/$DIM_DRM_INTEL - if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then - echo -n "Fetching linux (local remote $remote)... " - git_fetch_helper $remote - echo "Done." - fi + remote=$(url_to_remote $linux_upstream_git) + echo -n "Fetching linux (local remote $remote)... " + git_fetch_helper $remote + echo "Done." for repo in "${!drm_tip_repos[@]}"; do url_list=${drm_tip_repos[$repo]} - if ! remote=$(url_to_remote $url_list 2>/dev/null); then - continue - fi + remote=$(url_to_remote $url_list) echo -n "Fetching $repo (local remote $remote)... " git_fetch_helper $remote echo "Done."@@ -1826,9 +1820,7 @@ function dim_status for branch in $dim_branches ; do repo=$(branch_to_repo $branch) - if ! remote=$(repo_to_remote $repo) ; then - continue - fi + remote=$(repo_to_remote $repo) patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
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: [dim PATCH 2/6] dim: url_to_remote can't normally fail
Quoted 23 lines · Jani Nikula
Quoted 4 lines · Jani Nikula
Since commit
cad37e1910f9("dim: auto-add remotes")url_to_remotecan't really fail. Same forrepo_to_remotewhen the repo exists. Redirecting their output when the remote isn't there leads tourl_to_remotewaiting for user input without prompting, giving an appearance of a hang.Wah. I've been going back and forth with this, but I'm now leaning towards reverting
cad37e1910f9("dim: auto-add remotes") and going back to the drawing board with it.The problem is,
url_to_remote,repo_to_remoteand friends are low-level helpers in the script. That kind of things are better off returning true/false status instead of going out of their way to interactively fix stuff up. The *caller*, where applicable, should auto-add remotes, depending on the case.I hit the problem first on one machine which doesn't use worktrees. I conceded we could make worktrees a requirement. However, I have a strict separation between maintainer and developer repos, with no push access at all to the remotes from the developer repo. I have no desire to give up on that safety measure. However, dim is helpful in the developer repo too.
Quoted 5 lines
Also, there's been requests to move dim more towards working in the CWD instead of cd to predefined repo. I'm not sure it's reasonable to require that all of them have all of the remotes available, for no particularly good reason. With worktrees the remotes are shared, but if you don't use a common tree for all of them, that benefit is lost.
Okay, I admit defeat. I don't have the time or chrystal clear idea how to fix all this cleanly and nicely, and we can't block on this indefinitely. One of the problems with tab completion was that list-upstreams operated in the current dir; I sent a fix on top of this series. In general, I think we need a better idea on what should work and operate in CWD. The mixture we have now is not ideal.
So if you would be so kind to review this set so we can move forward, and let's improve upon this gradually as issues arise.
BR,
Jani.
Quoted 76 lines
BR,
Jani.Quoted 70 lines
While at it, change the exit to a return. set -e at the top takes care of aborting.
Cc Rodrigo Vivi <[email protected]>Cc Sean Paul <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- dim | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)dim +8
-16@@ -282,7 +282,7 @@ function url_to_remote # url [url ...] echoerr "Please set it up yourself using:" echoerr " $ git remote add <name> $url" echoerr "with a name of your choice." - exit 1 + return 1 fi git remote add $remote $url@@ -1749,10 +1749,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - # Handle failures gracefully - if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then - return 0 - fi + dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) echo origin/master echo $dim_drm_upstream_remote/drm-next@@ -1772,17 +1769,14 @@ function dim_update_branches cd $DIM_PREFIX/$DIM_DRM_INTEL - if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then - echo -n "Fetching linux (local remote $remote)... " - git_fetch_helper $remote - echo "Done." - fi + remote=$(url_to_remote $linux_upstream_git) + echo -n "Fetching linux (local remote $remote)... " + git_fetch_helper $remote + echo "Done." for repo in "${!drm_tip_repos[@]}"; do url_list=${drm_tip_repos[$repo]} - if ! remote=$(url_to_remote $url_list 2>/dev/null); then - continue - fi + remote=$(url_to_remote $url_list) echo -n "Fetching $repo (local remote $remote)... " git_fetch_helper $remote echo "Done."@@ -1826,9 +1820,7 @@ function dim_status for branch in $dim_branches ; do repo=$(branch_to_repo $branch) - if ! remote=$(repo_to_remote $repo) ; then - continue - fi + remote=$(repo_to_remote $repo) patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)
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: [dim PATCH 2/6] dim: url_to_remote can't normally fail
In reply to Jani NikulaQuoted 44 lines · Jani Nikula
Since commit
cad37e1910f9("dim: auto-add remotes")url_to_remotecan't really fail. Same forrepo_to_remotewhen the repo exists. Redirecting their output when the remote isn't there leads tourl_to_remotewaiting for user input without prompting, giving an appearance of a hang.While at it, change the exit to a return. set -e at the top takes care of aborting.
Cc Rodrigo Vivi <[email protected]>Cc Sean Paul <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- dim | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)dim +2
-5@@ -282,7 +282,7 @@ function url_to_remote # url [url ...] echoerr "Please set it up yourself using:" echoerr " $ git remote add <name> $url" echoerr "with a name of your choice." - exit 1 + return 1 fi git remote add $remote $url@@ -1749,10 +1749,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - # Handle failures gracefully - if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then - return 0 - fi + dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) echo origin/master echo $dim_drm_upstream_remote/drm-next@@ -1772,17 +1769,14 @@ function dim_update_branches cd $DIM_PREFIX/$DIM_DRM_INTEL
dim function dim_update_branches · line 1775
Quoted 10 lines
dim +4
-5- if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then - echo -n "Fetching linux (local remote $remote)... " - git_fetch_helper $remote - echo "Done." - fi + remote=$(url_to_remote $linux_upstream_git) + echo -n "Fetching linux (local remote $remote)... " + git_fetch_helper $remote + echo "Done."
So this practically makes worktrees mandatory since we now need all the remotes everywhere. I'm ok with that, worktree is the default (with no easy way to intentionally fall back) anyway. Might be good to mention in the commit message though.
-Daniel
Quoted 24 lines
dim +2
-6for repo in "${!drm_tip_repos[@]}"; do url_list=${drm_tip_repos[$repo]} - if ! remote=$(url_to_remote $url_list 2>/dev/null); then - continue - fi + remote=$(url_to_remote $url_list) echo -n "Fetching $repo (local remote $remote)... " git_fetch_helper $remote echo "Done."@@ -1826,9 +1820,7 @@ function dim_status for branch in $dim_branches ; do repo=$(branch_to_repo $branch) - if ! remote=$(repo_to_remote $repo) ; then - continue - fi + remote=$(repo_to_remote $repo) patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)Signature · 1 line
2.11.0
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: [dim PATCH 2/6] dim: url_to_remote can't normally fail
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Jani Nikula
Since commit
cad37e1910f9("dim: auto-add remotes")url_to_remotecan't really fail. Same forrepo_to_remotewhen the repo exists. Redirecting their output when the remote isn't there leads tourl_to_remotewaiting for user input without prompting, giving an appearance of a hang.While at it, change the exit to a return. set -e at the top takes care of aborting.
Cc Rodrigo Vivi <[email protected]>Cc Sean Paul <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- dim | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)dim +2
-5@@ -282,7 +282,7 @@ function url_to_remote # url [url ...] echoerr "Please set it up yourself using:" echoerr " $ git remote add <name> $url" echoerr "with a name of your choice." - exit 1 + return 1 fi git remote add $remote $url@@ -1749,10 +1749,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - # Handle failures gracefully - if ! dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git 2>/dev/null); then - return 0 - fi + dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) echo origin/master echo $dim_drm_upstream_remote/drm-next@@ -1772,17 +1769,14 @@ function dim_update_branches cd $DIM_PREFIX/$DIM_DRM_INTEL
Quoted 14 lines
dim function dim_update_branches · line 1775
Quoted 9 lines
dim +4
-5- if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then - echo -n "Fetching linux (local remote $remote)... " - git_fetch_helper $remote - echo "Done." - fi + remote=$(url_to_remote $linux_upstream_git) + echo -n "Fetching linux (local remote $remote)... " + git_fetch_helper $remote + echo "Done."So this practically makes worktrees mandatory since we now need all the remotes everywhere. I'm ok with that, worktree is the default (with no easy way to intentionally fall back) anyway. Might be good to mention in the commit message though.
Added a paragraph about that in the log. Worktrees still aren't strictly required, but indeed practically mandatory. I still have that one box with a non-worktree setup even if the git has long since been upgraded to support worktrees.
Pushed all 7, many thanks for the review.
BR,
Jani.
Quoted 26 lines
-Daniel
Quoted 24 lines
dim +2
-6for repo in "${!drm_tip_repos[@]}"; do url_list=${drm_tip_repos[$repo]} - if ! remote=$(url_to_remote $url_list 2>/dev/null); then - continue - fi + remote=$(url_to_remote $url_list) echo -n "Fetching $repo (local remote $remote)... " git_fetch_helper $remote echo "Done."@@ -1826,9 +1820,7 @@ function dim_status for branch in $dim_branches ; do repo=$(branch_to_repo $branch) - if ! remote=$(repo_to_remote $repo) ; then - continue - fi + remote=$(repo_to_remote $repo) patches=$(git log --oneline $remote/$branch ^origin/master ^$drm_remote/drm-next ^$drm_remote/drm-fixes | wc -l)Signature · 1 line
2.11.0
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 dim: look at all tip branches in dim tc
In reply to Jani NikulaThe hard-coded list of remotes and branches has gone stale.
--- dim | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
dim +16 -9
@@ -1953,7 +1953,7 @@ function dim_cat_to_fixup function dim_tc { - local sha1 tag dim_drm_upstream_remote + local sha1 tag conf remote_branches sha1=${1:?$usage}
@@ -1961,15 +1961,22 @@ function dim_tc tag=$(git tag --contains $sha1 | grep ^v | sort -V | head -n 1) if [[ -n "$tag" ]]; then echo "$tag" - else - dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) - # not in a tagged release, show upstream branches - git branch -r --contains $sha1 \ - $DIM_DRM_INTEL_REMOTE/* \ - $dim_drm_upstream_remote/drm-next \ - $dim_drm_upstream_remote/drm-fixes \ - origin/master | sed 's/^ *//' + return 0 fi + + # not in a tagged release, show upstream branches + remote_branches="origin/master" + for conf in "${drm_tip_config[@]}"; do + local repo branch override url_list remote + + read -r repo branch override <<< $conf + url_list=${drm_tip_repos[$repo]} + remote=$(url_to_remote $url_list) + + remote_branches="$remote_branches $remote/$branch" + done + + git branch -r --contains $sha1 $remote_branches | sed 's/^ *//' | sort } function dim_cite
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 dim: s/DIM_DRM_INTEL/DIM_REPO/
In reply to Jani NikulaThe maintainer repo hasn't been Intel specific for a while now. Rename the variable. DIM_DRM_INTEL is used as a default for DIM_REPO for backward compatibility.
--- dim | 48 ++++++++++++++++++++++++------------------------ dim.rst | 10 +++++----- dimrc.sample | 6 +++--- 3 files changed, 32 insertions(+), 32 deletions(-)
dim +24 -24
@@ -46,9 +46,9 @@ fi DIM_PREFIX=${DIM_PREFIX:-$HOME/linux} # main maintainer repo under $DIM_PREFIX -DIM_DRM_INTEL=${DIM_DRM_INTEL:-src} +DIM_REPO=${DIM_REPO:-${DIM_DRM_INTEL:-src}} -# name of the $drm_intel_ssh remote within $DIM_DRM_INTEL +# name of the $drm_intel_ssh remote within $DIM_REPO DIM_DRM_INTEL_REMOTE=${DIM_DRM_INTEL_REMOTE:-drm-intel} # mail user agent. must support a subset of mutt(1) command line options:
@@ -224,7 +224,7 @@ fi export __dim_running=1 if [ "$subcommand" != "setup" ] && [ "$subcommand" != "help" ] && [ "$subcommand" != "usage" ]; then - for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do + for d in $DIM_PREFIX $DIM_PREFIX/$DIM_REPO $DIM_PREFIX/drm-rerere $DIM_PREFIX/drm-tip; do if [ ! -d $d ]; then echoerr "$d is missing, please check your configuration and/or run dim setup" exit 1
@@ -566,7 +566,7 @@ function rr_cache_dir if [ -d $DIM_PREFIX/drm-tip/.git/ ] ; then echo $DIM_PREFIX/drm-tip/.git/rr-cache else - echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache + echo $DIM_PREFIX/$DIM_REPO/.git/rr-cache fi }
@@ -1216,7 +1216,7 @@ function dim_create_branch start=${2:-HEAD} repo="drm-intel" - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO repo=${branch%%/*} branch=${branch#*/}
@@ -1243,7 +1243,7 @@ function dim_remove_branch branch=${1:?$usage} - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO if [[ -d $DIM_PREFIX/$branch ]] ; then rm -R $DIM_PREFIX/$branch
@@ -1284,7 +1284,7 @@ function dim_cd if [[ -d $DIM_PREFIX/$1 ]] ; then path=$DIM_PREFIX/$1 else - path=$DIM_PREFIX/$DIM_DRM_INTEL + path=$DIM_PREFIX/$DIM_REPO fi echo $path > ~/.dim-last-path
@@ -1537,12 +1537,12 @@ function dim_create_workdir if git help worktree &> /dev/null; then # native worktree support was added in git 2.5 - cd $DIM_DRM_INTEL + cd $DIM_REPO $DRY git worktree prune $DRY git worktree add $DIM_PREFIX/$branch $branch cd $DIM_PREFIX else - $DRY git-new-workdir $DIM_DRM_INTEL $branch $branch + $DRY git-new-workdir $DIM_REPO $branch $branch fi done }
@@ -1550,7 +1550,7 @@ function dim_create_workdir dim_alias_fw=for-each-workdir function dim_for_each_workdir { - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO "$@" for branch in $dim_branches ; do if [[ -d $DIM_PREFIX/$branch ]] ; then
@@ -1639,7 +1639,7 @@ function dim_tag_next { local tag suffix - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO git fetch $DIM_DRM_INTEL_REMOTE if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
@@ -1690,7 +1690,7 @@ function dim_pull_request if [ "$branch" != "drm-intel-next" ]; then assert_branch $branch else - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO fi git_fetch_helper ${upstream%%/*}
@@ -1767,7 +1767,7 @@ function dim_update_branches { local repo remote url_list - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO remote=$(url_to_remote $linux_upstream_git) echo -n "Fetching linux (local remote $remote)... "
@@ -1814,7 +1814,7 @@ function dim_status { local repo remote drm_remote patches - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO drm_remote=$(url_to_remote $drm_upstream_git)
@@ -1842,7 +1842,7 @@ function setup_aux_checkout # name url directory if [ ! -d $dir ]; then if git help worktree &> /dev/null ; then - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO remote=$(url_to_remote $url) if ! git_branch_exists $name ; then git_fetch_helper $remote
@@ -1850,10 +1850,10 @@ function setup_aux_checkout # name url directory fi git worktree add $DIM_PREFIX/$dir $name else - git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git $url $dir + git clone --reference=$DIM_PREFIX/$DIM_REPO/.git $url $dir cd $dir git config remote.origin.url $url - echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > .git/objects/info/alternates + echo "$DIM_PREFIX/$DIM_REPO/.git/objects" > .git/objects/info/alternates git repack -a -d -l remote=origin fi
@@ -1880,11 +1880,11 @@ function dim_setup fi cd $DIM_PREFIX - if [ ! -d $DIM_PREFIX/$DIM_DRM_INTEL/.git ]; then - echoerr "No git checkout found in $DIM_PREFIX/$DIM_DRM_INTEL." - echoerr "Please set up your maintainer linux repository at $DIM_PREFIX/$DIM_DRM_INTEL with" + if [ ! -d $DIM_PREFIX/$DIM_REPO/.git ]; then + echoerr "No git checkout found in $DIM_PREFIX/$DIM_REPO." + echoerr "Please set up your maintainer linux repository at $DIM_PREFIX/$DIM_REPO with" echoerr " cd $DIM_PREFIX" - echoerr " git clone $linux_upstream_git $DIM_DRM_INTEL" + echoerr " git clone $linux_upstream_git $DIM_REPO" echoerr "or update your configuration (see dimrc.sample)." exit 1 fi
@@ -1957,7 +1957,7 @@ function dim_tc sha1=${1:?$usage} - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO tag=$(git tag --contains $sha1 | grep ^v | sort -V | head -n 1) if [[ -n "$tag" ]]; then echo "$tag"
@@ -1985,7 +1985,7 @@ function dim_cite sha1=${1:?$usage} - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \ sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
@@ -1997,7 +1997,7 @@ function dim_fixes sha1=${1:?$usage} - cd $DIM_PREFIX/$DIM_DRM_INTEL + cd $DIM_PREFIX/$DIM_REPO echo "Fixes: $(dim_cite $sha1)" (
dim.rst +5 -5
@@ -64,7 +64,7 @@ when adding a remote and, if it's not already done, you should add a new entry i $ printf '\nHost git.freedesktop.org\n\tUser <username>' >> ~/.ssh/config You should now have a main repository for patch application. The directory -corresponding to this repository is defined by DIM_DRM_INTEL in your .dimrc. +corresponding to this repository is defined by DIM_REPO in your .dimrc. You should also have directories called maintainer-tools, drm-tip (for rebuilding the tree), and drm-rerere for some dim-internal book-keeping.
@@ -316,7 +316,7 @@ branches if "all" is given. for-each-workdir *command* -------------------------- Run the given command in all active workdirs including the main repository under -\$DIM_DRM_INTEL. +\$DIM_REPO. COMMANDS FOR MAINTAINERS ========================
@@ -473,13 +473,13 @@ DIM_PREFIX ---------- Path prefix for kernel repositories. -DIM_DRM_INTEL -------------- +DIM_REPO +-------- The main maintainer repository under \$DIM_PREFIX. DIM_DRM_INTEL_REMOTE -------------------- -Name of the $drm_intel_ssh remote within \$DIM_DRM_INTEL. +Name of the $drm_intel_ssh remote within \$DIM_REPO. DIM_MUA -------
dimrc.sample +3 -3
@@ -4,14 +4,14 @@ # Defaults are in the comments below. # Prefix for the repo directories. The prefix will contain -# $DIM_DRM_INTEL, drm-tip, maintainer-tools, etc. +# $DIM_REPO, drm-tip, maintainer-tools, etc. #DIM_PREFIX=$HOME/linux # Name of the main maintainer repo under $DIM_PREFIX. -#DIM_DRM_INTEL=src +#DIM_REPO=src # Name of the remote for ssh://git.freedesktop.org/git/drm-intel within -# $DIM_DRM_INTEL +# $DIM_REPO #DIM_DRM_INTEL_REMOTE=danvet # Mail User Agent supporting a subset of mutt(1) command line options:
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 dim: figure drm-intel remote out automatically
In reply to Jani NikulaWe have all the plumbing necessary to figure out the drm-intel remote. No need to configure it separately.
--- dim | 40 ++++++++++++++++++++++------------------ dim.rst | 4 ---- dimrc.sample | 4 ---- 3 files changed, 22 insertions(+), 26 deletions(-)
dim +22 -18
@@ -48,9 +48,6 @@ DIM_PREFIX=${DIM_PREFIX:-$HOME/linux} # main maintainer repo under $DIM_PREFIX DIM_REPO=${DIM_REPO:-${DIM_DRM_INTEL:-src}} -# name of the $drm_intel_ssh remote within $DIM_REPO -DIM_DRM_INTEL_REMOTE=${DIM_DRM_INTEL_REMOTE:-drm-intel} - # mail user agent. must support a subset of mutt(1) command line options: # usage: $DIM_MUA [-s subject] [-i file] [-c cc-addr] to-addr [...] DIM_MUA=${DIM_MUA:-mutt}
@@ -1089,14 +1086,16 @@ function git_list_fixes function cherry_pick_branch { - local branch log fail_log needed have_fixes + local branch log fail_log intel_remote needed have_fixes branch=${1:?$usage} log=$(mktemp) fail_log=$(mktemp) + intel_remote=$(url_to_remote $drm_intel_ssh) + # Look for commits in dinq tagged as fixes. - for commit in $(git_list_fixes $DIM_DRM_INTEL_REMOTE/$branch..$DIM_DRM_INTEL_REMOTE/drm-intel-next-queued -- drivers/gpu/drm/i915); do + for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do echo -n "Considering $(dim_cite $commit)... " # Look at history for already cherry-picked fixes.
@@ -1597,13 +1596,14 @@ function dim_update_next function dim_update_next_continue { - local remote req_file suffix tag tag_testing + local remote intel_remote req_file suffix tag tag_testing assert_branch drm-intel-next-queued + intel_remote=$(url_to_remote $drm_intel_ssh) remote=$(url_to_remote $drm_tip_ssh) - git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE drm-intel-next-queued:drm-intel-next + git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next tag=drm-intel-next-$today tag_testing=drm-intel-testing-$today
@@ -1612,13 +1612,13 @@ function dim_update_next_continue tag_testing="drm-intel-testing-$today-$((++suffix))" done - $DRY git tag -a $DIM_GPG_KEYID $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next - git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag + $DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next + git push $DRY_RUN $intel_remote $tag echo "Updating drm-intel-testing to latest drm-tip" - git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$remote/drm-tip:drm-intel-testing - $DRY git tag $tag_testing $DIM_DRM_INTEL_REMOTE/drm-intel-testing - $DRY git push $DIM_DRM_INTEL_REMOTE $tag_testing + git push $DRY_RUN $intel_remote +$remote/drm-tip:drm-intel-testing + $DRY git tag $tag_testing $intel_remote/drm-intel-testing + $DRY git push $intel_remote $tag_testing req_file=$(mktemp) cat > $req_file <<-HERE
@@ -1637,10 +1637,12 @@ function dim_update_next_continue function dim_tag_next { - local tag suffix + local intel_remote tag suffix cd $DIM_PREFIX/$DIM_REPO - git fetch $DIM_DRM_INTEL_REMOTE + + intel_remote=$(url_to_remote $drm_intel_ssh) + git fetch $intel_remote if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then echo "Tagging current drm-intel-next"
@@ -1650,8 +1652,8 @@ function dim_tag_next tag="drm-intel-next-$today-$((++suffix))" done - $DRY git tag -a $DIM_GPG_KEYID $tag $DIM_DRM_INTEL_REMOTE/drm-intel-next - git push $DRY_RUN $DIM_DRM_INTEL_REMOTE $tag + $DRY git tag -a $DIM_GPG_KEYID $tag $intel_remote/drm-intel-next + git push $DRY_RUN $intel_remote $tag else echo "drm-intel-next not up-to-date, aborting" exit
@@ -1765,7 +1767,7 @@ function dim_list_branches dim_alias_ub=update-branches function dim_update_branches { - local repo remote url_list + local repo remote url_list intel_remote cd $DIM_PREFIX/$DIM_REPO
@@ -1797,8 +1799,10 @@ function dim_update_branches fi done if git_branch_exists drm-intel-next ; then + intel_remote=$(url_to_remote $drm_intel_ssh) + dim_checkout drm-intel-next - $DRY git reset --hard $DIM_DRM_INTEL_REMOTE/drm-intel-next + $DRY git reset --hard $intel_remote/drm-intel-next fi cd $DIM_PREFIX/maintainer-tools
dim.rst +0 -4
@@ -477,10 +477,6 @@ DIM_REPO -------- The main maintainer repository under \$DIM_PREFIX. -DIM_DRM_INTEL_REMOTE --------------------- -Name of the $drm_intel_ssh remote within \$DIM_REPO. - DIM_MUA ------- Mail user agent. Must support the following subset of **mutt(1)** command line
dimrc.sample +0 -4
@@ -10,10 +10,6 @@ # Name of the main maintainer repo under $DIM_PREFIX. #DIM_REPO=src -# Name of the remote for ssh://git.freedesktop.org/git/drm-intel within -# $DIM_REPO -#DIM_DRM_INTEL_REMOTE=danvet - # Mail User Agent supporting a subset of mutt(1) command line options: # [-s subject] [-i file] [-c cc-addr] to-addr [...] #DIM_MUA=mutt
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 dim: reduce dependency on hard-coded repo URLs
In reply to Jani NikulaLook up the remotes using the repo names in nightly.conf.
--- dim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
dim +9 -9
@@ -1092,7 +1092,7 @@ function cherry_pick_branch log=$(mktemp) fail_log=$(mktemp) - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) # Look for commits in dinq tagged as fixes. for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do
@@ -1586,7 +1586,7 @@ function dim_update_next $DRY git add drivers/gpu/drm/i915/i915_drv.h git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date" - gitk drm-intel-next-queued ^$(url_to_remote $drm_upstream_git)/drm-next & + gitk drm-intel-next-queued ^$(repo_to_remote drm-upstream)/drm-next & # try to push dinq first in case someone raced FORCE=1 dim_push_queued
@@ -1600,7 +1600,7 @@ function dim_update_next_continue assert_branch drm-intel-next-queued - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) remote=$(url_to_remote $drm_tip_ssh) git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next
@@ -1641,7 +1641,7 @@ function dim_tag_next cd $DIM_PREFIX/$DIM_REPO - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) git fetch $intel_remote if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then
@@ -1730,7 +1730,7 @@ function dim_pull_request function dim_pull_request_next { - upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next} + upstream=${1:-$(repo_to_remote drm-upstream)/drm-next} dim_pull_request drm-intel-next $upstream }
@@ -1742,7 +1742,7 @@ function dim_pull_request_fixes function dim_pull_request_next_fixes { - upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next} + upstream=${1:-$(repo_to_remote drm-upstream)/drm-next} dim_pull_request drm-intel-next-fixes $upstream }
@@ -1751,7 +1751,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) + dim_drm_upstream_remote=$(repo_to_remote drm-upstream) echo origin/master echo $dim_drm_upstream_remote/drm-next
@@ -1799,7 +1799,7 @@ function dim_update_branches fi done if git_branch_exists drm-intel-next ; then - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) dim_checkout drm-intel-next $DRY git reset --hard $intel_remote/drm-intel-next
@@ -1820,7 +1820,7 @@ function dim_status cd $DIM_PREFIX/$DIM_REPO - drm_remote=$(url_to_remote $drm_upstream_git) + drm_remote=$(repo_to_remote drm-upstream) for branch in $dim_branches ; do repo=$(branch_to_repo $branch)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [dim PATCH 6/6] dim: reduce dependency on hard-coded repo URLs
Quoted 3 lines · Jani Nikula
Look up the remotes using the repo names in nightly.conf.
Signed-off-by Jani Nikula <[email protected]>
Aw, last user of $drm_intel_ssh is the maintainer-tools setup. I really should move that to drm-tip, but I still haven't figured out a neat way to auto-migrate. Oh well.
-Daniel
Quoted 92 lines
--- dim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)dim +9
-9@@ -1092,7 +1092,7 @@ function cherry_pick_branch log=$(mktemp) fail_log=$(mktemp) - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) # Look for commits in dinq tagged as fixes. for commit in $(git_list_fixes $intel_remote/$branch..$intel_remote/drm-intel-next-queued -- drivers/gpu/drm/i915); do@@ -1586,7 +1586,7 @@ function dim_update_next $DRY git add drivers/gpu/drm/i915/i915_drv.h git commit $DRY_RUN -sm "drm/i915: Update DRIVER_DATE to $driver_date" - gitk drm-intel-next-queued ^$(url_to_remote $drm_upstream_git)/drm-next & + gitk drm-intel-next-queued ^$(repo_to_remote drm-upstream)/drm-next & # try to push dinq first in case someone raced FORCE=1 dim_push_queued@@ -1600,7 +1600,7 @@ function dim_update_next_continue assert_branch drm-intel-next-queued - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) remote=$(url_to_remote $drm_tip_ssh) git push $DRY_RUN -f $intel_remote drm-intel-next-queued:drm-intel-next@@ -1641,7 +1641,7 @@ function dim_tag_next cd $DIM_PREFIX/$DIM_REPO - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) git fetch $intel_remote if [ $(git rev-parse drm-intel-next) == $(git rev-parse "drm-intel-next@{u}") ] ; then@@ -1730,7 +1730,7 @@ function dim_pull_request function dim_pull_request_next { - upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next} + upstream=${1:-$(repo_to_remote drm-upstream)/drm-next} dim_pull_request drm-intel-next $upstream }@@ -1742,7 +1742,7 @@ function dim_pull_request_fixes function dim_pull_request_next_fixes { - upstream=${1:-$(url_to_remote $drm_upstream_git)/drm-next} + upstream=${1:-$(repo_to_remote drm-upstream)/drm-next} dim_pull_request drm-intel-next-fixes $upstream }@@ -1751,7 +1751,7 @@ function dim_list_upstreams { local dim_drm_upstream_remote - dim_drm_upstream_remote=$(url_to_remote $drm_upstream_git) + dim_drm_upstream_remote=$(repo_to_remote drm-upstream) echo origin/master echo $dim_drm_upstream_remote/drm-next@@ -1799,7 +1799,7 @@ function dim_update_branches fi done if git_branch_exists drm-intel-next ; then - intel_remote=$(url_to_remote $drm_intel_ssh) + intel_remote=$(repo_to_remote drm-intel) dim_checkout drm-intel-next $DRY git reset --hard $intel_remote/drm-intel-next@@ -1820,7 +1820,7 @@ function dim_status cd $DIM_PREFIX/$DIM_REPO - drm_remote=$(url_to_remote $drm_upstream_git) + drm_remote=$(repo_to_remote drm-upstream) for branch in $dim_branches ; do repo=$(branch_to_repo $branch)Signature · 1 line
2.11.0
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 1/1 dim: cd to dim repo in list-upstreams
In reply to Jani NikulaDon't assume current directory works.
--- dim | 2 ++ 1 file changed, 2 insertions(+)
dim +2 -0
@@ -1751,6 +1751,8 @@ function dim_list_upstreams { local dim_drm_upstream_remote + cd $DIM_PREFIX/$DIM_REPO + dim_drm_upstream_remote=$(repo_to_remote drm-upstream) echo origin/master
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [dim PATCH] dim: cd to dim repo in list-upstreams
Quoted 3 lines · Jani Nikula
Don't assume current directory works.
Signed-off-by Jani Nikula <[email protected]>
On all 6 + this patch here:
Thanks for doing this de-dusting.
-Daniel
Quoted 20 lines
--- dim | 2 ++ 1 file changed, 2 insertions(+)dim +2
-0@@ -1751,6 +1751,8 @@ function dim_list_upstreams { local dim_drm_upstream_remote + cd $DIM_PREFIX/$DIM_REPO + dim_drm_upstream_remote=$(repo_to_remote drm-upstream) echo origin/masterSignature · 1 line
2.11.0
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