SVN: UX improvements #136

Merged
Demeter Dzadik merged 15 commits from Mets/blender-studio-pipeline:svn_ux_improvements into main 2023-08-01 15:39:18 +02:00
3 changed files with 26 additions and 7 deletions
Showing only changes of commit f461661bb8 - Show all commits

View File

@ -396,6 +396,7 @@ class SVN_OT_resolve_conflict(May_Modifiy_Current_Blend, Operator):
col.alert = True
col.label(text="Choose which version of the file to keep.")
col.row().prop(self, 'resolve_method', expand=True)
col.separator()
if self.resolve_method == 'mine-full':
col.label(text="Local changes will be kept.")
col.label(

View File

@ -40,6 +40,8 @@ class SVN_OT_commit(SVN_Operator, Popup_Operator, Operator):
bl_options = {'INTERNAL'}
bl_property = "first_line" # Focus the text input box
popup_width = 600
# The first line of the commit message needs to be an operator property in order
# for us to be able to focus the input box automatically when the window pops up
# (see bl_property above)
@ -92,6 +94,7 @@ class SVN_OT_commit(SVN_Operator, Popup_Operator, Operator):
for f in repo.external_files:
f.include_in_commit = False
for f in self.get_committable_files(context):
if not f.will_conflict:
f.include_in_commit = True
return super().invoke(context, event)
@ -108,20 +111,30 @@ class SVN_OT_commit(SVN_Operator, Popup_Operator, Operator):
row.label(text="Status")
for file in files:
row = layout.row()
row.prop(file, "include_in_commit", text=file.name)
split = row.split()
checkbox_ui = split.row()
status_ui = split.row()
checkbox_ui.prop(file, "include_in_commit", text=file.name)
text = file.status_name
icon = file.status_icon
if file == repo.current_blend_file and self.is_file_really_dirty:
split = row.split(factor=0.7)
row = split.row()
row.alert = True
if file.will_conflict:
# We don't want to conflict-resolve during a commit, it's
# confusing. User should resolve this as a separate step.
checkbox_ui.enabled = False
text = "Conflicting"
status_ui.alert = True
icon = 'ERROR'
elif file == repo.current_blend_file and self.is_file_really_dirty:
split = status_ui.split(factor=0.7)
status_ui = split.row()
status_ui.alert = True
text += " but not saved!"
icon = 'ERROR'
op_row = split.row()
op_row.alignment = 'LEFT'
op_row.operator('svn.save_during_commit',
icon='FILE_BLEND', text="Save")
row.label(text=text, icon=icon)
status_ui.label(text=text, icon=icon)
row = layout.row()
row.label(text="Commit message:")

View File

@ -48,6 +48,10 @@ class SVN_file(PropertyGroup):
default="none",
options=set()
)
@property
def will_conflict(self):
return self.status != 'normal' and self.repos_status != 'none'
status_prediction_type: EnumProperty(
name="Status Predicted By Process",
items=[
@ -374,6 +378,7 @@ class SVN_repository(PropertyGroup):
return i, log
def get_latest_revision_of_file(self, svn_path: str) -> int:
"""Return the revision number of the last log entry that affects the given file."""
svn_path = str(svn_path)
for log in reversed(self.log):
for changed_file in log.changed_files: