Really simple API for updating refs
authorJohn Carr <john.carr@unrouted.co.uk>
Thu, 18 Dec 2008 10:25:50 +0000 (10:25 +0000)
committerJohn Carr <john.carr@unrouted.co.uk>
Thu, 18 Dec 2008 10:25:50 +0000 (10:25 +0000)
dulwich/repo.py

index 1842e298e19ed1d2924774359255421b45b2612d..3002403170a2112b8d358722e7fb62db1fa7dbd3 100644 (file)
@@ -90,6 +90,16 @@ class Repo(object):
       if os.path.exists(file):
         return self._get_ref(file)
 
+  def set_ref(self, name, vale):
+    file = os.path.join(self.basedir(), name)
+    open(file, 'w').write(value)
+
+  def remove_ref(self, name):
+    file = os.path.join(self.basedir(), name)
+    if os.path.exists(file):
+      os.remove(file)
+      return
+
   def get_tags(self):
     ret = {}
     for root, dirs, files in os.walk(os.path.join(self.basedir(), 'refs', 'tags')):