Source

aurum / python / aurum / rcdriverfuncs.py

The branch 'bzr-support' does not exist.
Diff from to

python/aurum/rcdriverfuncs.py

 from aurum.utils import readlines
 from copy import deepcopy
 
-statchars={
+hgstatchars={
     'M': 'modified',
     'A': 'added',
     'R': 'removed',
 def hg_status(path, args, reverse=False):
     r=deepcopy(emptystatdct)
     for line in readlines(['hg']+args, cwd=path):
-        r[statchars[line[0]]].append(line[2:])
+        r[hgstatchars[line[0]]].append(line[2:])
     if reverse:
         r['deleted'], r['unknown'] = r['unknown'], r['deleted']
         r['added'],   r['removed'] = r['removed'], r['added']
             return line[2:]
     return ''
 
+svnstatchars=[
+    {
+        'C': 'modified',
+        'M': 'modified',
+        '~': 'modified',
+        'R': 'modified',
+        'A': 'added',
+        'D': 'removed',
+        '!': 'deleted',
+        '?': 'unknown',
+        'I': 'ignored',
+    },
+    {
+        'C': 'modified',
+        'M': 'modified',
+    },
+]
+def svn_status(path, fname):
+    r=deepcopy(emptystatdct)
+    try:
+        line=readlines(['svn', 'status', '--', fname]).next()
+        status=line[:7]
+        for schar, colschars in zip(status, svnstatchars):
+            if schar in colschars:
+                r[colschars[schar]].append(fname)
+                break
+    except StopIteration:
+        r['clean'].append(fname)
+    return r
+
 # vim: ft=python ts=4 sw=4 sts=4 et tw=100