[PATCH v2] dim: Add dim rebase command

Daniel Vetter daniel.vetter at ffwll.ch
Fri Dec 7 13:07:12 UTC 2018


On Fri, Dec 7, 2018 at 1:37 PM Jani Nikula <jani.nikula at linux.intel.com> wrote:
>
> On Tue, 28 Aug 2018, Sean Paul <sean at poorly.run> wrote:
> > From: Sean Paul <seanpaul at chromium.org>
> >
> > Since -fixes and -fixes-next (to a lesser extent) are rebasing trees in
> > drm-misc, add a dim rebase command that sanity checks the upstream and
> > adds SoB for the committer.
> >
> > Changes in v2:
> > - s/validate_upstream_branch/validate_upstream_baseline/ (Daniel)
> > - Use check_conflicts instead of hand rolling (Daniel)
> >
> > Cc: Boris Brezillon <boris.brezillon at bootlin.com>
> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> > Signed-off-by: Sean Paul <seanpaul at chromium.org>
> > ---
> >  dim     | 42 +++++++++++++++++++++++++++++++++++++-----
> >  dim.rst |  8 ++++++++
> >  2 files changed, 45 insertions(+), 5 deletions(-)
> >
> > diff --git a/dim b/dim
> > index 5040d6b046b2..3f5fdb9233f7 100755
> > --- a/dim
> > +++ b/dim
> > @@ -1014,12 +1014,12 @@ function dim_apply_pull
> >       return $rv
> >  }
> >
> > -function dim_backmerge
> > +function validate_upstream_baseline
> >  {
> > -     local branch upstream patch_file
> > +     local branch upstream
> >
> > -     branch=${1:?$usage}
> > -     upstream=${2:?$usage}
> > +     branch=${1}
> > +     upstream=${2}
> >
> >       cd $DIM_PREFIX/drm-tip
> >
> > @@ -1041,6 +1041,16 @@ function dim_backmerge
> >
> >       assert_branch $branch
> >       assert_repo_clean
> > +}
> > +
> > +function dim_backmerge
> > +{
> > +     local branch upstream patch_file
> > +
> > +     branch=${1:?$usage}
> > +     upstream=${2:?$usage}
> > +
> > +     validate_upstream_baseline $branch $upstream
> >
> >       git merge --rerere-autoupdate --no-commit $upstream >& /dev/null || true
> >
> > @@ -1059,7 +1069,7 @@ function dim_backmerge
> >
> >               HERE
> >
> > -     if git diff | grep -q '\(<<<<<<<\|=======\|>>>>>>>\||||||||\)' ; then
> > +     if ! check_conflicts "$upstream" ; then
> >               echoerr "Conflicts found while merging $upstream into $branch."
> >               echoerr "This should only happen when git rerere gets confused"
> >               echoerr "or if there's a manual fixup patch in drm-rerere."
> > @@ -1072,6 +1082,28 @@ function dim_backmerge
> >       git commit -s
> >  }
> >
> > +function dim_rebase
> > +{
> > +     local branch upstream patch_file
> > +
> > +     branch=${1:?$usage}
> > +     upstream=${2:?$usage}
> > +
> > +     validate_upstream_baseline $branch $upstream
> > +
> > +     git rebase --signoff $upstream >& /dev/null || true
>
> So the version of git I use doesn't have --signoff option, and this
> completely silences the output and the exit code completely, doing
> nothing.

Totally untested, but something like git rebase --execute "git commit
--amend --signoff --no-edit" should work too.
-Daniel

>
> BR,
> Jani.
>
>
> > +     if ! check_conflicts "$upstream" ; then
> > +             echoerr "Conflicts found while rebasing $branch onto $upstream."
> > +             echoerr "Please proceed with extreme caution."
> > +             echoerr "Resolve the conflict and test it.  Once the conflict "
> > +             echoerr "is resolved, commit it with: "
> > +             echoerr "   git commit -a"
> > +             echoerr "And continue the rebase with: "
> > +             echoerr "   git rebase --continue"
> > +             exit 1
> > +     fi
> > +}
> > +
> >  function dim_add_link
> >  {
> >       local branch file message_id
> > diff --git a/dim.rst b/dim.rst
> > index 6d7528ce497f..4137d1be6f52 100644
> > --- a/dim.rst
> > +++ b/dim.rst
> > @@ -338,6 +338,14 @@ Backmerges *upstream* into *branch*, making a few sanity checks on the way. The
> >  using **pull-request**. Alternatively it can also be a tag, which if available
> >  should be preferred.
> >
> > +rebase *branch* *upstream*
> > +-----------------------------
> > +
> > +Rebases *branch* onto *upstream*, making a few sanity checks on the way. The
> > +*upstream* we rebase onto should be the same as used for sending out pull requests
> > +using **pull-request**. Alternatively it can also be a tag, which if available
> > +should be preferred.
> > +
> >  update-next
> >  -----------
> >  Pushes out the latest dinq to drm-intel-next and tags it. Also
>
> --
> Jani Nikula, Intel Open Source Graphics Center



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dim-tools mailing list