contrib/bash_completion
branchstable
changeset 13509 8aea95ec128f
parent 13243 159651b3c9ec
child 14332 a2f0f61a6988
equal deleted inserted replaced
13508:0396ca8015be 13509:8aea95ec128f
    99     local branches="$(_hg_cmd branches -q)"
    99     local branches="$(_hg_cmd branches -q)"
   100     local IFS=$'\n'
   100     local IFS=$'\n'
   101     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
   101     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$branches' -- "$cur"))
   102 }
   102 }
   103 
   103 
       
   104 _hg_bookmarks()
       
   105 {
       
   106     local bookmarks="$(_hg_cmd bookmarks -q)"
       
   107     local IFS=$'\n'
       
   108     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$bookmarks' -- "$cur"))
       
   109 }
       
   110 
       
   111 _hg_labels()
       
   112 {
       
   113     _hg_tags
       
   114     _hg_branches
       
   115     _hg_bookmarks
       
   116 }
       
   117 
   104 # this is "kind of" ugly...
   118 # this is "kind of" ugly...
   105 _hg_count_non_option()
   119 _hg_count_non_option()
   106 {
   120 {
   107     local i count=0
   121     local i count=0
   108     local filters="$1"
   122     local filters="$1"
   198 	return 0
   212 	return 0
   199     fi
   213     fi
   200 
   214 
   201     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then
   215     if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" == --rev ]; then
   202 	if [ $canonical = 1 ]; then
   216 	if [ $canonical = 1 ]; then
   203 	    _hg_tags
   217 	    _hg_labels
   204 	    _hg_branches
       
   205 	    return 0
   218 	    return 0
   206 	elif [[ status != "$cmd"* ]]; then
   219 	elif [[ status != "$cmd"* ]]; then
   207 	    _hg_tags
   220             _hg_labels
   208 	    _hg_branches
       
   209 	    return 0
   221 	    return 0
   210 	else
   222 	else
   211 	    return 1
   223 	    return 1
   212 	fi
   224 	fi
   213     fi
   225     fi
   218 	;;
   230 	;;
   219 	export)
   231 	export)
   220 	    if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
   232 	    if _hg_ext_mq_patchlist qapplied && [ "${COMPREPLY[*]}" ]; then
   221 		return 0
   233 		return 0
   222 	    fi
   234 	    fi
   223 	    _hg_tags
   235 	    _hg_labels
   224 	    _hg_branches
       
   225 	;;
   236 	;;
   226 	manifest|update)
   237 	manifest|update)
   227 	    _hg_tags
   238 	    _hg_labels
   228 	    _hg_branches
       
   229 	;;
   239 	;;
   230 	pull|push|outgoing|incoming)
   240 	pull|push|outgoing|incoming)
   231 	    _hg_paths
   241 	    _hg_paths
   232 	    _hg_repos
   242 	    _hg_repos
   233 	;;
   243 	;;
   236 	;;
   246 	;;
   237 	add)
   247 	add)
   238 	    _hg_status "u"
   248 	    _hg_status "u"
   239 	;;
   249 	;;
   240 	merge)
   250 	merge)
   241 	    _hg_tags
   251 	    _hg_labels
   242 	    _hg_branches
       
   243 	;;
   252 	;;
   244 	commit|record)
   253 	commit|record)
   245 	    _hg_status "mar"
   254 	    _hg_status "mar"
   246 	;;
   255 	;;
   247 	remove)
   256 	remove)
   376     fi
   385     fi
   377 }
   386 }
   378 
   387 
   379 _hg_cmd_strip()
   388 _hg_cmd_strip()
   380 {
   389 {
   381     _hg_tags
   390     _hg_labels
   382     _hg_branches
       
   383 }
   391 }
   384 
   392 
   385 _hg_cmd_qcommit()
   393 _hg_cmd_qcommit()
   386 {
   394 {
   387     local root=$(_hg_cmd root)
   395     local root=$(_hg_cmd root)
   495 	return
   503 	return
   496     fi
   504     fi
   497 
   505 
   498     case "$subcmd" in
   506     case "$subcmd" in
   499 	good|bad)
   507 	good|bad)
   500 	    _hg_tags
   508 	    _hg_labels
   501 	    _hg_branches
       
   502 	    ;;
   509 	    ;;
   503     esac
   510     esac
   504 
   511 
   505     return
   512     return
   506 }
   513 }
   532 	    # free form string
   539 	    # free form string
   533 	    return
   540 	    return
   534 	    ;;
   541 	    ;;
   535     esac
   542     esac
   536 
   543 
   537     _hg_tags
   544     _hg_labels
   538     _hg_branches
       
   539     return
   545     return
   540 }
   546 }
   541 
   547 
   542 
   548 
   543 # gpg
   549 # gpg
   544 _hg_cmd_sign()
   550 _hg_cmd_sign()
   545 {
   551 {
   546     _hg_tags
   552     _hg_labels
   547     _hg_branches
       
   548 }
   553 }
   549 
   554 
   550 
   555 
   551 # transplant
   556 # transplant
   552 _hg_cmd_transplant()
   557 _hg_cmd_transplant()
   562 	    return
   567 	    return
   563 	    ;;
   568 	    ;;
   564     esac
   569     esac
   565 
   570 
   566     # all other transplant options values and command parameters are revisions
   571     # all other transplant options values and command parameters are revisions
   567     _hg_tags
   572     _hg_labels
   568     _hg_branches
       
   569     return
   573     return
   570 }
   574 }
   571 
   575 
   572 # shelve
   576 # shelve
   573 _hg_shelves()
   577 _hg_shelves()