Kevin Turner committed ce66db3

Add DarcsCommands to base.fscommands

Comments (0)

Files changed (1)


     commands = {'.hg': MercurialCommands,
                 '.svn': SubversionCommands,
                 '.git': GITCommands,
-                '_svn': SubversionCommands}
+                '_svn': SubversionCommands,
+                '_darcs': DarcsCommands}
     for key in commands:
         if key in dirlist:
         return self.root
+class DarcsCommands(object):
+    def __init__(self, root):
+        self.root = root
+        self.normal_actions = FileSystemCommands()
+    def create_file(self, path):
+        self.normal_actions.create_file(path)
+        self._do(['add', path])
+    def create_folder(self, path):
+        self.normal_actions.create_folder(path)
+        self._do(['add', path])
+    def move(self, path, new_location):
+        self._do(['mv', path, new_location])
+    def remove(self, path):
+        self.normal_actions.remove(path)
+    def write(self, path, data):
+        self.normal_actions.write(path, data)
+    def _do(self, args):
+        _execute(['darcs'] + args, cwd=self.root)
 def _execute(args, cwd=None):
     process = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE)
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
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.