annotate rhodecode/tests/vcs/test_inmemchangesets.py @ 3912:91f440a11b94 beta

fixes issues #849 IMC failed for non-ascii files - added set of regression tests into vcs lib
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 29 May 2013 00:20:27 +0200
parents d7488551578e
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3912
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
1 # encoding: utf8
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 Tests so called "in memory changesets" commit API of vcs.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 from __future__ import with_statement
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 import time
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 import datetime
3797
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 2894
diff changeset
9
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 2894
diff changeset
10 from rhodecode.lib import vcs
d7488551578e synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents: 2894
diff changeset
11 from rhodecode.tests.vcs.conf import SCM_TESTS, get_new_dir
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 from rhodecode.lib.vcs.exceptions import EmptyRepositoryError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 from rhodecode.lib.vcs.exceptions import NodeAlreadyAddedError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 from rhodecode.lib.vcs.exceptions import NodeAlreadyExistsError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 from rhodecode.lib.vcs.exceptions import NodeAlreadyRemovedError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 from rhodecode.lib.vcs.exceptions import NodeAlreadyChangedError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 from rhodecode.lib.vcs.exceptions import NodeDoesNotExistError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 from rhodecode.lib.vcs.exceptions import NodeNotChangedError
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 from rhodecode.lib.vcs.nodes import DirNode
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 from rhodecode.lib.vcs.nodes import FileNode
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 from rhodecode.lib.vcs.utils.compat import unittest
3912
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
22 from rhodecode.lib.vcs.utils import safe_unicode
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 class InMemoryChangesetTestMixin(object):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 This is a backend independent test case class which should be created
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28 with ``type`` method.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 It is required to set following attributes at subclass:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 - ``backend_alias``: alias of used backend (see ``vcs.BACKENDS``)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 - ``repo_path``: path to the repository which would be created for set of
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 tests
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 def get_backend(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 return vcs.get_backend(self.backend_alias)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 def setUp(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 Backend = self.get_backend()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 self.repo_path = get_new_dir(str(time.time()))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 self.repo = Backend(self.repo_path, create=True)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44 self.imc = self.repo.in_memory_changeset
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 self.nodes = [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 FileNode('foobar', content='Foo & bar'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 FileNode('foobar2', content='Foo & bar, doubled!'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
48 FileNode('foo bar with spaces', content=''),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
49 FileNode('foo/bar/baz', content='Inside'),
2894
2654edfb1700 fixes #591 git backend was causing encoding errors when handling binary files
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
50 FileNode('foo/bar/file.bin', content='\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00;\x00\x03\x00\xfe\xff\t\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x18\x00\x00\x00\x01\x00\x00\x00\xfe\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'),
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
51 ]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
53 def test_add(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54 rev_count = len(self.repo.revisions)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 to_add = [FileNode(node.path, content=node.content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 for node in self.nodes]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57 for node in to_add:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 message = u'Added: %s' % ', '.join((node.path for node in self.nodes))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 author = unicode(self.__class__)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 changeset = self.imc.commit(message=message, author=author)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 newtip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 self.assertEqual(changeset, newtip)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 self.assertEqual(rev_count + 1, len(self.repo.revisions))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66 self.assertEqual(newtip.message, message)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67 self.assertEqual(newtip.author, author)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
68 self.assertTrue(not any((self.imc.added, self.imc.changed,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
69 self.imc.removed)))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
70 for node in to_add:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
71 self.assertEqual(newtip.get_node(node.path).content, node.content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 def test_add_in_bulk(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 rev_count = len(self.repo.revisions)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 to_add = [FileNode(node.path, content=node.content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
76 for node in self.nodes]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 self.imc.add(*to_add)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 message = u'Added: %s' % ', '.join((node.path for node in self.nodes))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 author = unicode(self.__class__)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 changeset = self.imc.commit(message=message, author=author)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 newtip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83 self.assertEqual(changeset, newtip)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
84 self.assertEqual(rev_count + 1, len(self.repo.revisions))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
85 self.assertEqual(newtip.message, message)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86 self.assertEqual(newtip.author, author)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
87 self.assertTrue(not any((self.imc.added, self.imc.changed,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
88 self.imc.removed)))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
89 for node in to_add:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
90 self.assertEqual(newtip.get_node(node.path).content, node.content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
91
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
92 def test_add_actually_adds_all_nodes_at_second_commit_too(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
93 self.imc.add(FileNode('foo/bar/image.png', content='\0'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
94 self.imc.add(FileNode('foo/README.txt', content='readme!'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
95 changeset = self.imc.commit(u'Initial', u'joe.doe@example.com')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
96 self.assertTrue(isinstance(changeset.get_node('foo'), DirNode))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
97 self.assertTrue(isinstance(changeset.get_node('foo/bar'), DirNode))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
98 self.assertEqual(changeset.get_node('foo/bar/image.png').content, '\0')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
99 self.assertEqual(changeset.get_node('foo/README.txt').content, 'readme!')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
100
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
101 # commit some more files again
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
102 to_add = [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 FileNode('foo/bar/foobaz/bar', content='foo'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
104 FileNode('foo/bar/another/bar', content='foo'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
105 FileNode('foo/baz.txt', content='foo'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
106 FileNode('foobar/foobaz/file', content='foo'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
107 FileNode('foobar/barbaz', content='foo'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
108 ]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
109 self.imc.add(*to_add)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
110 changeset = self.imc.commit(u'Another', u'joe.doe@example.com')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
111 self.assertEqual(changeset.get_node('foo/bar/foobaz/bar').content, 'foo')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
112 self.assertEqual(changeset.get_node('foo/bar/another/bar').content, 'foo')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
113 self.assertEqual(changeset.get_node('foo/baz.txt').content, 'foo')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
114 self.assertEqual(changeset.get_node('foobar/foobaz/file').content, 'foo')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
115 self.assertEqual(changeset.get_node('foobar/barbaz').content, 'foo')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116
3912
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
117 def test_add_non_ascii_files(self):
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
118 rev_count = len(self.repo.revisions)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
119 to_add = [
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
120 FileNode('żółwik/zwierzątko', content='ćććć'),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
121 FileNode(u'żółwik/zwierzątko_uni', content=u'ćććć'),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
122 ]
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
123 for node in to_add:
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
124 self.imc.add(node)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
125 message = u'Added: %s' % ', '.join((node.path for node in self.nodes))
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
126 author = unicode(self.__class__)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
127 changeset = self.imc.commit(message=message, author=author)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
128
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
129 newtip = self.repo.get_changeset()
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
130 self.assertEqual(changeset, newtip)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
131 self.assertEqual(rev_count + 1, len(self.repo.revisions))
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
132 self.assertEqual(newtip.message, message)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
133 self.assertEqual(newtip.author, author)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
134 self.assertTrue(not any((self.imc.added, self.imc.changed,
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
135 self.imc.removed)))
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
136 for node in to_add:
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
137 self.assertEqual(newtip.get_node(node.path).content, node.content)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
138
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
139 def test_add_raise_already_added(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
140 node = FileNode('foobar', content='baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
141 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
142 self.assertRaises(NodeAlreadyAddedError, self.imc.add, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
143
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
144 def test_check_integrity_raise_already_exist(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
145 node = FileNode('foobar', content='baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
146 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
147 self.imc.commit(message=u'Added foobar', author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
148 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
149 self.assertRaises(NodeAlreadyExistsError, self.imc.commit,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
150 message='new message',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
151 author=str(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
153 def test_change(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
154 self.imc.add(FileNode('foo/bar/baz', content='foo'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
155 self.imc.add(FileNode('foo/fbar', content='foobar'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
156 tip = self.imc.commit(u'Initial', u'joe.doe@example.com')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
157
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
158 # Change node's content
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
159 node = FileNode('foo/bar/baz', content='My **changed** content')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
160 self.imc.change(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
161 self.imc.commit(u'Changed %s' % node.path, u'joe.doe@example.com')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
162
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
163 newtip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
164 self.assertNotEqual(tip, newtip)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
165 self.assertNotEqual(tip.id, newtip.id)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
166 self.assertEqual(newtip.get_node('foo/bar/baz').content,
3912
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
167 'My **changed** content')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
168
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
169 def test_change_non_ascii(self):
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
170 to_add = [
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
171 FileNode('żółwik/zwierzątko', content='ćććć'),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
172 FileNode(u'żółwik/zwierzątko_uni', content=u'ćććć'),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
173 ]
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
174 for node in to_add:
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
175 self.imc.add(node)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
176
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
177 tip = self.imc.commit(u'Initial', u'joe.doe@example.com')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
178
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
179 # Change node's content
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
180 node = FileNode('żółwik/zwierzątko', content='My **changed** content')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
181 self.imc.change(node)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
182 self.imc.commit(u'Changed %s' % safe_unicode(node.path),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
183 u'joe.doe@example.com')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
184
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
185 node = FileNode(u'żółwik/zwierzątko_uni', content=u'My **changed** content')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
186 self.imc.change(node)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
187 self.imc.commit(u'Changed %s' % safe_unicode(node.path),
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
188 u'joe.doe@example.com')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
189
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
190 newtip = self.repo.get_changeset()
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
191 self.assertNotEqual(tip, newtip)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
192 self.assertNotEqual(tip.id, newtip.id)
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
193
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
194 self.assertEqual(newtip.get_node('żółwik/zwierzątko').content,
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
195 'My **changed** content')
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
196 self.assertEqual(newtip.get_node('żółwik/zwierzątko_uni').content,
91f440a11b94 fixes issues #849 IMC failed for non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
197 'My **changed** content')
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
198
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
199 def test_change_raise_empty_repository(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
200 node = FileNode('foobar')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
201 self.assertRaises(EmptyRepositoryError, self.imc.change, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
202
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
203 def test_check_integrity_change_raise_node_does_not_exist(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
204 node = FileNode('foobar', content='baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
205 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
206 self.imc.commit(message=u'Added foobar', author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
207 node = FileNode('not-foobar', content='')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
208 self.imc.change(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
209 self.assertRaises(NodeDoesNotExistError, self.imc.commit,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
210 message='Changed not existing node',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
211 author=str(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
212
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
213 def test_change_raise_node_already_changed(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
214 node = FileNode('foobar', content='baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
215 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
216 self.imc.commit(message=u'Added foobar', author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
217 node = FileNode('foobar', content='more baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
218 self.imc.change(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
219 self.assertRaises(NodeAlreadyChangedError, self.imc.change, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
220
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
221 def test_check_integrity_change_raise_node_not_changed(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
222 self.test_add() # Performs first commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
223
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
224 node = FileNode(self.nodes[0].path, content=self.nodes[0].content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
225 self.imc.change(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
226 self.assertRaises(NodeNotChangedError, self.imc.commit,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
227 message=u'Trying to mark node as changed without touching it',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
228 author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
229
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
230 def test_change_raise_node_already_removed(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
231 node = FileNode('foobar', content='baz')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
232 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
233 self.imc.commit(message=u'Added foobar', author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
234 self.imc.remove(FileNode('foobar'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
235 self.assertRaises(NodeAlreadyRemovedError, self.imc.change, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
236
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
237 def test_remove(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
238 self.test_add() # Performs first commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
239
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
240 tip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
241 node = self.nodes[0]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
242 self.assertEqual(node.content, tip.get_node(node.path).content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
243 self.imc.remove(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
244 self.imc.commit(message=u'Removed %s' % node.path, author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
245
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
246 newtip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
247 self.assertNotEqual(tip, newtip)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
248 self.assertNotEqual(tip.id, newtip.id)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
249 self.assertRaises(NodeDoesNotExistError, newtip.get_node, node.path)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
250
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
251 def test_remove_last_file_from_directory(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
252 node = FileNode('omg/qwe/foo/bar', content='foobar')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
253 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
254 self.imc.commit(u'added', u'joe doe')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
255
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
256 self.imc.remove(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
257 tip = self.imc.commit(u'removed', u'joe doe')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
258 self.assertRaises(NodeDoesNotExistError, tip.get_node, 'omg/qwe/foo/bar')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
259
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
260 def test_remove_raise_node_does_not_exist(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
261 self.imc.remove(self.nodes[0])
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
262 self.assertRaises(NodeDoesNotExistError, self.imc.commit,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
263 message='Trying to remove node at empty repository',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
264 author=str(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
265
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
266 def test_check_integrity_remove_raise_node_does_not_exist(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
267 self.test_add() # Performs first commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
268
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
269 node = FileNode('no-such-file')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
270 self.imc.remove(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
271 self.assertRaises(NodeDoesNotExistError, self.imc.commit,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
272 message=u'Trying to remove not existing node',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
273 author=unicode(self))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
274
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
275 def test_remove_raise_node_already_removed(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
276 self.test_add() # Performs first commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
277
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
278 node = FileNode(self.nodes[0].path)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
279 self.imc.remove(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
280 self.assertRaises(NodeAlreadyRemovedError, self.imc.remove, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
281
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
282 def test_remove_raise_node_already_changed(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
283 self.test_add() # Performs first commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
284
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
285 node = FileNode(self.nodes[0].path, content='Bending time')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
286 self.imc.change(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
287 self.assertRaises(NodeAlreadyChangedError, self.imc.remove, node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
288
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
289 def test_reset(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
290 self.imc.add(FileNode('foo', content='bar'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
291 #self.imc.change(FileNode('baz', content='new'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
292 #self.imc.remove(FileNode('qwe'))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
293 self.imc.reset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
294 self.assertTrue(not any((self.imc.added, self.imc.changed,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
295 self.imc.removed)))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
296
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
297 def test_multiple_commits(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
298 N = 3 # number of commits to perform
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
299 last = None
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
300 for x in xrange(N):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
301 fname = 'file%s' % str(x).rjust(5, '0')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
302 content = 'foobar\n' * x
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
303 node = FileNode(fname, content=content)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
304 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
305 commit = self.imc.commit(u"Commit no. %s" % (x + 1), author=u'vcs')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
306 self.assertTrue(last != commit)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
307 last = commit
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
308
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
309 # Check commit number for same repo
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
310 self.assertEqual(len(self.repo.revisions), N)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
311
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
312 # Check commit number for recreated repo
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
313 backend = self.get_backend()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
314 repo = backend(self.repo_path)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
315 self.assertEqual(len(repo.revisions), N)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
316
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
317 def test_date_attr(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
318 node = FileNode('foobar.txt', content='Foobared!')
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
319 self.imc.add(node)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
320 date = datetime.datetime(1985, 1, 30, 1, 45)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
321 commit = self.imc.commit(u"Committed at time when I was born ;-)",
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
322 author=u'lb', date=date)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
323
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
324 self.assertEqual(commit.date, date)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
325
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
326
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
327 class BackendBaseTestCase(unittest.TestCase):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
328 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
329 Base test class for tests which requires repository.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
330 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
331 backend_alias = 'hg'
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
332 commits = [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
333 {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
334 'message': 'Initial commit',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
335 'author': 'Joe Doe <joe.doe@example.com>',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
336 'date': datetime.datetime(2010, 1, 1, 20),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
337 'added': [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
338 FileNode('foobar', content='Foobar'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
339 FileNode('foobar2', content='Foobar II'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
340 FileNode('foo/bar/baz', content='baz here!'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
341 ],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
342 },
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
343 ]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
344
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
345 def get_backend(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
346 return vcs.get_backend(self.backend_alias)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
347
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
348 def get_commits(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
349 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
350 Returns list of commits which builds repository for each tests.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
351 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
352 if hasattr(self, 'commits'):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
353 return self.commits
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
354
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
355 def get_new_repo_path(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
356 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
357 Returns newly created repository's directory.
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
358 """
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
359 backend = self.get_backend()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
360 key = '%s-%s' % (backend.alias, str(time.time()))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
361 repo_path = get_new_dir(key)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
362 return repo_path
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
363
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
364 def setUp(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
365 Backend = self.get_backend()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
366 self.backend_class = Backend
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
367 self.repo_path = self.get_new_repo_path()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
368 self.repo = Backend(self.repo_path, create=True)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
369 self.imc = self.repo.in_memory_changeset
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
370
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
371 for commit in self.get_commits():
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
372 for node in commit.get('added', []):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
373 self.imc.add(FileNode(node.path, content=node.content))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
374 for node in commit.get('changed', []):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
375 self.imc.change(FileNode(node.path, content=node.content))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
376 for node in commit.get('removed', []):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
377 self.imc.remove(FileNode(node.path))
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
378 self.imc.commit(message=unicode(commit['message']),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
379 author=unicode(commit['author']),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
380 date=commit['date'])
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
381
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
382 self.tip = self.repo.get_changeset()
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
383
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
384
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
385 # For each backend create test case class
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
386 for alias in SCM_TESTS:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
387 attrs = {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
388 'backend_alias': alias,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
389 }
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
390 cls_name = ''.join(('%s in memory changeset test' % alias).title().split())
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
391 bases = (InMemoryChangesetTestMixin, unittest.TestCase)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
392 globals()[cls_name] = type(cls_name, bases, attrs)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
393
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
394
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
395 if __name__ == '__main__':
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
396 unittest.main()