comparison hgext3rd/fastimport/vendor/python_fastimport/tests/test_info_processor.py @ 86:28704a2a7461 vendor/python-fastimport

Import python-fastimport-0.9.8
author Roy Marples <roy@marples.name>
date Tue, 19 Jan 2021 22:56:34 +0000
parents
children
comparison
equal deleted inserted replaced
85:1f5544a8870b 86:28704a2a7461
1 # Copyright (C) 2018 Jelmer Vernooij
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 """Test InfoProcessor"""
17 from io import BytesIO
18
19 try:
20 from StringIO import StringIO
21 except ImportError:
22 from io import StringIO
23
24 from unittest import TestCase
25
26 from fastimport import (
27 parser,
28 )
29
30 from fastimport.processors import (
31 info_processor,
32 )
33
34 simple_fast_import_stream = b"""commit refs/heads/master
35 mark :1
36 committer Jelmer Vernooij <jelmer@samba.org> 1299718135 +0100
37 data 7
38 initial
39
40 """
41
42 class TestFastImportInfo(TestCase):
43
44 def test_simple(self):
45 stream = BytesIO(simple_fast_import_stream)
46 outf = StringIO()
47 proc = info_processor.InfoProcessor(outf=outf)
48 p = parser.ImportParser(stream)
49 proc.process(p.iter_commands)
50
51 self.maxDiff = None
52 self.assertEqual(outf.getvalue(), """Command counts:
53 \t0\tblob
54 \t0\tcheckpoint
55 \t1\tcommit
56 \t0\tfeature
57 \t0\tprogress
58 \t0\treset
59 \t0\ttag
60 File command counts:
61 \t0\tfilemodify
62 \t0\tfiledelete
63 \t0\tfilecopy
64 \t0\tfilerename
65 \t0\tfiledeleteall
66 Parent counts:
67 \t1\tparents-0
68 \t0\ttotal revisions merged
69 Commit analysis:
70 \tno\tblobs referenced by SHA
71 \tno\texecutables
72 \tno\tseparate authors found
73 \tno\tsymlinks
74 Head analysis:
75 \t:1\trefs/heads/master
76 Merges:
77 """)