Show More
@@ -11,7 +11,8 b' from rhodecode.lib.vcs.exceptions import' | |||||
11 | from rhodecode.lib.vcs.exceptions import ImproperArchiveTypeError |
|
11 | from rhodecode.lib.vcs.exceptions import ImproperArchiveTypeError | |
12 | from rhodecode.lib.vcs.backends.base import BaseChangeset, EmptyChangeset |
|
12 | from rhodecode.lib.vcs.backends.base import BaseChangeset, EmptyChangeset | |
13 | from rhodecode.lib.vcs.nodes import FileNode, DirNode, NodeKind, RootNode, \ |
|
13 | from rhodecode.lib.vcs.nodes import FileNode, DirNode, NodeKind, RootNode, \ | |
14 | RemovedFileNode, SubModuleNode |
|
14 | RemovedFileNode, SubModuleNode, ChangedFileNodesGenerator,\ | |
|
15 | AddedFileNodesGenerator, RemovedFileNodesGenerator | |||
15 | from rhodecode.lib.vcs.utils import safe_unicode |
|
16 | from rhodecode.lib.vcs.utils import safe_unicode | |
16 | from rhodecode.lib.vcs.utils import date_fromtimestamp |
|
17 | from rhodecode.lib.vcs.utils import date_fromtimestamp | |
17 | from rhodecode.lib.vcs.utils.lazy import LazyProperty |
|
18 | from rhodecode.lib.vcs.utils.lazy import LazyProperty | |
@@ -468,7 +469,8 b' class GitChangeset(BaseChangeset):' | |||||
468 | """ |
|
469 | """ | |
469 | if not self.parents: |
|
470 | if not self.parents: | |
470 | return list(self._get_file_nodes()) |
|
471 | return list(self._get_file_nodes()) | |
471 | return [self.get_node(path) for path in self._get_paths_for_status('added')] |
|
472 | return AddedFileNodesGenerator([n for n in | |
|
473 | self._get_paths_for_status('added')], self) | |||
472 |
|
474 | |||
473 | @LazyProperty |
|
475 | @LazyProperty | |
474 | def changed(self): |
|
476 | def changed(self): | |
@@ -477,7 +479,8 b' class GitChangeset(BaseChangeset):' | |||||
477 | """ |
|
479 | """ | |
478 | if not self.parents: |
|
480 | if not self.parents: | |
479 | return [] |
|
481 | return [] | |
480 | return [self.get_node(path) for path in self._get_paths_for_status('modified')] |
|
482 | return ChangedFileNodesGenerator([n for n in | |
|
483 | self._get_paths_for_status('modified')], self) | |||
481 |
|
484 | |||
482 | @LazyProperty |
|
485 | @LazyProperty | |
483 | def removed(self): |
|
486 | def removed(self): | |
@@ -486,4 +489,5 b' class GitChangeset(BaseChangeset):' | |||||
486 | """ |
|
489 | """ | |
487 | if not self.parents: |
|
490 | if not self.parents: | |
488 | return [] |
|
491 | return [] | |
489 | return [RemovedFileNode(path) for path in self._get_paths_for_status('deleted')] |
|
492 | return RemovedFileNodesGenerator([n for n in | |
|
493 | self._get_paths_for_status('deleted')], self) |
@@ -5,7 +5,8 b' import datetime' | |||||
5 | from base import BackendTestMixin |
|
5 | from base import BackendTestMixin | |
6 | from conf import SCM_TESTS |
|
6 | from conf import SCM_TESTS | |
7 | from rhodecode.lib.vcs.backends.base import BaseChangeset |
|
7 | from rhodecode.lib.vcs.backends.base import BaseChangeset | |
8 | from rhodecode.lib.vcs.nodes import FileNode |
|
8 | from rhodecode.lib.vcs.nodes import FileNode, AddedFileNodesGenerator,\ | |
|
9 | ChangedFileNodesGenerator, RemovedFileNodesGenerator | |||
9 | from rhodecode.lib.vcs.exceptions import BranchDoesNotExistError |
|
10 | from rhodecode.lib.vcs.exceptions import BranchDoesNotExistError | |
10 | from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError |
|
11 | from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError | |
11 | from rhodecode.lib.vcs.exceptions import RepositoryError |
|
12 | from rhodecode.lib.vcs.exceptions import RepositoryError | |
@@ -308,13 +309,16 b' class ChangesetsChangesTestCaseMixin(Bac' | |||||
308 |
|
309 | |||
309 | def test_head_added(self): |
|
310 | def test_head_added(self): | |
310 | changeset = self.repo.get_changeset() |
|
311 | changeset = self.repo.get_changeset() | |
|
312 | self.assertTrue(isinstance(changeset.added, AddedFileNodesGenerator)) | |||
311 | self.assertItemsEqual(changeset.added, [ |
|
313 | self.assertItemsEqual(changeset.added, [ | |
312 | changeset.get_node('fallout'), |
|
314 | changeset.get_node('fallout'), | |
313 | ]) |
|
315 | ]) | |
|
316 | self.assertTrue(isinstance(changeset.changed, ChangedFileNodesGenerator)) | |||
314 | self.assertItemsEqual(changeset.changed, [ |
|
317 | self.assertItemsEqual(changeset.changed, [ | |
315 | changeset.get_node('foo/bar'), |
|
318 | changeset.get_node('foo/bar'), | |
316 | changeset.get_node('foobar'), |
|
319 | changeset.get_node('foobar'), | |
317 | ]) |
|
320 | ]) | |
|
321 | self.assertTrue(isinstance(changeset.removed, RemovedFileNodesGenerator)) | |||
318 | self.assertEqual(len(changeset.removed), 1) |
|
322 | self.assertEqual(len(changeset.removed), 1) | |
319 | self.assertEqual(list(changeset.removed)[0].path, 'qwe') |
|
323 | self.assertEqual(list(changeset.removed)[0].path, 'qwe') | |
320 |
|
324 |
General Comments 0
You need to be logged in to leave comments.
Login now