1. ZyX_I
  2. aurum

Commits

ZyX_I  committed 0ca6769

Added `cmd' option to :AuGlog

  • Participants
  • Parent commits 1d30c1f
  • Branches default

Comments (0)

Files changed (6)

File ftplugin/aurumgraphlog.vim

View file
         let diff=a:opts.repo.functions.diff(a:opts.repo, a:cs.hex,
                     \                       a:cs.parents[0], patchfiles, a:opts)
         if dostat
-            " FIXME Put this regular expressions somewhere else
+            " TODO Put this regular expressions somewhere else
             let git=get(a:opts, 'git', 0)
             let stats=s:F.glog.getstats(diff, git ? '\V --git a/\(\.\{-}\) b/'
                         \                         : '\v\ .*\-r\ \w+\s(.*)$')
     while !empty(tocheck)
         let [file, cs]=remove(tocheck, 0)
         if !has_key(a:csfiles, cs.hex)
-            " FIXME Check whether it causes a problem with more then one parent
+            " TODO Check whether it causes a problem with more then one parent
             return
         endif
         let rename=get(cs.renames, file, 0)

File plugin/aurum.vim

View file
 let s:patharg='either (path d, match @\v^\w+%(\+\w+)*\V://@)'
 let s:repoarg=':*F.comm.getrepo(".") ('.s:patharg.
             \                        '|*F.comm.getrepo '.
+            \                        '#norepo '.
             \                        'type {})'
-            " FIXME Check when this line is just before `type {}'
-            " \                        '#norepo '.
 let s:nogetrepoarg=':"." ('.s:patharg.')'
 let s:nogetrepocarg=':":" ('.s:patharg.')'
