##// END OF EJS Templates
vcs: optimized pre-load attributes for better caching.
marcink -
r3850:0415fef3 default
parent child Browse files
Show More
@@ -458,7 +458,7 b' class BaseReferencesView(RepoAppView):'
458 458
459 459 def load_refs_context(self, ref_items, partials_template):
460 460 _render = self.request.get_partial_renderer(partials_template)
461 pre_load = ["author", "date", "message"]
461 pre_load = ["author", "date", "message", "parents"]
462 462
463 463 is_svn = h.is_svn(self.rhodecode_vcs_repo)
464 464 is_hg = h.is_hg(self.rhodecode_vcs_repo)
@@ -211,7 +211,7 b' class RepoCompareView(RepoAppView):'
211 211 c.source_ref_type = source_ref_type
212 212 c.target_ref_type = target_ref_type
213 213
214 pre_load = ["author", "branch", "date", "message"]
214 pre_load = ["author", "date", "message", "branch"]
215 215 c.ancestor = None
216 216
217 217 try:
@@ -687,7 +687,7 b' class RepoPullRequestsView(RepoAppView, '
687 687 commit_cache = collections.OrderedDict()
688 688 missing_requirements = False
689 689 try:
690 pre_load = ["author", "branch", "date", "message", "parents"]
690 pre_load = ["author", "date", "message", "branch", "parents"]
691 691 show_revs = pull_request_at_ver.revisions
692 692 for rev in show_revs:
693 693 comm = commits_source_repo.get_commit(
@@ -50,8 +50,6 b' class GitCommit(base.BaseCommit):'
50 50 _filter_pre_load = [
51 51 # done through a more complex tree walk on parents
52 52 "affected_files",
53 # based on repository cached property
54 "branch",
55 53 # done through subprocess not remote call
56 54 "children",
57 55 # done through a more complex tree walk on parents
@@ -82,6 +80,7 b' class GitCommit(base.BaseCommit):'
82 80 self._submodules = None
83 81
84 82 def _set_bulk_properties(self, pre_load):
83
85 84 if not pre_load:
86 85 return
87 86 pre_load = [entry for entry in pre_load
@@ -98,6 +97,8 b' class GitCommit(base.BaseCommit):'
98 97 value = utcdate_fromtimestamp(*value)
99 98 elif attr == "parents":
100 99 value = self._make_commits(value)
100 elif attr == "branch":
101 value = value[0] if value else None
101 102 self.__dict__[attr] = value
102 103
103 104 @LazyProperty
@@ -157,12 +158,10 b' class GitCommit(base.BaseCommit):'
157 158
158 159 @LazyProperty
159 160 def branch(self):
160 # actually commit can have multiple branches
161 branches = self.commit_branches
161 branches = safe_unicode(self._remote.branch(self.raw_id))
162 162 if branches:
163 return branches[0]
164
165 return None
163 # actually commit can have multiple branches in git
164 return safe_unicode(branches[0])
166 165
167 166 def _get_tree_id_for_path(self, path):
168 167 path = safe_str(path)
@@ -432,7 +432,7 b' class FileNode(Node):'
432 432 @LazyProperty
433 433 def last_commit(self):
434 434 if self.commit:
435 pre_load = ["author", "date", "message"]
435 pre_load = ["author", "date", "message", "parents"]
436 436 return self.commit.get_path_commit(self.path, pre_load=pre_load)
437 437 raise NodeError(
438 438 "Cannot retrieve last commit of the file without "
@@ -548,7 +548,7 b' class FileNode(Node):'
548 548 """
549 549 if self.commit is None:
550 550 raise NodeError('Unable to get commit for this FileNode')
551 pre_load = ["author", "date", "message"]
551 pre_load = ["author", "date", "message", "parents"]
552 552 return self.commit.get_file_annotate(self.path, pre_load=pre_load)
553 553
554 554 @LazyProperty
@@ -756,7 +756,7 b' class DirNode(Node):'
756 756 @LazyProperty
757 757 def last_commit(self):
758 758 if self.commit:
759 pre_load = ["author", "date", "message"]
759 pre_load = ["author", "date", "message", "parents"]
760 760 return self.commit.get_path_commit(self.path, pre_load=pre_load)
761 761 raise NodeError(
762 762 "Cannot retrieve last commit of the file without "
@@ -749,7 +749,7 b' class PullRequestModel(BaseModel):'
749 749
750 750 # re-compute commit ids
751 751 old_commit_ids = pull_request.revisions
752 pre_load = ["author", "branch", "date", "message"]
752 pre_load = ["author", "date", "message", "branch"]
753 753 commit_ranges = target_repo.compare(
754 754 target_commit.raw_id, source_commit.raw_id, source_repo, merge=True,
755 755 pre_load=pre_load)
General Comments 0
You need to be logged in to leave comments. Login now