ZyX_I avatar ZyX_I committed f2c3012

Fixed `files' cs property, added two more properties:
- `files' with list of added and modified files (files which contents can be obtained) (errorneously it was a list with all files, including unmodified, previously it was the same as now `changes')
- `removes' with list of removed files
- `changes' with list of added, modified and removed files

Comments (0)

Files changed (5)

ftplugin/aurumannotate.vim

 endfunction
 let s:_augroups+=['AuAnnotateNoInsert']
 call s:F.setup()
-"▶1 getfile :: cs → path
-function s:F.getfile(cs)
+"▶1 getfile :: repo, cs → path
+function s:F.getfile(repo, cs)
     let file=0
+    let files=a:repo.functions.getcsprop(a:repo, a:cs, 'files')
     if spname=~#'\v^file\d+$'
-        let file=a:cs.files[+spname[4:]]
-    elseif !empty(a:cs.files)
-        if len(a:cs.files)==1
-            let file=a:cs.files[0]
+        let file=files[+spname[4:]]
+    elseif !empty(files)
+        if len(files)==1
+            let file=files[0]
         else
             let choice=inputlist(['Select file (0 to cancel):']+
-                        \               map(copy(a:cs.files),
+                        \               map(copy(files),
                         \                   '(v:key+1).". ".v:val'))
             if choice
-                let file=a:cs.files[choice-1]
+                let file=files[choice-1]
             endif
         endif
     endif
                         \                                        '\:*?['))))
         endif
     elseif a:action is# 'open'
-        let file=s:F.getfile(cs)
+        let file=s:F.getfile(bvar.repo, cs)
         if file is 0
             return
         endif

ftplugin/aurumgraphlog.vim

     "▲2
     let cslist=bvar.repo.cslist[bvar.opts.revs[0]:bvar.opts.revs[1]]
     "▶2 Generate cs.renames for `showrenames' option
-    if has_key(bvar.opts, 'showrenames')
+    if get(bvar.opts, 'showrenames', 0)
         for cs in cslist
             call bvar.repo.functions.getcsprop(bvar.repo, cs, 'renames')
         endfor
     endif
+    "▶2 Generate cs.files for several options
+    if has_key(bvar.opts, 'files') || get(bvar.opts, 'showrenames', 0) ||
+                \                     get(bvar.opts, 'showfiles',   0)
+        for cs in cslist
+            call bvar.repo.functions.getcsprop(bvar.repo, cs, 'files')
+        endfor
+    endif
     "▶2 Generate file lists for `files' option
     if has_key(bvar.opts, 'files')
         let bvar.opts.filepats=map(copy(bvar.opts.files),
                     \              's:_r.aurum.globtopattern(v:val)')
         let bvar.opts.csfiles={}
         for cs in cslist
-            let rns   = bvar.repo.functions.getcsprop(bvar.repo, cs, 'renames')
-            let files = bvar.repo.functions.getcsprop(bvar.repo, cs, 'files')
-            let files = copy(files)
-            let csfiles=[]
+            let rns     = bvar.repo.functions.getcsprop(bvar.repo,cs, 'renames')
+            let changes = bvar.repo.functions.getcsprop(bvar.repo,cs, 'changes')
+            let changes = copy(changes)
+            let csfiles = []
             let bvar.opts.csfiles[cs.hex]=csfiles
             for pattern in bvar.opts.filepats
-                let newfiles=filter(copy(files), 'v:val=~#pattern')
-                call filter(files, 'index(newfiles, v:val)==-1')
+                let newfiles=filter(copy(changes), 'v:val=~#pattern')
+                call filter(changes, 'index(newfiles, v:val)==-1')
                 let csfiles+=newfiles
-                if empty(files)
+                if empty(changes)
                     break
                 endif
             endfor
 
 def get_cs_prop(path, rev, prop):
     cs=get_repo(path)[rev]