+let s:cmds=['new', 'vnew', 'edit',
+            \'leftabove vnew', 'rightbelow vnew', 'topleft vnew', 'botright vnew',
+            \'aboveleft new',  'belowright new',  'topleft new',  'botright new'
+            \]
+call map(s:cmds, 'escape(v:val, " ")')
 let s:_messages={
             \ 'uchngs': 'Found changes done manually. Resetting buffer, '.
             \           'please retry.',
     endif
     let opts=s:F.comm.encodeopts(a:opts)
     let epath=escape(a:repo.path, ':\')
-    execute 'silent new '.fnameescape('aurum://glog:'.epath.':'.opts)
+    let cmd=get(a:opts, 'cmd', 'silent new')
+    execute cmd fnameescape('aurum://glog:'.epath.':'.opts)
 endfunction
-" FIXME Check :AuGlog stats, :AuGlog repo testrepo, :AuGlog branch
 let s:glogfunc['@FWC']=['-onlystrings '.
             \           '['.s:repoarg.']'.
             \           '{ *?files    (type "")'.
             \           '  !?showfiles'.
             \           '  !?showrenames'.
             \           s:diffoptsstr.
+            \           '   ?cmd      type ""'.
             \           '}', 'filter']
 call add(s:glogcomp,
-            \substitute(substitute(s:glogfunc['@FWC'][0],
+            \substitute(substitute(substitute(s:glogfunc['@FWC'][0],
             \'\V|*F.comm.getrepo',  '',           ''),
-            \'\vfiles\s+\([^)]*\)', 'files path', ''))
+            \'\vfiles\s+\([^)]*\)', 'files path', ''),
+            \'\V?cmd\s\+type ""',   'cmd first (in cmds, idof command)', ''))
 "▶2 annfunc
 function s:annfunc.function(opts)
     let [hasannbuf, repo, rev, file]=s:F.comm.getrrf(a:opts, 'noafile')
             execute 'silent edit '.
                         \fnameescape('aurum://file:'.epath.':'.frev.':'.file)
         endif
+        let fbuf=bufnr('%')
     endif
     for rev in revs
         if rev is 0
             let f='aurum://file:'.epath.':'.rev.':'.file
         endif
         if hasbuf && len(revs)==1
+            let existed=bufexists(f)
             call s:F.comm.diffsplit(fbuf, f)
+            if !existed
+                setlocal bufhidden=wipe
+            endif
         else
             execute 'silent diffsplit' fnameescape(f)
         endif
     endfor
+    if bufwinnr(fbuf)!=-1
+        execute bufwinnr(fbuf).'wincmd w'
+    endif
 endfunction
 let s:vimdfunc['@FWC']=['-onlystrings '.
             \           '{  repo  '.s:nogetrepocarg.

File test/glog-cmd.in

View file
+:Run AuGlog cmd silent\ edit
+:call WriteFile('w$: '.winnr('$'))
+:source addmessages.vim

File test/glog-cmd.ok

View file
+@  Changeset 22:bd8865085771912fc9ab56425f385a1751696ec1
+|  Commited 11 Feb 2002 05:43 by A <a@example.com>
+|  Tag: tip
+|    Added .hgignore
+|  
+o  Changeset 21:9b5258a5153f27d241f5040773f1b8e4e1f1007f
+|  Commited 11 Feb 2002 03:15 by A <a@example.com>
+|    Added ignored10.lst
+|  
+o  Changeset 20:94915b6e8a2083844817612e240b051c659cc8c1
+|  Commited 10 Feb 2002 16:01 by B <b@example.org>
+|    Added nohglinesrev.lst
+|  
+o  Changeset 19:beb86707c20d123eb87539cf8e768f01bba92b88
+|  Commited 10 Feb 2002 15:33 by B <b@example.org>
+|    Added nohglines.lst
+|  
+o  Changeset 18:4611405bbd48d7553b65527362efbadf3962a1b3
+|  Commited 10 Feb 2002 05:00 by A <a@example.com>
+|    Copied “hglines.lst” to “hglines2.lst”
+|  
+o    Changeset 17:92417d8da493282f784bfc6503e5df0be8244cf0
+|\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| |    Merge from A
+| |  
+o |    Changeset 16:953c61e9595489c939871a73bee3f2695d152b0a
+|\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | |    Merge from C:1
+| | |  
+| | o    Changeset 15:1992543408d3ea5517669672c604d27a4f2a98bf (branch A)
+| | |\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | |    Merge from C:2
+| | | |  
+| | o |    Changeset 14:cb8988d17d9028501b649479a7fe120950f8a355 (branch A)
+| | |\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | | |    Merge from B
+| | | | |  
+| | | | | o  Changeset 13:813cb09ba00f7521079d836cee6cd6088f3267c0 (branch C)
+| | | | |/   Commited 01 Feb 2001 14:56 by B <b@example.org>
+| | | | |      Added tag clines for changeset 12844281dfff
+| | | | |    
+| +-----o  Changeset 12:12844281dfff5856777e1eb742e4208e88ae8fe0 (branch C)
+| | | |    Commited 01 Feb 2001 14:56 by B <b@example.org>
+| | | |    Tag: clines
+| | | |      Added clines.lst
+| | | |    
+| +-----o  Changeset 11:4500f72da552962c983ec6a8f188c8411cd2eff7 (branch C)
+| | | |    Commited 01 Feb 2001 05:19 by A <a@example.com>
+| | | |      Added tag blines for changeset d924bbfba7c0
+| | | |    
+| o | |  Changeset 10:d924bbfba7c0cedef506ac507f73ea194ef8e7a0 (branch C)
+| | | |  Commited 01 Feb 2001 05:18 by A <a@example.com>
+| | | |  Tag: blines
+| | | |    Added blines.lst
+| | | |  
+o | | |    Changeset 9:c8b03fbdb1d40207b806224fa02e348d041d4733
+|\ \ \ \   Commited 01 Jan 2001 00:00 by C <c@example.gov>
+| | | | |    Merge from C
+| | | | |  
+| | o | |  Changeset 8:2dacb96bd8953daf557f2350309080331795025a (branch C)
+| |/ / /   Commited 02 Nov 2000 14:14 by B <b@example.org>
+| | | |      Added tag ablines for changeset 34f86802338f
+| | | |    
+| o---+  Changeset 7:34f86802338f49d174d1b1f783def16f8b0d5a28 (branch C)
+|   | |  Commited 02 Nov 2000 14:13 by B <b@example.org>
+|  / /   Tag: ablines
+| | |      Added ablines.lst
+| | |    
+| | o  Changeset 6:ad9ef3ae5da7f0af0f413dc9b0bbbccc73195c73 (branch B)
+| |/   Commited 02 Nov 2000 05:44 by A <a@example.com>
+| |      Added alines.lst
+| |    
+| o  Changeset 5:c5d978071bc74635267df368a498d81f4ca03e27 (branch A)
+|/   Commited 01 Nov 2000 13:24 by B <b@example.org>
+|      Added dlines.lst
+|    
+o  Changeset 4:a02f2fc6c51afe07a34bd65f5f8bb69d74105054
+|  Commited 10 May 2000 04:23 by A <a@example.com>
+|    Added «hglines.lst» and «datelines.lst»
+|  
+o  Changeset 3:edd6110273b433a7e0cbdc512ea8f0eb8978a592
+|  Commited 01 Feb 2000 14:00 by B <b@example.org>
+|    Renamed «crepo.zsh» to «chgrepo.zsh»
+|  
+o  Changeset 2:1ddeac9b650f689aec0a77b68463ba9de40d9e01
+|  Commited 15 Jan 2000 15:00 by B <b@example.org>
+|    Replaced
+|        (
+|            ...
+|        )
+|    with
+|        {
+|            ...
+|        }
+|  
+o  Changeset 1:6a040abfa9457d6066c8469fab4f9e3ae1f3e494
+|  Commited 05 Jan 2000 07:30 by A <a@example.com>
+|    Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 0:00b61a9315e2ecb239feba3bc44b2ef3af4c7dd1
+|  Commited 02 Jan 1999 05:20 by A <a@example.com>
+|    Added «createrepo.zsh»
+|  
+w$: 1

File test/glog.in

View file
 :Run AuGlog
+:call WriteFile('w$: '.winnr('$'))
 :source addmessages.vim

File test/glog.ok

View file
 |  Commited 02 Jan 1999 05:20 by A <a@example.com>
 |    Added «createrepo.zsh»
 |  
+w$: 2