Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a51f56787 | ||
|
|
66772ffcca | ||
|
|
aca00ffd03 |
No files matched your search
@@ -1,5 +1,13 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v0.4.1 (2024-08-19)
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
* 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))
|
||||||
|
|
||||||
## v0.4.0 (2024-08-01)
|
## v0.4.0 (2024-08-01)
|
||||||
|
|
||||||
### Feature
|
### Feature
|
||||||
|
|||||||
@@ -75,6 +75,25 @@ class PerforceErrorMessageBox(ErrorMessageBox):
|
|||||||
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:
|
def force_sync(self, depot_file:str) -> subprocess.CompletedProcess:
|
||||||
"""Force Perforce sync for the give depot file.
|
"""Force Perforce sync for the give depot file.
|
||||||
|
|
||||||
@@ -101,18 +120,26 @@ class PerforceErrorMessageBox(ErrorMessageBox):
|
|||||||
result_failed = False
|
result_failed = False
|
||||||
for line in self._exc_msg.splitlines():
|
for line in self._exc_msg.splitlines():
|
||||||
wrn_match = re.match(
|
wrn_match = re.match(
|
||||||
r"^(?P<depotfile>.*)#\d+"
|
r"(?P<depotfile>\/\/.*)#\d+"
|
||||||
r" - can't (overwrite existing|update modified) file "
|
r" - (?P<opened>is opened for add and )?can't "
|
||||||
|
r"(overwrite existing file|update modified file|be replaced)"
|
||||||
r"(?P<localfile>.*)$",
|
r"(?P<localfile>.*)$",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
if not wrn_match:
|
if not wrn_match:
|
||||||
continue
|
continue
|
||||||
depot_file = wrn_match.group("depotfile")
|
depot_file = wrn_match.group("depotfile")
|
||||||
self.log.info(f"sync -f {depot_file}")
|
# 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)
|
result = self.force_sync(depot_file)
|
||||||
stdout_result = result.stdout.strip()
|
stdout_result = result.stdout.strip()
|
||||||
if " - refreshing " in stdout_result:
|
# check sync result
|
||||||
|
if re.match(r".+ - (refreshing|updating|added) .+", stdout_result):
|
||||||
self.log.info(f">>> {stdout_result}")
|
self.log.info(f">>> {stdout_result}")
|
||||||
color_result = "YellowGreen"
|
color_result = "YellowGreen"
|
||||||
else:
|
else:
|
||||||
@@ -212,7 +239,9 @@ class PerforceSync(PreLaunchHook):
|
|||||||
|
|
||||||
percent_match = re.search(r"(\d{1,3}%|finishing)", capture_log)
|
percent_match = re.search(r"(\d{1,3}%|finishing)", capture_log)
|
||||||
warning_match = re.search(
|
warning_match = re.search(
|
||||||
r"(.* can't (overwrite|update) .*)\n", capture_log, re.M
|
r"(\/\/.+ can't (overwrite|update|be replaced).*)\n",
|
||||||
|
capture_log,
|
||||||
|
re.M,
|
||||||
)
|
)
|
||||||
if percent_match:
|
if percent_match:
|
||||||
current_percent = percent_match.group(1)
|
current_percent = percent_match.group(1)
|
||||||
@@ -221,8 +250,9 @@ class PerforceSync(PreLaunchHook):
|
|||||||
last_percent = current_percent
|
last_percent = current_percent
|
||||||
capture_log = ""
|
capture_log = ""
|
||||||
elif warning_match:
|
elif warning_match:
|
||||||
self.log.info(f"*** WRN: {warning_match.group(1)}")
|
warning_message = warning_match.group(1).strip()
|
||||||
complete_log += capture_log
|
self.log.info(f"*** WRN: {warning_message}")
|
||||||
|
complete_log += warning_message + "\n"
|
||||||
capture_log = ""
|
capture_log = ""
|
||||||
elif capture_log.endswith("\n"):
|
elif capture_log.endswith("\n"):
|
||||||
if capture_log.strip():
|
if capture_log.strip():
|
||||||
|
|||||||
+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.0"
|
version = "0.4.1"
|
||||||
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.0"
|
__version__ = "0.4.1"
|
||||||
Reference in new issue
Block a user