ZyX_I avatar ZyX_I committed fff45ab

@aurum/repo, @aurum/drivers/git, @aurum/drivers/subversion:
Added {requireclean} argument to rf-status()

Comments (0)

Files changed (5)

           (revision, filename (relative to repository root)). Second is to be 
           transformed into |aurum://file| path.
                                                              *aurum-rf-status*
-  status :: [hex[, hex[, [ file ]]]] -> {status : [ files ]}
+  status :: [hex[, hex[, [ file ][, requiresclean]]]] -> {status : [ file ]}
     Returns dictionary where values are lists of files and keys are 
     "modified", "added" (new tracked files), "removed" (made untracked, not 
     necessary deleted from filesystem), "deleted" (just deleted from 
     filesystem without making files untracked), "unknown" (new untracked 
     files), "ignored" and "clean" (unmodified).
+    Specifying 0 instead of any optional argument acts like not specifying 
+    this argument.
+    Note: “clean” may be empty unless {requiresclean} argument is present and 
+          true.
   dirty :: file -> Bool                                       *aurum-rf-dirty*
     Check whether file is “dirty” (meaning that it has changes that can be 
     committed).
     2.1: Added |aurum-repo.iterfuncs| support.
     2.2: Added |aurum-repo.initprops|.
     2.3: Added |aurum-rf-getroot| support.
+    2.4: Added {requiresclean} argument to |aurum-rf-status|.
 @aurum:
     0.1: Added :AuBranch and :AuName.
 @aurum/edit:

plugin/aurum/drivers/git.vim

     endfor
     return r
 endfunction
-"▶1 git.status :: repo[, rev1[, rev2[, files]]]
+"▶1 git.status :: repo[, rev1[, rev2[, files[, clean]]]]
 let s:statchars={
             \'A': 'added',
             \'M': 'modified',
         \}
 function s:git.status(repo, ...)
     let r=deepcopy(s:initstatdct)
+    let requiresclean=(a:0>3 && a:4)
     if a:0 && (a:1 isnot 0 || (a:0>1 && a:2 isnot 0))
         let args=((a:0>2 && !empty(a:3))?(['--']+a:3):([]))
         let rspec=[]
             let [r.deleted, r.unknown]=[r.unknown, r.deleted]
             let [r.added,   r.removed]=[r.removed, r.added  ]
         endif
-        let allfiles=a:repo.functions.getcsprop(a:repo, rspec[0], 'allfiles')
-        if a:0>2 && !empty(a:3)
-            let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
+        if requiresclean
+            let allfiles=a:repo.functions.getcsprop(a:repo,rspec[0],'allfiles')
         endif
-        let r.clean=filter(copy(allfiles), 'index(files, v:val)==-1')
     else
         let args=((a:0>2 && !empty(a:3))?(['--']+a:3):([]))
         let kwargs={'porcelain': 1, 'z': 1}
                 let r.unknown+=[file]
             endif
         endwhile
-        let allfiles=a:repo.functions.getcsprop(a:repo, 'HEAD', 'allfiles')
+        if requiresclean
+            let allfiles=a:repo.functions.getcsprop(a:repo, 'HEAD', 'allfiles')
+        endif
+    endif
+    if exists('allfiles')
         if a:0>2 && !empty(a:3)
             let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
         endif

plugin/aurum/drivers/subversion.vim

     return r
 endfunction
 "▶1 status :: repo, files → (status, revstatus)
