Show More
@@ -381,7 +381,7 b' def get_repo_changesets(request, apiuser' | |||||
381 |
|
381 | |||
382 | try: |
|
382 | try: | |
383 | commits = vcs_repo.get_commits( |
|
383 | commits = vcs_repo.get_commits( | |
384 | start_id=start_rev, pre_load=pre_load) |
|
384 | start_id=start_rev, pre_load=pre_load, translate_tags=False) | |
385 | except TypeError as e: |
|
385 | except TypeError as e: | |
386 | raise JSONRPCError(safe_str(e)) |
|
386 | raise JSONRPCError(safe_str(e)) | |
387 | except Exception: |
|
387 | except Exception: |
@@ -203,7 +203,6 b' class RepoChangelogView(RepoAppView):' | |||||
203 | pre_load = self._get_preload_attrs() |
|
203 | pre_load = self._get_preload_attrs() | |
204 |
|
204 | |||
205 | partial_xhr = self.request.environ.get('HTTP_X_PARTIAL_XHR') |
|
205 | partial_xhr = self.request.environ.get('HTTP_X_PARTIAL_XHR') | |
206 |
|
||||
207 | try: |
|
206 | try: | |
208 | if f_path: |
|
207 | if f_path: | |
209 | log.debug('generating changelog for path %s', f_path) |
|
208 | log.debug('generating changelog for path %s', f_path) | |
@@ -231,7 +230,7 b' class RepoChangelogView(RepoAppView):' | |||||
231 | else: |
|
230 | else: | |
232 | collection = self.rhodecode_vcs_repo.get_commits( |
|
231 | collection = self.rhodecode_vcs_repo.get_commits( | |
233 | branch_name=branch_name, show_hidden=show_hidden, |
|
232 | branch_name=branch_name, show_hidden=show_hidden, | |
234 | pre_load=pre_load) |
|
233 | pre_load=pre_load, translate_tags=False) | |
235 |
|
234 | |||
236 | self._load_changelog_data( |
|
235 | self._load_changelog_data( | |
237 | c, collection, p, chunk_size, c.branch_name, |
|
236 | c, collection, p, chunk_size, c.branch_name, | |
@@ -320,7 +319,8 b' class RepoChangelogView(RepoAppView):' | |||||
320 | collection = list(reversed(collection)) |
|
319 | collection = list(reversed(collection)) | |
321 | else: |
|
320 | else: | |
322 | collection = self.rhodecode_vcs_repo.get_commits( |
|
321 | collection = self.rhodecode_vcs_repo.get_commits( | |
323 |
branch_name=branch_name, show_hidden=show_hidden, pre_load=pre_load |
|
322 | branch_name=branch_name, show_hidden=show_hidden, pre_load=pre_load, | |
|
323 | translate_tags=False) | |||
324 |
|
324 | |||
325 | p = safe_int(self.request.GET.get('page', 1), 1) |
|
325 | p = safe_int(self.request.GET.get('page', 1), 1) | |
326 | try: |
|
326 | try: |
@@ -97,7 +97,7 b' class RepoCommitsView(RepoAppView):' | |||||
97 | if len(commit_range) == 2: |
|
97 | if len(commit_range) == 2: | |
98 | commits = self.rhodecode_vcs_repo.get_commits( |
|
98 | commits = self.rhodecode_vcs_repo.get_commits( | |
99 | start_id=commit_range[0], end_id=commit_range[1], |
|
99 | start_id=commit_range[0], end_id=commit_range[1], | |
100 | pre_load=pre_load) |
|
100 | pre_load=pre_load, translate_tags=False) | |
101 | commits = list(commits) |
|
101 | commits = list(commits) | |
102 | else: |
|
102 | else: | |
103 | commits = [self.rhodecode_vcs_repo.get_commit( |
|
103 | commits = [self.rhodecode_vcs_repo.get_commit( |
@@ -141,7 +141,8 b' class RepoSummaryView(RepoAppView):' | |||||
141 |
|
141 | |||
142 | pre_load = ['author', 'branch', 'date', 'message'] |
|
142 | pre_load = ['author', 'branch', 'date', 'message'] | |
143 | try: |
|
143 | try: | |
144 |
collection = self.rhodecode_vcs_repo.get_commits( |
|
144 | collection = self.rhodecode_vcs_repo.get_commits( | |
|
145 | pre_load=pre_load, translate_tags=False) | |||
145 | except EmptyRepositoryError: |
|
146 | except EmptyRepositoryError: | |
146 | collection = self.rhodecode_vcs_repo |
|
147 | collection = self.rhodecode_vcs_repo | |
147 |
|
148 |
@@ -401,7 +401,7 b' class BaseRepository(object):' | |||||
401 | # COMMITS |
|
401 | # COMMITS | |
402 | # ========================================================================== |
|
402 | # ========================================================================== | |
403 |
|
403 | |||
404 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None): |
|
404 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None, translate_tag=None): | |
405 | """ |
|
405 | """ | |
406 | Returns instance of `BaseCommit` class. If `commit_id` and `commit_idx` |
|
406 | Returns instance of `BaseCommit` class. If `commit_id` and `commit_idx` | |
407 | are both None, most recent commit is returned. |
|
407 | are both None, most recent commit is returned. | |
@@ -418,7 +418,7 b' class BaseRepository(object):' | |||||
418 |
|
418 | |||
419 | def get_commits( |
|
419 | def get_commits( | |
420 | self, start_id=None, end_id=None, start_date=None, end_date=None, |
|
420 | self, start_id=None, end_id=None, start_date=None, end_date=None, | |
421 | branch_name=None, show_hidden=False, pre_load=None): |
|
421 | branch_name=None, show_hidden=False, pre_load=None, translate_tags=None): | |
422 | """ |
|
422 | """ | |
423 | Returns iterator of `BaseCommit` objects from start to end |
|
423 | Returns iterator of `BaseCommit` objects from start to end | |
424 | not inclusive. This should behave just like a list, ie. end is not |
|
424 | not inclusive. This should behave just like a list, ie. end is not | |
@@ -431,6 +431,7 b' class BaseRepository(object):' | |||||
431 | :param branch_name: |
|
431 | :param branch_name: | |
432 | :param show_hidden: |
|
432 | :param show_hidden: | |
433 | :param pre_load: |
|
433 | :param pre_load: | |
|
434 | :param translate_tags: | |||
434 | """ |
|
435 | """ | |
435 | raise NotImplementedError |
|
436 | raise NotImplementedError | |
436 |
|
437 | |||
@@ -1646,12 +1647,13 b' class EmptyRepository(BaseRepository):' | |||||
1646 |
|
1647 | |||
1647 | class CollectionGenerator(object): |
|
1648 | class CollectionGenerator(object): | |
1648 |
|
1649 | |||
1649 | def __init__(self, repo, commit_ids, collection_size=None, pre_load=None): |
|
1650 | def __init__(self, repo, commit_ids, collection_size=None, pre_load=None, translate_tag=None): | |
1650 | self.repo = repo |
|
1651 | self.repo = repo | |
1651 | self.commit_ids = commit_ids |
|
1652 | self.commit_ids = commit_ids | |
1652 | # TODO: (oliver) this isn't currently hooked up |
|
1653 | # TODO: (oliver) this isn't currently hooked up | |
1653 | self.collection_size = None |
|
1654 | self.collection_size = None | |
1654 | self.pre_load = pre_load |
|
1655 | self.pre_load = pre_load | |
|
1656 | self.translate_tag = translate_tag | |||
1655 |
|
1657 | |||
1656 | def __len__(self): |
|
1658 | def __len__(self): | |
1657 | if self.collection_size is not None: |
|
1659 | if self.collection_size is not None: | |
@@ -1667,8 +1669,9 b' class CollectionGenerator(object):' | |||||
1667 | """ |
|
1669 | """ | |
1668 | Allows backends to override the way commits are generated. |
|
1670 | Allows backends to override the way commits are generated. | |
1669 | """ |
|
1671 | """ | |
1670 |
return self.repo.get_commit( |
|
1672 | return self.repo.get_commit( | |
1671 |
|
|
1673 | commit_id=commit_id, pre_load=self.pre_load, | |
|
1674 | translate_tag=self.translate_tag) | |||
1672 |
|
1675 | |||
1673 | def __getslice__(self, i, j): |
|
1676 | def __getslice__(self, i, j): | |
1674 | """ |
|
1677 | """ | |
@@ -1676,7 +1679,8 b' class CollectionGenerator(object):' | |||||
1676 | """ |
|
1679 | """ | |
1677 | commit_ids = self.commit_ids[i:j] |
|
1680 | commit_ids = self.commit_ids[i:j] | |
1678 | return self.__class__( |
|
1681 | return self.__class__( | |
1679 |
self.repo, commit_ids, pre_load=self.pre_load |
|
1682 | self.repo, commit_ids, pre_load=self.pre_load, | |
|
1683 | translate_tag=self.translate_tag) | |||
1680 |
|
1684 | |||
1681 | def __repr__(self): |
|
1685 | def __repr__(self): | |
1682 | return '<CollectionGenerator[len:%s]>' % (self.__len__()) |
|
1686 | return '<CollectionGenerator[len:%s]>' % (self.__len__()) |
@@ -269,7 +269,8 b' class GitCommit(base.BaseCommit):' | |||||
269 |
|
269 | |||
270 | def _make_commits(self, commit_ids, pre_load=None): |
|
270 | def _make_commits(self, commit_ids, pre_load=None): | |
271 | return [ |
|
271 | return [ | |
272 |
self.repository.get_commit(commit_id=commit_id, pre_load=pre_load |
|
272 | self.repository.get_commit(commit_id=commit_id, pre_load=pre_load, | |
|
273 | translate_tag=False) | |||
273 | for commit_id in commit_ids] |
|
274 | for commit_id in commit_ids] | |
274 |
|
275 | |||
275 | def get_file_mode(self, path): |
|
276 | def get_file_mode(self, path): |
@@ -426,7 +426,7 b' class GitRepository(BaseRepository):' | |||||
426 | except Exception: |
|
426 | except Exception: | |
427 | return |
|
427 | return | |
428 |
|
428 | |||
429 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None): |
|
429 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None, translate_tag=True): | |
430 | """ |
|
430 | """ | |
431 | Returns `GitCommit` object representing commit from git repository |
|
431 | Returns `GitCommit` object representing commit from git repository | |
432 | at the given `commit_id` or head (most recent commit) if None given. |
|
432 | at the given `commit_id` or head (most recent commit) if None given. | |
@@ -438,8 +438,9 b' class GitRepository(BaseRepository):' | |||||
438 | commit_id = commit_idx |
|
438 | commit_id = commit_idx | |
439 | commit_id = self._get_commit_id(commit_id) |
|
439 | commit_id = self._get_commit_id(commit_id) | |
440 | try: |
|
440 | try: | |
441 | # Need to call remote to translate id for tagging scenario |
|
441 | if translate_tag: | |
442 | commit_id = self._remote.get_object(commit_id)["commit_id"] |
|
442 | # Need to call remote to translate id for tagging scenario | |
|
443 | commit_id = self._remote.get_object(commit_id)["commit_id"] | |||
443 | idx = self._commit_ids[commit_id] |
|
444 | idx = self._commit_ids[commit_id] | |
444 | except KeyError: |
|
445 | except KeyError: | |
445 | raise RepositoryError("Cannot get object with id %s" % commit_id) |
|
446 | raise RepositoryError("Cannot get object with id %s" % commit_id) | |
@@ -448,7 +449,7 b' class GitRepository(BaseRepository):' | |||||
448 |
|
449 | |||
449 | def get_commits( |
|
450 | def get_commits( | |
450 | self, start_id=None, end_id=None, start_date=None, end_date=None, |
|
451 | self, start_id=None, end_id=None, start_date=None, end_date=None, | |
451 | branch_name=None, show_hidden=False, pre_load=None): |
|
452 | branch_name=None, show_hidden=False, pre_load=None, translate_tags=True): | |
452 | """ |
|
453 | """ | |
453 | Returns generator of `GitCommit` objects from start to end (both |
|
454 | Returns generator of `GitCommit` objects from start to end (both | |
454 | are inclusive), in ascending date order. |
|
455 | are inclusive), in ascending date order. | |
@@ -528,7 +529,8 b' class GitRepository(BaseRepository):' | |||||
528 | if start_pos or end_pos: |
|
529 | if start_pos or end_pos: | |
529 | commit_ids = commit_ids[start_pos: end_pos] |
|
530 | commit_ids = commit_ids[start_pos: end_pos] | |
530 |
|
531 | |||
531 |
return CollectionGenerator(self, commit_ids, pre_load=pre_load |
|
532 | return CollectionGenerator(self, commit_ids, pre_load=pre_load, | |
|
533 | translate_tag=translate_tags) | |||
532 |
|
534 | |||
533 | def get_diff( |
|
535 | def get_diff( | |
534 | self, commit1, commit2, path='', ignore_whitespace=False, |
|
536 | self, commit1, commit2, path='', ignore_whitespace=False, |
@@ -414,7 +414,7 b' class MercurialRepository(BaseRepository' | |||||
414 | """ |
|
414 | """ | |
415 | return os.path.join(self.path, '.hg', '.hgrc') |
|
415 | return os.path.join(self.path, '.hg', '.hgrc') | |
416 |
|
416 | |||
417 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None): |
|
417 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None, translate_tag=None): | |
418 | """ |
|
418 | """ | |
419 | Returns ``MercurialCommit`` object representing repository's |
|
419 | Returns ``MercurialCommit`` object representing repository's | |
420 | commit at the given `commit_id` or `commit_idx`. |
|
420 | commit at the given `commit_id` or `commit_idx`. | |
@@ -456,7 +456,7 b' class MercurialRepository(BaseRepository' | |||||
456 |
|
456 | |||
457 | def get_commits( |
|
457 | def get_commits( | |
458 | self, start_id=None, end_id=None, start_date=None, end_date=None, |
|
458 | self, start_id=None, end_id=None, start_date=None, end_date=None, | |
459 | branch_name=None, show_hidden=False, pre_load=None): |
|
459 | branch_name=None, show_hidden=False, pre_load=None, translate_tags=None): | |
460 | """ |
|
460 | """ | |
461 | Returns generator of ``MercurialCommit`` objects from start to end |
|
461 | Returns generator of ``MercurialCommit`` objects from start to end | |
462 | (both are inclusive) |
|
462 | (both are inclusive) |
@@ -250,7 +250,7 b' class SubversionRepository(base.BaseRepo' | |||||
250 | """ |
|
250 | """ | |
251 | return os.path.join(self.path, 'hooks') |
|
251 | return os.path.join(self.path, 'hooks') | |
252 |
|
252 | |||
253 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None): |
|
253 | def get_commit(self, commit_id=None, commit_idx=None, pre_load=None, translate_tag=None): | |
254 | if self.is_empty(): |
|
254 | if self.is_empty(): | |
255 | raise EmptyRepositoryError("There are no commits yet") |
|
255 | raise EmptyRepositoryError("There are no commits yet") | |
256 | if commit_id is not None: |
|
256 | if commit_id is not None: | |
@@ -268,7 +268,7 b' class SubversionRepository(base.BaseRepo' | |||||
268 |
|
268 | |||
269 | def get_commits( |
|
269 | def get_commits( | |
270 | self, start_id=None, end_id=None, start_date=None, end_date=None, |
|
270 | self, start_id=None, end_id=None, start_date=None, end_date=None, | |
271 | branch_name=None, show_hidden=False, pre_load=None): |
|
271 | branch_name=None, show_hidden=False, pre_load=None, translate_tags=None): | |
272 | if self.is_empty(): |
|
272 | if self.is_empty(): | |
273 | raise EmptyRepositoryError("There are no commit_ids yet") |
|
273 | raise EmptyRepositoryError("There are no commit_ids yet") | |
274 | self._validate_branch_name(branch_name) |
|
274 | self._validate_branch_name(branch_name) |
General Comments 0
You need to be logged in to leave comments.
Login now