Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2556e0edb | ||
|
|
bbd30fd57f | ||
|
|
b91501d334 |
No files matched your search
+27
-10
@@ -1,32 +1,43 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
|
||||||
|
## v0.5.0 (2024-10-24)
|
||||||
|
|
||||||
|
### Code Style
|
||||||
|
|
||||||
|
* style: clean code ruff ([`b91501d`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/b91501d3346e5442071b8d9fe5d79f24abc0931c))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* feat: auto resolve if QApp.instance is None ([`bbd30fd`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/bbd30fd57f3433e746ffcd8c4c7f908e3e79ab7e))
|
||||||
|
|
||||||
|
|
||||||
## v0.4.2 (2024-08-26)
|
## v0.4.2 (2024-08-26)
|
||||||
|
|
||||||
### Fix
|
### Bug Fixes
|
||||||
|
|
||||||
* fix: bug capure log ([`a775dc2`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/a775dc22923016166691dc0221b60f7d018eeea4))
|
* fix: bug capure log ([`a775dc2`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/a775dc22923016166691dc0221b60f7d018eeea4))
|
||||||
|
|
||||||
|
|
||||||
## v0.4.1 (2024-08-19)
|
## v0.4.1 (2024-08-19)
|
||||||
|
|
||||||
### Fix
|
### Bug Fixes
|
||||||
|
|
||||||
* fix: resolve for opened file with revert before sync force (#8) ([`66772ff`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/66772ffcca326ce99e219b6596013ede248b3029))
|
* fix: resolve for opened file with revert before sync force (#8) ([`66772ff`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/66772ffcca326ce99e219b6596013ede248b3029))
|
||||||
|
|
||||||
* fix: re match patterns adjustment ([`aca00ff`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/aca00ffd032975a05812d43cc13b5561ff81c468))
|
* fix: re match patterns adjustment ([`aca00ff`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/aca00ffd032975a05812d43cc13b5561ff81c468))
|
||||||
|
|
||||||
|
|
||||||
## v0.4.0 (2024-08-01)
|
## v0.4.0 (2024-08-01)
|
||||||
|
|
||||||
### Feature
|
### Features
|
||||||
|
|
||||||
* feat: resolve sync button to force resync in popup warning (#6) ([`fb5f548`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/fb5f548f0af47e8eb89b14e8a862921cd52983f8))
|
* feat: resolve sync button to force resync in popup warning (#6) ([`fb5f548`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/fb5f548f0af47e8eb89b14e8a862921cd52983f8))
|
||||||
|
|
||||||
|
|
||||||
## v0.3.0 (2024-07-26)
|
## v0.3.0 (2024-07-26)
|
||||||
|
|
||||||
### Feature
|
### Bug Fixes
|
||||||
|
|
||||||
* feat: Add popup message on sync error or warning (#3) ([`c1b259c`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/c1b259c90649b3d4bd775880305f3e7f3f2f8bc6))
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
* fix: err typos missing ([`df7381f`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/df7381f679097064dc06430c35abd633b4506976))
|
* fix: err typos missing ([`df7381f`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/df7381f679097064dc06430c35abd633b4506976))
|
||||||
|
|
||||||
@@ -40,6 +51,11 @@
|
|||||||
|
|
||||||
* fix: add token to bypass release ([`5a71a1d`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/5a71a1da1f0bddc7c195fcc4879ac13c38d1802c))
|
* fix: add token to bypass release ([`5a71a1d`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/5a71a1da1f0bddc7c195fcc4879ac13c38d1802c))
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* feat: Add popup message on sync error or warning (#3) ([`c1b259c`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/c1b259c90649b3d4bd775880305f3e7f3f2f8bc6))
|
||||||
|
|
||||||
|
|
||||||
## v0.2.0 (2024-07-10)
|
## v0.2.0 (2024-07-10)
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
@@ -48,7 +64,7 @@
|
|||||||
|
|
||||||
* docs: update readme ([`915b4d4`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/915b4d4f853fede50c6e74f5bb0126c207b1e6a4))
|
* docs: update readme ([`915b4d4`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/915b4d4f853fede50c6e74f5bb0126c207b1e6a4))
|
||||||
|
|
||||||
### Feature
|
### Features
|
||||||
|
|
||||||
* feat: version update (#1) ([`a153501`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/a153501e0e6afbc1312f440a2770ec16e4f7b8a3))
|
* feat: version update (#1) ([`a153501`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/a153501e0e6afbc1312f440a2770ec16e4f7b8a3))
|
||||||
|
|
||||||
@@ -58,9 +74,10 @@
|
|||||||
|
|
||||||
* Update README.md ([`9bfe258`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/9bfe2582c0b50c44db89f0b653058eeda06c55f6))
|
* Update README.md ([`9bfe258`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/9bfe2582c0b50c44db89f0b653058eeda06c55f6))
|
||||||
|
|
||||||
|
|
||||||
## v0.1.0 (2024-03-19)
|
## v0.1.0 (2024-03-19)
|
||||||
|
|
||||||
### Feature
|
### Features
|
||||||
|
|
||||||
* feat: first commit ([`2b0f997`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/2b0f9973fa4aca0f2c7b4663f5e56be5909b023c))
|
* feat: first commit ([`2b0f997`](https://github.com/LoopsCreativeStudio/ayon-perforce/commit/2b0f9973fa4aca0f2c7b4663f5e56be5909b023c))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Perforce Sync PreLaunch Hook."""
|
"""Perforce Sync PreLaunch Hook."""
|
||||||
|
from __future__ import annotations
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import Optional, Union, Dict
|
|
||||||
|
|
||||||
from qtpy.QtWidgets import QApplication, QLabel, QPushButton
|
from qtpy.QtWidgets import QApplication, QLabel, QPushButton
|
||||||
from qtpy.QtGui import QIcon
|
from qtpy.QtGui import QIcon
|
||||||
@@ -13,21 +13,108 @@ from ayon_core.style import load_stylesheet
|
|||||||
from ayon_core.tools.utils import ErrorMessageBox
|
from ayon_core.tools.utils import ErrorMessageBox
|
||||||
|
|
||||||
from ayon_applications import (
|
from ayon_applications import (
|
||||||
PreLaunchHook, LaunchTypes, ApplicationLaunchFailed
|
PreLaunchHook,
|
||||||
|
LaunchTypes,
|
||||||
|
ApplicationLaunchFailed,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class PerforceResolver:
|
||||||
|
"""Perforce Resolver."""
|
||||||
|
|
||||||
|
def __init__(self, wrn_msg: str) -> None:
|
||||||
|
self.log = Logger.get_logger("PerforceResolver")
|
||||||
|
self.wrn_msg = wrn_msg
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def revert_file(depot_file: str) -> subprocess.CompletedProcess:
|
||||||
|
"""Do a Perforce revert for the give depot file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
depot_file (str): the depot file to revert.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
subprocess.CompletedProcess: The process result.
|
||||||
|
"""
|
||||||
|
return subprocess.run(
|
||||||
|
["p4", "revert", depot_file],
|
||||||
|
shell=True,
|
||||||
|
text=True,
|
||||||
|
check=False,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
errors="replace",
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def force_sync(depot_file: str) -> subprocess.CompletedProcess:
|
||||||
|
"""Force Perforce sync for the give depot file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
depot_file (str): the depot file to update.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
subprocess.CompletedProcess: The process result.
|
||||||
|
"""
|
||||||
|
return subprocess.run(
|
||||||
|
["p4", "sync", "-f", f"{depot_file}#head"],
|
||||||
|
shell=True,
|
||||||
|
text=True,
|
||||||
|
check=False,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
errors="replace",
|
||||||
|
)
|
||||||
|
|
||||||
|
def resolve(self) -> list[subprocess.CompletedProcess]:
|
||||||
|
"""Resolve Perforce sync warning.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
list[subprocess.CompletedProcess]: The subprocess results.
|
||||||
|
"""
|
||||||
|
subprocess_results = []
|
||||||
|
for line in self.wrn_msg.splitlines():
|
||||||
|
wrn_match = re.match(
|
||||||
|
r"(?P<depotfile>\/\/.*)#\d+"
|
||||||
|
r" - (?P<opened>is opened for add and )?can't "
|
||||||
|
r"(overwrite existing file|update modified file|be replaced)"
|
||||||
|
r"(?P<localfile>.*)$",
|
||||||
|
line,
|
||||||
|
)
|
||||||
|
if not wrn_match:
|
||||||
|
continue
|
||||||
|
depot_file = wrn_match.group("depotfile")
|
||||||
|
# revert if needed
|
||||||
|
if wrn_match.group("opened"):
|
||||||
|
self.log.info(f"p4 revert {depot_file}")
|
||||||
|
revert_result = self.revert_file(depot_file)
|
||||||
|
self.log.info(f">>> {revert_result.stdout.strip()}")
|
||||||
|
# force sync
|
||||||
|
self.log.info(f"p4 sync -f {depot_file}")
|
||||||
|
result = self.force_sync(depot_file)
|
||||||
|
stdout_result = result.stdout.strip()
|
||||||
|
# check sync result
|
||||||
|
if re.match(r".+ - (refreshing|updating|added) .+", stdout_result):
|
||||||
|
self.log.info(f">>> {stdout_result}")
|
||||||
|
else:
|
||||||
|
self.log.info(f"!!! {stdout_result}")
|
||||||
|
subprocess_results.append(result)
|
||||||
|
|
||||||
|
return subprocess_results
|
||||||
|
|
||||||
|
|
||||||
class PerforceErrorMessageBox(ErrorMessageBox):
|
class PerforceErrorMessageBox(ErrorMessageBox):
|
||||||
"""Perforce Error Message Box."""
|
"""Perforce Error Message Box."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
p4settings: Dict[str, Union[str, bool]],
|
p4settings: dict[str, str | bool],
|
||||||
exc_msg: str,
|
exc_msg: str,
|
||||||
msg_type: str = "ERROR",
|
msg_type: str = "ERROR",
|
||||||
) -> None:
|
) -> None:
|
||||||
self._p4settings = p4settings
|
self._p4settings = p4settings
|
||||||
self._exc_msg = exc_msg
|
self._exc_msg = exc_msg
|
||||||
self._msg_type = msg_type
|
self._msg_type = msg_type
|
||||||
self.log = Logger.get_logger("PerforceResolve")
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
f"Perforce {self._msg_type}", QApplication.activeWindow(),
|
f"Perforce {self._msg_type}", QApplication.activeWindow(),
|
||||||
)
|
)
|
||||||
@@ -68,88 +155,30 @@ class PerforceErrorMessageBox(ErrorMessageBox):
|
|||||||
if key != "bypass" and (key != "P4USER" or value is not None)
|
if key != "bypass" and (key != "P4USER" or value is not None)
|
||||||
]
|
]
|
||||||
content_html.append(
|
content_html.append(
|
||||||
f"<br>{self.convert_text_for_html(self._exc_msg)}"
|
f"<br>{self.convert_text_for_html(self._exc_msg)}",
|
||||||
)
|
)
|
||||||
content_label = QLabel("<br>".join(content_html), self)
|
content_label = QLabel("<br>".join(content_html), self)
|
||||||
content_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
content_label.setTextInteractionFlags(Qt.TextSelectableByMouse)
|
||||||
content_label.setCursor(Qt.IBeamCursor)
|
content_label.setCursor(Qt.IBeamCursor)
|
||||||
content_layout.addWidget(content_label)
|
content_layout.addWidget(content_label)
|
||||||
|
|
||||||
def revert_file(self, depot_file:str) -> subprocess.CompletedProcess:
|
|
||||||
"""Do a Perforce revert for the give depot file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
depot_file (str): the depot file to revert.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
subprocess.CompletedProcess: The process result.
|
|
||||||
"""
|
|
||||||
return subprocess.run(
|
|
||||||
['p4', 'revert', depot_file],
|
|
||||||
shell=True,
|
|
||||||
text=True,
|
|
||||||
check=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
errors='replace',
|
|
||||||
)
|
|
||||||
|
|
||||||
def force_sync(self, depot_file:str) -> subprocess.CompletedProcess:
|
|
||||||
"""Force Perforce sync for the give depot file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
depot_file (str): the depot file to update.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
subprocess.CompletedProcess: The process result.
|
|
||||||
"""
|
|
||||||
return subprocess.run(
|
|
||||||
['p4', 'sync', '-f', f'{depot_file}#head'],
|
|
||||||
shell=True,
|
|
||||||
text=True,
|
|
||||||
check=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
errors='replace',
|
|
||||||
)
|
|
||||||
|
|
||||||
def resolve_warning(self) -> None:
|
def resolve_warning(self) -> None:
|
||||||
"""Resolve Perforce sync warning.
|
"""Resolve Perforce sync warning."""
|
||||||
"""
|
|
||||||
result_html = ["<span style='font-size:14pt;'>Resolve Result:</span>"]
|
result_html = ["<span style='font-size:14pt;'>Resolve Result:</span>"]
|
||||||
result_failed = False
|
result_failed = False
|
||||||
for line in self._exc_msg.splitlines():
|
|
||||||
wrn_match = re.match(
|
for result in PerforceResolver(self._exc_msg).resolve():
|
||||||
r"(?P<depotfile>\/\/.*)#\d+"
|
|
||||||
r" - (?P<opened>is opened for add and )?can't "
|
|
||||||
r"(overwrite existing file|update modified file|be replaced)"
|
|
||||||
r"(?P<localfile>.*)$",
|
|
||||||
line,
|
|
||||||
)
|
|
||||||
if not wrn_match:
|
|
||||||
continue
|
|
||||||
depot_file = wrn_match.group("depotfile")
|
|
||||||
# revert if needed
|
|
||||||
if wrn_match.group("opened"):
|
|
||||||
self.log.info(f"p4 revert {depot_file}")
|
|
||||||
revert_result = self.revert_file(depot_file)
|
|
||||||
self.log.info(f">>> {revert_result.stdout.strip()}")
|
|
||||||
# force sync
|
|
||||||
self.log.info(f"p4 sync -f {depot_file}")
|
|
||||||
result = self.force_sync(depot_file)
|
|
||||||
stdout_result = result.stdout.strip()
|
stdout_result = result.stdout.strip()
|
||||||
# check sync result
|
# check sync result
|
||||||
if re.match(r".+ - (refreshing|updating|added) .+", stdout_result):
|
if re.match(r".+ - (refreshing|updating|added) .+", stdout_result):
|
||||||
self.log.info(f">>> {stdout_result}")
|
|
||||||
color_result = "YellowGreen"
|
color_result = "YellowGreen"
|
||||||
else:
|
else:
|
||||||
self.log.info(f"!!! {stdout_result}")
|
|
||||||
color_result = "Orange"
|
color_result = "Orange"
|
||||||
result_failed = True
|
result_failed = True
|
||||||
|
|
||||||
result_html.append(
|
result_html.append(
|
||||||
f"<span style='color:{color_result};'>"
|
f"<span style='color:{color_result};'>"
|
||||||
f"{self.convert_text_for_html(stdout_result)}</span>"
|
f"{self.convert_text_for_html(stdout_result)}</span>",
|
||||||
)
|
)
|
||||||
|
|
||||||
resolve_label = QLabel("<br>".join(result_html), self)
|
resolve_label = QLabel("<br>".join(result_html), self)
|
||||||
@@ -164,17 +193,16 @@ class PerforceErrorMessageBox(ErrorMessageBox):
|
|||||||
else:
|
else:
|
||||||
self.resolve_btn.setDisabled(True)
|
self.resolve_btn.setDisabled(True)
|
||||||
|
|
||||||
|
|
||||||
class PerforceSync(PreLaunchHook):
|
class PerforceSync(PreLaunchHook):
|
||||||
"""Run Perforce Sync for the given project config.
|
"""Run Perforce Sync for the given project config."""
|
||||||
"""
|
|
||||||
order = -1
|
order = -1
|
||||||
launch_types = {LaunchTypes.local}
|
launch_types = {LaunchTypes.local}
|
||||||
|
|
||||||
def _get_p4settings(self) -> Optional[Dict[str, Union[str, bool]]]:
|
def _get_p4settings(self) -> dict[str, str | bool] | None:
|
||||||
perforce_settings = self.data["project_settings"]["perforce"]
|
perforce_settings = self.data["project_settings"]["perforce"]
|
||||||
perforce_hosts = {
|
perforce_hosts = {
|
||||||
host["name"]: host["bypass"]
|
host["name"]: host["bypass"] for host in perforce_settings["hosts"]
|
||||||
for host in perforce_settings["hosts"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.host_name not in perforce_hosts:
|
if self.host_name not in perforce_hosts:
|
||||||
@@ -197,7 +225,7 @@ class PerforceSync(PreLaunchHook):
|
|||||||
if p4client.count("{") == p4client.count("}") > 0:
|
if p4client.count("{") == p4client.count("}") > 0:
|
||||||
p4client = p4client.format(
|
p4client = p4client.format(
|
||||||
project_name=self.data["project_name"],
|
project_name=self.data["project_name"],
|
||||||
**self.data["env"]
|
**self.data["env"],
|
||||||
)
|
)
|
||||||
if perforce_settings.get("p4client_lower"):
|
if perforce_settings.get("p4client_lower"):
|
||||||
p4client = p4client.lower()
|
p4client = p4client.lower()
|
||||||
@@ -206,11 +234,11 @@ class PerforceSync(PreLaunchHook):
|
|||||||
"P4PORT": p4port or None,
|
"P4PORT": p4port or None,
|
||||||
"P4CLIENT": p4client or None,
|
"P4CLIENT": p4client or None,
|
||||||
"P4USER": p4user or None,
|
"P4USER": p4user or None,
|
||||||
"bypass": perforce_hosts.get(self.host_name, False)
|
"bypass": perforce_hosts.get(self.host_name, False),
|
||||||
}
|
}
|
||||||
|
|
||||||
def run_perforce_sync(
|
def run_perforce_sync(
|
||||||
self, p4settings: Dict[str, Union[str, bool]]
|
self, p4settings: dict[str, str | bool],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run Perforce Sync using the given settings.
|
"""Run Perforce Sync using the given settings.
|
||||||
|
|
||||||
@@ -219,13 +247,13 @@ class PerforceSync(PreLaunchHook):
|
|||||||
"""
|
"""
|
||||||
self.log.info("[SYNC PERFORCE PROJECT]")
|
self.log.info("[SYNC PERFORCE PROJECT]")
|
||||||
with subprocess.Popen(
|
with subprocess.Popen(
|
||||||
['p4', '-I', 'sync', '-s', '-q'],
|
["p4", "-I", "sync", "-s", "-q"],
|
||||||
shell=True,
|
shell=True,
|
||||||
text=True,
|
text=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
bufsize=0,
|
bufsize=0,
|
||||||
errors='replace',
|
errors="replace",
|
||||||
) as process:
|
) as process:
|
||||||
complete_log = ""
|
complete_log = ""
|
||||||
capture_log = ""
|
capture_log = ""
|
||||||
@@ -233,7 +261,7 @@ class PerforceSync(PreLaunchHook):
|
|||||||
read_log = None
|
read_log = None
|
||||||
while True:
|
while True:
|
||||||
read_log = process.stdout.read(1)
|
read_log = process.stdout.read(1)
|
||||||
if read_log == "" and not process.poll() is None:
|
if read_log == "" and process.poll() is not None:
|
||||||
break
|
break
|
||||||
capture_log += read_log
|
capture_log += read_log
|
||||||
|
|
||||||
@@ -241,7 +269,7 @@ class PerforceSync(PreLaunchHook):
|
|||||||
warning_match = re.search(
|
warning_match = re.search(
|
||||||
r"(\/\/.+ can't (overwrite|update|be replaced).*)\n",
|
r"(\/\/.+ can't (overwrite|update|be replaced).*)\n",
|
||||||
capture_log,
|
capture_log,
|
||||||
re.M,
|
re.MULTILINE,
|
||||||
)
|
)
|
||||||
if percent_match:
|
if percent_match:
|
||||||
current_percent = percent_match.group(1)
|
current_percent = percent_match.group(1)
|
||||||
@@ -262,19 +290,28 @@ class PerforceSync(PreLaunchHook):
|
|||||||
elif capture_log == "sync ":
|
elif capture_log == "sync ":
|
||||||
capture_log = ""
|
capture_log = ""
|
||||||
|
|
||||||
|
if QApplication.instance() is None:
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
|
self.log.error(
|
||||||
|
"Perforce sync process return non-zero code: "
|
||||||
|
f"{process.returncode}",
|
||||||
|
)
|
||||||
|
if complete_log:
|
||||||
|
PerforceResolver(complete_log).resolve()
|
||||||
|
|
||||||
|
elif process.returncode != 0:
|
||||||
error_msg = (
|
error_msg = (
|
||||||
"Perforce sync process return non-zero code: "
|
"Perforce sync process return non-zero code: "
|
||||||
f"{process.returncode}"
|
f"{process.returncode}"
|
||||||
)
|
)
|
||||||
self.log.error(error_msg)
|
self.log.error(error_msg)
|
||||||
box = PerforceErrorMessageBox(
|
box = PerforceErrorMessageBox(
|
||||||
p4settings, f"{complete_log}\n{error_msg}"
|
p4settings, f"{complete_log}\n{error_msg}",
|
||||||
)
|
)
|
||||||
box.exec_()
|
box.exec_()
|
||||||
if not p4settings["bypass"]:
|
if not p4settings["bypass"]:
|
||||||
raise ApplicationLaunchFailed(
|
raise ApplicationLaunchFailed(
|
||||||
"Couldn't run the application! Perforce sync failed!"
|
"Couldn't run the application! Perforce sync failed!",
|
||||||
)
|
)
|
||||||
elif complete_log:
|
elif complete_log:
|
||||||
box = PerforceErrorMessageBox(
|
box = PerforceErrorMessageBox(
|
||||||
@@ -286,7 +323,6 @@ class PerforceSync(PreLaunchHook):
|
|||||||
|
|
||||||
def execute(self, *_args, **_kwargs) -> None:
|
def execute(self, *_args, **_kwargs) -> None:
|
||||||
"""Execute prelaunch hook process."""
|
"""Execute prelaunch hook process."""
|
||||||
|
|
||||||
p4settings = self._get_p4settings()
|
p4settings = self._get_p4settings()
|
||||||
|
|
||||||
if p4settings is None:
|
if p4settings is None:
|
||||||
@@ -300,8 +336,9 @@ class PerforceSync(PreLaunchHook):
|
|||||||
self.log.error(error_msg)
|
self.log.error(error_msg)
|
||||||
if not p4settings["bypass"]:
|
if not p4settings["bypass"]:
|
||||||
raise ApplicationLaunchFailed(
|
raise ApplicationLaunchFailed(
|
||||||
"Couldn't run the application! Perforce config error!"
|
"Couldn't run the application! Perforce config error!",
|
||||||
)
|
)
|
||||||
|
if QApplication.instance() is not None:
|
||||||
box = PerforceErrorMessageBox(p4settings, error_msg)
|
box = PerforceErrorMessageBox(p4settings, error_msg)
|
||||||
box.exec_()
|
box.exec_()
|
||||||
return
|
return
|
||||||
@@ -309,7 +346,8 @@ class PerforceSync(PreLaunchHook):
|
|||||||
for p4env in ("P4PORT", "P4CLIENT", "P4USER"):
|
for p4env in ("P4PORT", "P4CLIENT", "P4USER"):
|
||||||
if p4settings[p4env] is not None:
|
if p4settings[p4env] is not None:
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["p4", "set", f"{p4env}={p4settings[p4env]}"], check=True
|
["p4", "set", f"{p4env}={p4settings[p4env]}"],
|
||||||
|
check=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.run_perforce_sync(p4settings)
|
self.run_perforce_sync(p4settings)
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "ayon-perforce"
|
name = "ayon-perforce"
|
||||||
description = "perforce addon for ayon"
|
description = "perforce addon for ayon"
|
||||||
version = "0.4.2"
|
version = "0.5.0"
|
||||||
authors = ["LoopsCreativeStudio <tech@loopscreativestudio.com>"]
|
authors = ["LoopsCreativeStudio <tech@loopscreativestudio.com>"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""Package declaring addon version."""
|
"""Package declaring addon version."""
|
||||||
__version__ = "0.4.2"
|
__version__ = "0.5.0"
|
||||||
Reference in new issue
Block a user