On 02/10/2014 01:32 PM, Martin Kosek wrote:
Hello,

I would like to follow up on a core devel team discussion we had last week. We
found out, that it would be beneficial to see a reviewer of the patches that
land in our git.

This will serve both as a nice way to both generate statistics who is devoted
to both writing new code, but also to reviewing other people's code (and win
prizes ;-), but it will also offer the git history archaeologist 2 names of
developers which should be the most knowledgeable about the patch.

We will use the current de-facto standard "Reviewed-By" tag. Example:

commit da70c6d9353cd29531c8e2c135db81a97f22293c
Author: Martin Kosek <mko...@redhat.com>
Date:   Mon Jan 27 12:28:12 2014 +0100

     Migration does not add users to default group

     When users with missing default group were searched, IPA suffix was
     not passed so these users were searched in a wrong base DN. Thus,
     no user was detected and added to default group.

     https://fedorahosted.org/freeipa/ticket/4141

     Reviewed-By: Petr Viktorin <pvikt...@redhat.com>


Currently, I used to add the tag via "git commit --amend". Does anybody have a
nice helper scripts or snippets to semi-automate it? Note that we will be able
to fully automate it when we start with an CI merging system.


I usually hack tasks like these with a special "editor" for git. I've attached one for Reviewed-By.

Usage:
REVIEWER='I Myself <me@ego.example>' GIT_EDITOR=add-reviewed-by.py git commit --amend -e


I'll use some time this week to write a better patch-pushing helper that'll incorporate this. (For the record, now we usually use https://github.com/mkosek/ipa-tools/blob/master/pushpatch.py)

--
PetrĀ³

#! /usr/bin/python2

import os
import re
import sys

reviewer = os.environ['REVIEWER']
assert re.match('(\w+) ([\w ]+) <.*@.*>', reviewer), 'wrong format of $REVIEWER'

with open(sys.argv[1]) as infile:
    lines = [line for line in infile.readlines() if not line.startswith('#')]

with open(sys.argv[1], 'w') as outfile:
    outfile.writelines(lines + ['Reviewed-By: %s' % reviewer])
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to