{"thread":{"id":"2891","subject":"Pushing git patches to a subversion project","startedAt":"2005-12-21T05:37:26Z","lastAt":"2005-12-21T07:25:19Z","messageCount":2,"participants":["Martin Langhoff","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13858","messageId":"46a038f90512202137w772a3fe9p8e9e68345e39654a@mail.gmail.com","threadId":"2891","inReplyTo":null,"subject":"Pushing git patches to a subversion project","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2005-12-21T05:37:26Z","receivedAt":"2005-12-21T05:37:26Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"I am starting to work an svn-based upstream. In order to make life\neasy for me and for them I am trying to figure out a way for them to\nbe able to merge my (emailed) patches atomically and preserving my\ncomments.\n\nSomething like git-am for svn.\n\nIdeally, it should keep the patch as free of corruption as possible,\nas the results will be echoed back into my branches via git-svnimport\nand later \"cg-update upstream\" and I want git-cherry to have a fair go\nat matching them.\n\nThere doesn't seem to be much. SVN-based projects ask for unified\ndiffs mostly, and I can't find indication of patch trading that\nincludes commit messages.\n\nAny hints?\n\ncheers,\n\n\nmartin\n"},{"id":"13860","messageId":"7vpsnqdi8w.fsf@assigned-by-dhcp.cox.net","threadId":"2891","inReplyTo":"46a038f90512202137w772a3fe9p8e9e68345e39654a@mail.gmail.com","subject":"Re: Pushing git patches to a subversion project","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-21T07:25:19Z","receivedAt":"2005-12-21T07:25:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Langhoff <martin.langhoff@gmail.com> writes:\n\n> I am starting to work an svn-based upstream. In order to make life\n> easy for me and for them I am trying to figure out a way for them to\n> be able to merge my (emailed) patches atomically and preserving my\n> comments.\n>\n> Something like git-am for svn.\n\nMany building blocks git-am uses should be usable for this.\n\n * git-mailsplit you already know about due to earlier \"non UNIX\n   mbox\" discussion.\n\n * git-mailinfo can be used to parse out commit message, title\n   and authorship information, and actual patch.\n\n * git-apply without --index option can be used to apply patch\n   to the working tree, but normal \"patch -p1\" would do the same\n   unless it is a git renaming patch.  git-apply would also be\n   useful for its --summary option to find out mode changes\n   (if it is a git patch) and file creation and deletion.\n\nSo probably you could script something like this:\n\n\t$ git mailinfo .msg .patch <e-mail-file >.info\n        $ (sed -ne 's/^Subject: //p' .info ; echo ; cat .msg) >.final-msg\n\t$ git apply --summary <.patch |\n        while read cd mo de file\n        do\n        \tcase \"$cd\" in\n                create)\n                \tsvn add \"$file\" ;;\n\t\tdelete)\n                \tsvn rm \"$file\" ;;\n\t\tesac\n\tdone\n\t$ svn commit -F .final-msg\n"}]}