diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index a57a60a..37a1694 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -140,8 +140,8 @@ module Redmine
         end
 
         def num_revisions
-          cmd = "#{HG_BIN} -R #{target('')} log -r :tip --template='\n'"
-          shellout(cmd) {|io| io.readlines.size}
+          cmd = "#{HG_BIN} -R #{target('')} log -r :tip --template='.\n'"
+          shellout(cmd) {|io| io.readlines.compact.size}
         end
         
         # Returns the entry identified by path and revision identifier
