| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -165,8 +165,13 @@ def iter_items(cls, repo, rev, paths='', **kwargs): | |||
| 165 | 165 | """ | |
| 166 | 166 | options = {'pretty': 'raw', 'as_process' : True } | |
| 167 | 167 | options.update(kwargs) | |
| 168 | + | ||
| 169 | + args = list() | ||
| 170 | + if paths: | ||
| 171 | + args.extend(('--', paths)) | ||
| 172 | + # END if paths | ||
| 168 | 173 | ||
| 169 | - proc = repo.git.rev_list(rev, '--', paths, **options) | ||
| 174 | + proc = repo.git.rev_list(rev, args, **options) | ||
| 170 | 175 | return cls._iter_from_process_or_stream(repo, proc, True) | |
| 171 | 176 | ||
| 172 | 177 | def iter_parents(self, paths='', **kwargs): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,6 +92,24 @@ def test_traversal(self): | |||
| 92 | 92 | # sha ) | |
| 93 | 93 | assert len(first.parents) == 0 | |
| 94 | 94 | ||
| 95 | + def test_iteration(self): | ||
| 96 | + # we can iterate commits | ||
| 97 | + all_commits = Commit.list_items(self.rorepo, 'master') | ||
| 98 | + assert all_commits | ||
| 99 | + assert all_commits == list(self.rorepo.iter_commits()) | ||
| 100 | + | ||
| 101 | + # this includes merge commits | ||
| 102 | + mcomit = Commit(self.rorepo, 'd884adc80c80300b4cc05321494713904ef1df2d') | ||
| 103 | + assert mcomit in all_commits | ||
| 104 | + | ||
| 105 | + # we can limit the result to paths | ||
| 106 | + ltd_commits = list(self.rorepo.iter_commits(paths='CHANGES')) | ||
| 107 | + assert ltd_commits and len(ltd_commits) < len(all_commits) | ||
| 108 | + | ||
| 109 | + # show commits of multiple paths, resulting in a union of commits | ||
| 110 | + less_ltd_commits = list(Commit.iter_items(self.rorepo, 'master', paths=('CHANGES', 'AUTHORS'))) | ||
| 111 | + assert len(ltd_commits) < len(less_ltd_commits) | ||
| 112 | + | ||
| 95 | 113 | ||
| 96 | 114 | @patch_object(Git, '_call_process') | |
| 97 | 115 | def test_rev_list_bisect_all(self, git): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments