Commits

ZyX_I  committed 0069cf7

Add third argument to outermethodgen, add support for vim.Dictionary.update

  • Participants
  • Parent commits 7dab100

Comments (0)

Files changed (4)

File python/aurum/aubazaar.py

     globals()[func.__name__+'_unchanged'] = func
     return f
 
-outermethod      = outermethodgen(g_repo, flush)
+outermethod      = outermethodgen(g_repo, flush, globals())
 autoexportmethod = autoexportmethodgen(g_repo, globals())
 
 def g_revid(repo, rev):

File python/aurum/augit.py

     except KeyError:
         vim_throw('norepo', path)
 
-outermethod      = outermethodgen(g_repo, flush)
+outermethod      = outermethodgen(g_repo, flush, globals())
 autoexportmethod = autoexportmethodgen(g_repo, globals())
 
 def g_cs(repo, rev):
         v.sort()
     return r
 
+def get_allfiles(repo, cs):
+    return list(list_tree_files(repo, cs.tree))
+
+csprops = {
+    'allfiles': get_allfiles,
+}
+
+@outermethod
+@autoexportmethod(var='a:cs')
+def get_cs_prop(repo, rev, prop):
+    cs=g_cs(repo, rev)
+    return {prop : csprops[prop](repo, cs)}
+
 cs_vim_defaults = {
         'phase'     : 'unknown',
         'branch'    : 'default',

File python/aurum/aumercurial.py

     except error.RepoError:
         vim_throw('norepo', path)
 
-outermethod      = outermethodgen(g_repo, flush)
+outermethod      = outermethodgen(g_repo, flush, globals())
 autoexportmethod = autoexportmethodgen(g_repo, globals())
 
 class PrintUI(ui.ui):

File python/aurum/auutils.py

             'clean'   : [],
             }
 
-def outermethodgen(g_repo, flush):
+def outermethodgen(g_repo, flush, g):
     def outermethod(func):
         """
             Decorator used to make functions omit showing python traceback in 
 def autoexportmethodgen(g_repo, g):
     def autoexportmethod(*extargs, **extkwargs):
         def autoexportmethoddec(func):
+            g['_'+func.__name__+'_orig']=func
             def f2(path, *args, **kwargs):
                 return func(g_repo(path), *args, **kwargs)
             g['_'+func.__name__]=f2
     return json.dumps(obj, encoding='utf8')
 
 if hasattr(vim, 'bindeval'):
-    def vim_extend(val, var='d', utf=True, list=False):
-        d_vim = vim.bindeval(var)
-        if list:
-            d_vim.extend(val)
-        else:
-            for key in val:
-                d_vim[key] = val[key]
+    if hasattr(vim, 'Dictionary') and hasattr(vim.Dictionary, 'update'):
+        def vim_extend(val, var='d', utf=True, list=False):
+            if list:
+                vim.bindeval(var).extend(val)
+            else:
+                vim.bindeval(var).update(val)
+    else:
+        def vim_extend(val, var='d', utf=True, list=False):
+            d_vim = vim.bindeval(var)
+            if list:
+                d_vim.extend(val)
+            else:
+                for key in val:
+                    d_vim[key] = val[key]
 else:
     def vim_extend(val, var='d', utf=True, list=False):
         vim.eval('extend('+var+', '+((utf_dumps if utf else nonutf_dumps)(val))+')')