Commits

ZyX_I committed 2b02f18

@aurum/drivers/subversion: Made rf-status() work in simplest case: status between working directory and working revision

  • Participants
  • Parent commits 94685cf
  • Branches svnsupport

Comments (0)

Files changed (2)

File plugin/aurum/drivers/git.vim

         let args=((a:0>2 && !empty(a:3))?(['--']+a:3):([]))
         let kwargs={'porcelain': 1, 'z': 1}
         let s=s:F.nullnl(s:F.git(a:repo, 'status', args, kwargs, 1, 'statusf'))
-        let files=[]
+        let files={}
         while !empty(s)
             let line=remove(s, 0)
             let status=line[:1]
             let file=line[3:]
-            call add(files, file)
+            let files[file]=1
             if status[0] is# 'R'
                 let r.added+=[file]
                 let r.removed+=[remove(s, 0)]
         if a:0>2 && !empty(a:3)
             let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
         endif
-        let r.clean=filter(copy(allfiles), 'index(files, v:val)==-1')
+        let r.clean=filter(copy(allfiles), '!has_key(files, v:val)')
     endif
     return r
 endfunction

File plugin/aurum/drivers/subversion.vim

             \  'listf': 'Failed to list file of revision %s '.
             \           'in the repository %s: %s',
             \   'logf': 'Failed to get log of the repository %s: %s',
+            \  'statf': 'Failed to get status of the repository %s: %s',
             \  'nocfg': 'Failed to get property %s of repository %s',
             \'fcunsup': 'Forced copy is not supported',
             \   'perr': 'Parser error: expected %s, but got %s',
 function s:svn.setcsprop(repo, cs, prop)
     if a:prop is# 'allfiles'
         let r=s:F.svn(a:repo, 'list', ['.'], {'recursive': 1,
-                    \                         'revision': cs.hex}, 0,
-                    \ 'listf', cs.hex)
+                    \                         'revision': a:cs.hex}, 0,
+                    \ 'listf', a:cs.hex)
     elseif a:prop is# 'children'
-        let lastrev=+(a:repo.functions.gettiphex(a:repo))
-        return ((a:cs.rev<lastrev)?([string(a:cs.rev+1)]):([]))
     elseif  a:prop is# 'changes' || a:prop is# 'files' || a:prop is# 'removes'
     endif
     let a:cs[a:prop]=r
     return r
 endfunction
 "▶1 svn.status :: repo[, rev1[, rev2[, files]]]
+let s:initstatdct={
+            \'modified': [],
+            \   'added': [],
+            \ 'removed': [],
+            \ 'deleted': [],
+            \ 'unknown': [],
+            \ 'ignored': [],
+            \   'clean': [],
+        \}
+let s:statchars=[{
+            \'C': 'modified',
+            \'M': 'modified',
+            \'~': 'modified',
+            \'R': 'modified',
+            \'A': 'added',
+            \'D': 'removed',
+            \'!': 'deleted',
+            \'?': 'unknown',
+            \'I': 'ignored',}, {
+            \'C': 'modified',
+            \'M': 'modified',}]
 function s:svn.status(repo, ...)
-    if a:0 && (a:1 isnot 0 || (a:0>1 && a:2 isnot 0))
+    let r=deepcopy(s:initstatdct)
+    if a:0 || (a:1 is 0 && !(a:0>1 && a:2 isnot 0))
+        let slines=s:F.svn(a:repo, 'status', ['--']+get(a:000, 2, []), {}, 0,
+                    \      'statf')
+        let files={}
+        for line in slines
+            let status=line[:6]
+            let file=line[8:]
+            let col=0
+            for colschars in s:statchars
+                if has_key(colschars, status[col])
+                    let r[colschars[status[col]]]+=[file]
+                    let files[file]=1
+                    break
+                endif
+                let col+=1
+            endfor
+        endfor
+        if a:0>2 && !empty(a:3)
+            let allfiles=filter(copy(allfiles), 'index(a:3, v:val)!=-1')
+        endif
+        let allfiles=a:repo.functions.getcsprop(a:repo, 'HEAD', 'allfiles')
+        let r.clean=filter(copy(allfiles), '!has_key(files, v:val)')
     else
     endif
     return r