Differences between revisions 4 and 8 (spanning 4 versions)
Revision 4 as of 2009-04-30 18:35:10
Size: 1634
Editor: PaulMoore
Comment:
Revision 8 as of 2016-05-04 14:56:35
Size: 2669
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
Download site: Download direct from this page - attachment:info.py Download site: Download direct from this page - [[attachment:info.py]]
Line 48: Line 48:
 AttributeError: 'changelog' object has no attribute 'count'  !AttributeError: 'changelog' object has no attribute 'count'
Line 55: Line 55:
Martin Häcker Mercurial 3.8.1 now warns about the command not registered using the decorator, locally for me this patch works. Feel free to remove it from this page once it is applied.

{{{
diff --git a/info.py b/info.py
--- a/info.py
+++ b/info.py
@@ -7,9 +7,14 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
+from mercurial import cmdutil
 from mercurial.i18n import _
 from mercurial.node import short, hex
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
+@command("info", [], _("hg info"))
 def info(ui, repo):
     """Print information about the repository"""
     try:
@@ -25,10 +30,3 @@
     default_push = ui.config('paths','default-push')
     if default_push:
         ui.write(_("Push To: %s [hg paths default-push]\n") % (default_push,))
-
-
-cmdtable = {
- # "command-name": (function-call, options-list, help-string)
- "info": (info, [], _("hg info"))
-}
-
}}}
Line 56: Line 89:
CategoryExtension CategoryExtensionsByOthers

Info Extension

This extension is not distributed with Mercurial.

Author: Paul Moore

Download site: Download direct from this page - info.py

Overview

This extension displays basic information about a (local) repository. The information displayed includes:

  • The repository root.
  • The "base hash" - the changeset ID of revision 0 of the repository. This is the nearest equivalent of a unique identifier for the repository.
  • The number of revisions present in the repository.
  • The number of files in the tip revision.
  • The location (if any) from which this repository was cloned.
  • The default push location for the repository.

An example of usage:

>hg info
Repository: C:\Data\Mercurial\crew
Base Hash: 9117c6561b0bd7792fa13b50d28239d51b78e51f
Revisions: 6469
Files: 787
Cloned From: http://hg.intevation.org/mercurial/crew

Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
info = path/to/info.py

History

  • 2009-04-30 - Compatibility with Mercurial 1.1

Feedback

This dies for me on the current mercurial on the line

  • ui.write(_("Revisions: %s\n") % (repo.changelog.count(),))

with the error message saying:

  • AttributeError: 'changelog' object has no attribute 'count'

So this probably means it's no longer compatible with the current version of mercurial.

DirkjanOchtman: the repo.changelog.count() can be changed to len(repo) (needed for 1.1+). PaulMoore: Thanks, fixed (with a patch supplied by Greg Ward).

Martin Häcker Mercurial 3.8.1 now warns about the command not registered using the decorator, locally for me this patch works. Feel free to remove it from this page once it is applied.

diff --git a/info.py b/info.py
--- a/info.py
+++ b/info.py
@@ -7,9 +7,14 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
+from mercurial import cmdutil
 from mercurial.i18n import _
 from mercurial.node import short, hex
 
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
+@command("info", [], _("hg info"))
 def info(ui, repo):
     """Print information about the repository"""
     try:
@@ -25,10 +30,3 @@
     default_push = ui.config('paths','default-push')
     if default_push:
         ui.write(_("Push To: %s [hg paths default-push]\n") % (default_push,))
-
-
-cmdtable = {
-    # "command-name": (function-call, options-list, help-string)
-    "info": (info, [], _("hg info"))
-}
-


CategoryExtensionsByOthers

InfoExtension (last edited 2016-05-04 15:22:56 by Martin Häcker)