Commits

ZyX_I committed 1bd62b4

Added comments explaining what will be commited

Comments (0)

Files changed (5)

plugin/aurum/cmdutils.vim

             \ 'nocurf': 'Failed to deduce which file was meant',
         \}
 "▶1 globtopattern :: glob → pattern
-" TODO test it
 function s:F.globtopattern(glob)
     " XXX If more metacharacters will be supported, they must be added to 
     " escape() calls in s:F.filehistory in ftplugin/aurumlog and in logfunc 

plugin/aurum/commit.vim

     endif
     return r
 endfunction
-"▶1 commit :: repo, opts, files → + repo
-" TODO Comments explaining what will be commited
+"▶1 commit :: repo, opts, files, status → + repo
 let s:defdate=['strftime("%Y")',
             \  'strftime("%m")',
             \  'strftime("%d")',
             \  '"00"',
             \  '"00"',
             \  '"00"']
+let s:statmsgs={
+            \'added': 'Added',
+            \'removed': 'Removed',
+            \'modified': 'Modified',
+        \}
+let s:statmsgs.unknown=s:statmsgs.added
+let s:statmsgs.deleted=s:statmsgs.removed
 " XXX Do not change names of options used here, see :AuRecord
-function s:F.commit(repo, opts, files)
+function s:F.commit(repo, opts, files, status)
     let user=''
     let date=''
     let message=''
     let cb=get(a:opts, 'closebranch', 0)
+    let revstatus={}
+    call map(copy(a:status),
+                \'map(copy(v:val),"extend(revstatus,{v:val : ''".v:key."''})")')
     for key in filter(['user', 'date', 'message'], 'has_key(a:opts, v:val)')
         let l:{key}=a:opts[key]
     endfor
             call cursor(line('$'), col([line('$'), '$']))
             unlet g:AuPreviousRepoPath g:AuPreviousTip g:AuPreviousCommitMessage
         endif
+        let fmessage=[]
+        for file in a:files
+            let fmessage+=['# '.s:statmsgs[revstatus[file]].' '.file]
+        endfor
+        call append('.', fmessage)
         startinsert
         return 0
     else
 function s:commfunc.function(opts, ...)
     let repo=a:opts.repo
     call s:_r.cmdutils.checkrepo(repo)
+    let status=repo.functions.status(repo)
     "▶2 Get file list
     if a:0 && index(a:000, 'all')!=-1
         let files=[]
         let filepats=map(filter(copy(a:000), 'v:val isnot# ":"'),
                     \    's:_r.cmdutils.globtopat('.
                     \    'repo.functions.reltorepo(repo, v:val))')
-        let status=repo.functions.status(repo)
         let files=[]
         if len(filepats)!=a:0
             let files+=[repo.functions.reltorepo(repo, expand('%'))]
         call s:_f.throw('nocfile')
     endif
     "▲2
-    return s:F.commit(repo, a:opts, files)
+    return s:F.commit(repo, a:opts, files, status)
 endfunction
 let s:commfunc['@FWC']=['-onlystrings '.
             \           '{  repo '.s:_r.cmdutils.repoarg.

plugin/aurum/record.vim

             call s:_f.warn('recnof')
             return
         endif
-        aboveleft let r=s:_r.commit.commit(bvar.repo, bvar.recopts, files)
+        aboveleft let r=s:_r.commit.commit(bvar.repo, bvar.recopts, files,
+                    \                      bvar.status)
         if r
             call s:F.unload(bvar)
         else

plugin/aurum/status.vim

     let bvar=a:bvar
     let status=bvar.repo.functions.status(bvar.repo, get(bvar.opts, 'rev1', 0),
                 \                                    get(bvar.opts, 'rev2', 0))
+    let bvar.status=status
     let bvar.types=[]
     let bvar.chars=[]
     let bvar.files=[]

syntax/aurumcommit.vim

+if exists('b:current_syntax')
+    finish
+endif
+
+syn match auCommitComment /\v^\#.*/
+
+hi def link auCommitComment Comment
+
+let b:current_syntax=expand('<sfile>:t:r')
+