Commits

ZyX_I committed f147323 Merge

Merge

  • Participants
  • Parent commits f0bb9a8, 5e70bf7

Comments (0)

Files changed (12)

File aurum-addon-info.txt

         "test/hgtestrepo.tar.xz",
         "test/maps-annotate.in",
         "test/maps-annotate.ok",
+        "test/maps-commit-diff.in",
+        "test/maps-commit-diff.ok",
         "test/maps-diff.in",
         "test/maps-diff.ok",
         "test/maps-file.in",

File autoload/aurum/commit.vim

 "▶1 
 scriptencoding utf-8
-execute frawor#Setup('1.1', {'@/resources': '0.0',
+execute frawor#Setup('1.3', {'@/resources': '0.0',
             \                  '@/options': '0.0',
+            \                       '@/os': '0.0',
             \                     '@aurum': '1.0',
             \             '@%aurum/status': '1.2',
             \           '@%aurum/cmdutils': '4.0',
             \            '@%aurum/bufvars': '0.0',
+            \            '@%aurum/vimdiff': '1.1',
             \               '@%aurum/edit': '1.0',
             \               '@aurum/cache': '2.1',})
 let s:_messages={
 let s:_options={
             \'remembermsg':         {'default': 1, 'filter': 'bool'},
             \'bufleaveremembermsg': {'default': 1, 'filter': 'bool'},
+            \'commitautoopendiff':  {'default': 0, 'filter': 'bool'},
+            \'commitinfowincmd':    {
+            \   'default': 'largest_adjacent',
+            \   'checker': 'match /\v^%([jkhlwWtbpvs]|'.
+            \                          'largest%(_%(vertical|'.
+            \                                      'horizontal|'.
+            \                                      'adjacent))?)$/'},
         \}
 "▶1 parsedate string → [year, month, day, hour, minute, second]
 " Date must have one of the following formats (XXX it is not validated):
     endif
     return r
 endfunction
-"▶1 commit :: repo, opts, files, status, types → + repo
+"▶1 vimdiffcb
+function s:F.vimdiffcb(file, bvar, hex)
+    execute 'silent tabnew'
+                \ fnameescape(s:_r.os.path.join(a:bvar.repo.path, a:file))
+    return s:_r.vimdiff.split([['file', a:bvar.repo, a:hex, a:file]], 0)
+endfunction
+"▶1 findwindow :: () -> winexisted::Bool
+function s:F.winsize(wnr)
+    let width=winwidth(a:wnr)
+    return (width>80 ? 80 : width)*winheight(a:wnr)
+endfunction
+function s:F.winsplit()
+    if winwidth(0)>=&textwidth*2
+        execute 'silent' (winwidth(0)-&textwidth)                'vsplit'
+    else
+        execute 'silent' (max([winheight(0)-5, winheight(0)/2]))  'split'
+    endif
+    return 0
+endfunction
+function s:F.findwindow()
+    let wcommand=s:_f.getoption('commitinfowincmd')
+    if len(wcommand)==1
+        let commit_mark=reltime()
+        let wscope=w:
+        let w:aurum_commit_mark=commit_mark
+        try
+            execute 'wincmd' wcommand
+            if              exists('w:aurum_commit_mark')
+                        \&& w:aurum_commit_mark is# commit_mark
+                return s:F.winsplit()
+            endif
+            return (stridx('sv', wcommand)==-1)
+        finally
+            call remove(wscope, 'aurum_commit_mark')
+        endtry
+    elseif wcommand is# 'largest'
+        let maxsize=0
+        let mwnr=0
+        for wnr in filter(range(1, winnr('$')), 'v:val!='.winnr())
+            let size=s:F.winsize(a:wnr)
+            if size>maxsize
+                let maxsize=size
+                let mwnr=a:wnr
+            endif
+        endfor
+        if mwnr
+            execute mwnr.'wincmd w'
+            return 1
+        else
+            return s:F.winsplit()
+        endif
+    else
+        let maxsize=0
+        let mwcmd=0
+        let wcmds={
+                    \'vertical':   ['j', 'k'],
+                    \'horizontal': ['h', 'l'],
+                    \'adjacent':   ['h', 'l', 'j', 'k'],
+                \}[wcommand[8:]]
+        let curwin=winnr()
+        for wcmd in wcmds
+            execute 'wincmd' wcmd
+            if winnr()!=curwin
+                let size=s:F.winsize(0)
+                wincmd p
+                if size>maxsize
+                    let maxsize=size
+                    let mwcmd=wcmd
+                endif
+            endif
+        endfor
+        if mwcmd is 0
+            return s:F.winsplit()
+        else
+            execute 'wincmd' mwcmd
+            return 1
+        endif
+    endif
+endfunction
+"▶1 commit :: repo, opts, files, status, types[, cmd[, bvarpart]] → + repo
 let s:defdate=['strftime("%Y")',
             \  'strftime("%m")',
             \  'strftime("%d")',
     endif
     "▲2
     if empty(message)
-        call s:_r.run(get(a:000, 0, 'silent new'),
+        call s:_r.run(((a:0 && a:1 isnot 0)? a:1 : 'silent new'),
                     \ 'commit', a:repo, user, date, cb, a:files)
         let bvar=s:_r.bufvars[bufnr('%')]
+        if a:0>1 && a:2 isnot 0
+            call extend(bvar, a:2)
+        endif
         let bvar.revstatus=revstatus
+        "▶2 Add previous message
         if exists('g:AuPreviousRepoPath') &&
                     \   g:AuPreviousRepoPath is# a:repo.path &&
                     \exists('g:AuPreviousTip') &&
             call cursor(line('$'), col([line('$'), '$']))
             unlet g:AuPreviousRepoPath g:AuPreviousTip g:AuPreviousCommitMessage
         endif
+        "▶2 Add comment
         let fmessage=[]
         for [file, state] in items(revstatus)
             let fmessage+=['# '.s:statmsgs[state].' '.file]
         call sort(fmessage)
         call append('.', fmessage)
         startinsert!
+        "▶2 Open diff
+        if s:_f.getoption('commitautoopendiff')
+            let winexisted=bvar.findwindow()
+            if winexisted
+                let prevbuf=bufnr('%')
+            else
+                let prevbuf=0
+            endif
+            let existed=s:_r.mrun('silent edit', 'diff', bvar.repo, 0, 0,
+                        \                                keys(revstatus), {})
+            if !existed
+                setlocal bufhidden=wipe
+            endif
+            let dbuf=bufnr('%')
+            let dtabpagenr=tabpagenr()
+            silent! %foldopen!
+            wincmd p
+            augroup AuCommitAutoCloseDiff
+                execute 'autocmd BufWipeOut <buffer> '.
+                            \':call s:F.closediffbuf('.dbuf.', '.
+                            \                          dtabpagenr.', '.
+                            \                          prevbuf.', '
+                            \                          existed.', '.
+                            \                          winexisted.')'
+            augroup END
+        endif
+        "▲2
         return 0
     else
         call a:repo.functions.commit(a:repo, message, a:files, user, date, cb)
         return 1
     endif
 endfunction
+let s:_augroups+=['AuCommitAutoCloseDiff']
+"▶1 closediffbuf
+function s:F.closediffbuf(dbuf, dtabpagenr, prevbuf, existed, winexisted)
+    if bufexists(a:dbuf) && count(tabpagebuflist(a:dtabpagenr), a:dbuf)==1
+        let cmds=[]
+        let switchcmds=[]
+        if (a:prevbuf && bufexists(a:prevbuf)) || a:winexisted
+            let curtab=tabpagenr()
+            if curtab!=a:dtabpagenr
+                let cmds+=['tabnext '.a:dtabpagenr]
+                call insert(switchcmds, 'tabnext '.curtab)
+            endif
+            let cmds+=['execute bufwinnr('.a:dbuf.') "wincmd w"']
+            call insert(switchcmds, 'wincmd p')
+            if a:prevbuf && bufexists(a:prevbuf)
+                let cmds+=['buffer '.a:prevbuf]
+            else
+                let cmds+=['bnext']
+            endif
+        endif
+        if !a:existed
+            let cmds+=['if bufexists('.a:dbuf.')', 'bwipeout '.a:dbuf, 'endif']
+        endif
+        let cmds+=switchcmds
+        return feedkeys("\<C-\>\<C-n>:".join(cmds, '|')."\n\<C-l>", 'n')
+    endif
+endfunction
 "▶1 savemsg :: message, bvar → + g:
 function s:F.savemsg(message, bvar)
     if a:message!~#"[^[:blank:]\n]"
     augroup END
     return {'user': a:user, 'date': a:date, 'files': a:files,
                 \'closebranch': !!a:cb, 'write': s:F.finish,
-                \'did_message': 0}
+                \'did_message': 0, 'vimdiffcb': s:F.vimdiffcb,
+                \'findwindow': s:F.findwindow,}
 endfunction
 let s:_augroups+=['AuCommit']
 function s:commit.write(lines, repo, user, date, cb, files)

File autoload/aurum/drivers/common/hypsites.vim

 "  https://vimpluginloader.svn.sourceforge.net/svnroot/vimpluginloader
 "  http://conque.googlecode.com/svn/trunk
 "  https://zyx.repositoryhosting.com/svn/zyx_t1 / svn+ssh://svn@zyx.repositoryhosting.com/zyx/t1
+"  http://pysvn.tigris.org/svn/pysvn/trunk
 let s:svngcbase='"http://code.google.com/p/".'.s:gcproj
 let s:svngcfile='path[5:]."/".file'
 let s:hyp.svn=[
 \        'log': '"http://".domain."/viewvcs".path[4:]."?view=log"',
 \      'clone': '"svn://".domain.path',
 \       'push': '"svn+ssh://".user."@".domain.path',}],
+\['domain =~? "\\Vtigris.org\\$"',
+\ {     'html': '"http://".domain."/source/browse".path[4:]."/".file."?view=markup&revision=".hex',
+\        'raw': '"http://".domain."/source/browse/*checkout*".path[4:]."/".file."?revision=".hex',
+\   'annotate': '"http://".domain."/source/browse".path[4:]."/".file."?annotate=".hex', 'aline': '"id".(line-1)',
+\   'filehist': '"http://".domain."/source/browse".path[4:]."/".file."?view=log"',
+\      'clone': '"http://".domain.path',
+\       'push': 'url',}],
 \['domain =~? "\\Vrepositoryhosting.com\\$" && protocol is? "https" && path[:3] is? "/svn"', s:rhdicts.svn.0],
 \['domain =~? "\\Vrepositoryhosting.com\\$" && protocol is? "svn+ssh"',                      s:rhdicts.svn.1],
 \]

