Markus Rothe wrote:     [Tue Aug 09 2005, 07:36:18AM EDT]
> Personaly I find it a little bit annoying to write changes twise.
> One time in Changelog and one time in --commitmsg. How about using
> the commitmsg for Changelog as default, but if a Changelog entry
> already exists, then write nothing to Changelog.

A few others have posted their solutions to this problem.  Perhaps
some people will find my solution useful, since it's a bit more
sophisticated.  I've been using this for literally years now with no
modifications.

    - handles using editor for echangelog
    - fixes spacing before re-using the message for cvs commit
    - post-runs eviewcvs (for the sake of pasting into bugs)

# echangelog and repoman combined
er() {
  echangelog ${1:+"$*"} || return 1
  rc
}

# repoman commit with the message from the ChangeLog
rc() { 
  declare msg

  if [[ -n $* ]]; then
    msg="$*"
    echo "Using msg from command-line" >&2
  else
    msg=$(perl <ChangeLog -0777 -pe \
      's/^.*?\n  \d{2} \w{3} \d{4};.*?:\n//s || exit 1; # trim top
       s/\n(?:\*|  \d{2} \w{3} \d{4};).*//s;            # trim bottom
       s/^\s*//; s/\s*$//; s/^(?:  |\t)//gm;            # fix spacing
       #/^ /m || s/\s+/ /g;  # normalize spacing unless formatted
      ')
    if [[ $? != 0 || -z $msg ]]; then
      echo "couldn't parse message from ChangeLog" >&2
      return 1
    fi
    echo "Parsed msg from ChangeLog" >&2
  fi

  echo "----------" >&2
  echo "$msg" >&2
  echo "----------" >&2

  repoman commit -m "$msg" || return 1

  if [[ -x /usr/bin/eviewcvs ]]; then
    local f entry=$(perl -00ne '/^  \d/ and print, last' ChangeLog)
    entry=${entry%%:*}
    entry=${entry##*>}
    entry=${entry//,/ }
    for f in $entry; do
      [[ $f == -* ]] && continue
      f=${f#+}
      echo "$f"
    done | xargs -n1 eviewcvs
  fi
}

Regards,
Aron

--
Aron Griffis
Gentoo Linux Developer

Attachment: pgpwoTbgK9bLI.pgp
Description: PGP signature

Reply via email to