Source

hgstuff / info.py

Full commit
# Mercurial extension to provide the 'hg info' command
#
# Copyright 2008 by Paul Moore <p.f.moore@gmail.com>
# Author(s):
# Paul Moore <p.f.moore@gmail.com>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.

from mercurial.i18n import _
from mercurial.node import short, hex

def info(ui, repo):
    """Print information about the repository"""
    ui.write(_("Repository: %s\n") % (repo.root,))
    ui.write(_("Base Hash: %s\n") % (hex(repo.changectx(0).node()),))
    ui.write(_("Revisions: %s\n") % (len(repo),))
    ui.write(_("Files: %s\n") % (len(repo.changectx(None).manifest()),))
    ui.write(_("Cloned From: %s\n") % (ui.config('paths','default'),))
    default_push = ui.config('paths','default-push')
    if default_push:
        ui.write(_("Push To: %s\n") % (default_push,))


cmdtable = {
    # "command-name": (function-call, options-list, help-string)
    "info": (info, [], _("hg info"))
}