File autoload/aurum/drivers/mercurial.vim

             \    'dates': 'nodates',
         \}
 if s:usepythondriver "▶2
+function s:F.getdiffargs(repo, rev1, rev2, files, opts)
+    return       'vim.eval("a:repo.path"), '.
+                \(empty(a:rev1)  ? 'None' : 'vim.eval("a:rev1")' ).', '.
+                \(empty(a:rev2)  ? 'None' : 'vim.eval("a:rev2")' ).', '.
+                \(empty(a:files) ? '[]'   : 'vim.eval("a:files")').', '.
+                \'vim.eval("diffopts")'
+endfunction
 function s:hg.diff(repo, rev1, rev2, files, opts)
     let r=[]
     let diffopts=s:_r.utils.diffopts(a:opts, a:repo.diffopts, s:difftrans)
     try
-        execute s:pya.'diff(vim.eval("a:repo.path"), '.
-                    \      'vim.eval("a:rev1"), '.
-                    \      'vim.eval("a:rev2"), '.
-                    \      'vim.eval("a:files"), '.
-                    \      'vim.eval("diffopts"))'
+        execute s:pya.'diff('.s:F.getdiffargs(a:repo, a:rev1, a:rev2, a:files,
+                    \                         a:opts).')'
     endtry
     return r
 endfunction
     endif
     try
         let diffopts=s:_r.utils.diffopts(a:opts, a:repo.diffopts, s:difftrans)
