{"thread":{"id":"31622","subject":"[PATCH] Teach git-completion about git p4","startedAt":"2012-09-21T21:51:11Z","lastAt":"2012-09-26T00:48:38Z","messageCount":3,"participants":["Ryan Cumming","Junio C Hamano","Pete Wyckoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199707","messageId":"1348264271-99395-1-git-send-email-rcumming@ea.com","threadId":"31622","inReplyTo":null,"subject":"[PATCH] Teach git-completion about git p4","fromName":"Ryan Cumming","fromEmail":"etaoins@gmail.com","sentAt":"2012-09-21T21:51:11Z","receivedAt":"2012-09-21T21:51:11Z","isPatch":true,"sender":{"key":"etaoins@gmail.com","avatar":null},"body":"From: Ryan Cumming <etaoins@gmail.com>\n\ngit p4 was moved out of contrib in 1.7.11 but it git-completion didn't\nknow about it. Add git p4 completion based on the existing SVN\ncompletion. It covers all known subcommands and options except for the\n-/ option for clone which doesn't use the standard -- prefix.\n\nSigned-off-by: Ryan Cumming <etaoins@gmail.com>\n---\n contrib/completion/git-completion.bash | 44 ++++++++++++++++++++++++++++++++++\n 1 file changed, 44 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c48cd19..c6140be 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1459,6 +1459,50 @@ _git_notes ()\n \tesac\n }\n \n+_git_p4 ()\n+{\n+\tlocal subcommands=\"\n+\t\tclone sync rebase submit\n+\t\t\"\n+\tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n+\tif [ -z \"$subcommand\" ]; then\n+\t\t__gitcomp \"$subcommands\"\n+\telse\n+\t\tlocal common_opts=\"--git-dir= --verbose\"\n+\t\tlocal sync_opts=\"\n+\t\t\t--branch= --detect-branches --changes-file=\n+\t\t\t--silent --detect-labels --import-labels\n+\t\t\t--import-local --max-changes= --keep-path\n+\t\t\t--use-client-spec $common_opts\n+\t\t\t\"\n+\t\tlocal clone_opts=\"\n+\t\t\t--destination= --bare $sync_opts\n+\t\t\t\"\n+\t\tlocal submit_opts=\"\n+\t\t\t--origin= -M --preserve-user --export-labels\n+\t\t\t$common_opts\n+\t\t\t\"\n+\n+\t\tcase \"$subcommand,$cur\" in\n+\t\tclone,--*)\n+\t\t\t__gitcomp \"$clone_opts\"\n+\t\t\t;;\n+\t\tsync,--*)\n+\t\t\t__gitcomp \"$sync_opts\"\n+\t\t\t;;\n+\t\trebase,--*)\n+\t\t\t__gitcomp \"$common_opts --import-labels\"\n+\t\t\t;;\n+\t\tsubmit,--*)\n+\t\t\t__gitcomp \"$submit_opts\"\n+\t\t\t;;\n+\t\tsubmit,*)\n+\t\t\t__gitcomp \"$(__git_refs)\"\n+\t\t\t;;\n+\t\tesac\n+\tfi\n+}\n+\n _git_pull ()\n {\n \t__git_complete_strategy && return\n-- \n1.7.12.1\n"},{"id":"199822","messageId":"7vbogv1ju2.fsf@alter.siamese.dyndns.org","threadId":"31622","inReplyTo":"1348264271-99395-1-git-send-email-rcumming@ea.com","subject":"Re: [PATCH] Teach git-completion about git p4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-24T16:12:05Z","receivedAt":"2012-09-24T16:12:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ryan Cumming <etaoins@gmail.com> writes:\n\n> From: Ryan Cumming <etaoins@gmail.com>\n>\n> git p4 was moved out of contrib in 1.7.11 but it git-completion didn't\n> know about it. Add git p4 completion based on the existing SVN\n> completion. It covers all known subcommands and options except for the\n> -/ option for clone which doesn't use the standard -- prefix.\n>\n> Signed-off-by: Ryan Cumming <etaoins@gmail.com>\n> ---\n\nSounds sensible; thanks.\n\n> +_git_p4 ()\n> +{\n> +...\n> +\t\tlocal submit_opts=\"\n> +\t\t\t--origin= -M --preserve-user --export-labels\n> +\t\t\t$common_opts\n> +\t\t\t\"\n> +\n> +\t\tcase \"$subcommand,$cur\" in\n> ...\n> +\t\tsubmit,--*)\n> +\t\t\t__gitcomp \"$submit_opts\"\n\nThis is taken when $cur begins with --, but $submit_opts includes\n\"-M\" which doesn't begin with it.  Is that a problem?\n\n> +\t\t\t;;\n> +\t\tsubmit,*)\n> +\t\t\t__gitcomp \"$(__git_refs)\"\n> +\t\t\t;;\n> +\t\tesac\n> +\tfi\n> +}\n"},{"id":"199919","messageId":"20120926004838.GA29907@padd.com","threadId":"31622","inReplyTo":"1348264271-99395-1-git-send-email-rcumming@ea.com","subject":"Re: [PATCH] Teach git-completion about git p4","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2012-09-26T00:48:38Z","receivedAt":"2012-09-26T00:48:38Z","isPatch":true,"sender":{"key":"pw@padd.com","avatar":null},"body":"etaoins@gmail.com wrote on Fri, 21 Sep 2012 14:51 -0700:\n> git p4 was moved out of contrib in 1.7.11 but it git-completion didn't\n> know about it. Add git p4 completion based on the existing SVN\n> completion. It covers all known subcommands and options except for the\n> -/ option for clone which doesn't use the standard -- prefix.\n\nVery nice, thank you.  A couple nits.\n\n> +_git_p4 ()\n> +{\n> +\tlocal subcommands=\"\n> +\t\tclone sync rebase submit\n> +\t\t\"\n> +\tlocal subcommand=\"$(__git_find_on_cmdline \"$subcommands\")\"\n> +\tif [ -z \"$subcommand\" ]; then\n> +\t\t__gitcomp \"$subcommands\"\n> +\telse\n> +\t\tlocal common_opts=\"--git-dir= --verbose\"\n> +\t\tlocal sync_opts=\"\n> +\t\t\t--branch= --detect-branches --changes-file=\n\nIt's --changesfile (no dash), weird, but true.\n\n> +\t\t\t--silent --detect-labels --import-labels\n> +\t\t\t--import-local --max-changes= --keep-path\n> +\t\t\t--use-client-spec $common_opts\n> +\t\t\t\"\n> +\t\tlocal clone_opts=\"\n> +\t\t\t--destination= --bare $sync_opts\n> +\t\t\t\"\n> +\t\tlocal submit_opts=\"\n> +\t\t\t--origin= -M --preserve-user --export-labels\n> +\t\t\t$common_opts\n> +\t\t\t\"\n\nVery recently we added --dry-run and --prepare-p4-only and\n--conflict to submit.  Follow 8db3865^2 to see the patches\nfor those.\n\n> +\t\tcase \"$subcommand,$cur\" in\n> +\t\tclone,--*)\n> +\t\t\t__gitcomp \"$clone_opts\"\n> +\t\t\t;;\n> +\t\tsync,--*)\n> +\t\t\t__gitcomp \"$sync_opts\"\n> +\t\t\t;;\n> +\t\trebase,--*)\n> +\t\t\t__gitcomp \"$common_opts --import-labels\"\n\nThis would be prettier if it had its own local rebase_opts.\n\n> +\t\tsubmit,--*)\n> +\t\t\t__gitcomp \"$submit_opts\"\n> +\t\t\t;;\n> +\t\tsubmit,*)\n> +\t\t\t__gitcomp \"$(__git_refs)\"\n> +\t\t\t;;\n> +\t\tesac\n> +\tfi\n> +}\n> +\n>  _git_pull ()\n>  {\n>  \t__git_complete_strategy && return\n> -- \n> 1.7.12.1\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"}]}