Hi,

I guess it might be worth mentioning somewhere in the wiki how to
easily (in an automated fashion) add r-b tags to a range of
commits. Following Jon's suggestion on IRC, I've opted for:

git filter-branch --msg-filter 'add-tag.sh "Reviewed-by: Peter Hutterer 
<[email protected]>" "Reviewed-by: Daniel Stone <[email protected]>"' 
origin/master..

(You may want to pass -f if you play with it several times in a row.)

add-tag.sh:
--o<--o<--o<--
#!/bin/sh

# Build the awk command line, reverse param orders:
cmd=
for i in "$@"; do
  cmd="print \"$i\"; $cmd"
done

# Insert lines after the first/last empty line:
tac|awk "BEGIN { done=0 }; /^$/ { if (done < 1) $cmd ; done=1 }; { print };"|tac
-->o-->o-->o--

Seems to work fine for a few examples; and can easily be tweaked to
learn about usual tag aliases (r-b et al.), and possibly people
aliases (peter, daniels, etc.).

Or just put everything in a file (letting your editor deal with alias
expansion), and replace the first part of the “script” with a while
read loop on that file's contents.

That could become:
  git filter-branch -f --msg-filter "add-tag-two.sh $(pwd)/.rb"  origin/master..

add-tag-two.sh:
--o<--o<--o<--
#!/bin/sh

# Make sure the file exists:
tagfile=$1
if [ -z "$tagfile" -o ! -f $tagfile ]; then
    echo "E: Missing tag file ($tagfile); cwd=$(pwd)" >&2
    exit 1
fi

# Build the awk command line, reverse line orders:
cmd=
while read line; do
  cmd="print \"$line\"; $cmd"
done < $tagfile

# Insert lines after the last empty line:
tac|awk "BEGIN { done=0 }; /^$/ { if (done < 1) $cmd ; done=1 }; { print };"|tac
-->o-->o-->o--

The pitfall is that cwd points to .git-rewrite/t when that script is
run, so passing just '.rb' would fail.

Mraw,
KiBi.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to