-        execute s:pya.'diffToBuffer(vim.eval("a:repo.path"), '.
-                    \              'vim.eval("a:rev1"), '.
-                    \              'vim.eval("a:rev2"), '.
-                    \              'vim.eval("a:files"), '.
-                    \              'vim.eval("diffopts"))'
+        execute s:pya.'diffToBuffer('.s:F.getdiffargs(a:repo, a:rev1, a:rev2,
+                    \                                 a:files, a:opts).')'
     finally
         if oldbuf!=a:buf
             execute 'buffer' oldbuf

File autoload/aurum/hyperlink.vim

 scriptencoding utf-8
-execute frawor#Setup('0.0', {'@aurum': '1.0',
+execute frawor#Setup('0.1', {'@aurum': '1.0',
             \      '@%aurum/cmdutils': '4.0',
             \             '@/options': '0.0',})
 let s:_messages={
     endif
     "▲2
     let url=repo.functions.getrepoprop(repo, 'url')
-    let [protocol, user, domain, port, path]=
+    let [protocol, user, password, domain, port, path]=
                 \matchlist(url, '\v^%(([^:]+)\:\/\/)?'.
-                \                  '%(([^@/:]+)\@)?'.
+                \                  '%(([^@/:]+)'.
+                \                   '%(\:([^@/:]+))?\@)?'.
                 \                   '([^/:]*)'.
                 \                  '%(\:(\d+))?'.
-                \                   '(.*)$')[1:5]
+                \                   '(.*)$')[1:6]
     for [matcher, dict] in s:_f.getoption('hypsites')+repo.hypsites
         if eval(matcher)
             if !has_key(dict, utype)

