SVN: Checkout, Multi-Repo, Optimizations & Clean-up #104

Merged
Demeter Dzadik merged 12 commits from Mets/blender-studio-pipeline:SVN-improvements into main 2023-07-10 16:49:03 +02:00
2 changed files with 29 additions and 21 deletions
Showing only changes of commit df18790869 - Show all commits

View File

@ -164,6 +164,11 @@ class SVN_log(PropertyGroup):
name="Changed Files", name="Changed Files",
description="List of file entries that were affected by this revision" description="List of file entries that were affected by this revision"
) )
def changes_file(self, file: SVN_file) -> bool:
for affected_file in self.changed_files:
if affected_file.svn_path == "/"+file.svn_path:
return True
return False
matches_filter: BoolProperty( matches_filter: BoolProperty(
name="Matches Filter", name="Matches Filter",
@ -189,6 +194,11 @@ class SVN_log(PropertyGroup):
date = self.revision_date_simple date = self.revision_date_simple
return " ".join([rev, auth, files, msg, date]).lower() return " ".join([rev, auth, files, msg, date]).lower()
affects_active_file: BoolProperty(
name="Affects Active File",
description="Flag set whenever the active file index updates. Used to accelerate drawing performance by moving filtering logic from the drawing code to update callbacks and flags",
default=False
)
class SVN_repository(PropertyGroup): class SVN_repository(PropertyGroup):
### Basic SVN Info. ### ### Basic SVN Info. ###
@ -435,6 +445,12 @@ class SVN_repository(PropertyGroup):
relative_path=self.active_file.name) relative_path=self.active_file.name)
Processes.start('Activate File') Processes.start('Activate File')
# Filter out log entries that did not affect the selected file.
self.log.foreach_set(
'affects_active_file',
[log_entry.changes_file(self.active_file) for log_entry in self.log]
)
external_files_active_index: IntProperty( external_files_active_index: IntProperty(
name="File List", name="File List",
description="Files tracked by SVN", description="Files tracked by SVN",

View File

@ -60,21 +60,13 @@ class SVN_UL_log(UIList):
key=lambda i: log_entries[i].revision_number) key=lambda i: log_entries[i].revision_number)
flt_neworder.reverse() flt_neworder.reverse()
is_filebrowser = context.space_data.type == 'FILE_BROWSER'
active_file = svn.get_filebrowser_active_file(
context) if is_filebrowser else svn.active_file
if not self.show_all_logs: if not self.show_all_logs:
# Filter out log entries that did not affect the selected file. flt_flags = [
for idx, log_entry in enumerate(log_entries): log_entry.affects_active_file * self.bitflag_filter_item
for affected_file in log_entry.changed_files: for log_entry in log_entries
if affected_file.svn_path == "/"+active_file.svn_path: ]
# If the active file is one of the files affected by this log
# entry, break the for loop and skip the else block.
break
else:
flt_flags[idx] = 0
if self.filter_name:
# Filtering: Allow comma-separated keywords. # Filtering: Allow comma-separated keywords.
# ALL keywords must be found somewhere in the log entry for it to show up. # ALL keywords must be found somewhere in the log entry for it to show up.
filter_words = [word.strip().lower() for word in self.filter_name.split(",")] filter_words = [word.strip().lower() for word in self.filter_name.split(",")]