Skip to content

Commit 944186e

Browse files
author
Harald Klimach
committed
Make also ShowHistory working with Mercurial.
Mercurial uses other temporary filenames than git. Match those, if g:diffconflicts_vcs is set to 'hg'.
1 parent 7a44b37 commit 944186e

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

plugin/diffconflicts.vim

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,32 @@ function! s:showHistory()
7070
wincmd h
7171

7272
" Populate each window.
73-
buffer LOCAL
73+
if g:diffconflicts_vcs == "hg"
74+
buffer ~local.
75+
file LOCAL
76+
else
77+
buffer LOCAL
78+
endif
7479
setlocal nomodifiable readonly
7580
diffthis
7681

7782
wincmd l
78-
buffer BASE
83+
if g:diffconflicts_vcs == "hg"
84+
buffer ~base.
85+
file BASE
86+
else
87+
buffer BASE
88+
endif
7989
setlocal nomodifiable readonly
8090
diffthis
8191

8292
wincmd l
83-
buffer REMOTE
93+
if g:diffconflicts_vcs == "hg"
94+
buffer ~other.
95+
file OTHER
96+
else
97+
buffer REMOTE
98+
endif
8499
setlocal nomodifiable readonly
85100
diffthis
86101

@@ -89,6 +104,11 @@ function! s:showHistory()
89104
endfunction
90105

91106
function! s:checkThenShowHistory()
107+
if g:diffconflicts_vcs == "hg"
108+
let l:filecheck = 'v:val =~# "\\~base\\." || v:val =~# "\\~local\\." || v:val =~# "\\~other\\."'
109+
else
110+
let l:filecheck = 'v:val =~# "BASE" || v:val =~# "LOCAL" || v:val =~# "REMOTE"'
111+
endif
92112
let l:xs =
93113
\ filter(
94114
\ map(
@@ -98,7 +118,7 @@ function! s:checkThenShowHistory()
98118
\ ),
99119
\ 'bufname(v:val)'
100120
\ ),
101-
\ 'v:val =~# "BASE" || v:val =~# "LOCAL" || v:val =~# "REMOTE"'
121+
\ l:filecheck
102122
\ )
103123

104124
if (len(l:xs) < 3)

0 commit comments

Comments
 (0)