Skip to content
Version control information in your prompt
Python
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
man
tests
.gitignore
.gitmodules
HISTORY
LICENSE
MANIFEST.in
Makefile
README
TODO
setup.py

README

========
vcprompt
========

Version control information in your prompt (or anywhere!).

Heavily inspired by Greg Ward's vcprompt_

.. _vcprompt: http://vc.gerg.ca/hg/vcprompt/




Installing
----------

``vcprompt`` is best installed as a standalone executable:

::

    # assuming ~/bin is on your $PATH
    $ curl -s http://github.com/xvzf/vcprompt/raw/master/bin/vcprompt > ~/bin/vcprompt
    $ chmod 755 ~/bin/vcprompt


Alternatively, you can clone the repository and run setup.py manually:

::

    $ git clone git://github.com/xvzf/vcprompt.git
    $ cd vcprompt
    $ python setup.py install




Setting up your prompt
----------------------

For bash:

::

    $ export PS1='\u@\h:\w $(vcprompt)\$'


For zsh you need to enable PROMPT_SUBST first:

::

    $ setopt prompt_subst
    $ PS1='[%n@%m] [%~] $(vcprompt)'




Basic customizing
-----------------

``vcprompt``'s output can be customized to your liking by using the
``--format`` option. For example:

::

    $ vcprompt --format "%s:%b"


If not given, the formatting string defaults to ``%s:%b``, that is the
current system and the branch. For example:

::

    git:master


The complete list of formatting arguments are as follows:

* ``%s`` - the VCS system in use
* ``%r`` - the current revision (or hash if no revision number is present)
* ``%h`` - the current hash (or revision number if no hash is present)
* ``%b`` - the current branch name (or directory where the repository exists)
* ``%i`` - the status of the repository (see below)

The status indicators for the ``%i`` argument will use the underlying
status codes from the VCS (e.g. ``git status``, ``hg status``).

For full documentation on all the options available to ``vcprompt`` see the
bundled manpages.




Requirements
------------

* Python 2.5+
* Python 3.0+ (with 2to3)




Testing
-------

To run the tests, use the provided Makefile:

::

    make test


A few notes on testing:

* Tests have to fetch remote repositories, so network access is required
* Fetching remote repositories requires each VCS to be installed
Something went wrong with that request. Please try again.