File autoload/aurum/record.vim

             \               '@/mappings': '0.0',
             \                   '@aurum': '1.0',
             \             '@aurum/cache': '2.1',
-            \           '@%aurum/commit': '1.1',
+            \           '@%aurum/commit': '1.3',
             \         '@%aurum/cmdutils': '4.0',
             \        '@%aurum/lineutils': '0.0',
             \             '@%aurum/edit': '1.5',
             \           "  2. You edited a file which discards undo ".
             \                "information unless g:aurum_fullundo is set",
         \}
+"▶1 commitvimdiffcb
+function s:F.commitvimdiffcb(file, bvar, hex)
+    let [lwnr, rwnr, swnr]=s:F.getwnrs()
+
+    execute lwnr.'wincmd w'
+    let file=s:_r.os.path.join(a:bvar.repo.path, a:file)
+    let existed=bufexists(file)
+    execute 'silent edit' fnameescape(file)
+    if !existed
+        setlocal bufhidden=wipe
+    endif
+    diffthis
+
+    execute rwnr.'wincmd w'
+    let existed=s:_r.run('silent edit', 'file', a:bvar.repo, a:hex, a:file)
+    if !existed
+        setlocal bufhidden=wipe
+    endif
+    diffthis
+
+    execute lwnr.'wincmd w'
+endfunction
+"▶1 commitfindwindow
+function s:F.commitfindwindow()
+    let [lwnr, rwnr, swnr]=s:F.getwnrs()
+    execute lwnr.'wincmd w'
+    return 1
+endfunction
 "▶1 write
 function s:F.write(bvar)
     call feedkeys("\<C-\>\<C-n>:call ".
     let winview=winsaveview()
     try
         let r=s:_r.commit.commit(a:bvar.repo, a:bvar.recopts, files,
-                    \            a:bvar.status, keys(s:ntypes), 'silent edit')
+                    \            a:bvar.status, keys(s:ntypes), 'silent edit',
+                    \            {'vimdiffcb':  s:F.commitvimdiffcb,
+                    \             'findwindow': s:F.commitfindwindow,
+                    \             'bwfunc':     s:F.srestore,
+                    \             'sbvar':      a:bvar,
+                    \             'sbuf':       a:buf,
+                    \             'winview':    winview,})
     finally
         if bufwinnr(a:buf)!=-1
             call setbufvar(a:buf, '&bufhidden', 'wipe')
         call s:F.unload(a:bvar)
     else
         let w:aurecid='AuRecordCommitMessage'
-        let cbvar=s:_r.bufvars[bufnr('%')]
-        let cbvar.sbvar=a:bvar
-        let cbvar.sbuf=a:buf
-        let cbvar.bwfunc=s:F.srestore
-        let cbvar.winview=winview
     endif
     return 0
 endfunction

File doc/aurum.txt

                                                  *g:frawormap_AuCommitMessage*
        *g:frawormap_AuCommitMessage_Commit* *g:frawormap_AuCommitMessage_Prev*
        *g:frawormap_AuCommitMessage_Vdiff*  *g:frawormap_AuCommitMessage_Next*
+       *g:frawormap_AuCommitMessage_Fdiff*  *g:frawormap_AuCommitMessage_Diff*
        *g:frawormap_AuCommitMessage_FVdiff*
            *aurum-m-AuCommitMessage_Commit*     *aurum-m-AuCommitMessage_Prev*
            *aurum-m-AuCommitMessage_Vdiff*      *aurum-m-AuCommitMessage_Next*
