Commits

ZyX_I committed 87ebe7c

@%aurum/drivers/bazaar: Added support for {clean} optional argument to rf-status()
tests: Added function for testing rf-status to drivers-bazaar test

Comments (0)

Files changed (3)

autoload/aurum/drivers/bazaar.vim

 scriptencoding utf-8
 execute frawor#Setup('0.0', {'@%aurum/drivers/common/hypsites': '0.0',
             \                                   '@%aurum/repo': '5.0',
-            \                   '@%aurum/drivers/common/utils': '0.3',
+            \                   '@%aurum/drivers/common/utils': '0.4',
             \                                           '@/os': '0.1',
             \                                      '@/options': '0.0',})
 let s:_messages={
 let s:statstats={'added': 'added', 'removed': 'removed', 'modified': 'modified',
             \    'kind changed': 'modified', 'unknown': 'unknown',
             \    'missing': 'deleted'}
-let s:initstatdct={'modified': [],
-            \         'added': [],
-            \       'removed': [],
-            \       'deleted': [],
-            \       'unknown': [],
-            \       'ignored': []}
 function s:bzr.status(repo, ...)
     let statdict=s:F.getstatdict(a:repo, ['--']+((a:0>2 && a:3 isnot 0)?
                 \                                   (a:3):
                 \                ((a:0>1 && a:2 isnot 0)?
                 \                   ({'revision': a:2.'..'}):
                 \                   ({})))))
-    let r=deepcopy(s:initstatdct)
+    let r=deepcopy(s:_r.utils.emptystatdct)
     " XXX There cannot be deleted files similar to mercurial, but there can be 
     "     files that have 2 statuses
     "     (missing is a bit different: it is shown after deleting added file)
         let [r.deleted, r.unknown]=[r.unknown, r.deleted]
         let [r.added,   r.removed]=[r.removed, r.added  ]
     endif
+    if a:0>3 && a:4
+        if a:1 is 0
+            if a:2 is 0
+                let rev=a:repo.functions.getworkhex(a:repo)
+            else
+                let rev=a:2
+            endif
+        else
+            let rev=a:1
+        endif
+        let allfiles=copy(a:repo.functions.getcsprop(a:repo, rev, 'allfiles'))
+        if !empty(a:3)
+            let allfiles=filter(allfiles, 'index(a:3, v:val)!=-1')
+        endif
+        let files=r.added+r.removed+r.unknown+r.deleted
+        let r.clean=filter(allfiles, 'index(files, v:val)==-1')
+    endif
     return r
 endfunction
 "▶1 bzr.commit :: repo, message[, files[, user[, date[, _]]]]

test/drivers-bazaar.ok

Binary file modified.

test/drivers-bazaar.vim

                     \string(a:repo.functions.getcsprop(a:repo, a:cs, p))]
     endfor
 endfunction
+function FormatStatus(status)
+    let g:r+=[' >> Status']
+    for [key, files] in items(a:status)
+        let g:r+=['  - '.key]+map(copy(files), '"     ".v:val')
+    endfor
+endfunction
 cd bzrtestrepo/A
 let Arepo=aurum#repository()
 cd -
 for cs in Arepo.functions.getchangesets(Arepo)
     call FormatCS(Arepo, cs)
 endfor
+call FormatStatus(Arepo.functions.status(Arepo))
 
 call WriteFile(r)
 source addEmessages.vim