Attachment 'info.py'
Download 1 # Mercurial extension to provide the 'hg info' command
2 #
3 # Copyright 2008 by Paul Moore <p.f.moore@gmail.com>
4 # Author(s):
5 # Paul Moore <p.f.moore@gmail.com>
6 #
7 # This software may be used and distributed according to the terms
8 # of the GNU General Public License, incorporated herein by reference.
9
10 from mercurial.i18n import _
11 from mercurial.node import short, hex
12
13 def info(ui, repo):
14 """Print information about the repository"""
15 try:
16 numrev = repo.changelog.count()
17 except AttributeError: # post Mercurial 1.1
18 numrev = len(repo)
19
20 ui.write(_("Repository: %s [hg root]\n") % (repo.root,))
21 ui.write(_("Base Hash: %s [hg id -r0]\n") % (hex(repo.changectx(0).node()),))
22 ui.write(_('Revisions: %s [hg tip --template "{rev}"]\n') % (numrev,))
23 ui.write(_("Files: %s [hg manifest | wc -l]\n") % (len(repo.changectx(numrev-1).manifest()),))
24 ui.write(_("Cloned From: %s [hg paths default]\n") % (ui.config('paths','default'),))
25 default_push = ui.config('paths','default-push')
26 if default_push:
27 ui.write(_("Push To: %s [hg paths default-push]\n") % (default_push,))
28
29
30 cmdtable = {
31 # "command-name": (function-call, options-list, help-string)
32 "info": (info, [], _("hg info"))
33 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.