Commits

ZyX_I committed b8444a4

Made :AuJunk throw an exception when called without arguments
Made :AuLog accept date ranges (<=date, >=date, date<=>date)
Fixed :AuDiff glob1 glob2 (second glob had no affect)

Comments (0)

Files changed (7)

             \'nocread': 'Cannot read aurum://commit',
             \ 'invurl': 'Failed to parse url %s of repository %s',
             \ 'unkurl': 'Failed to process url %s of repository %s',
+            \'nofiles': 'No files were specified',
         \}
 "▶1 closebuf :: bvar → + buf
 function s:F.closebuf(bvar)
             \ 'Vdiff': {'lhs': 'D', 'rhs': ['vimdiff' ]},
         \}, {'func': s:F.rundiffmap, 'silent': 1, 'mode': 'n', 'dontmap': 1,})
 "▶1 difffunc
+" TODO globs -> repo
 function s:difffunc.function(opts, ...)
     let repo=a:opts.repo
     call s:_r.cmdutils.checkrepo(repo)
     call map(csfiles, 'join(s:_r.os.path.split(v:val)[1:], "/")')
     let filelist=[]
     for pattern in map(copy(files), 's:_r.cmdutils.globtopat(v:val)')
-        let filelist+=filter(csfiles, 'v:val=~#pattern && '.
-                    \                 'index(filelist, v:val)==-1')
+        let filelist+=filter(copy(csfiles), 'v:val=~#pattern && '.
+                    \                       'index(filelist, v:val)==-1')
     endfor
     if hascur
         let curfile=s:_r.cmdutils.getrrf({'repo': ':'}, 'nocurf', -1)[3]
 "▶1 junkfunc
 function s:junkfunc.function(opts, ...)
     if !a:0
-        return
+        call s:_f.throw('nofiles')
     endif
     let repo=s:_r.repo.get(a:1)
     let allfiles=s:F.getexsttrckdfiles(repo)

plugin/aurum/commit.vim

                 \                     a:bvar.closebranch)
 endfunction
 "▶1 commfunc
