Commits

Andrew Godwin  committed 8dd124b

Fixing up the git module. Haven't tested it yet, but it's mostly correct.

  • Participants
  • Parent commits 748ed41

Comments (0)

Files changed (2)

File heechee/repo/git.py

         self.repo_lineariser = RepositoryLineariser(self)
         self.repo_lineariser.add_missing(self.git_repo.head())
     
-    def _commit_by_revision(self, revision):
-        return self.git_repo.commit(self.repo_lineariser[revision])
+    
+    ########### Public functions (main heechee repo API) ###########
     
     def get_top_revision(self):
         return self.repo_lineariser.top_revision_number()
     
-    def tree_for_revision(self, revision, path):
+    def tree_for_revision(self, revision):
         """
         Returns the entire tree for the given revision - including the
         top-level trunk/, tags/ and branches/ directories.
         
         return root
     
+    def file_changes(self, path, source, target):
+        raise NotImplementedError
+    
+    def logs_for_revisions(self, highest, lowest, path):
+        raise NotImplementedError
+    
+    def commit(self, branch_name, parent, message, author, changes, deletions):
+        raise NotImplementedError
+    
+    
+    ########### Private functions (git -> svn mapping) ###########
+    
+    def _commit_by_revision(self, revision):
+        return self.git_repo.commit(self.repo_lineariser[revision])
+    
     
     def _tree_for_commit(self, commit, name, parent, rev):
         

File heechee/tests/git.py

+"""
+Mercurial backend unit tests.
+"""
+
+import unittest
+from heechee.tests.base import HeecheeTest
+
+class GitTests(HeecheeTest):
+    
+    def init_repo(self):
+        self.source_cmds([
+            "git init",
+            "echo a > a",
+            "git add a",
+            "git commit -m adda"
+            "git branch branch1",
+            "git checkout branch1",
+            "echo b > b",
+            "git add b",
+            "git commit -m addb"
+            "mkdir dir",
+            "echo c > dir/c",
+            "git add dir/c",
+            "git commit -m addc"
+            "git tag tag1",
+        ])
+    
+    def test_checkout_all(self):
+        # Checkout the whole repo
+        self.target_cmds([
+            "svn co http://localhost:8080/ checkout"
+        ])
+        # Check things are there
+        self.assert_contents("checkout/trunk/a", "a\n")
+        self.assert_contents("checkout/tags/tip/a", "a\n")
+        self.assert_contents("checkout/branches/branch1/b", "b\n")
+        self.assert_contents("checkout/branches/branch1/dir/c", "c\n")
+        # Check there's no default branch (it's trunk)
+        self.assert_not_exists("checkout/branches/default/a")
+
+
+if __name__ == '__main__':
+    unittest.main()