SVN: Checkout, Multi-Repo, Optimizations & Clean-up #104
@ -42,13 +42,12 @@ class SVN_scene_properties(PropertyGroup):
|
|||||||
return prefs.active_repo
|
return prefs.active_repo
|
||||||
|
|
||||||
def get_scene_repo(self, context) -> Optional['SVN_repository']:
|
def get_scene_repo(self, context) -> Optional['SVN_repository']:
|
||||||
scene_svn = context.scene.svn
|
if not self.svn_url or not self.svn_directory:
|
||||||
if not scene_svn.svn_url or not scene_svn.svn_directory:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
prefs = get_addon_prefs(context)
|
prefs = get_addon_prefs(context)
|
||||||
for repo in prefs.repositories:
|
for repo in prefs.repositories:
|
||||||
if (repo.url == scene_svn.svn_url) and (Path(repo.directory) == Path(scene_svn.svn_directory)):
|
if (repo.url == self.svn_url) and (Path(repo.directory) == Path(self.svn_directory)):
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ def get_svn_info(path: Path or str) -> Tuple[str, str]:
|
|||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
error_msg = e.stderr.decode()
|
error_msg = e.stderr.decode()
|
||||||
if "is not a working copy" in error_msg:
|
if "is not a working copy" in error_msg:
|
||||||
return None, None, None
|
return None, None
|
||||||
elif "E200009" in error_msg:
|
elif "E200009" in error_msg:
|
||||||
# If we're in a folder that wasn't yet added to the repo,
|
# If we're in a folder that wasn't yet added to the repo,
|
||||||
# try again one folder higher.
|
# try again one folder higher.
|
||||||
|
@ -90,6 +90,10 @@ def init_svn_of_current_file(_scene=None):
|
|||||||
if not repo:
|
if not repo:
|
||||||
repo = prefs.init_repo(context, scene_svn.svn_directory)
|
repo = prefs.init_repo(context, scene_svn.svn_directory)
|
||||||
|
|
||||||
|
for i, other_repo in enumerate(prefs.repositories):
|
||||||
|
if other_repo == repo:
|
||||||
|
prefs.active_repo_idx = i
|
||||||
|
|
||||||
else:
|
else:
|
||||||
repo = prefs.active_repo
|
repo = prefs.active_repo
|
||||||
if not repo:
|
if not repo:
|
||||||
|
@ -28,7 +28,6 @@ class SVN_UL_file_list(UIList):
|
|||||||
if self.layout_type != 'DEFAULT':
|
if self.layout_type != 'DEFAULT':
|
||||||
raise NotImplemented
|
raise NotImplemented
|
||||||
|
|
||||||
repo = data
|
|
||||||
file_entry = item
|
file_entry = item
|
||||||
prefs = get_addon_prefs(context)
|
prefs = get_addon_prefs(context)
|
||||||
|
|
||||||
|
@ -15,6 +15,10 @@ class SVN_UL_repositories(UIList):
|
|||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
repo = item
|
repo = item
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
|
prefs = get_addon_prefs(context)
|
||||||
|
if prefs.ui_mode == 'CURRENT_BLEND' and repo != context.scene.svn.get_repo(context):
|
||||||
|
row.enabled = False
|
||||||
row.label(text=repo.display_name)
|
row.label(text=repo.display_name)
|
||||||
|
|
||||||
if not repo.is_valid:
|
if not repo.is_valid:
|
||||||
@ -107,8 +111,6 @@ def draw_prefs(self, context) -> None:
|
|||||||
repo_col.enabled = not auth_in_progress
|
repo_col.enabled = not auth_in_progress
|
||||||
|
|
||||||
list_row = repo_col.row()
|
list_row = repo_col.row()
|
||||||
if self.ui_mode == 'CURRENT_BLEND':
|
|
||||||
list_row.enabled = False
|
|
||||||
col = list_row.column()
|
col = list_row.column()
|
||||||
col.template_list(
|
col.template_list(
|
||||||
"SVN_UL_repositories",
|
"SVN_UL_repositories",
|
||||||
|
Loading…
Reference in New Issue
Block a user