瀏覽代碼

tests: fastexport: add a test for commit handler markers

Antoine Pietri 7 年之前
父節點
當前提交
fa9c3298f6
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      dulwich/tests/test_fastexport.py

+ 13 - 0
dulwich/tests/test_fastexport.py

@@ -144,6 +144,19 @@ class GitImportProcessorTests(TestCase):
         self.assertEqual(3600, commit.author_timezone)
         self.assertEqual(commit, self.repo[b"refs/heads/foo"])
 
+    def test_commit_handler_marker(self):
+        from fastimport import commands
+        [c1, c2] = build_commit_graph(self.repo.object_store, [[1], [2]])
+        self.processor.markers[b'10'] = c1.id
+        cmd = commands.CommitCommand(
+                b"refs/heads/foo",  b"mrkr",
+                (b"Jelmer", b"jelmer@samba.org", 432432432.0, 3600),
+                (b"Jelmer", b"jelmer@samba.org", 432432432.0, 3600),
+                b"FOO", b":10", [], [])
+        self.processor.commit_handler(cmd)
+        commit = self.repo[self.processor.last_commit]
+        self.assertEqual(c1.id, commit.parents[0])
+
     def test_import_stream(self):
         markers = self.processor.import_stream(BytesIO(b"""blob
 mark :1