Commits

ZyX_I committed a8f5d50

Added `revision' :AuGlog option
Renamed `rev' :AuGlog option to `revrange'
Made <CR> on changeset show only ancestors of current revision
Added `gr' mapping (same as <CR> on changeset)
`revrange' fixes

Comments (0)

Files changed (3)

ftplugin/aurumgraphlog.vim

                 \                    (len(a:cs.parents)>1))) ||
                 \(has_key(a:opts, 'search') &&
                 \   a:cs.description!~#a:opts.search) ||
-                \(has_key(a:opts, 'user') && a:cs.user!~#a:opts.user)
+                \(has_key(a:opts, 'user') && a:cs.user!~#a:opts.user) ||
+                \(has_key(a:opts, 'revision') &&
+                \   !has_key(a:opts.revisions, a:cs.hex))
         let r.min=1
         return r
     endif
                 \'specials': {},
                 \'rectangles': [],
                 \'csstarts': {},}
-    for cs in a:css[a:opts.rev[0]:a:opts.rev[1]]
+    for cs in a:css
+        echom cs.rev
         let char=((index(a:showparents, cs.hex)==-1)?('o'):('@'))
         let text=call(a:Dumper, [cs, a:opts], {})
         call s:F.glog.utf(state, 'C', char, text,
 endfunction
 "▶2 glog.graphlog
 function s:F.glog.graphlog(repo, opts)
-    let css=reverse(a:repo.cslist[:-2])
+    let css=reverse(a:repo.cslist[a:opts.revrange[0]:a:opts.revrange[1]-1])
     let a:opts.repo=a:repo
     return s:F.glog.generate(css, [a:repo.work_hex], s:F.glog.summary, a:opts)
 endfunction
         let &l:syntax=&l:syntax
     endif
     "▶2 Get revision range
-    if has_key(bvar.opts, 'rev')
-        call map(bvar.opts.rev,
+    if has_key(bvar.opts, 'revrange')
+        call map(bvar.opts.revrange,
                     \'bvar.repo.changesets['.
                     \   'bvar.repo.functions.getrevhex(bvar.repo, v:val)].rev')
     elseif get(bvar.opts, 'limit', 0)>0
-        let bvar.opts.rev=[len(bvar.repo.cslist)-limit, -1]
+        let bvar.opts.revrange=[bvar.repo.csnum-limit, -1]
     else
-        let bvar.opts.rev=[0, -1]
+        let bvar.opts.revrange=[0, bvar.repo.csnum-1]
+    endif
+    "▶2 Process `revision' option
+    if has_key(bvar.opts, 'revision')
+        let hex=bvar.repo.functions.getrevhex(bvar.repo, bvar.opts.revision)
+        let cs=bvar.repo.changesets[hex]
+        if cs.rev<bvar.opts.revrange[1]
+            let bvar.opts.revrange[1]=cs.rev
+        endif
+        let bvar.opts.revisions={}
+        let addrevs=[cs]
+        while !empty(addrevs)
+            let cs=remove(addrevs, 0)
+            if has_key(bvar.opts.revisions, cs.hex)
+                continue
+            endif
+            let bvar.opts.revisions[cs.hex]=1
+            let addrevs+=map(copy(cs.parents), 'bvar.repo.changesets[v:val]')
+        endwhile
     endif
     "▲2
-    let cslist=bvar.repo.cslist[bvar.opts.rev[0]:bvar.opts.rev[1]]
+    let cslist=bvar.repo.cslist[bvar.opts.revrange[0]:bvar.opts.revrange[1]]
     "▶2 Generate cs.renames for `showrenames' option
     if has_key(bvar.opts, 'showrenames')
         for cs in cslist
         let cmd='edit '.fnameescape('aurum://glog:'.epath.':'.opts.
                     \               'date:'.strftime('*\:%m\:%Y', cs.time).','.
                     \               'crrestrict:date')
+    "▶3 changeset: show only ancestors of the current changeset
+    elseif spname is# 'changeset'
+        let cmd='edit '.fnameescape('aurum://glog:'.epath.':'.opts.
+                    \               'revision:'.hex.','.
+                    \               'crrestrict:revision')
     "▶3 file: view file
     elseif spname=~#'\v^file\d+$'
         " XXX If fileN special exists, then files property was definitely added, 
             \    'User': {'lhs': 'gu', 'rhs': ['user']                        },
             \    'Date': {'lhs': 'gD', 'rhs': ['date']                        },
             \  'Branch': {'lhs': 'gb', 'rhs': ['branch']                      },
+            \     'Rev': {'lhs': 'gr', 'rhs': ['changeset']                   },
             \    'Diff': {'lhs':  'd', 'rhs': ['diff']                        },
             \   'RDiff': {'lhs':  'c', 'rhs': ['revdiff']                     },
             \   'VDiff': {'lhs':  'D', 'rhs': [1],         'func': s:F.vimdiff},

ftplugin/aurumstatus.vim

             \ 'ROpen': {'lhs': 'o',    'rhs': ['revopen']},
             \  'Diff': {'lhs': 'd',    'rhs': [   'diff']},
             \ 'Vdiff': {'lhs': 'D',    'rhs': ['vimdiff']},
-            \}, {'func': s:F.runmap})
+            \}, {'func': s:F.runmap, 'silent': 1})
 "▶1
 call frawor#Lockvar(s:, '_r')
 " vim: ft=vim ts=4 sts=4 et fmr=▶,▲
             let opts.files=map(split(opts.files, '\v%(\\@<!\\%(\\\\)*)@<!;'),
                         \            's:F.comm.globtopattern(v:val)')
         endif
-        if has_key(opts, 'rev')
-            let opts.rev=split(opts.rev, ';')
+        if has_key(opts, 'revrange')
+            let opts.revrange=split(opts.revrange, ';')
         endif
         for key in filter(['merges', 'patch', 'limit', 'stat', 'showfiles'],
                     \     'has_key(opts, v:val)')
             \                               'match @\v^\w+%(\+\w+)*\V://@) '.
             \                        '|*F.comm.getrepo)'
 let s:glogfunc['@FWC']=['['.s:repoarg.']'.
-            \           '{ *?files   (type "")'.
-            \           '   ?date    match /\v%(\d\d?|\*)'.
-            \                                '%(\.%(\d\d?|\*)'.
-            \                                '%(\.%(\d\d%(\d\d)?|\*)'.
-            \                                '%(\ %(\d\d?|\*)'.
-            \                                '%(\:%(\d\d?|\*))?)?)?)?/'.
-            \           '   ?search  isreg'.
-            \           ' +2?rev     type "" type ""'.
+            \           '{ *?files    (type "")'.
+            \           '   ?date     match /\v%(\d\d?|\*)'.
+            \                                 '%(\.%(\d\d?|\*)'.
+            \                                 '%(\.%(\d\d%(\d\d)?|\*)'.
+            \                                 '%(\ %(\d\d?|\*)'.
+            \                                 '%(\:%(\d\d?|\*))?)?)?)?/'.
+            \           '   ?search   isreg'.
+            \           '   ?user     isreg'.
+            \           '   ?branch   type ""'.
+            \           '   ?limit    range 1 inf'.
+            \           '   ?revision type ""'.
+            \           ' +2?revrange type "" type ""'.
             \           '  !?merges'.
-            \           '   ?user    isreg'.
-            \           '   ?branch  type ""'.
             \           '  !?patch'.
-            \           '   ?limit   range 1 inf'.
             \           '  !?stat'.
             \           '  !?showfiles'.
             \           '  !?showrenames'.