-    if prop=='files':
-        r=[f for f in cs]
+    if prop=='files' or prop=='removes' or prop=='changes':
+        am=[]
+        r=[]
+        c=cs.files()
+        for f in c:
+            if f in cs:
+                am.append(f)
+            else:
+                r.append(f)
+        vim.eval('extend(a:cs, {  "files": '+nonutf_dumps(am)+', '+
+                               '"removes": '+nonutf_dumps(r) +', '+
+                               '"changes": '+nonutf_dumps(c) +'})')
+        return
     else:
         r=cs.__getattribute__(prop)()
     # XXX There is much code relying on the fact that after getcsprop property 

test/glog-files.ok

 |  / / 
 | |/ 
 |/ 
+o  Changeset 3:7f4b93c6941e41286e9652e56da6aa747e143a55
+|  Commited 01 Feb 2000 14:00 by B <b@example.org>
+|    Renamed «crepo.zsh» to «chgrepo.zsh»
+|  
 o  Changeset 2:0cb41972850ae6291c2d92cb9bbda2fb36f81dbd
 |  Commited 15 Jan 2000 15:00 by B <b@example.org>
 |    Replaced

test/glog-showfiles.ok

 @  Changeset 22:352303b72a519a2b27aa05b858030fcf7be8a60f
 |  Commited 11 Feb 2002 05:43 by A <a@example.com>
 |  Tag: tip
-|  Files: .hgignore, .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh
-|  Files: clines.lst, dlines.lst, hglines.lst, hglines2.lst, ignored10.lst
-|  Files: nohglines.lst, nohglinesrev.lst
+|  Files: .hgignore
 |    Added .hgignore
 |  
 o  Changeset 21:e2cc844e83ab36afcd95b78d71b4b5192aab372e
 |  Commited 11 Feb 2002 03:15 by A <a@example.com>
-|  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-|  Files: dlines.lst, hglines.lst, hglines2.lst, ignored10.lst, nohglines.lst
-|  Files: nohglinesrev.lst
+|  Files: ignored10.lst
 |    Added ignored10.lst
 |  
 o  Changeset 20:d8c87ef007b4de3d05b356964f527fedcc90246f
 |  Commited 10 Feb 2002 16:01 by B <b@example.org>
-|  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-|  Files: dlines.lst, hglines.lst, hglines2.lst, nohglines.lst
 |  Files: nohglinesrev.lst
 |    Added nohglinesrev.lst
 |  
 o  Changeset 19:10985e763df4815d19ec347cf030d5b154b939f3
 |  Commited 10 Feb 2002 15:33 by B <b@example.org>
-|  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-|  Files: dlines.lst, hglines.lst, hglines2.lst, nohglines.lst
+|  Files: nohglines.lst
 |    Added nohglines.lst
 |  
 o  Changeset 18:a85a511e5b8b94bbfe6d585104970945ec5b779d
 |  Commited 10 Feb 2002 05:00 by A <a@example.com>
-|  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-|  Files: dlines.lst, hglines.lst, hglines2.lst
+|  Files: hglines2.lst
 |    Copied “hglines.lst” to “hglines2.lst”
 |  
 o    Changeset 17:6fef6ffc308430b791ff1f0f87ce19e5c667089c
 |\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
-| |  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-| |  Files: dlines.lst, hglines.lst
 | |    Merge from A
 | |  
 o |    Changeset 16:67447f869439d27d2f3629a2f274ac06a8bbba76
 |\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
-| | |  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, dlines.lst
-| | |  Files: hglines.lst
 | | |    Merge from C:1
 | | |  
 | | o    Changeset 15:a1a9e96b64879d892b8a515972e4ee3a241abdff (branch A)
 | | |\   Commited 01 Jan 2002 00:00 by C <c@example.gov>
-| | | |  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-| | | |  Files: dlines.lst, hglines.lst
 | | | |    Merge from C:2
 | | | |  
 | | o |    Changeset 14:e32c389ecc7ca7bb62db508bc5120a72921007fd (branch A)
 | | |\ \   Commited 01 Jan 2002 00:00 by C <c@example.gov>