+           *aurum-m-AuCommitMessage_Fdiff*      *aurum-m-AuCommitMessage_Diff*
            *aurum-m-AuCommitMessage_FVdiff*
     Mapname  LHS  Description ~
     Commit    i   Finish writing commit message and commit changes
                         message will be inserted before the first line of the 
                         buffer.
     Next      K   Like above, but works for descendants.
+    Diff      d   Open a diff with the selected file (uses file under cursor 
+                  or prompts user).
+    Fdiff    gd   Open a diff with all changes to be committed.
     Vdiff     D   Open a vimdiff split with the selected file (uses file under 
                   cursor or prompts user).
     FVdiff   gD   Open a number of vimdiff splits with all files to be 
     Open differencies between revisions {rev1} and {rev2} of files {files} 
     (semicolon-delimited list, semicolons in filenames can be escaped). For 
     {diffopts} see |aurum-diffoptions|. If one of {rev1} or {rev2} is empty 
-    then it will open the same diff as |:AuDiff| would if “rev1”, “rev2” and 
-    “changes” options were not given. If {files} is empty, then it will show 
-    all changes.
+    then it will open the same diff as |:AuDiff| would if “rev1” and/or “rev2” 
+    and “changes” options were not given. If {files} is empty, then it will 
+    show all changes.
     Local mappings (mgid=AuDiff, without leader by default):
                                                           *g:frawormap_AuDiff*
                          *g:frawormap_AuDiff_Next* *g:frawormap_AuDiff_FVdiff*
 Vdiff       D   acDf S  g  Shows vimdiff between cur. rev. and WD for file
                            (status and diff: between two current revisions)
 RVdiff      C   a  f s     Shows changes to file in cur. rev. as a vimdiff
-Fdiff      gd   a   lS  g  Shows diff between current revision and working dir
+Fdiff      gd   ac  lS  g  Shows diff between current revision and working dir
                            (status: between two current revisions)
 RFdiff     gc   a   ls     Shows changes introduced by current revision
-Diff        d   a  flS  g  Shows diff between rev and WD for current file
+Diff        d   ac flS  g  Shows diff between rev and WD for current file
                            (status: between two current revisions)
 Rdiff       c   a  fls     Shows changes done in current rev to current file
 Prev/Next  J/K  acdfl      Go to previous/next revision
     Ignored if there is only one window left.
     Default: “c”.
 
+commitinfowincmd                                    *g:aurum_commitinfowincmd*
+    String, one of “j”, “k”, “h”, “l”, “w”, “W”, “t”, “b”, “p”, “s”, “v”, 
+    “largest_vertical”, “largest_horizontal”, “largest_adjacent”, “largest”. 
+    Determines what window should be switched to when running 
+    |aurum-m-AuCommit_Diff| and |aurum-m-AuCommit_Fdiff| mappings. See 
+    |window-move-cursor| and |open-window| for the description of the keys. 
+    Values, beginning with “largest_” are special: they select the largest 
+    window out of vertical, horizontal or all four directions respectively. 
+    The largest is determined by comparing |winwidth()|*|winheight()|, window 
+    width in this formula is capped with 80 columns.
+    Ignored when commit is done from |aurum-record| mode, in this case diff 
+    always opens in left window.
+    Default: “largest_adjacent”.
+
+commitautoopendiff                                *g:aurum_commitautoopendiff*
+    Bool. Determines whether diff should be opened when commit window is 
+    created. Uses |g:aurum_commitinfowincmd| to determine where diff should be 
+    opened. Opened diff will be automatically closed when commit buffer is 
+    closed.
+    Default: 0.
+
 remembermsg                                              *g:aurum_remembermsg*
     Bool. Determines whether message typed in commit buffer should be saved 
     when commit is performed in case of rollback. This message will appear in 
         hex        Changeset hash (|aurum-cs.hex|) (url≠clone,push).
         url        URL of remote repository from local repository 
                    configuration.
-        protocol, user, domain, port, path
-                   Parts of the URL: {protocol}://{user}@{domain}{path}, 
-                   {path} must start with either forward slash or colon.
+        protocol, user, password, domain, port, path
+                   For {protocol}://{user}:{password}@{domain}:{port}{path} 
+                   each variable contains the value of {varname}. {path} must 
+                   start with either forward slash or colon and contains 
+                   everything after it. Each part may be omitted.
         matcher    First item in the current pair.
         dict       Second item in the current pair.
         utype      URL type.
     1.2: Made _r.status.parseshow handle “all” “status”.
 @%aurum/commit:
     1.0: Added fifth argument to _r.commit.commit().
