diff plugin/lawrencium.vim @ 5:3a4f9f41a7e2

Use a hackish shortcut to get the current branch faster for the statusline.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 08 Dec 2011 21:12:04 -0800
parents b6e4446ed292
children 1da613c13d81
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Thu Dec 08 17:19:52 2011 -0800
+++ b/plugin/lawrencium.vim	Thu Dec 08 21:12:04 2011 -0800
@@ -292,10 +292,11 @@
     if !exists('b:mercurial_dir')
         return ''
     endif
-    let l:summary = s:hg_repo().RunCommand('summary')
-    let l:parent_rev = matchstr(l:summary, 'parent\: \d+\:[0-9a-f]+')
-    let l:branch = matchstr(l:summary, 'branch\: [\d\w\-_\.]+')
-    return l:branch . ', ' . l:parent_rev
+    let l:prefix = (a:0 > 0 ? a:1 : '')
+    let l:suffix = (a:0 > 1 ? a:2 : '')
+    let l:branch_file = s:hg_repo().GetFullPath('.hg/branch')
+    let l:branch = readfile(l:branch_file)[0]
+    return l:prefix . l:branch .  l:suffix
 endfunction
 
 " Rescans the current buffer for setting up Mercurial commands.