savannah-hackers-public
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Savannah-hackers-public] git-to-cvs for coreutils


From: Sylvain Beucler
Subject: Re: [Savannah-hackers-public] git-to-cvs for coreutils
Date: Mon, 8 Jan 2007 01:29:23 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Hi,

I'll check the code more deeply asap, just a few comments meanwhile:

- we install software along with security updates. In the case of git
we track upstream's git manually and make a debian package based on
backport.org's git-core/debian/ files. You want to install git-cvs
which unfortunately requires a newer version of cvsps not packages for
sarge. This begins to be cumbersome so we might drop the Debian
packaging and install git from bare sources.

Check ~/infra/git.txt for details.

Anyway I mean it's Bad (tm) to install binaries (git-cvsexportcommit)
without a security track. Feel free to install software but setup
security/updates alongside :)

- I try to imagine how this could then be automated. I'm thinking of
something smilar to CVS commitinfo/loginfo: 'update' would then be a
wrapper script generated by Savane, calling your unmodified script
with command line arguments. It would be good then to be able to
control your script with command line arguments instead of using a
modified version of the script for each project.

- I'm not sure address@hidden is a valid adress, there's no smtp
service for receiving mail at SV. I don't understand the issue with
mails "From: address@hidden", can you explain me?

Thanks!

-- 
Sylvain

On Sat, Jan 06, 2007 at 04:24:51PM +0100, Jim Meyering wrote:
> FYI,
> 
> I installed the modified update hook for coreutils,
> then made it executable:
> 
>   chmod a+x /srv/git/coreutils.git/hooks/update
> 
> I had two coreutils change sets from this morning, and to test, I pushed
> them.  The push failed with diagnostics saying that git-cvsexportcommit
> was not found.  So I copied git-cvsexportcommit (from latest git.git)
> to /usr/bin in the vserver, and then used it to manually mirror those
> two change sets:
> 
>   # cd /var/tmp/git-to-cvs/coreutils/
>   # export GIT_DIR=/srv/git/coreutils.git
>   # git-cvsexportcommit -a -c -p -v 37bcc2770788d8fd9fd8cda3413a27dd131d9e22
>   # git-cvsexportcommit -a -c -p -v bce110cdd584f52f91bd83ba17078e63d8b89841
> 
> Those succeeded, so I'm optimistic that my next push will succeed.
> Here's the script:
> [Note: I've recently added mail's -a 'From:...' option, since the first
>  message I received was "From: address@hidden", which was not good
>  at all, since it was from sv.gnu.org.
>  Also, note that it's sending email for each push to me.
>  I'd rather send to a list, and will do so, eventually, but
>  this is ok while testing things. ]
> 
> ----------------------
> #!/bin/sh
> #
> VERSION='2007-01-06 15:03' # UTC
> # Based on an example hook script to mail out commit update information.
> # It also does the following:
> # - blocks tags that aren't annotated.
> # - propagates each git change-set to a CVS repository
> # Called by git-receive-pack with arguments: refname sha1-old sha1-new
> #
> # To enable this hook:
> # (1) change the recipient e-mail address
> # (2) make this file executable by "chmod +x update".
> # (3) set cvs_working_dir to the name of a cvs-checked-out
> #     copy of the same content that's in the git repository.
> #
> 
> project=$(cat $GIT_DIR/description)
> recipients="address@hidden"
> cvs_working_dir=/var/tmp/git-to-cvs/coreutils
> 
> ref_type=$(git cat-file -t "$3")
> 
> # Only allow annotated tags in a shared repo
> # Remove this code to treat dumb tags the same as everything else
> case "$1","$ref_type" in
> refs/tags/*,commit)
>       echo "*** Un-annotated tags are not allowed in this repo" >&2
>       echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
>       exit 1;;
> refs/tags/*,tag)
>       echo "### Pushing version '${1##refs/tags/}' to the masses" >&2
>       # recipients="address@hidden address@hidden"
>       ;;
> esac
> 
> # set this  to 'cat' to get a very detailed listing.
> # short only kicks in when an annotated tag is added
> short='git shortlog'
> 
> # see 'date --help' for info on how to write this
> # The default is a human-readable iso8601-like format with minute
> # precision ('2006-01-25 15:58 +0100' for example)
> date_format="%F %R %z"
> 
> (if expr "$2" : '0*$' >/dev/null
> then
>       # new ref
>       case $1 in
>       refs/tags/*)
>               # a pushed and annotated tag (usually) means a new version
>               tag="${1##refs/tags/}"
>               cvs_tag=$(echo "$tag"|sed 's/\./_/g')
>               ( cd $cvs_working_dir && cvs tag "$cvs_tag" )
>               if [ "$ref_type" = tag ]; then
>                       eval $(git cat-file tag $3 | \
>                               sed -n '4s/tagger 
> \([^>]*>\)[^0-9]*\([0-9]*\).*/tagger="\1" ts="\2"/p')
>                       date=$(date --date="1970-01-01 00:00:00 $ts seconds" 
> +"$date_format")
>                       echo "Tag '$tag' created by $tagger at $date"
>                       git cat-file tag $3 | sed -n '5,$p'
>                       echo
>               fi
>               prev=$(git describe "$3^" | sed 's/-g.*//')
>               # the first tag in a repo will yield no $prev
>               if [ -z "$prev" ]; then
>                       echo "Changes since the dawn of time:"
>                       git rev-list --pretty $3 | $short
>               else
>                       echo "Changes since $prev:"
>                       git rev-list --pretty $prev..$3 | $short
>                       echo ---
>                       git diff --stat $prev..$3
>                       echo ---
>               fi
>               ;;
> 
>       refs/heads/*)
>               branch="${1##refs/heads/}"
>               echo "New branch '$branch' available with the following 
> commits:"
>               git-rev-list --pretty "$3" $(git-rev-parse --not --all)
>               ;;
>       esac
> else
>       base=$(git-merge-base "$2" "$3")
>       case $base in
>       "$2")
>               git diff --stat "$3" "^$base"
>               echo
>               echo "New commits:"
>               ;;
>       *)
>               echo "Rebased ref, commits from common ancestor:"
>               ;;
>       esac
> 
>       git-rev-list --pretty "$3" "^$base"
> 
>       # Mirror to cvs only changes on "master".
>       # Don't bother trying to mirror git tags to cvs.
>       if test "$1" = refs/heads/master; then
>         (
>           export GIT_DIR=$(cd $GIT_DIR; pwd)
>           cd $cvs_working_dir
>           for sha1 in $(git-rev-list "$3" "^$base"); do
>             git-cvsexportcommit -a -c -p -v $sha1
>           done
>         )
>       fi
> fi) |
> mail -a 'From: address@hidden' \
>     -s "$project: Changes to '${1##refs/heads/}'" $recipients
> exit 0
> 
> ## Local Variables:
> ## eval: (add-hook 'write-file-hooks 'time-stamp)
> ## time-stamp-start: "VERSION='"
> ## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
> ## time-stamp-time-zone: "UTC"
> ## time-stamp-end: "' # UTC"
> ## End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]