-    1.1: Added sixth optional argument to _r.commit.commit()
+    1.1: Added sixth optional argument to _r.commit.commit().
+    1.2: Added vimdiffcb and findwindow functions to aurum://commit bvar, 
+         added |g:aurum_commitinfowincmd| option
+    1.3: Added seventh optional argument to _r.commit.commit() and 
+         |g:aurum_commitautoopendiff| option.
 @%aurum/annotate:
     1.0: Removed one argument to _r.annotate.setannbuf().
 @%aurum/cmdutils:
          made _r.utils.run return a pair (output, exit_code)
 @%aurum/file:
     0.1: Added |:AuFile| prompt option.
+@%aurum/hyperlink:
+    0.1: Added support for password in URL.
 
 vim: ft=help:tw=78

File ftplugin/aurumcommit.vim

             \           '@%aurum/bufvars': '0.0',
             \          '@%aurum/maputils': '0.0',
             \           '@%aurum/vimdiff': '1.1',
-            \            '@%aurum/commit': '1.0',
+            \            '@%aurum/commit': '1.2',
             \              '@%aurum/edit': '1.0',})
 "▶1 listfiles
 function s:F.listfiles(bvar)
         let status=a:bvar.repo.functions.status(a:bvar.repo, 0, 0, a:bvar.files)
         let status=filter(copy(status), 'index(s:defstats, v:key)!=-1')
         let revstatus={}
-        call map(copy(a:status), 'map(copy(v:val),'.
-                    \              '"extend(revstatus,{v:val:''".v:key."''})")')
+        call map(copy(status),'map(copy(v:val),'.
+                    \             '"extend(revstatus,{v:val :''".v:key."''})")')
         let a:bvar.revstatus=revstatus
         return keys(a:bvar.revstatus)
     endif
     endif
     return 0
 endfunction
-"▶1 vimdiffcb
-function s:F.vimdiffcb(file, bvar, hex)
-    execute 'silent tabnew'
-                \ fnameescape(s:_r.os.path.join(a:bvar.repo.path, a:file))
-    return s:_r.vimdiff.split([['file', a:bvar.repo, a:hex, a:file]], 0)
-endfunction
-"▶1 vimdiffrecordcb
-function s:F.vimdiffrecordcb(file, bvar, hex)
-    let [lwnr, rwnr, swnr]=a:bvar.sbvar.getwnrs()
-
-    execute lwnr.'wincmd w'
-    let file=s:_r.os.path.join(a:bvar.repo.path, a:file)
-    let existed=bufexists(file)
-    execute 'silent edit' fnameescape(file)
-    if !existed
+"▶1 diffcb
+function s:F.diffcb(file, bvar, hex)
+    call a:bvar.findwindow()
+    if !s:_r.mrun('silent edit', 'diff', a:bvar.repo, 0, 0, [a:file], {})
         setlocal bufhidden=wipe
     endif
-    diffthis
-
-    execute rwnr.'wincmd w'
-    let existed=s:_r.run('silent edit', 'file', a:bvar.repo, a:hex, a:file)
-    if !existed
-        setlocal bufhidden=wipe
-    endif
-    diffthis
-
-    execute lwnr.'wincmd w'
 endfunction
 "▶1 runcommap
 function s:F.runcommap(count, action)
                     \                                      bvar.recallcs.hex,
                     \                                      cnt)
         call append(0, split(bvar.recallcs.description, "\n", 1))
-    elseif a:action is# 'vimdiff'
+    elseif a:action is# 'fulldiff'
+        call bvar.findwindow()
+        if !s:_r.mrun('silent edit', 'diff', bvar.repo, 0, 0,
+                    \                        s:F.listfiles(bvar), {})
+            setlocal bufhidden=wipe
+        endif
+    elseif a:action is# 'diff' || a:action is# 'vimdiff'
         let file=s:F.getfile(bvar)
         let hex=bvar.repo.functions.getworkhex(bvar.repo)
