changeset 1814:9de452afbe01 beta

small change for post update hook that displays repository size
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 29 Dec 2011 00:02:26 +0200
parents a8c66e870bd0
children 985f1fb3999a
files rhodecode/lib/hooks.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/hooks.py	Thu Dec 29 00:01:05 2011 +0200
+++ b/rhodecode/lib/hooks.py	Thu Dec 29 00:02:26 2011 +0200
@@ -41,8 +41,6 @@
     :param hooktype:
     """
 
-    if hooktype != 'changegroup':
-        return False
     size_hg, size_root = 0, 0
     for path, dirs, files in os.walk(repo.root):
         if path.find('.hg') != -1:
@@ -61,8 +59,15 @@
     size_hg_f = h.format_byte_size(size_hg)
     size_root_f = h.format_byte_size(size_root)
     size_total_f = h.format_byte_size(size_root + size_hg)
-    sys.stdout.write('Repository size .hg:%s repo:%s total:%s\n' \
-                     % (size_hg_f, size_root_f, size_total_f))
+
+    last_cs = repo[len(repo) - 1]
+
+    msg = ('Repository size .hg:%s repo:%s total:%s\n'
+           'Last revision is now r%s:%s\n') % (
+        size_hg_f, size_root_f, size_total_f, last_cs.rev(), last_cs.hex()[:12]
+    )
+
+    sys.stdout.write(msg)
 
 
 def log_pull_action(ui, repo, **kwargs):