monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] monotone-viz 0.6


From: Olivier Andrieu
Subject: [Monotone-devel] monotone-viz 0.6
Date: Thu, 23 Dec 2004 02:03:17 +0100 (CET)

Hi all,

I forgot to mention, I released a new version of monotone-vizĀ¹. This
one includes a couple of features that were requested, notably
keyboard navigation of the graph and some automatic colouring. I also
migrated my server (it uses the new netsync protocol now).

And here is an updated bash completion code that takes into account
revisions and a couple of new commands (explicit_merge).

[1] http://oandrieu.nerim.net/monotone-viz/
-- 
   Olivier
# -*- shell-script -*-

# bash completion for monotone 0.15

# The function _filedir is defined in /etc/bash_completion.
# This is a weaker version, for those who do not have the 
# bash completion package installed. <http://www.caliban.org/bash/>
if ! type _filedir >& /dev/null ; then
_filedir() {
    local IFS=$'\t\n' arg
    COMPREPLY=( address@hidden:-} $(compgen ${1:--f} -- $cur) )
}
fi

# Call monotone to complete IDs
_monotone_complete() {
  if [ -n "$cur" ] ; then
    COMPREPLY=( address@hidden:-} $(monotone $mono_db complete $1 $cur 2> 
/dev/null) )
  fi
}

# Call monotone to complete key ids (private or public)
_monotone_keys() {
  local range
  if [ "$1" == "privkey" ]; then
    range='/\[private/,$'
  else
    range='1,/\[private/'
  fi
  COMPREPLY=( $(compgen -W "$(monotone $mono_db list keys 2> /dev/null |\
                              sed -n ${range}'{/^[0-9a-f]/s/[0-9a-f]* //p}')" 
-- ${cur#*=} ) )
}

_monotone_branches() {
  COMPREPLY=( $(compgen -W "$(monotone $mono_db list branches 2> /dev/null)" -- 
${cur#*=} ) )
}

_monotone() {
  local cur=${COMP_WORDS[COMP_CWORD]}
  local prev=${COMP_WORDS[COMP_CWORD-1]}
  local mono_db

  for w in address@hidden ; do
    if [[ "$w" == --db=* ]] ; then
      mono_db="$w" ; break
    fi
  done

  case $cur in
    --db=* | --rcfile=* )
      cur="${cur#*=}"
      _filedir
      ;;
    --branch=* )
      _monotone_branches
      ;;
    --key=* )
      _monotone_keys pubkey
      ;;
    --ticker=* )
      cur="${cur#*=}"
      COMPREPLY=( $(compgen -W 'count dot' -- $cur ) )
      ;;
    -* )
      COMPREPLY=( $(compgen -W '--debug --quiet --help --nostd --norc\
                                --rcfile= --key= --db= --branch= --version 
--full-version\
                                --dump= --ticker=' -- $cur) ) 
      ;;
    * )
      case $prev in
        db )
          COMPREPLY=( $(compgen -W 'init info version dump load migrate 
execute' -- $cur ) )
          ;;
        diff | log | approve | disapprove | comment | tag | testresult | cert | 
explicit_merge | trusted | update )
          _monotone_complete revision
          ;;
        ls | list )
          COMPREPLY=( $(compgen -W 'certs keys branches unknown ignored 
missing' -- $cur ) )
          ;;
        attr )
          COMPREPLY=( $(compgen -W 'get set' -- $cur ) )
          ;;
        co | checkout )
          _filedir -d
          _monotone_complete revision
          ;;
        cvs_import | add | drop | rename | revert )
          _filedir
          ;;
        cat )
          COMPREPLY=( $(compgen -W 'file manifest revision' -- $cur) )
          ;;
        push | pull | serve | sync )
          COMPREPLY=( $(compgen -A hostname -- $cur) )
          ;;
        pubkey | privkey )
          _monotone_keys $prev
          ;;
        chkeypass )
          _monotone_keys privkey
          ;;
        propagate )
          _monotone_branches
          ;;
        * )
          if (( $COMP_CWORD >= 2 )) ; then
            local prev2=${COMP_WORDS[COMP_CWORD-2]}
            case $prev2 in
              diff | explicit_merge )
                _monotone_complete revision
                ;;
              co | checkout | rename )
                _filedir -d
                ;;
              cat )
                _monotone_complete $prev
                ;;
              attr )
                _filedir
                ;;
              list )
                if [ $prev == certs ] ; then
                    _monotone_complete revision
                    _monotone_complete manifest 
                    _monotone_complete file
                fi
                ;;
              push | pull | serve | sync )
                _monotone_branches
                ;;
              * )
                unset prev2
                ;;
            esac
          fi
          if [ -z "$prev2" ] ; then
            COMPREPLY=( $(compgen -W 'approve comment disapprove tag testresult 
\
                                      db agraph \
                                      complete diff list log ls status \
                                      cert chkeypass genkey trusted vcheck \
                                      pull push reindex serve sync \
                                      fcerts fdata fdelta mcerts mdata mdelta 
privkey pubkey read \
                                      cvs_import rcs_import \
                                      cat checkout co fload fmerge heads 
explicit_merge merge propagate \
                                      add attr commit drop rename revert 
update' -- $cur) )
          fi
          ;;
      esac
      ;;
  esac
  return 0
}

complete -F _monotone -o default monotone

reply via email to

[Prev in Thread] Current Thread [Next in Thread]