git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Teach git-completion about git p4

From
PWPete Wyckoff <pw@padd.com>
Date
Sep 26, 2012, 00:48 UTC
Message-ID
<20120926004838.GA29907@padd.com>
In-Reply-To
<1348264271-99395-1-git-send-email-rcumming@ea.com>
etaoins@gmail.com wrote on Fri, 21 Sep 2012 14:51 -0700:
> git p4 was moved out of contrib in 1.7.11 but it git-completion didn't
> know about it. Add git p4 completion based on the existing SVN
> completion. It covers all known subcommands and options except for the
> -/ option for clone which doesn't use the standard -- prefix.
Very nice, thank you.  A couple nits.
Show 12 quoted lines
> +_git_p4 ()
> +{
> +	local subcommands="
> +		clone sync rebase submit
> +		"
> +	local subcommand="$(__git_find_on_cmdline "$subcommands")"
> +	if [ -z "$subcommand" ]; then
> +		__gitcomp "$subcommands"
> +	else
> +		local common_opts="--git-dir= --verbose"
> +		local sync_opts="
> +			--branch= --detect-branches --changes-file=
It's --changesfile (no dash), weird, but true.
Show 11 quoted lines
> +			--silent --detect-labels --import-labels
> +			--import-local --max-changes= --keep-path
> +			--use-client-spec $common_opts
> +			"
> +		local clone_opts="
> +			--destination= --bare $sync_opts
> +			"
> +		local submit_opts="
> +			--origin= -M --preserve-user --export-labels
> +			$common_opts
> +			"

Very recently we added --dry-run and --prepare-p4-only and --conflict to submit. Follow 8db3865^2 to see the patches for those.

Show 9 quoted lines
> +		case "$subcommand,$cur" in
> +		clone,--*)
> +			__gitcomp "$clone_opts"
> +			;;
> +		sync,--*)
> +			__gitcomp "$sync_opts"
> +			;;
> +		rebase,--*)
> +			__gitcomp "$common_opts --import-labels"
This would be prettier if it had its own local rebase_opts.
Show 21 quoted lines
> +		submit,--*)
> +			__gitcomp "$submit_opts"
> +			;;
> +		submit,*)
> +			__gitcomp "$(__git_refs)"
> +			;;
> +		esac
> +	fi
> +}
> +
>  _git_pull ()
>  {
>  	__git_complete_strategy && return
> -- 
> 1.7.12.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Previous: Junio C Hamano
Message 3 of 3 in “Teach git-completion about git p4”
  1. Teach git-completion about git p4Ryan Cumming, Sep 21, 2012
  2. Junio C HamanoSep 24, 2012
  3. Pete WyckoffSep 26, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.