-        let cbargs=[((has_key(bvar, 'sbvar'))?
-                    \   (s:F.vimdiffrecordcb):
-                    \   (s:F.vimdiffcb)), bvar, hex]
+        let cbargs=[(a:action is# 'diff' ? s:F.diffcb : bvar.vimdiffcb),
+                    \bvar, hex]
         if file is 0
             let pvargs=[s:_r.maputils.readfilewrapper, bvar.repo, hex]
             return s:_r.maputils.promptuser(s:F.listfiles(bvar), cbargs, pvargs)
             \ 'Commit': {'lhs':  'i', 'rhs': ['commit'     ]},
             \   'Prev': {'lhs':  'J', 'rhs': ['recallprev' ]},
             \   'Next': {'lhs':  'K', 'rhs': ['recallnext' ]},
+            \   'Diff': {'lhs':  'd', 'rhs': ['diff'       ]},
+            \  'Fdiff': {'lhs': 'gd', 'rhs': ['fulldiff'   ]},
             \  'Vdiff': {'lhs':  'D', 'rhs': ['vimdiff'    ]},
             \ 'FVdiff': {'lhs': 'gD', 'rhs': ['fullvimdiff']},
             \   'Exit': {'lhs':  'X', 'rhs': ['discard'    ]},

File python/aurum/aumercurial.py

     args=[ui, repo]+files
     kwargs=opts
     if rev2:
-        kwargs["rev"]=[rev2]
+        kwargs['rev']=[rev2]
         if rev1:
-            kwargs["rev"].append(rev1)
+            kwargs['rev'].append(rev1)
     else:
         if rev1:
-            kwargs["change"]=rev1
+            kwargs['change']=rev1
     run_in_dir(repo.root, commands.diff, *args, **kwargs)
 
 @outermethod

File test/gentests-setuptestrepos.zsh

 
 for test in cmd-annotate-buffers cmd+maps-commit cmd-record cmd-status \
             maps-status cmd+maps-vimdiff cmd-diff cmd-update opts-remembermsg \
-            opts-vimdiffusewin cmd-vimdiff-full cmdaus maps-record-undo
+            opts-vimdiffusewin cmd-vimdiff-full cmdaus maps-record-undo \
+            maps-commit-diff
 do
     ln -s util-add-modified-repo.zsh $test.pre
 done

File test/maps-commit-diff.in

+:W{{{1 Diff mapping
+:R AuCommit all
+G$,d:WW
+:bwipeout!
+:W{{{1 FDiff mapping
+,gd:WW
+:bwipeout!
+:bwipeout!
+:W{{{1 commitinfocmd
+vvsslsslss=4>jjh4+k
+:R silent edit aurum://commit
+:command -nargs=1 -bar Tcic :W{{{2 commitinfowincmd=<args> | let g:aurum_commitinfowincmd=<q-args> | execute 'normal ,gd' | WW | enew | wincmd p
+:Tcic largest_horizontal
+:Tcic largest_vertical
+:Tcic largest_adjacent
+:Tcic h
+:Tcic j
+:Tcic k
+:Tcic l

File test/maps-commit-diff.ok

+{{{1 Diff mapping
+#1: aurum://commit:%ETMPDIR%%-test%-maps-commit-diffrepo:::0:
+*2: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:hglines2.lst:
+{{{1 FDiff mapping
+*1: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+#2: aurum://commit:%ETMPDIR%%-test%-maps-commit-diffrepo:::0:
+{{{1 commitinfocmd
+{{{2 commitinfowincmd=largest_horizontal
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+#5: aurum://commit
+ 6: 
+ 7: 
+*8: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 9: 
+{{{2 commitinfowincmd=largest_vertical
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+#5: aurum://commit
+*6: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 7: 
+ 8: 
+ 9: 
+{{{2 commitinfowincmd=largest_adjacent
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+#5: aurum://commit
+*6: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 7: 
+ 8: 
+ 9: 
+{{{2 commitinfowincmd=h
+ 1: 
+*2: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 3: 
+ 4: 
+#5: aurum://commit
+ 6: 
+ 7: 
+ 8: 
+ 9: 
+{{{2 commitinfowincmd=j
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+#5: aurum://commit
+*6: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 7: 
+ 8: 
+ 9: 
+{{{2 commitinfowincmd=k
+ 1: 
+ 2: 
+ 3: 
+*4: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+#5: aurum://commit
+ 6: 
+ 7: 
+ 8: 
+ 9: 
+{{{2 commitinfowincmd=l
+ 1: 
+ 2: 
+ 3: 
+ 4: 
+#5: aurum://commit
+ 6: 
+ 7: 
+*8: aurum://diff:%ETMPDIR%%-test%-maps-commit-diffrepo:0:0:addeddef;hglines2.lst;nohglinesrev.lst:
+ 9: