{"thread":{"id":"12652","subject":"CVS to git: parsing ChangeLog entries?","startedAt":"2008-03-12T19:08:27Z","lastAt":"2008-03-15T10:38:42Z","messageCount":4,"participants":["Ralf Wildenhues","Jeff King","Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"71829","messageId":"20080312190827.GE3198@ins.uni-bonn.de","threadId":"12652","inReplyTo":null,"subject":"CVS to git: parsing ChangeLog entries?","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2008-03-12T19:08:27Z","receivedAt":"2008-03-12T19:08:27Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"Hello,\n\nwhen migrating a project that uses GNU-style ChangeLogs from CVS\nto git, is it possible to extract patch author information from\nthe ChangeLog entries rather than from the CVS commit logs?\nFor simplicity let's first assume the project used only one\nChangeLog file.\n\nAsking because it is not uncommon that patches are committed on\nbehalf of other people, and it would be nice to credit them.\n\nRelated question: when CVS commit logs have varying encoding,\nsay, some latin1 and some UTF-8, is it possible to have uniformly\nencoded git log entries?\n\nThank you, and please Cc: me on replies,\nRalf\n"},{"id":"71961","messageId":"20080313170322.GA3580@sigill.intra.peff.net","threadId":"12652","inReplyTo":"20080312190827.GE3198@ins.uni-bonn.de","subject":"Re: CVS to git: parsing ChangeLog entries?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-03-13T17:03:22Z","receivedAt":"2008-03-13T17:03:22Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 12, 2008 at 08:08:27PM +0100, Ralf Wildenhues wrote:\n\n> when migrating a project that uses GNU-style ChangeLogs from CVS\n> to git, is it possible to extract patch author information from\n> the ChangeLog entries rather than from the CVS commit logs?\n> For simplicity let's first assume the project used only one\n> ChangeLog file.\n\nI don't think there is a way to do this automatically with\ngit-cvsimport. However, once imported, I think you could rewrite history\nusing git-filter-branch with a filter that looked at the diff of\nChangeLog for that commit and rewrote the author. See the documentation\nfor git-filter-branch.\n\n> Related question: when CVS commit logs have varying encoding,\n> say, some latin1 and some UTF-8, is it possible to have uniformly\n> encoded git log entries?\n\nI don't think git-cvsimport does much with encodings at all. But again,\nyou could probably go back through the imported repo with\ngit-filter-branch and iconv the commit messages as appropriate.\n\n-Peff\n"},{"id":"72127","messageId":"47DAC6A1.7070400@alum.mit.edu","threadId":"12652","inReplyTo":"20080312190827.GE3198@ins.uni-bonn.de","subject":"Re: CVS to git: parsing ChangeLog entries?","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2008-03-14T18:40:33Z","receivedAt":"2008-03-14T18:40:33Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"I'll answer your questions from the point of view of cvs2git, a.k.a.\ncvs2svn (http://cvs2svn.tigris.org).\n\nRalf Wildenhues wrote:\n> when migrating a project that uses GNU-style ChangeLogs from CVS\n> to git, is it possible to extract patch author information from\n> the ChangeLog entries rather than from the CVS commit logs?\n> For simplicity let's first assume the project used only one\n> ChangeLog file.\n> \n> Asking because it is not uncommon that patches are committed on\n> behalf of other people, and it would be nice to credit them.\n\nThere is no builtin support for this in cvs2git.  But the place where\nthe author is determined knows about the whole changeset, including any\nsimultaneous changes to the changelog.  So it should be possible to add\nthis functionality without too much work.\n\n> Related question: when CVS commit logs have varying encoding,\n> say, some latin1 and some UTF-8, is it possible to have uniformly\n> encoded git log entries?\n\ncvs2git allows you to specify multiple encodings.  It tries one after\nthe other until one works successfully.  It also has hooks where you can\nadd your own decoder using arbitrary Python code.\n\nThat reminds me that there is a Python universal decoder that uses\nheuristics to determine the encoding of an arbitrary octet stream.  That\nmight be a nice thing to add support for....\n\nMichael\n"},{"id":"72172","messageId":"20080315103841.GB14769@ins.uni-bonn.de","threadId":"12652","inReplyTo":"20080313170322.GA3580@sigill.intra.peff.net","subject":"Re: CVS to git: parsing ChangeLog entries?","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2008-03-15T10:38:42Z","receivedAt":"2008-03-15T10:38:42Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"* Jeff King wrote on Thu, Mar 13, 2008 at 06:03:22PM CET:\n> On Wed, Mar 12, 2008 at 08:08:27PM +0100, Ralf Wildenhues wrote:\n> \n> > when migrating a project that uses GNU-style ChangeLogs from CVS\n> > to git, is it possible to extract patch author information from\n> > the ChangeLog entries rather than from the CVS commit logs?\n\n> I don't think there is a way to do this automatically with\n> git-cvsimport. However, once imported, I think you could rewrite history\n> using git-filter-branch with a filter that looked at the diff of\n> ChangeLog for that commit and rewrote the author. See the documentation\n> for git-filter-branch.\n\nThank you, I just learned a new cool tool!\n\nFWIW, here's what I used successfully on a repository with only one\nChangeLog file (some fiddling to cope with format variations):\n\ngit filter-branch -d /dev/shm/t --tree-filter '\n  line=`sed -n \"s,^[12][90][0-9][0-9]-[0-1][0-9]-[0-3][0-9]  *\\([A-Za-z].*\\),\\1,;\n                s,.*  \\([A-Za-z].*\\),\\1,;\n                /./{\n                        s/(tiny change)//\n                        s/ *$//\n                        p\n                        q\n                }\" ChangeLog`\n  author=`echo \"$line\" | sed \"s, *[<(].*,,\"`\n  email=`echo \"$line\" | sed \"s,[^,(]*[<(],<,; s/[)>].*/>/\"`\n  test -n \"$author\" && test -n \"$email\" && {\n        GIT_AUTHOR_NAME=\"$author\"\n        GIT_AUTHOR_EMAIL=\"$email\"\n        export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL\n  }'\n\n> > Related question: when CVS commit logs have varying encoding,\n> > say, some latin1 and some UTF-8, is it possible to have uniformly\n> > encoded git log entries?\n> \n> I don't think git-cvsimport does much with encodings at all. But again,\n> you could probably go back through the imported repo with\n> git-filter-branch and iconv the commit messages as appropriate.\n\nI'll try that, too.\n\nThanks!\nRalf\n"}]}