-| | | | |  Files: alines.lst, chgrepo.zsh, dlines.lst, hglines.lst
 | | | | |    Merge from B
 | | | | |  
 | | | | | o  Changeset 13:f76ee16fff80308a87c1f5c135f3607aadb524e2 (branch C)
 | | | | |/   Commited 01 Feb 2001 14:56 by B <b@example.org>
-| | | | |    Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-| | | | |    Files: dlines.lst, hglines.lst
+| | | | |    Files: .hgtags
 | | | | |      Added tag clines for changeset 6c0b2db2cd9b
 | | | | |    
 | +-----o  Changeset 12:6c0b2db2cd9b4559f85d13c0bc2773e69ae60dd7 (branch C)
 | | | |    Commited 01 Feb 2001 14:56 by B <b@example.org>
 | | | |    Tag: clines
-| | | |    Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, clines.lst
-| | | |    Files: dlines.lst, hglines.lst
+| | | |    Files: clines.lst
 | | | |      Added clines.lst
 | | | |    
 | +-----o  Changeset 11:781db45aff790bbfe3a82d9b96685e5d74376e0e (branch C)
 | | | |    Commited 01 Feb 2001 05:19 by A <a@example.com>
-| | | |    Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, dlines.lst
-| | | |    Files: hglines.lst
+| | | |    Files: .hgtags
 | | | |      Added tag blines for changeset f8eff9ce1120
 | | | |    
 | o | |  Changeset 10:f8eff9ce112027c65255450ebc892102ca899d0e (branch C)
 | | | |  Commited 01 Feb 2001 05:18 by A <a@example.com>
 | | | |  Tag: blines
-| | | |  Files: .hgtags, ablines.lst, alines.lst, blines.lst, chgrepo.zsh, dlines.lst
-| | | |  Files: hglines.lst
+| | | |  Files: blines.lst
 | | | |    Added blines.lst
 | | | |  
 o | | |    Changeset 9:045d5e6a8b34ccb9a05e0d546d49ddef11e491d3
 |\ \ \ \   Commited 01 Jan 2001 00:00 by C <c@example.gov>
-| | | | |  Files: ablines.lst, alines.lst, chgrepo.zsh, dlines.lst, hglines.lst
 | | | | |    Merge from C
 | | | | |  
 | | o | |  Changeset 8:c1824d49c2bd2c676c42c21d912730018c110990 (branch C)
 | |/ / /   Commited 02 Nov 2000 14:14 by B <b@example.org>
-| | | |    Files: .hgtags, ablines.lst, alines.lst, chgrepo.zsh, dlines.lst, hglines.lst
+| | | |    Files: .hgtags
 | | | |      Added tag ablines for changeset 10432c9ec0e7
 | | | |    
 | o---+  Changeset 7:10432c9ec0e7b99422f65c93bbb22755d6310b57 (branch C)
 |   | |  Commited 02 Nov 2000 14:13 by B <b@example.org>
 |  / /   Tag: ablines
-| | |    Files: ablines.lst, alines.lst, chgrepo.zsh, dlines.lst, hglines.lst
+| | |    Files: ablines.lst
 | | |      Added ablines.lst
 | | |    
 | | o  Changeset 6:28359fe9734742399ffc592a684ac47301df26dc (branch B)
 | |/   Commited 02 Nov 2000 05:44 by A <a@example.com>
-| |    Files: alines.lst, chgrepo.zsh, dlines.lst, hglines.lst
+| |    Files: alines.lst
 | |      Added alines.lst
 | |    
 | o  Changeset 5:2419893b605ec11533e37256a0f1a0864656e02a (branch A)
 |/   Commited 01 Nov 2000 13:24 by B <b@example.org>
-|    Files: chgrepo.zsh, dlines.lst, hglines.lst
+|    Files: dlines.lst
 |      Added dlines.lst
 |    
 o  Changeset 4:07c3ed860c2245eacf07d8104a6dc5483b34d770
 |  Commited 10 May 2000 04:23 by A <a@example.com>
-|  Files: chgrepo.zsh, hglines.lst
+|  Files: hglines.lst
 |    Added «hglines.lst»
 |  
 o  Changeset 3:7f4b93c6941e41286e9652e56da6aa747e143a55
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.