Commits

ZyX_I committed bb7936e

@aurum/repo, @aurum/drivers/*: Added repo.initprops
@aurum/log: Moved s:F.reqiredpropslist functionality to template function generator
Made it use repo.initprops to filter requirements

  • Participants
  • Parent commits 4068004

Comments (0)

Files changed (5)

File doc/aurum.txt

     If it is true, then it also assumes that changesets sorted by revision 
     numbers are sorted in topological order (see |aurum-rf-getchangesets|).
     This key is optional, default value: true.
+initprops :: [ propname ]                               *aurum-repo.initprops*
+    Contains list of properties that are always set by |aurum-rf-getcs|.
+    This key is optional, default value: ["rev", "hex", "parents", "tags", 
+    "bookmarks", "branch", "time", "user", "description"]
                                                         *aurum-repo.iterfuncs*
 iterfuncs :: {String : {"start": startfunc, "next": nextfunc}}
         startfunc :: repo, opts -> d
     2.0: Purged support of numeric ranges out of |aurum-rf-revrange|, returned 
          value of |aurum-rf-getchangesets| is not stated as ignored.
     2.1: Added |aurum-repo.iterfuncs| support.
+    2.2: Added |aurum-repo.initprops|.
 @aurum:
     0.1: Added :AuBranch and :AuName
 @aurum/edit:

File plugin/aurum/drivers/mercurial.vim

                 \'labeltypes': ['tag', 'bookmark'],
                 \'has_octopus_merges': 0, 'requires_sort': 0,
                 \'iterfuncs': deepcopy(s:iterfuncs),
-                \'hypsites': deepcopy(s:hypsites),}
+                \'hypsites': deepcopy(s:hypsites),
+                \'initprops': ['rev', 'hex', 'parents', 'tags', 'bookmarks',
+                \              'branch', 'time', 'user', 'changes', 'removes',
+                \              'copies', 'renames', 'files', 'description']}
     return repo
 endfunction
 endif

File plugin/aurum/drivers/subversion.vim

                 \'local': (stridx(a:path, '://')==-1),
                 \'labeltypes': [], 'hasrevisions': 1,
                 \'requires_sort': 0, 'has_octopus_merges': 0,
-                \'has_merges': 0,}
+                \'initprops': ['rev', 'hex', 'parents', 'tags', 'bookmarks',
+                \              'branch', 'time', 'user', 'description',
+                \              'renames', 'copies'],
+                \'has_merges': 0,
+                \}
     return repo
 endfunction
 "▶1 svn.checkdir :: dir → Bool

File plugin/aurum/log.vim

                 \         '@aurum/bufvars': '0.0',
                 \            '@aurum/edit': '1.0',
                 \                  '@/fwc': '0.3',
-                \            '@aurum/repo': '2.1',
+                \            '@aurum/repo': '2.2',
                 \             '@/commands': '0.0',
                 \            '@/functions': '0.0',
                 \              '@/options': '0.0',}, 0)
     endif
     let foundfirst=0
     let csbuf=[]
-    let reqprops=s:F.requiredpropslist(a:opts)
+    let reqprops=keys(a:opts.reqs)
+    call filter(reqprops, 'index(a:repo.initprops, v:val)==-1')
     "▶3 Initialize variables not required for reading
     if !a:read
         let specials={}
             \'parents': '\v\x{12,}( \x{12,})?',
             \'children': '\v\x{12,}( \x{12,})*',
         \}
+let s:kwreqseqkw=['hex', 'branch', 'user', 'rev', 'time', 'parents', 'children',
+            \     'tags', 'bookmarks', 'description', 'files', 'changes']
+let s:kwreqs = {'stat': {'files': 1},
+            \'renames': {'files': 1, 'renames': 1},
+            \ 'copies': {'files': 1, 'renames': 1},
+            \}
+call map(s:kwreqseqkw, 'extend(s:kwreqs, {v:val : {v:val : 1}})')
+unlet s:kwreqseqkw
 "▶2 temp.stat :: stats, idxlist, linebeg → ([String], sp)
 function s:F.temp.stat(stats, idxlist, linebeg)
     let sitems=map(sort(keys(a:stats.files)),
                     \                                    'a:opts)',
                     \'endif']
     endif
+    let reqs={}
     "▲3
     for [lit; meta] in a:template
         if s:F.temp.skip(meta, a:opts)
                 if kw is# 'rev' && !hasrevisions && arg.0 isnot# 'keep'
                     continue
                 endif
+                "▶3 Add requirements information
+                if has_key(s:kwreqs, kw)
+                    call extend(reqs, s:kwreqs[kw])
+                endif
                 "▶3 Add complex multiline statement
                 let addedif2=0
                 if ke[0]==2
                 \'endfunction']
     let d={}
     execute join(func, "\n")
-    let s:compilecache[cid]=d.template
-    return d.template
+    let r=[reqs, d.template]
+    let s:compilecache[cid]=r
+    return r
 endfunction
 "▶2 temp.addgroup
 function s:F.temp.addgroup(r, nlgroups, group)
     endfor
     return 0
 endfunction
-"▶1 requiredpropslist :: opts → [csprop]
-function s:F.requiredpropslist(opts)
-    let r=[]
-    let r+=filter(['renames', 'copies'], 'get(a:opts, "show".v:val, 0)')
-    if           get(a:opts, 'showrenames', 0) ||
-                \get(a:opts, 'showcopies',  0) ||
-                \get(a:opts, 'showfiles',   0) ||
-                \get(a:opts, 'stat',        0)
-        let r+=['files']
-    endif
-    if get(a:opts, 'showfiles', 0)
-        let r+=['changes']
-    endif
-    return r
-endfunction
 "▶1 iterfuncs.check
 " startfunc (here)  :: repo, opts → d
 let s:fcheckpropslist=['renames', 'copies', 'changes', 'files']
     endif
     let opts.repo=a:repo
     let bvar.templatelist=s:F.temp.parse(template)
-    let opts.templatefunc=s:F.temp.compile(bvar.templatelist, opts)
+    let [opts.reqs, opts.templatefunc]=s:F.temp.compile(bvar.templatelist, opts)
     "▲2
     if !a:read
         "▶ Required for setting syntax definitions and also for maps to work

File plugin/aurum/repo.vim

 "▶1
 scriptencoding utf-8
 if !exists('s:_pluginloaded')
-    execute frawor#Setup('2.1', {'@/resources': '0.0',
+    execute frawor#Setup('2.2', {'@/resources': '0.0',
                 \                       '@/os': '0.0',
                 \                  '@/options': '0.0',
                 \             '@aurum/bufvars': '0.0',}, 0)
     else
         call extend(repo.iterfuncs, s:iterfuncs, 'keep')
     endif
+    if !has_key(repo, 'initprops')
+        let repo.initprops=['rev', 'hex', 'parents', 'tags', 'bookmarks',
+                    \       'branch', 'time', 'user', 'description']
+    endif
     lockvar! repo
     unlockvar! repo.cslist
     unlockvar! repo.changesets