ZyX_I avatar ZyX_I committed 56d23b6

Fixed updater and graphical log

Comments (0)

Files changed (3)

ftplugin/aurumgraphlog.vim

 endfunction
 "▶1 glog
 "▶2 glog.utfedges
-function s:F.glog.utfedges(seen, hex, parents_hex)
+function s:F.glog.utfedges(seen, hex, parents)
     let nodeidx=index(a:seen, a:hex)
     if nodeidx==-1
         let nodeidx=len(a:seen)
     endif
     let knownparents=[]
     let newparents=[]
-    for parent_hex in a:parents_hex
-        call add(((index(a:seen, parent_hex)==-1)?
+    for parent in a:parents
+        call add(((index(a:seen, parent.hex)==-1)?
                     \   (newparents):
                     \   (knownparents)),
-                    \parent_hex)
+                    \parent.hex)
     endfor
     let ncols=len(a:seen)
     call remove(a:seen, nodeidx)
         let char=((has_key(a:showparents, cs.hex))?('@'):('o'))
         let text=call(a:Dumper, [cs], {})
         call s:F.glog.utf(state, 'C', char, text,
-                    \     s:F.glog.utfedges(seen, cs.hex, cs.parents_hex))
+                    \     s:F.glog.utfedges(seen, cs.hex, cs.parents))
         call s:F.glog.addlines(text, len(r.text))
         let r.text+=text.text
         let r.specials[cs.hex]=text.special
         endfor
     endfor
 endfunction
+"▶3 hg.removechangesets :: repo, start_rev_num → + repo
+function s:F.hg.removechangesets(repo, start)
+    for cs in remove(a:repo.cslist, a:start, -1)
+        for parent in cs.parents
+            call filter(parent.children, 'v:val isnot cs')
+        endfor
+        for child in cs.children
+            call filter(child.parents, 'v:val isnot cs')
+        endfor
+    endfor
+endfunction
 "▶3 hg.update
 function s:F.hg.update(repo)
     execute s:_r.py.cmd 'aurum.get_updates(vim.eval("a:repo.path"), '.
                 \                         'vim.eval("a:repo.tip_hex"))'
-    call remove(a:repo.cslist, -1)
+    if !exists('css')
+        return a:repo
+    endif
+    call a:repo.functions.removechangesets(a:repo, startrev)
     let a:repo.cslist+=css
     call a:repo.functions.addchangesets(a:repo, css)
     let a:repo.work_hex=work_hex
 import json
 
 ui=ui.ui()
-repositories={}
 
 def get_repo(path):
-    if(path not in repositories):
-        repositories[path]=hg.repository(ui, path)
-    return repositories[path]
+    return hg.repository(ui, path)
 
 def set_rev_dict(cs, cs_vim):
     cs_vim['hex']=cs.hex()
     repo=get_repo(path)
     cs=repo[oldtip]
     tipcs=repo['tip']
-    if tipcs is cs:
+    if tipcs.hex()==cs.hex():
         return
-    curcsnum=cs.rev()
+    startrev=cs.rev()
+    curcsnum=startrev
     cscount=tipcs.rev()+1
     css_vim=[]
     while curcsnum<=cscount:
         curcsnum+=1
     vim.eval('extend(l:, {"css": '+json.dumps(css_vim)+', '+
                          '"tip_hex": "'+tipcs.hex()+'", '+
-                         '"work_hex": "'+repo['.'].hex()+'"})')
+                         '"work_hex": "'+repo['.'].hex()+'", '+
+                         '"startrev": '+str(startrev)+'})')
 
 def new_repo(path):
     repo=get_repo(path)
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.