git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: CVS to git: parsing ChangeLog entries?
Date: Sat, 15 Mar 2008 11:38:42 +0100	[thread overview]
Message-ID: <20080315103841.GB14769@ins.uni-bonn.de> (raw)
In-Reply-To: <20080313170322.GA3580@sigill.intra.peff.net>

* Jeff King wrote on Thu, Mar 13, 2008 at 06:03:22PM CET:
> On Wed, Mar 12, 2008 at 08:08:27PM +0100, Ralf Wildenhues wrote:
> 
> > when migrating a project that uses GNU-style ChangeLogs from CVS
> > to git, is it possible to extract patch author information from
> > the ChangeLog entries rather than from the CVS commit logs?

> I don't think there is a way to do this automatically with
> git-cvsimport. However, once imported, I think you could rewrite history
> using git-filter-branch with a filter that looked at the diff of
> ChangeLog for that commit and rewrote the author. See the documentation
> for git-filter-branch.

Thank you, I just learned a new cool tool!

FWIW, here's what I used successfully on a repository with only one
ChangeLog file (some fiddling to cope with format variations):

git filter-branch -d /dev/shm/t --tree-filter '
  line=`sed -n "s,^[12][90][0-9][0-9]-[0-1][0-9]-[0-3][0-9]  *\([A-Za-z].*\),\1,;
                s,.*  \([A-Za-z].*\),\1,;
                /./{
                        s/(tiny change)//
                        s/ *$//
                        p
                        q
                }" ChangeLog`
  author=`echo "$line" | sed "s, *[<(].*,,"`
  email=`echo "$line" | sed "s,[^,(]*[<(],<,; s/[)>].*/>/"`
  test -n "$author" && test -n "$email" && {
        GIT_AUTHOR_NAME="$author"
        GIT_AUTHOR_EMAIL="$email"
        export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
  }'

> > Related question: when CVS commit logs have varying encoding,
> > say, some latin1 and some UTF-8, is it possible to have uniformly
> > encoded git log entries?
> 
> I don't think git-cvsimport does much with encodings at all. But again,
> you could probably go back through the imported repo with
> git-filter-branch and iconv the commit messages as appropriate.

I'll try that, too.

Thanks!
Ralf

  reply	other threads:[~2008-03-15 10:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 19:08 CVS to git: parsing ChangeLog entries? Ralf Wildenhues
2008-03-13 17:03 ` Jeff King
2008-03-15 10:38   ` Ralf Wildenhues [this message]
2008-03-14 18:40 ` Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080315103841.GB14769@ins.uni-bonn.de \
    --to=ralf.wildenhues@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).