Commits

ZyX_I committed 3d5a6c3

Replaced code that extends l: dictionary (workaround for a vim bug: l: may appear locked)

  • Participants
  • Parent commits 56446da

Comments (0)

Files changed (2)

 endfunction
 "▶3 hg.update
 function s:F.hg.update(repo)
+    let d={}
     execute s:_r.py.cmd 'aurum.get_updates(vim.eval("a:repo.path"), '.
                 \                         'vim.eval("a:repo.tip_hex"))'
-    if !exists('css')
+    if !empty(d)
         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
-    let a:repo.tip_hex=tip_hex
+    call a:repo.functions.removechangesets(a:repo, d.startrev)
+    let a:repo.cslist+=d.css
+    call a:repo.functions.addchangesets(a:repo, d.css)
+    let a:repo.work_hex=d.work_hex
+    let a:repo.tip_hex=d.tip_hex
     let a:repo.work=a:repo.changesets[a:repo.work_hex]
     let a:repo.tip=a:repo.changesets[a:repo.tip_hex]
     return a:repo
 endfunction
 "▶3 hg.readfile :: repo, rev, file → [String]
 function s:F.hg.readfile(repo, rev, file)
+    let r=[]
     execute s:_r.py.cmd 'aurum.get_file(vim.eval("a:repo.path"), '.
                 \                      'vim.eval("a:rev"), '.
                 \                      'vim.eval("a:file"))'
 endfunction
 "▶3 hg.annotate :: repo, rev, file → [cs]
 function s:F.hg.annotate(repo, rev, file)
+    let r=[]
     execute s:_r.py.cmd 'aurum.annotate(vim.eval("a:repo.path"), '.
                 \                      'vim.eval("a:rev"), '.
                 \                      'vim.eval("a:file"))'
         set_rev_dict(repo[curcsnum], cs_vim)
         css_vim.append(cs_vim)
         curcsnum+=1
-    vim.eval('extend(l:, {"css": '+json.dumps(css_vim)+', '+
-                         '"tip_hex": "'+tipcs.hex()+'", '+
-                         '"work_hex": "'+repo['.'].hex()+'", '+
-                         '"startrev": '+str(startrev)+'})')
+    vim.eval('extend(d, {"css": '+json.dumps(css_vim)+', '+
+                        '"tip_hex": "'+tipcs.hex()+'", '+
+                        '"work_hex": "'+repo['.'].hex()+'", '+
+                        '"startrev": '+str(startrev)+'})')
 
 def new_repo(path):
     repo=get_repo(path)
 
 def get_file(path, rev, filepath):
     fctx=get_repo(path)[rev].filectx(filepath)
-    vim.eval('extend(l:, {"r": '+
+    vim.eval('extend(r, '+
             json.dumps(
                 [line.replace("\0", "\n") for line in fctx.data().split("\n")])+
-                   '})')
+                   ')')
 
 def annotate(path, rev, filepath):
     ann=get_repo(path)[rev].filectx(filepath).annotate()
-    vim.eval('extend(l:, {"r": ['+
-                             ", ".join(['"'+line[0].hex()+'"' for line in ann])+
-                               ']})')
+    vim.eval('extend(r, ['+",".join(['"'+line[0].hex()+'"' for line in ann])+
+                       '])')