How to add signoffs (Signed-Off-By: ...) ?

Kirill Smelkov kirr at landau.phys.spbu.ru
Sat Jun 28 07:56:47 CDT 2008


On Sat, Jun 28, 2008 at 07:32:52AM +0200, Peter Arrenbrecht wrote:
> On Sat, Jun 28, 2008 at 12:29 AM, Gregory Collins <greg at maptuit.com> wrote:
> > Kirill Smelkov <kirr at landau.phys.spbu.ru> writes:
> >
> >> Good evening,
> >>
> >> I'd like to ask a question about how to add signoffs like people do in
> >> Linux kernel.
> >>
> >>
> >> My workflow is something like this:
> >>
> >> When someone sends a patch series to our -patches list, I'd like to
> >> import it into staging tree and add my "Signed-Off-By: me", or
> >> "Reviewed-By: me".
> >>
> >> The problem is that to my knowledge and understanding of mercurial
> >> codebase this is not possible with e.g.  commit/precommit/pretxncommit
> >> hooks.
> >
> > You'll probably need to rewrite the changeset message to
> > accomplish. Take a look at the mercurial queues extension; to add your
> > signoff message you could do:
> >
> > $ hg qimport foo.diff
> >
> > # push patch onto queue
> > $ hg qpush
> >
> > # modify changeset message here
> > $ hg qrefresh -e
> >
> > # turn it into a "normal" changeset, i.e. import it into tree
> > $ hg qdelete foo.diff
> 
> I think this should rather be
> 
> $ hg qdelete -r tip
> 
> Note that to add your signoff message, you could also edit the patch
> directly (at least if it's in git format), either before or after
> qimport, but certainly before qpush. This might be easier to automate.

Gregory, Peter, thanks for the tips.

I always knew about MQ, but my aim was to automate this procedure, so
I've crafted attached hg-import-signoff script -- it works the same way
as 'hg import' but adds 'Signed-Off-By'.

What do you think about it?


Now another question is that I thing this is pretty oftenly needed, and
is there a way to integrate this facility with Mercurial?

Initially I though this could be done in some preXXX hook, but it seems
with the current state it is not possible...

Thanks again.

-- 
    Всего хорошего, Кирилл.
-------------- next part --------------
#!/bin/sh -e

die () {
    echo "E: dying ..."
    exit 1
}

# first import pristine patch
hg import $@

# this is original patch description
patchdesc=`hg log -r tip --template='{desc}'`

# whoami + new patch description
me=`hg showconfig ui.username`
newpatchdesc="$patchdesc

Signed-Off-By: $me"


# # export/reimport
# TMPFILE=`mktemp -t hgimport.XXXXXXXXXX` || die
#
# # let's now export patch and reimport it with modified description
# hg export tip > $TMPFILE
# hg strip tip
#
# hg import --message "$newpatchdesc" $TMPFILE

# rollback/recommit
echo "adding signoff ..."
hg rollback --quiet
hg commit --message "$newpatchdesc"


More information about the Mercurial mailing list