Show More
@@ -315,6 +315,7 b' endfunction' | |||||
315 |
|
315 | |||
316 | function! s:HGGetStatusVars(revisionVar, branchVar, repositoryVar) |
|
316 | function! s:HGGetStatusVars(revisionVar, branchVar, repositoryVar) | |
317 | let hgBufferCheck=s:HGCurrentBufferCheck() |
|
317 | let hgBufferCheck=s:HGCurrentBufferCheck() | |
|
318 | "echomsg "DBG : in HGGetStatusVars" | |||
318 | if hgBufferCheck == -1 |
|
319 | if hgBufferCheck == -1 | |
319 | return "" |
|
320 | return "" | |
320 | endif |
|
321 | endif | |
@@ -326,15 +327,19 b' function! s:HGGetStatusVars(revisionVar,' | |||||
326 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " |
|
327 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " | |
327 | let roottext=system(hgCommand) |
|
328 | let roottext=system(hgCommand) | |
328 | " Suppress ending null char ! Does it work in window ? |
|
329 | " Suppress ending null char ! Does it work in window ? | |
329 |
let roottext=substitute(roottext, |
|
330 | let roottext=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','') | |
330 | if match(getcwd()."/".fileNameWithoutLink, roottext) == -1 |
|
331 | if match(getcwd()."/".fileNameWithoutLink, roottext) == -1 | |
331 | return "" |
|
332 | return "" | |
332 | endif |
|
333 | endif | |
|
334 | let returnExpression = "" | |||
333 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName |
|
335 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " status -mardui " . fileName | |
334 | let statustext=system(hgCommand) |
|
336 | let statustext=system(hgCommand) | |
335 | if(v:shell_error) |
|
337 | if(v:shell_error) | |
336 | return "" |
|
338 | return "" | |
337 | endif |
|
339 | endif | |
|
340 | if a:repositoryVar != "" | |||
|
341 | let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . roottext . "'" | |||
|
342 | endif | |||
338 | if match(statustext, '^[?I]') >= 0 |
|
343 | if match(statustext, '^[?I]') >= 0 | |
339 | let revision="NEW" |
|
344 | let revision="NEW" | |
340 | elseif match(statustext, '^[R]') >= 0 |
|
345 | elseif match(statustext, '^[R]') >= 0 | |
@@ -343,32 +348,23 b' function! s:HGGetStatusVars(revisionVar,' | |||||
343 | let revision="DELETED" |
|
348 | let revision="DELETED" | |
344 | elseif match(statustext, '^[A]') >= 0 |
|
349 | elseif match(statustext, '^[A]') >= 0 | |
345 | let revision="ADDED" |
|
350 | let revision="ADDED" | |
346 | endif |
|
351 | else | |
347 |
|
352 | " The file is tracked, we can try to get is revision number | ||
348 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " parents -b " |
|
353 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " parents -b " | |
349 | let statustext=system(hgCommand) |
|
354 | let statustext=system(hgCommand) | |
350 | if(v:shell_error) |
|
355 | if(v:shell_error) | |
351 |
|
|
356 | return "" | |
352 | endif |
|
357 | endif | |
353 | if exists('revision') |
|
|||
354 | let returnExpression = "let " . a:revisionVar . "='" . revision . "'" |
|
|||
355 | else |
|
|||
356 | let revision=substitute(statustext, '^changeset:\s*\(\d\+\):.*\_$\_.*$', '\1', "") |
|
358 | let revision=substitute(statustext, '^changeset:\s*\(\d\+\):.*\_$\_.*$', '\1', "") | |
357 | let returnExpression = "let " . a:revisionVar . "='" . revision . "'" |
|
|||
358 | endif |
|
|||
359 |
|
359 | |||
360 | if a:branchVar != "" && match(statustext, '^\_.*\_^branch:') >= 0 |
|
360 | if a:branchVar != "" && match(statustext, '^\_.*\_^branch:') >= 0 | |
361 |
|
|
361 | let branch=substitute(statustext, '^\_.*\_^branch:\s*\(\S\+\)\n\_.*$', '\1', "") | |
362 |
|
|
362 | let returnExpression=returnExpression . " | let " . a:branchVar . "='" . branch . "'" | |
363 | endif |
|
363 | endif | |
364 | if a:repositoryVar != "" |
|
|||
365 | let hgCommand = s:HGGetOption("HGCommandHGExec", "hg") . " root " |
|
|||
366 | let roottext=system(hgCommand) |
|
|||
367 | let repository=substitute(roottext,'^.*/\([^/\n\r]*\)\n\_.*$','\1','') |
|
|||
368 | let returnExpression=returnExpression . " | let " . a:repositoryVar . "='" . repository . "'" |
|
|||
369 | endif |
|
364 | endif | |
370 |
|
365 | if (exists('revision')) | ||
371 |
|
366 | let returnExpression = "let " . a:revisionVar . "='" . revision . "' " . returnExpression | ||
|
367 | endif | |||
372 |
|
368 | |||
373 | return returnExpression |
|
369 | return returnExpression | |
374 | finally |
|
370 | finally | |
@@ -436,6 +432,11 b' function! s:HGMarkOrigBufferForSetup(hgB' | |||||
436 | if origBuffer != a:hgBuffer |
|
432 | if origBuffer != a:hgBuffer | |
437 | call setbufvar(origBuffer, "HGBufferSetup", 0) |
|
433 | call setbufvar(origBuffer, "HGBufferSetup", 0) | |
438 | endif |
|
434 | endif | |
|
435 | else | |||
|
436 | "We are presumably in the original buffer | |||
|
437 | let b:HGBufferSetup = 0 | |||
|
438 | "We do the setup now as now event will be triggered allowing it later. | |||
|
439 | call s:HGSetupBuffer() | |||
439 | endif |
|
440 | endif | |
440 | return a:hgBuffer |
|
441 | return a:hgBuffer | |
441 | endfunction |
|
442 | endfunction | |
@@ -612,6 +613,7 b' function! HGEnableBufferSetup()' | |||||
612 | augroup HGCommandPlugin |
|
613 | augroup HGCommandPlugin | |
613 | au! |
|
614 | au! | |
614 | au BufEnter * call s:HGSetupBuffer() |
|
615 | au BufEnter * call s:HGSetupBuffer() | |
|
616 | au BufWritePost * call s:HGSetupBuffer() | |||
615 | " Force resetting up buffer on external file change (HG update) |
|
617 | " Force resetting up buffer on external file change (HG update) | |
616 | au FileChangedShell * call s:HGSetupBuffer(1) |
|
618 | au FileChangedShell * call s:HGSetupBuffer(1) | |
617 | augroup END |
|
619 | augroup END | |
@@ -758,8 +760,7 b' function! s:HGCommit(...)' | |||||
758 | \ ':call <SID>HGFinishCommit("' . messageFileName . '",' . |
|
760 | \ ':call <SID>HGFinishCommit("' . messageFileName . '",' . | |
759 | \ '"' . newCwd . '",' . |
|
761 | \ '"' . newCwd . '",' . | |
760 | \ '"' . realFileName . '",' . |
|
762 | \ '"' . realFileName . '",' . | |
761 |
\ hgBufferCheck . ')<CR>' |
|
763 | \ hgBufferCheck . ')<CR>' | |
762 | \ ':call <SID>HGBufferSetup(1)<CR>' |
|
|||
763 |
|
764 | |||
764 | silent 0put ='HG: ----------------------------------------------------------------------' |
|
765 | silent 0put ='HG: ----------------------------------------------------------------------' | |
765 | silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" |
|
766 | silent put =\"HG: Enter Log. Lines beginning with `HG:' are removed automatically\" | |
@@ -912,7 +913,6 b' endfunction' | |||||
912 | " Function: s:HGUpdate() {{{2 |
|
913 | " Function: s:HGUpdate() {{{2 | |
913 | function! s:HGUpdate() |
|
914 | function! s:HGUpdate() | |
914 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) |
|
915 | return s:HGMarkOrigBufferForSetup(s:HGDoCommand('update', 'update', '')) | |
915 | call s:HGSetupBuffer(1) |
|
|||
916 | endfunction |
|
916 | endfunction | |
917 |
|
917 | |||
918 | " Function: s:HGVimDiff(...) {{{2 |
|
918 | " Function: s:HGVimDiff(...) {{{2 |
General Comments 0
You need to be logged in to leave comments.
Login now