Commits

ZyX_I  committed da62a23

@aurum/drivers/*, @aurum/log: Now using revrange() only to get revisions range, purged out support for numeric arguments to revrange() (!!this function is not tested anymore for git driver), made returned value of getchangesets() be used

  • Participants
  • Parent commits 20896c1
  • Branches incrementallog

Comments (0)

Files changed (17)

File autoload/aurum.vim

 "▶1 
-execute frawor#Setup('0.0', {'@aurum/repo': '1.0',
+execute frawor#Setup('0.0', {'@aurum/repo': '2.0',
             \               '@aurum/cache': '0.0',})
 "▶1 aurum#repository
 function aurum#repository()

File doc/aurum.txt

     List of |aurum-changeset| objects. It is empty by default and may be 
     populated only when you call |aurum-rf-getchangesets|. See also 
     |aurum-cs.rev|.
-    Obsolete, use |aurum-rf-revrange|.
+    Obsolete, use |aurum-rf-getchangesets|.
 changesets :: {hex : cs}                               *aurum-repo.changesets*
     Dictionary containing all |aurum-changeset| objects that are associated 
     with the repository. For each changeset cs is repo.changesets[cs.hex].
     (thus meaning that every changeset appears before every its parent) or 
     |aurum-repo.requires_sort| should be set to true.
   revrange :: hex, hex -> [ cs ]                           *aurum-rf-revrange*
-    Get revision range (inclusive). Numbers are to be treated specially, like 
-    it is done by |list-index|, but it is up to driver what it thinks is “last 
-    revision” (-1) or “first revision” (0).
+    Get revision range (inclusive).
   getcs :: hex -> cs                                          *aurum-rf-getcs*
     Returns |aurum-changeset| object which has given hash. See also 
     |aurum-cs.hex|.
 ==============================================================================
 11. Changelog                                                *aurum-changelog*
 
-@aurum/repo:
+@aurum/repo (reflects all drivers’ API changes):
     1.0: Instead of depending on drivers, make drivers depend on @aurum/repo
     1.1: Added repo.branch and repo.label
     1.2: Added setlines function, default implementations of |aurum-rf-copy|, 
          |aurum-rf-getstats|, |aurum-rf-getcsprop| and |aurum-rf-diffname|.
     1.3: Added default implementation of |aurum-rf-revrange|.
+    2.0: Purged support of numeric ranges out of |aurum-rf-revrange|, returned 
+         value of |aurum-rf-getchangesets| is not stated as ignored.
 @aurum:
     0.1: Added :AuBranch and :AuName
 @aurum/edit:

File ftplugin/aurumannotate.vim

 endif
 setlocal noswapfile
 setlocal nomodeline
-execute frawor#Setup('0.0', {'@aurum/repo': '1.0',
+execute frawor#Setup('0.0', {'@aurum/repo': '2.0',
             \             '@aurum/bufvars': '0.0',
             \             '@aurum/vimdiff': '0.0',
             \            '@aurum/annotate': '0.0',

File ftplugin/aurumlog.vim

 setlocal nomodeline
 execute frawor#Setup('0.0', {'@aurum/cmdutils': '0.0',
             \                 '@aurum/bufvars': '0.0',
-            \                    '@aurum/repo': '1.0',
+            \                    '@aurum/repo': '2.0',
             \                    '@aurum/edit': '1.0',
             \                           '@/os': '0.0',
             \                     '@/mappings': '0.0',})

File plugin/aurum.vim

                 \             '@aurum/status': '0.0',
                 \                '@aurum/log': '0.0',
                 \             '@aurum/commit': '0.0',
-                \               '@aurum/repo': '1.1',
+                \               '@aurum/repo': '2.0',
                 \               '@aurum/edit': '1.0',
                 \            '@aurum/bufvars': '0.0',
                 \            '@aurum/vimdiff': '0.0',}, 0)

File plugin/aurum/cmdutils.vim

 if !exists('s:_pluginloaded')
     execute frawor#Setup('0.0', {'@/resources': '0.0',
                 \                       '@/os': '0.0',
-                \                '@aurum/repo': '1.2',
+                \                '@aurum/repo': '2.0',
                 \                '@aurum/edit': '1.0',
                 \               '@aurum/cache': '0.0',
                 \             '@aurum/bufvars': '0.0',}, 0)

File plugin/aurum/commit.vim

                 \              '@aurum/status': '0.0',
                 \            '@aurum/cmdutils': '0.0',
                 \             '@aurum/bufvars': '0.0',
-                \                '@aurum/repo': '1.0',
+                \                '@aurum/repo': '2.0',
                 \                '@aurum/edit': '1.0',
                 \                      '@/fwc': '0.3',
                 \                 '@/commands': '0.0',

File plugin/aurum/diff.vim

 if !exists('s:_pluginloaded')
     execute frawor#Setup('0.0', {'@aurum/cmdutils': '0.0',
                 \                 '@aurum/bufvars': '0.0',
-                \                    '@aurum/repo': '1.2',
+                \                    '@aurum/repo': '2.0',
                 \                    '@aurum/edit': '1.0',
                 \                           '@/os': '0.0',
                 \                          '@/fwc': '0.0',

File plugin/aurum/drivers/git.vim

 "▶1
 scriptencoding utf-8
 if !exists('s:_pluginloaded')
-    execute frawor#Setup('0.1', {   '@aurum/repo': '1.0',
+    execute frawor#Setup('0.1', {   '@aurum/repo': '2.0',
                 \                          '@/os': '0.0',
                 \   '@aurum/drivers/common/utils': '0.0',
                 \'@aurum/drivers/common/hypsites': '0.0',}, 0)
     return [cs, line]
 endfunction
 "▶1 git.getchangesets :: repo → []
-"▶2 rerev :: Either rev num → rev
-function s:F.rerev(rev)
-    if type(a:rev)==type(0)
-        if a:rev is 0
-            " XXX Ranges like ..HEAD are not working, though it is unlikely that
-            "     revrange will receive ranges like ?..0 or 0..? except 0..-1, 
-            "     thus 0..? is always taken as 0..-1
-            return ''
-        elseif a:rev is -1
-            return 'HEAD'
-        elseif a:rev
-            return 'HEAD~'.(-1-a:rev)
-        endif
-    else
-        return a:rev
-    endif
-endfunction
-"▲2
 function s:git.getchangesets(repo, ...)
     "▶2 Prepare s:F.git arguments
     let args=[]
     let kwargs=copy(s:logkwargs)
     if a:0
-        if a:1 is 0
-        elseif a:1<0 && a:2 is -1
-            let args+=['-n'.(-a:1), 'HEAD']
-        else
-            let args+=[s:F.rerev(a:1).'^..'.s:F.rerev(a:2)]
-        endif
+        let args+=[a:1.'^..'.a:2]
     else
         let kwargs.all=1
         let kwargs['full-history']=1

File plugin/aurum/drivers/mercurial.vim

 scriptencoding utf-8
 if !exists('s:_pluginloaded')
     execute frawor#Setup('0.2', {      '@/python': '0.0',
-                \                   '@aurum/repo': '1.0',
+                \                   '@aurum/repo': '2.0',
                 \                          '@/os': '0.0',
                 \                     '@/options': '0.0',
                 \   '@aurum/drivers/common/utils': '0.0',
     return a:repo.cslist[:-2]
 endfunction
 "▶1 hg.revrange :: repo, rev, rev → [cs]
-function s:F.getrev(repo, rev, cslist)
-    if type(a:rev)==type(0)
-        if a:rev<0
-            return len(a:cslist)+a:rev-1
-        else
-            return a:rev
-        endif
-    else
-        return a:repo.functions.getcs(a:repo, a:rev).rev
-    endif
-endfunction
 function s:hg.revrange(repo, rev1, rev2)
     if empty(a:repo.cslist)
         let cslist=a:repo.functions.getchangesets(a:repo)
     else
         let cslist=a:repo.cslist
     endif
-    let rev1=s:F.getrev(a:repo, a:rev1, cslist)
-    let rev2=s:F.getrev(a:repo, a:rev2, cslist)
+    let rev1=a:repo.functions.getcs(a:repo, a:rev1).rev
+    let rev2=a:repo.functions.getcs(a:repo, a:rev2).rev
     if rev1>rev2
         let [rev1, rev2]=[rev2, rev1]
     endif

File plugin/aurum/drivers/subversion.vim

 "▶1
 scriptencoding utf-8
 if !exists('s:_pluginloaded')
-    execute frawor#Setup('0.1', {   '@aurum/repo': '1.0',
+    execute frawor#Setup('0.1', {   '@aurum/repo': '2.0',
                 \                          '@/os': '0.0',
                 \   '@aurum/drivers/common/utils': '0.0',
                 \'@aurum/drivers/common/hypsites': '0.0',}, 0)
 endfunction
 "▶1 svn.revrange :: repo, rev1, rev2 → [cs]
 function s:svn.revrange(repo, rev1, rev2)
-    if a:rev1 is 0 && a:rev2 is -1
-        return a:repo.functions.getchangesets(a:repo)
-    elseif a:rev2 is -1 && type(a:rev1)==type(0) && a:rev1<0
-        if empty(a:repo.cslist)
-            return s:F.getchangesets(a:repo, -a:rev1)
-        else
-            return a:repo.functions.getchangesets(a:repo)[(a:rev1):]
+    " call a:repo.functions.updatechangesets(a:repo)
+    let hex1=a:repo.functions.getrevhex(a:repo, a:rev1)
+    let hex2=a:repo.functions.getrevhex(a:repo, a:rev2)
+    let i=len(a:repo.cslist)-1
+    while i>=0 && a:repo.cslist[i].hex isnot# hex1
+        if a:repo.cslist[i].hex is# hex2
+            let r2i=i
         endif
-    elseif a:rev1 is 0
-        if type(a:rev2)==type(0)
-            return a:repo.functions.getchangesets(a:repo)[:(a:rev2)]
-        elseif empty(a:repo.cslist)
-            return s:F.getchangesets(a:repo, a:rev2)
-        else
-            call a:repo.functions.updatechangesets(a:repo)
-            let rev2=a:repo.functions.getrevhex(a:repo, a:rev2)
-            let i=len(a:repo.cslist)-1
-            while i>=0 && a:repo.cslist[i].hex isnot# rev2
-                let i-=1
-            endwhile
-            return a:repo.cslist[:(i)]
-        endif
-    elseif empty(a:repo.cslist)
-        return s:F.getchangesets(a:repo, a:rev1, a:rev2)
-    else
-        call a:repo.functions.updatechangesets(a:repo)
-        let rev1=a:repo.functions.getrevhex(a:repo, a:rev1)
-        let rev2=a:repo.functions.getrevhex(a:repo, a:rev2)
-        let i=len(a:repo.cslist)-1
-        while i>=0 && a:repo.cslist[i].hex isnot# rev1
-            if a:repo.cslist[i].hex is# rev2
-                let r2i=i
-            endif
-            let i-=1
-        endwhile
-        if !exists('r2i')
-            call s:_f.throw('r2fst', a:rev2, a:rev1)
-        endif
-        return a:repo.cslist[(i):(r2i)]
+        let i-=1
+    endwhile
+    if !exists('r2i')
+        call s:_f.throw('r2fst', a:rev2, a:rev1)
     endif
+    return a:repo.cslist[(i):(r2i)]
 endfunction
 "▶1 svn.getcs :: repo, rev → cs
 function s:svn.getcs(repo, rev)

File plugin/aurum/edit.vim

     execute frawor#Setup('1.0', {'@/autocommands': '0.0',
                 \                   '@/functions': '0.0',
                 \                   '@/resources': '0.0',
-                \                   '@aurum/repo': '1.2',
+                \                   '@aurum/repo': '2.0',
                 \                '@aurum/bufvars': '0.0',}, 0)
     call FraworLoad('@/autocommands')
     call FraworLoad('@/functions')

File plugin/aurum/file.vim

     execute frawor#Setup('0.0', {'@aurum/cmdutils': '0.0',
                 \                 '@aurum/bufvars': '0.0',
                 \                 '@aurum/vimdiff': '0.0',
-                \                    '@aurum/repo': '1.2',
+                \                    '@aurum/repo': '2.0',
                 \                    '@aurum/edit': '1.0',
                 \                           '@/os': '0.0',
                 \                          '@/fwc': '0.0',

File plugin/aurum/log.vim

                 \         '@aurum/bufvars': '0.0',
                 \            '@aurum/edit': '1.0',
                 \                  '@/fwc': '0.3',
-                \            '@aurum/repo': '1.3',
+                \            '@aurum/repo': '2.0',
                 \             '@/commands': '0.0',
                 \            '@/functions': '0.0',
                 \              '@/options': '0.0',}, 0)
     return ((a==b)?(0):((a>b)?(-1):(1)))
 endfunction
 let s:_functions+=['s:DateCmp']
-"▶2 glog.sort_in_topological_order :: [cs] → [cs]
-function s:F.glog.sort_in_topological_order(repo, css)
-    call map(copy(a:css), 'extend(v:val, {"indegree": 1})')
-    for parents in map(copy(a:css), 'v:val.parents')
-        for parent in filter(map(filter(copy(parents),
-                    \                   'has_key(a:repo.changesets, v:val)'),
-                    \            'a:repo.changesets[v:val]'),
-                    \        'get(v:val, "indegree", 0)')
-            let parent.indegree+=1
-        endfor
-    endfor
-    let work=[]
-    call map(copy(a:css), 'v:val.indegree==1 && add(work, v:val) is 0')
-    call sort(work, 's:DateCmp')
-    let r=[]
-    while !empty(work)
-        let cs=remove(work, 0)
-        for parent in filter(map(filter(copy(cs.parents),
-                    \                   'has_key(a:repo.changesets, v:val)'),
-                    \            'a:repo.changesets[v:val]'),
-                    \        'get(v:val, "indegree", 0)')
-            let parent.indegree-=1
-            if parent.indegree==1
-                let j=0
-                let lwork=len(work)
-                while j<lwork && work[j].time<parent.time
-                    let j+=1
-                endwhile
-                call insert(work, parent, j)
-            endif
-        endfor
-        let cs.indegree=0
-        call add(r, cs)
-    endwhile
-    call map(copy(a:css), 'remove(v:val, "indegree")')
-    return r
-endfunction
 "▶2 glog.graphlog
 function s:F.glog.graphlog(repo, opts, css)
     let d={}
     endif
     return r
 endfunction
+"▶1 sort_in_topological_order :: [cs] → [cs]
+" TODO put sorting requirement on getchangesets and revrange functions.
+function s:F.sort_in_topological_order(repo, css)
+    try
+        call map(copy(a:css), 'extend(v:val, {"indegree": 1})')
+        for parents in map(copy(a:css), 'v:val.parents')
+            for parent in filter(map(filter(copy(parents),
+                        \                   'has_key(a:repo.changesets,v:val)'),
+                        \            'a:repo.changesets[v:val]'),
+                        \        'get(v:val, "indegree", 0)')
+                let parent.indegree+=1
+            endfor
+        endfor
+        let work=[]
+        call map(copy(a:css), 'v:val.indegree==1 && add(work, v:val) is 0')
+        call sort(work, 's:DateCmp')
+        let r=[]
+        while !empty(work)
+            let cs=remove(work, 0)
+            for parent in filter(map(filter(copy(cs.parents),
+                        \                   'has_key(a:repo.changesets,v:val)'),
+                        \            'a:repo.changesets[v:val]'),
+                        \        'get(v:val, "indegree", 0)')
+                let parent.indegree-=1
+                if parent.indegree==1
+                    let j=0
+                    let lwork=len(work)
+                    while j<lwork && work[j].time<parent.time
+                        let j+=1
+                    endwhile
+                    call insert(work, parent, j)
+                endif
+            endfor
+            let cs.indegree=0
+            call add(r, cs)
+        endwhile
+    finally
+        call map(copy(a:css), 'remove(v:val, "indegree")')
+    endtry
+    return r
+endfunction
 "▶1 iterfuncs :: {fname: { "start": startfunc, "next": nextfunc }}
 " startfunc :: repo, opts → d
 " nextfunc  :: d → cs
 let s:iterfuncs.revrange={}
 function s:iterfuncs.revrange.start(repo, opts)
     if has_key(a:opts, 'revrange')
+        call map(a:opts.revrange, 'a:repo.functions.getrevhex(a:repo, v:val)')
         let cslist=copy(call(a:repo.functions.revrange,
                     \   [a:repo]+a:opts.revrange, {}))
     else
-        let cslist=copy(a:repo.functions.revrange(a:repo, 0, -1))
+        let cslist=copy(a:repo.functions.getchangesets(a:repo))
     endif
     if get(a:repo, 'requires_sort', 1)
-        let cslist=s:F.glog.sort_in_topological_order(a:repo, cslist)
+        let cslist=s:F.sort_in_topological_order(a:repo, cslist)
     else
         call reverse(cslist)
     endif

File plugin/aurum/record.vim

                 \                   '@/functions': '0.0',
                 \                 '@aurum/commit': '0.0',
                 \               '@aurum/cmdutils': '0.0',
-                \                   '@aurum/repo': '1.2',
+                \                   '@aurum/repo': '2.0',
                 \                   '@aurum/edit': '1.0',
                 \                     '@/options': '0.0',}, 0)
     call FraworLoad('@/commands')

File plugin/aurum/repo.vim

 "▶1
 scriptencoding utf-8
 if !exists('s:_pluginloaded')
-    execute frawor#Setup('1.3', {'@/resources': '0.0',
+    execute frawor#Setup('2.0', {'@/resources': '0.0',
                 \                       '@/os': '0.0',
                 \                  '@/options': '0.0',
                 \             '@aurum/bufvars': '0.0',}, 0)

File plugin/aurum/status.vim

     execute frawor#Setup('0.0', {'@/resources': '0.0',
                 \            '@aurum/cmdutils': '0.0',
                 \                      '@/fwc': '0.2',
-                \                '@aurum/repo': '1.0',
+                \                '@aurum/repo': '2.0',
                 \                '@aurum/edit': '1.0',
                 \                 '@/commands': '0.0',
                 \                  '@/options': '0.0',