{"thread":{"id":"546","subject":"[RFC] allow file list editing during cg-commit","startedAt":"2005-05-09T04:14:59Z","lastAt":"2005-05-09T22:24:35Z","messageCount":6,"participants":["Eugene Surovegin","Marcel Holtmann","Petr Baudis","Jonas Fonseca"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2858","messageId":"20050509041459.GA13475@gate.ebshome.net","threadId":"546","inReplyTo":null,"subject":"[RFC] allow file list editing during cg-commit","fromName":"Eugene Surovegin","fromEmail":"ebs@ebshome.net","sentAt":"2005-05-09T04:14:59Z","receivedAt":"2005-05-09T04:14:59Z","isPatch":false,"sender":{"key":"ebs@ebshome.net","avatar":null},"body":"Hi!\n\nI just started playing with cogito and failed to find _easy_ way to\nselect which files will be committed and which won't. cg-commit seems\nto support specifying file list in command line, but this isn't very\nconvenient when the list is big.\n\nI tend to have many modified files in my repo, but commit them in\nseveral different changeset.\n\nI just made simple change to cg-commit which allows  editing file\nlist while editing log message; for example, if I have 30 files  ready\nfor commit, but want to commit only 29, I just remove this file\nfrom \"CG:\" list.\n\nPatch which demonstrates the idea follows. Please note, this is\njust a quick hack, and I probably missed some cg-commit cases, when\nsuch behavior is undesirable; also, I cheated a little to make\ngrepping easy :).\n\nSigned-off-by: Eugene Surovegin <ebs@ebshome.net>\n\nIndex: cg-commit\n===================================================================\n--- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-commit  (mode:100755)\n+++ uncommitted/cg-commit  (mode:100755)\n@@ -116,7 +116,7 @@\n \tfor file in \"${commitfiles[@]}\"; do\n \t\t# TODO: Prepend a letter describing whether it's addition,\n \t\t# removal or update. Or call git status on those files.\n-\t\techo \"CG:    $file\" >>$LOGMSG\n+\t\techo \"CG:F    $file\" >>$LOGMSG\n \t\t[ \"$msgs\" ] && ! [ \"$forceeditor\" ] && echo $file\n \tdone\n fi\n@@ -131,6 +131,11 @@\n \t\trm $LOGMSG $LOGMSG2\n \t\tdie 'Commit message not modified, commit aborted'\n \tfi\n+\teval commitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))\n+\tif [ ! \"${commitfiles[*]}\" ]; then\n+\t\trm $LOGMSG $LOGMSG2\n+\t\tdie 'Nothing to commit'\n+\tfi\n else\n \tcat >>$LOGMSG2\n fi\n"},{"id":"2867","messageId":"1115627229.8949.132.camel@pegasus","threadId":"546","inReplyTo":"20050509041459.GA13475@gate.ebshome.net","subject":"Re: [RFC] allow file list editing during cg-commit","fromName":"Marcel Holtmann","fromEmail":"marcel@holtmann.org","sentAt":"2005-05-09T08:27:09Z","receivedAt":"2005-05-09T08:27:09Z","isPatch":false,"sender":{"key":"marcel@holtmann.org","avatar":null},"body":"Hi Eugene,\n\n> I just started playing with cogito and failed to find _easy_ way to\n> select which files will be committed and which won't. cg-commit seems\n> to support specifying file list in command line, but this isn't very\n> convenient when the list is big.\n\ndo you know any SCM native text interface that supports such a thing? In\ngeneral this is done by high-level GUI based interfaces to the SCM or a\nspecial Emacs mode etc.\n\nRegards\n\nMarcel\n\n\n"},{"id":"2868","messageId":"20050509083312.GA17447@gate.ebshome.net","threadId":"546","inReplyTo":"1115627229.8949.132.camel@pegasus","subject":"Re: [RFC] allow file list editing during cg-commit","fromName":"Eugene Surovegin","fromEmail":"ebs@ebshome.net","sentAt":"2005-05-09T08:33:12Z","receivedAt":"2005-05-09T08:33:12Z","isPatch":false,"sender":{"key":"ebs@ebshome.net","avatar":null},"body":"On Mon, May 09, 2005 at 10:27:09AM +0200, Marcel Holtmann wrote:\n> Hi Eugene,\n> \n> > I just started playing with cogito and failed to find _easy_ way to\n> > select which files will be committed and which won't. cg-commit seems\n> > to support specifying file list in command line, but this isn't very\n> > convenient when the list is big.\n> \n> do you know any SCM native text interface that supports such a thing? In\n> general this is done by high-level GUI based interfaces to the SCM or a\n> special Emacs mode etc.\n\nPerforce works like that. This is where I \"stole\" this idea :)\n\nI think cogito _is_ UI, a text one, of course.\n\n-- \nEugene\n\n"},{"id":"2869","messageId":"20050509084606.GD3599@pasky.ji.cz","threadId":"546","inReplyTo":"1115627229.8949.132.camel@pegasus","subject":"Re: [RFC] allow file list editing during cg-commit","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-05-09T08:46:06Z","receivedAt":"2005-05-09T08:46:06Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, May 09, 2005 at 10:27:09AM CEST, I got a letter\nwhere Marcel Holtmann <marcel@holtmann.org> told me that...\n> Hi Eugene,\n\nHello,\n\n> > I just started playing with cogito and failed to find _easy_ way to\n> > select which files will be committed and which won't. cg-commit seems\n> > to support specifying file list in command line, but this isn't very\n> > convenient when the list is big.\n> \n> do you know any SCM native text interface that supports such a thing? In\n> general this is done by high-level GUI based interfaces to the SCM or a\n> special Emacs mode etc.\n\nso what? I still think the idea is cool, why shouldn't support it if\nnoone else does?\n\nThe only thing to watch out for is that cg-commit -C produces no such\nlist at all; it should deal with that and tell the user he is not going\nto be able to control what is going to be committed then.\n\nAnother thing is that at the moment you modify the file list, you should\nset customfiles - otherwise you will commit even cg-adds and cg-rms of\nfiles you didn't select. But do that really only when you change the\nfile list, since it is more expensive.\n\nYou should also place an appropriate hint near the CG: lines, saying\nthat removing some of them will limit the list of files to be committed.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"2885","messageId":"20050509152411.GA24779@diku.dk","threadId":"546","inReplyTo":"20050509041459.GA13475@gate.ebshome.net","subject":"Re: [RFC] allow file list editing during cg-commit","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2005-05-09T15:24:11Z","receivedAt":"2005-05-09T15:24:11Z","isPatch":false,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Eugene Surovegin <ebs@ebshome.net> wrote Sun, May 08, 2005:\n> I just started playing with cogito and failed to find _easy_ way to\n> select which files will be committed and which won't. cg-commit seems\n> to support specifying file list in command line, but this isn't very\n> convenient when the list is big.\n\nThe commit message is already very self documenting so it would be great\nif this feature was also documented there. Something like the following,\nbut clearer:\n\nCG: -----------------------------------------------------------------\nCG: Lines beginning with the CG: prefix are removed automatically.\nCG: By deleting lines beginning with `CG:F' the associated file will\nCG: be removed from the commit list.\nCG: ...\n\n-- \nJonas Fonseca\n"},{"id":"2917","messageId":"20050509222435.GA25901@gate.ebshome.net","threadId":"546","inReplyTo":"20050509084606.GD3599@pasky.ji.cz","subject":"Re: [RFC] allow file list editing during cg-commit","fromName":"Eugene Surovegin","fromEmail":"ebs@ebshome.net","sentAt":"2005-05-09T22:24:35Z","receivedAt":"2005-05-09T22:24:35Z","isPatch":false,"sender":{"key":"ebs@ebshome.net","avatar":null},"body":"On Mon, May 09, 2005 at 10:46:06AM +0200, Petr Baudis wrote:\n\n[snip]\n\n> The only thing to watch out for is that cg-commit -C produces no such\n> list at all; it should deal with that and tell the user he is not going\n> to be able to control what is going to be committed then.\n> \n> Another thing is that at the moment you modify the file list, you should\n> set customfiles - otherwise you will commit even cg-adds and cg-rms of\n> files you didn't select. But do that really only when you change the\n> file list, since it is more expensive.\n> \n> You should also place an appropriate hint near the CG: lines, saying\n> that removing some of them will limit the list of files to be committed.\n\nOK, how about the following patch? I tried to address all issues you \nmentioned and also $merging case as well.\n\nSigned-off-by: Eugene Surovegin <ebs@ebshome.net>\n\nIndex: cg-commit\n===================================================================\n--- 972d8624458936868e6f392b40858b7c362af8cd/cg-commit  (mode:100755)\n+++ uncommitted/cg-commit  (mode:100755)\n@@ -111,12 +111,16 @@\n \t\trm $LOGMSG $LOGMSG2\n \t\tdie 'Nothing to commit'\n \tfi\n+\tif [ ! \"$merging\" ]; then\n+\t\techo \"CG: By deleting lines beginning with CG:F the associated file\" >>$LOGMSG \n+\t\techo \"CG: will be removed from the commit list.\" >>$LOGMSG \n+\tfi\t\n \techo \"CG:\" >>$LOGMSG\n \techo \"CG: Modified files:\" >>$LOGMSG\n \tfor file in \"${commitfiles[@]}\"; do\n \t\t# TODO: Prepend a letter describing whether it's addition,\n \t\t# removal or update. Or call git status on those files.\n-\t\techo \"CG:    $file\" >>$LOGMSG\n+\t\techo \"CG:F    $file\" >>$LOGMSG\n \t\t[ \"$msgs\" ] && ! [ \"$forceeditor\" ] && echo $file\n \tdone\n fi\n@@ -131,6 +135,17 @@\n \t\trm $LOGMSG $LOGMSG2\n \t\tdie 'Commit message not modified, commit aborted'\n \tfi\n+\tif [ ! \"$ignorecache\" ] && [ ! \"$merging\" ]; then\n+\t\teval newcommitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))\n+\t\tif [ ! \"${newcommitfiles[*]}\" ]; then\n+\t\t\trm $LOGMSG $LOGMSG2\n+\t\t\tdie 'Nothing to commit'\n+\t\tfi\n+\t\tif [ \"${commitfiles[*]}\" != \"${newcommitfiles[*]}\" ]; then\n+\t\t\tcommitfiles=\"${newcommitfiles[*]}\"\n+\t\t\tcustomfiles=\"${commitfiles[*]}\"\n+\t\tfi\n+\tfi\n else\n \tcat >>$LOGMSG2\n fi\n\n"}]}