+" TODO globs -> repo
 function s:commfunc.function(opts, ...)
     let [repo, rev, files]=s:_r.cmdutils.getrrf(a:opts,
                 \                               ((a:0)?(0):('nocfile')),

plugin/aurum/log.vim

     let s:syncache[cid]=r
     return r
 endfunction
+"▶1 comparedates :: datesel, time → -1|0|1
+let s:datechars='YmdHM'
+function s:F.comparedates(datesel, time)
+    let j=0
+    for selnum in split(a:datesel, '\v[^0-9*.]+')
+        if selnum isnot# '*'
+            let spec='%'.s:datechars[j]
+            if selnum is# '.'
+                let selnum=str2nr(strftime(spec))
+            else
+                if j==0 && len(selnum)==2
+                    let y=str2nr(selnum)
+                    let cy=str2nr(strftime('%y'))
+                    let c=str2nr(strftime('%Y')[:-3])
+                    if y<=cy
+                        let selnum=((c*100)+y)
+                    else
+                        let selnum=(((c-1)*100)+y)
+                    endif
+                else
+                    let selnum=str2nr(selnum)
+                endif
+            endif
+            let actnum=str2nr(strftime(spec, a:time))
+            if actnum!=selnum
+                if actnum<selnum
+                    return -1
+                else
+                    return 1
+                endif
+            endif
+        endif
+        let j+=1
+    endfor
+    return 0
+endfunction
 "▶1 setup
 "▶2 trackfile :: repo, cs, file, csfiles → + csfiles
 function s:F.trackfile(repo, cs, file, csfiles)
     endwhile
 endfunction
 "▲2
-let s:datechars='YmdHM'
 function s:F.setup(bvar)
     let bvar=a:bvar
     if has_key(bvar, 'createdlog')
             let skip=1
         "▶3 `date'
         elseif has_key(bvar.opts, 'date')
-            let j=0
-            for num in split(bvar.opts.date, '\v[^0-9*.]+')
-                if num isnot# '*'
-                    let spec='%'.s:datechars[j]
-                    if num is# '.'
-                        let num=str2nr(strftime(spec))
-                    else
-                        if j==0 && len(num)==2
-                            let y=str2nr(num)
-                            let cy=str2nr(strftime('%y'))
-                            let c=str2nr(strftime('%Y')[:-3])
-                            if y<=cy
-                                let num=((c*100)+y)
-                            else
-                                let num=(((c-1)*100)+y)
-                            endif
-                        else
-                            let num=str2nr(num)
-                        endif
-                    endif
-                    if str2nr(strftime(spec, cs.time))!=num
-                        let skip=1
-                        break
-                    endif
+            if match(bvar.opts.date, '\V<=\?>')!=-1
+                let [date1, date2]=split(bvar.opts.date, '\V<=\?>')
+                let acceptexact=(stridx(bvar.opts.date, '<=>', len(date1))!=-1)
+                let cmp1result=s:F.comparedates(date1, cs.time)
+                let cmp2result=s:F.comparedates(date2, cs.time)
+                if !((cmp1result==1 && cmp2result==-1) ||
+                            \(acceptexact && (cmp1result==0 ||
+                            \                 cmp2result==0)))
+                    let skip=1
                 endif
-                let j+=1
-            endfor
+            else
+                let selector=bvar.opts.date[0]
+                let acceptexact=(stridx('<>', selector)==-1 || bvar.opts.date[1] is# '=')
+                let cmpresult=s:F.comparedates(bvar.opts.date, cs.time)
+                if !((acceptexact && cmpresult==0) ||
+                            \(selector is# '<' && cmpresult==-1) ||
+                            \(selector is# '>' && cmpresult==1))
+                    let skip=1
+                endif
+            endif
         endif
         "▶3 `files'
         if !skip && has_key(bvar.opts, 'files')
 augroup END
 let s:_augroups+=['auLogSyntax']
 "▶1 logfunc
-" TODO make :AuLog accept date ranges
 function s:logfunc.function(repo, opts)
     call s:_r.cmdutils.checkrepo(a:repo)
     let opts=copy(a:opts)
     let epath=escape(a:repo.path, ':\')
     execute cmd fnameescape('aurum://log:'.epath.':'.optsstr)
 endfunction
+let s:datereg='%(\d\d%(\d\d)?|[*.])'.
+            \ '%(\-%(\d\d?|[*.])'.
+            \ '%(\-%(\d\d?|[*.])'.
+            \ '%([ _]%(\d\d?|[*.])'.
+            \ '%(\:%(\d\d?|[*.]))?)?)?)?'
 let s:logfunc['@FWC']=['-onlystrings '.
             \          '['.s:_r.cmdutils.repoarg.']'.
             \          '{ *?files    (type "")'.
             \          '  *?ignfiles in [patch renames diff files] ~start'.
-            \          '   ?date     match /\v%(\d\d%(\d\d)?|[*.])'.
-            \                                '%(\-%(\d\d?|[*.])'.
-            \                                '%(\-%(\d\d?|[*.])'.
-            \                                '%([ _]%(\d\d?|[*.])'.
-            \                                '%(\:%(\d\d?|[*.]))?)?)?)?/'.
+            \          '   ?date     match /\v[<>]?\=?'.s:datereg.'|'.
+            \                                 s:datereg.'\<\=?\>'.s:datereg.'/'.
             \          '   ?search   isreg'.
             \          '   ?user     isreg'.
             \          '   ?branch   type ""'.
 :command -nargs=? -bar CS :execute 'Run AuStatus '.<q-args> | bwipeout! | bwipeout! | for file in split(glob(g:curtest.'repo/test/*'), "\n") | call delete(file) | endfor | R silent AuUpdate!
 :W{{{1 :AuJ
 :R silent edit hglines.lst
-:AuJunk
+:try | AuJunk | catch | endtry
 :CS
 :W{{{1 :AuJ :
 :R silent edit hglines.lst
 R ignored10.lst
 R nohglines.lst
 R nohglinesrev.lst
+>>> Messages:
+Frawor:plugin/aurum:nofiles:No files were specified
+<<< Messages^
 :W{{{3 01
 :Run AuLog date *-*-*_*:01
 :bw!
+:W{{{2 >date
+:Run AuLog date >2001
+:bw!
+:W{{{2 >=date
+:Run AuLog date >=2002
+:bw!
+:W{{{2 <date
+:Run AuLog date <2000
+:bw!
+:W{{{2 <=date
+:Run AuLog date <=1999
+:bw!
+:W{{{2 date<>date
+:Run AuLog date 1999<>2001
+:bw!
+:W{{{2 date<=>date
+:Run AuLog date 1999<=>2001
+:bw!
 :W{{{1 files
 :Run AuLog files crepo.zsh
 :bw!
 |  Commited 10 Feb 2002 16:01 by B <b@example.org>
 |  @ Added nohglinesrev.lst
 |  
+{{{2 >date
+@  Changeset 22:54d2db605eec15091bb4b194499d6db40e2af027 (branch default)
+|  Commited 11 Feb 2002 05:43 by A <a@example.com>
+|  Tags: tip
+|  @ Added .hgignore
+|  
+o  Changeset 21:214bbd7a8f1198ea9a78a01edf38a3fa8d2ad2ae (branch default)
+|  Commited 11 Feb 2002 03:15 by A <a@example.com>
+|  @ Added ignored10.lst
+|  
+o  Changeset 20:2c2d8b2b8164681fcc1ea55bf8e086f034ddc70e (branch default)
+|  Commited 10 Feb 2002 16:01 by B <b@example.org>
+|  @ Added nohglinesrev.lst
+|  
+o  Changeset 19:a38ec092ab72534eae6240c4378f4e4da9fb7e74 (branch default)
+|  Commited 10 Feb 2002 15:33 by B <b@example.org>
+|  @ Added nohglines.lst
+|  
+o  Changeset 18:5b7ed139504a773cacfda7307e92cfba9a602d7f (branch default)
+|  Commited 10 Feb 2002 05:00 by A <a@example.com>
+|  @ Copied “hglines.lst” to “hglines2.lst”
+|  
+o    Changeset 17:21d58f7d0c8a0b75eb5b27fe97e78690c1a18be8 (branch default)
+|\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| |  @ Merge from A
+| |  
+o |    Changeset 16:90772a14fa550b47e27709d36a7c9efd506ba239 (branch default)
+|\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | |  @ Merge from C:1
+| | |  
+| | o    Changeset 15:3ced0ae2c577db232d151d5aca4b64aab1ebcf75 (branch A)
+| | |\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | |  @ Merge from C:2
+| | | |  
+| | o |    Changeset 14:4f33ce8791eb9481ed5e4e198641d6e69fc11ec0 (branch A)
+| | |\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | | |  @ Merge from B
+| | | | |  
+{{{2 >=date
+@  Changeset 22:54d2db605eec15091bb4b194499d6db40e2af027 (branch default)
+|  Commited 11 Feb 2002 05:43 by A <a@example.com>
+|  Tags: tip
+|  @ Added .hgignore
+|  
+o  Changeset 21:214bbd7a8f1198ea9a78a01edf38a3fa8d2ad2ae (branch default)
+|  Commited 11 Feb 2002 03:15 by A <a@example.com>
+|  @ Added ignored10.lst
+|  
+o  Changeset 20:2c2d8b2b8164681fcc1ea55bf8e086f034ddc70e (branch default)
+|  Commited 10 Feb 2002 16:01 by B <b@example.org>
+|  @ Added nohglinesrev.lst
+|  
+o  Changeset 19:a38ec092ab72534eae6240c4378f4e4da9fb7e74 (branch default)
+|  Commited 10 Feb 2002 15:33 by B <b@example.org>
+|  @ Added nohglines.lst
+|  
+o  Changeset 18:5b7ed139504a773cacfda7307e92cfba9a602d7f (branch default)
+|  Commited 10 Feb 2002 05:00 by A <a@example.com>
+|  @ Copied “hglines.lst” to “hglines2.lst”
+|  
+o    Changeset 17:21d58f7d0c8a0b75eb5b27fe97e78690c1a18be8 (branch default)
+|\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| |  @ Merge from A
+| |  
+o |    Changeset 16:90772a14fa550b47e27709d36a7c9efd506ba239 (branch default)
+|\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | |  @ Merge from C:1
+| | |  
+| | o    Changeset 15:3ced0ae2c577db232d151d5aca4b64aab1ebcf75 (branch A)
+| | |\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | |  @ Merge from C:2
+| | | |  
+| | o |    Changeset 14:4f33ce8791eb9481ed5e4e198641d6e69fc11ec0 (branch A)
+| | |\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
+| | | | |  @ Merge from B
+| | | | |  
+{{{2 <date
+|\ 
+|\ \ 
+| | |\ 
+| | |\ \ 
+| | | | |/ 
+| +-----+ 
+| +-----+ 
+|\ \ \ \ 
+| |/ / / 
+| +---+ 
+|  / / 
+| |/ 
+|/ 
+o  Changeset 0:00b61a9315e2ecb239feba3bc44b2ef3af4c7dd1 (branch default)
+|  Commited 02 Jan 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+{{{2 <=date
+|\ 
+|\ \ 
+| | |\ 
+| | |\ \ 
+| | | | |/ 
+| +-----+ 
+| +-----+ 
+|\ \ \ \ 
+| |/ / / 
+| +---+ 
+|  / / 
+| |/ 
+|/ 
+o  Changeset 0:00b61a9315e2ecb239feba3bc44b2ef3af4c7dd1 (branch default)
+|  Commited 02 Jan 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+{{{2 date<>date
+o  Changeset 8:5c5f63aea57fbe740977648a1315f3369cb43663 (branch C)
+|  Commited 02 Nov 2000 14:14 by B <b@example.org>
+|  @ Added tag ablines for changeset 0b4ef1ee673d
+|  
+o  Changeset 7:0b4ef1ee673d958bfa691f07fdbb4369b24904fa (branch C)
+|  Commited 02 Nov 2000 14:13 by B <b@example.org>
+|  Tags: ablines
+|  @ Added ablines.lst
+|  
+o  Changeset 6:5cd1070d0a3933f74c9d34e7f5e515d20931bccc (branch B)
+|  Commited 02 Nov 2000 05:44 by A <a@example.com>
+|  @ Added alines.lst
+|  
+o  Changeset 5:4654f8e4bccd8ba0e40479e6ba7f4a61874bbcb6 (branch A)
+|  Commited 01 Nov 2000 13:24 by B <b@example.org>
+|  @ Added dlines.lst
+|  
+o  Changeset 4:aa37b7dd6c397b16a77b1f405d49828aa6434bb2 (branch default)
+|  Commited 10 May 2000 04:23 by A <a@example.com>
+|  @ Added «hglines.lst» and «datelines.lst»
+|  
+o  Changeset 3:ccf3e1d041800ad99d46dcdec6e12c8a770456f9 (branch default)
+|  Commited 01 Feb 2000 14:00 by B <b@example.org>
+|  @ Renamed «crepo.zsh» to «chgrepo.zsh»
+|  
+o  Changeset 2:41c3d8d71ffecac8d1d2e4ac56b8a36c038290e1 (branch default)
+|  Commited 15 Jan 2000 15:00 by B <b@example.org>
+|  @ Replaced
+|  @     (
+|  @         ...
+|  @     )
+|  @ with
+|  @     {
+|  @         ...
+|  @     }
+|  
+o  Changeset 1:fe851681c15eb282a18ab7660f85a677ee1e577c (branch default)
+|  Commited 05 Jan 2000 07:30 by A <a@example.com>
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+{{{2 date<=>date
+o  Changeset 13:331b232648474c521c7f9d96865421698e8936da (branch C)
+|  Commited 01 Feb 2001 14:56 by B <b@example.org>
+|  @ Added tag clines for changeset c767dffcf34d
+|  
+o  Changeset 12:c767dffcf34d1d43e8fb4ec1d4ac83e929c68ccc (branch C)
+|  Commited 01 Feb 2001 14:56 by B <b@example.org>
+|  Tags: clines
+|  @ Added clines.lst
+|  
+| o  Changeset 11:e2b6fb70c2c7d6bd3f1d5bff65a7de6681976743 (branch C)
+|/   Commited 01 Feb 2001 05:19 by A <a@example.com>
+|    @ Added tag blines for changeset 235d6a7d7b43
+|    
+o  Changeset 10:235d6a7d7b435cd3452b4c84f74fe9bad4b91a59 (branch C)
+|  Commited 01 Feb 2001 05:18 by A <a@example.com>
+|  Tags: blines
+|  @ Added blines.lst
+|  
+| o    Changeset 9:00cf93136629e2fbbca9464205bbd381c0451d23 (branch default)
+| |\   Commited 01 Jan 2001 00:00 by C <c@example.gov>
+| | |  @ Merge from C
+| | |  
+o---+  Changeset 8:5c5f63aea57fbe740977648a1315f3369cb43663 (branch C)
+  | |  Commited 02 Nov 2000 14:14 by B <b@example.org>
+ / /   @ Added tag ablines for changeset 0b4ef1ee673d
+| |    
+| o  Changeset 7:0b4ef1ee673d958bfa691f07fdbb4369b24904fa (branch C)
+| |  Commited 02 Nov 2000 14:13 by B <b@example.org>
+| |  Tags: ablines
+| |  @ Added ablines.lst
+| |  
+| o  Changeset 6:5cd1070d0a3933f74c9d34e7f5e515d20931bccc (branch B)
+| |  Commited 02 Nov 2000 05:44 by A <a@example.com>
+| |  @ Added alines.lst
+| |  
+| o  Changeset 5:4654f8e4bccd8ba0e40479e6ba7f4a61874bbcb6 (branch A)
+|/   Commited 01 Nov 2000 13:24 by B <b@example.org>
+|    @ Added dlines.lst
+|    
+o  Changeset 4:aa37b7dd6c397b16a77b1f405d49828aa6434bb2 (branch default)
+|  Commited 10 May 2000 04:23 by A <a@example.com>
+|  @ Added «hglines.lst» and «datelines.lst»
+|  
+o  Changeset 3:ccf3e1d041800ad99d46dcdec6e12c8a770456f9 (branch default)
+|  Commited 01 Feb 2000 14:00 by B <b@example.org>
+|  @ Renamed «crepo.zsh» to «chgrepo.zsh»
+|  
+o  Changeset 2:41c3d8d71ffecac8d1d2e4ac56b8a36c038290e1 (branch default)
+|  Commited 15 Jan 2000 15:00 by B <b@example.org>
+|  @ Replaced
+|  @     (
+|  @         ...
+|  @     )
+|  @ with
+|  @     {
+|  @         ...
+|  @     }
+|  
+o  Changeset 1:fe851681c15eb282a18ab7660f85a677ee1e577c (branch default)
+|  Commited 05 Jan 2000 07:30 by A <a@example.com>
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 0:00b61a9315e2ecb239feba3bc44b2ef3af4c7dd1 (branch default)
+|  Commited 02 Jan 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
 {{{1 files
 o  Changeset 3:ccf3e1d041800ad99d46dcdec6e12c8a770456f9 (branch default)
 |  Commited 01 Feb 2000 14:00 by B <b@example.org>