-let s:initstatdct={
-            \'modified': [],
-            \   'added': [],
-            \ 'removed': [],
-            \ 'deleted': [],
-            \ 'unknown': [],
-            \ 'ignored': [],
-            \   'clean': [],
-        \}
 let s:statchars=[{
             \'C': 'modified',
             \'M': 'modified',
                 \'map(v:val, "extend(r, {v:val : ''".v:key."''})")')
     return r
 endfunction
-"▶1 svn.status :: repo[, rev1[, rev2[, files]]]
+"▶1 svn.status :: repo[, rev1[, rev2[, files[, clean]]]]
+let s:initstatdct={
+            \'modified': [],
+            \   'added': [],
+            \ 'removed': [],
+            \ 'deleted': [],
+            \ 'unknown': [],
+            \ 'ignored': [],
+            \   'clean': [],
+        \}
 " TODO Try using diff --summarize
 function s:svn.status(repo, ...)
+    let requiresclean=(a:0>3 && a:4)
     "▶2 Simple case: we can use “svn status”
     if !a:0 || (a:1 is 0 && !(a:0>1 && a:2 isnot 0))
         let [r, revstatus]=s:F.status(a:repo, get(a:000, 2, []))
-        let allfiles=a:repo.functions.getcsprop(a:repo, 'BASE', 'allfiles')
-        if a:0>2 && !empty(a:3)
-            let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
+        if requiresclean
+            let allfiles=a:repo.functions.getcsprop(a:repo, 'BASE', 'allfiles')
+            if a:0>2 && !empty(a:3)
+                let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
+            endif
         endif
     "▶2 Not so complicated case: cs and its parent or itself
     elseif a:0>1 && !empty(a:1) && !empty(a:2) && a:1.a:2!~#'\D' &&
                 \abs(a:1-a:2)<=1
         let r=copy(s:initstatdct)
-        let allfiles=copy(a:repo.functions.getcsprop(a:repo, a:1, 'allfiles'))
-        if a:0>2 && !empty(a:3)
-            call filter(allfiles, 'index(a:3, v:val)!=-1')
+        if requiresclean
+            let allfiles=copy(a:repo.functions.getcsprop(a:repo,a:1,'allfiles'))
+            if a:0>2 && !empty(a:3)
+                call filter(allfiles, 'index(a:3, v:val)!=-1')
+            endif
         endif
         if abs(a:1-a:2)==1
             let reverse=(a:2<a:1)
                 call map(copy(s), 'filter(copy(v:val), "index(a:3,v:val)!=-1")')
             endif
             let revs=s:F.statreverse(s)
-            call filter(allfiles, '!has_key(revs, v:val)')
+            if requiresclean
+                call filter(allfiles, '!has_key(revs, v:val)')
+            endif
             call extend(r, s)
             "▶3 Reversing range
             if reverse
             endif
             "▲3
         endif
-        let r.clean=allfiles
+        if requiresclean
+            let r.clean=allfiles
+        endif
         return r
     "▶2 Complicated case: diff
     else
         let allfiles=rsallfiless[0]
     endif
     "▲2
-    let r.clean=filter(copy(allfiles), '!has_key(revstatus, v:val)')
+    if exists('allfiles')
+        let r.clean=filter(copy(allfiles), '!has_key(revstatus, v:val)')
+    endif
     return r
 endfunction
 "▶1 svn.annotate :: repo, rev, file → [(file, hex, linenumber)]

plugin/aurum/repo.vim

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

plugin/aurum/status.vim

     execute frawor#Setup('1.1', {'@/resources': '0.0',
                 \            '@aurum/cmdutils': '0.0',
                 \                      '@/fwc': '0.2',
-                \                '@aurum/repo': '2.0',
+                \                '@aurum/repo': '2.4',
                 \                '@aurum/edit': '1.0',
                 \                 '@/commands': '0.0',
                 \                  '@/options': '0.0',
         let opts[key]=a:repo.functions.getrevhex(a:repo, opts[key])
     endfor
     let bvar={}
+    let requiresclean=0
+    if has_key(opts, 'show')
+        if index(opts.show, 'all')==-1
+            let show=s:F.parseshow(opts.show)
+            let requiresclean=(index(show, 'clean')!=-1)
+        else
+            let show=s:allshow
+            let requiresclean=1
+        endif
+    else
+        let show=s:defshow
+    endif
     let status=a:repo.functions.status(a:repo, get(opts, 'rev',   0),
-                \                              get(opts, 'wdrev', 0))
+                \                              get(opts, 'wdrev', 0),
+                \                              0, requiresclean)
     let bvar.status=status
     let bvar.types=[]
     let bvar.chars=[]
     let bvar.files=[]
-    if has_key(opts, 'show')
-        if index(opts.show, 'all')==-1
-            let show=s:F.parseshow(opts.show)
-        else
-            let show=s:allshow
-        endif
-    else
-        let show=s:defshow
-    endif
     let isrecord=get(opts, 'record', 0)
     let statlines=[]
     for [type, files] in filter(sort(items(status)), 'index(show,v:val[0])!=-1')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.