unknown-cli 0.9.23__tar.gz → 0.9.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/PKG-INFO +1 -1
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/PKG-INFO +1 -1
- unknown-cli-0.9.26/unknowncli/VERSION +1 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/commands/preflight.py +68 -65
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/commands/project.py +2 -1
- unknown-cli-0.9.23/unknowncli/VERSION +0 -1
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/README.md +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/setup.cfg +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/setup.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/SOURCES.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/dependency_links.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/entry_points.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/requires.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknown_cli.egg-info/top_level.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/__init__.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/__main__.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/commands/__init__.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/commands/task.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/commands/unreal.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/data/.p4ignore.txt +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/set_registry_keys.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/set_url_handler.py +0 -0
- {unknown-cli-0.9.23 → unknown-cli-0.9.26}/unknowncli/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.9.26
|
|
@@ -10,10 +10,10 @@ from collections import OrderedDict
|
|
|
10
10
|
from datetime import datetime
|
|
11
11
|
from enum import Enum
|
|
12
12
|
from P4 import P4, P4Exception
|
|
13
|
+
from psutil import process_iter
|
|
13
14
|
from shutil import which
|
|
14
15
|
from subprocess import CalledProcessError, check_output
|
|
15
16
|
from typing import List, Optional
|
|
16
|
-
|
|
17
17
|
from typer import confirm, Option, prompt, secho
|
|
18
18
|
from rich.live import Live
|
|
19
19
|
from rich.progress import Progress, BarColumn, MofNCompleteColumn, SpinnerColumn, TaskProgressColumn, TextColumn
|
|
@@ -104,10 +104,6 @@ custom_tool_list.append(
|
|
|
104
104
|
CustomToolDef(
|
|
105
105
|
name="Preflight and Commit - Full", command = pwsh_tool_exe,
|
|
106
106
|
arguments = f"{pwsh_cmd_base} {base_cmd_full}"
|
|
107
|
-
),
|
|
108
|
-
CustomToolDef(
|
|
109
|
-
name="Preflight and Commit on Server - Quick", command = pwsh_tool_exe, add_separator_before = True,
|
|
110
|
-
arguments = f"{pwsh_cmd_base} {base_cmd_quick} --use-server-submit"
|
|
111
107
|
)
|
|
112
108
|
]
|
|
113
109
|
)
|
|
@@ -409,6 +405,8 @@ def get_describe_shelve(shelve_changelist):
|
|
|
409
405
|
def revert_file_in_default(depot_file, *extra_args):
|
|
410
406
|
return p4.run_revert(*extra_args, "-c", "default", depot_file)
|
|
411
407
|
|
|
408
|
+
def revert_file_in_cl(depot_file, clnumber, *extra_args):
|
|
409
|
+
return p4.run_revert(*extra_args, "-c", clnumber, depot_file)
|
|
412
410
|
|
|
413
411
|
def flush_file(depot_file):
|
|
414
412
|
return p4.run_sync("-k", depot_file)
|
|
@@ -544,7 +542,7 @@ def get_script_path(script_file_name):
|
|
|
544
542
|
abort(f"Failed to find script '{script_file_name}', post for help on Slack!")
|
|
545
543
|
|
|
546
544
|
|
|
547
|
-
def get_shelve_preflight_build_id(shelve_changelist, type=PreflightType.FULL, stream="", find=False, print_output=True, abort_on_fail=True, submit_on_server=False):
|
|
545
|
+
def get_shelve_preflight_build_id(shelve_changelist, type=PreflightType.FULL, stream="", find=False, print_output=True, abort_on_fail=True, submit_on_server=True, content_only_build=False):
|
|
548
546
|
cmd = [
|
|
549
547
|
sys.executable,
|
|
550
548
|
get_script_path("trigger_shelve_preflight.py"),
|
|
@@ -556,6 +554,8 @@ def get_shelve_preflight_build_id(shelve_changelist, type=PreflightType.FULL, st
|
|
|
556
554
|
["--shelve_stream", stream] if stream else []
|
|
557
555
|
) + (
|
|
558
556
|
["--submit_on_server"] if submit_on_server else []
|
|
557
|
+
) + (
|
|
558
|
+
["--content_only"] if content_only_build else []
|
|
559
559
|
)
|
|
560
560
|
build_id = ""
|
|
561
561
|
try:
|
|
@@ -764,15 +764,16 @@ def get_teamcity_build_json(build_id):
|
|
|
764
764
|
def move_open_files_to_default(shelve_changelist: str):
|
|
765
765
|
opened_file_list = get_opened_file_list(shelve_changelist)
|
|
766
766
|
if opened_file_list:
|
|
767
|
-
if any('+l' in x['type'] for x in opened_file_list):
|
|
768
|
-
secho("\nYour CL contains exclusive edit files:")
|
|
769
|
-
for x in opened_file_list:
|
|
770
|
-
secho(f"\n {x['depotFile']}")
|
|
771
|
-
secho(f"\nMake sure not to revert these files until your preflight completes! (Press any key to continue)", fg="green", bold=True)
|
|
772
|
-
input('')
|
|
773
767
|
reopen_changelist_to_default(shelve_changelist)
|
|
774
768
|
return opened_file_list
|
|
775
769
|
|
|
770
|
+
def shelf_is_content_only(shelve_changelist: str) -> bool:
|
|
771
|
+
describe_shelve = get_describe_shelve(shelve_changelist)[0]
|
|
772
|
+
for shelf_file in describe_shelve["depotFile"]:
|
|
773
|
+
if re.search("/Source/", shelf_file):
|
|
774
|
+
return False
|
|
775
|
+
return True
|
|
776
|
+
|
|
776
777
|
def commit(shelve_changelist: str):
|
|
777
778
|
"""
|
|
778
779
|
Commit a shelve
|
|
@@ -825,16 +826,36 @@ def commit(shelve_changelist: str):
|
|
|
825
826
|
return
|
|
826
827
|
|
|
827
828
|
|
|
829
|
+
def tailscale_is_connected() -> bool:
|
|
830
|
+
try:
|
|
831
|
+
result = check_output('tailscale status')
|
|
832
|
+
return True
|
|
833
|
+
except CalledProcessError as e:
|
|
834
|
+
return False
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
def editor_is_running():
|
|
838
|
+
for proc in process_iter(['name']):
|
|
839
|
+
if proc.info['name'] == "Subnautica2Editor.exe":
|
|
840
|
+
return True
|
|
841
|
+
return False
|
|
842
|
+
|
|
843
|
+
|
|
828
844
|
def main(
|
|
829
845
|
changelist: str = Option("", help="The changelist you own and want to preflight."),
|
|
830
846
|
commit_on_success: Optional[bool] = Option(True, help="Commit the shelve on successful preflight."),
|
|
831
847
|
type: PreflightType = Option(PreflightType.QUICK, help="The type of preflight to run."),
|
|
832
848
|
p4v_config_type: P4VConfigType = Option(None, help="The command to use when running from P4V context menus."),
|
|
833
|
-
use_server_submit: Optional[bool] = Option(
|
|
849
|
+
use_server_submit: Optional[bool] = Option(True, help="If committing on successful preflight, should server side commit be used.")
|
|
834
850
|
):
|
|
835
851
|
"""
|
|
836
852
|
Preflight a changelist
|
|
837
853
|
"""
|
|
854
|
+
|
|
855
|
+
# Check for Tailscale connection
|
|
856
|
+
if not "Tailscale" in os.environ["PATH"] or not tailscale_is_connected():
|
|
857
|
+
abort("In order to preflight you must be connected to Tailscale.")
|
|
858
|
+
|
|
838
859
|
try:
|
|
839
860
|
install_p4v_tools(p4v_config_type)
|
|
840
861
|
except Exception as e:
|
|
@@ -846,62 +867,43 @@ def main(
|
|
|
846
867
|
except Exception as e:
|
|
847
868
|
abort(f"Failed to sync scripts; ask for help!\n{e}...")
|
|
848
869
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
shelve.change, find=True, print_output=False, abort_on_fail=False
|
|
855
|
-
)
|
|
856
|
-
if not attempted_build_id:
|
|
857
|
-
continue
|
|
870
|
+
# Check for editor, if running wait for it to be closed
|
|
871
|
+
if use_server_submit and editor_is_running():
|
|
872
|
+
secho("\nEditor is running, save your work and close it to continue..")
|
|
873
|
+
while editor_is_running():
|
|
874
|
+
time.sleep(1)
|
|
858
875
|
|
|
859
|
-
build_json = get_teamcity_build_json(attempted_build_id)
|
|
860
|
-
build_state = get_build_state(build_json)
|
|
861
|
-
secho(f" Build state: {build_state}")
|
|
862
|
-
if build_state in [BuildState.QUEUED, BuildState.RUNNING]:
|
|
863
|
-
secho(f"Existing preflight in progress for shelve {shelve.change}...\n", fg="green", bold=True)
|
|
864
|
-
build_id = attempted_build_id
|
|
865
|
-
shelve_changelist = shelve.change
|
|
866
|
-
break
|
|
867
|
-
elif build_state == BuildState.FINISHED and is_build_success(build_json):
|
|
868
|
-
if confirm(f"Shelve '{shelve.change}' was successful, do you want to commit it now?", prompt_suffix=""):
|
|
869
|
-
commit(shelve.change)
|
|
870
|
-
if changelist == shelve.change:
|
|
871
|
-
secho("Requested shelve was committed; refresh P4V.", fg="green", bold=True)
|
|
872
|
-
return
|
|
873
|
-
|
|
874
|
-
# Get an updated change list in case some changes were submitted.
|
|
875
876
|
sorted_change_obj_list = get_sorted_change_obj_list()
|
|
876
|
-
if
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
if changelist:
|
|
878
|
+
change_obj = get_change_obj(changelist)
|
|
879
|
+
else:
|
|
880
|
+
print_change_obj_list(sorted_change_obj_list)
|
|
881
|
+
chosen_index = prompt(f"\nSelect a changelist")
|
|
882
|
+
choice_count = len(sorted_change_obj_list)
|
|
883
|
+
if not chosen_index.isdigit() or not (int(chosen_index) in range(choice_count)):
|
|
884
|
+
abort("Invalid option.")
|
|
881
885
|
else:
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
if not confirm(f"\nFiles are opened in CL {change_obj.change} and must be re-opened in default to submit on server. Re-open files?"):
|
|
894
|
-
abort("Aborting preflight due to open files in CL..")
|
|
895
|
-
move_open_files_to_default(change_obj.change)
|
|
886
|
+
change_obj = sorted_change_obj_list[int(chosen_index)]
|
|
887
|
+
|
|
888
|
+
verify_changelist(change_obj, sorted_change_obj_list)
|
|
889
|
+
if get_opened_file_list(change_obj.change):
|
|
890
|
+
shelve_changelist = attempt_shelve_changelist(change_obj.change)
|
|
891
|
+
if use_server_submit and commit_on_success:
|
|
892
|
+
secho(f"Reverting files from CL {change_obj.change} to allow for submit on the server..")
|
|
893
|
+
revert_file_in_cl("//...", change_obj.change, "-k")
|
|
894
|
+
else:
|
|
895
|
+
if change_obj.is_shelved:
|
|
896
|
+
shelve_changelist = change_obj.change
|
|
896
897
|
else:
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
898
|
+
abort(f"No opened files or shelve to work with in changelist '{change_obj.change}'...")
|
|
899
|
+
|
|
900
|
+
use_content_build = shelf_is_content_only(changelist)
|
|
901
|
+
build_id = get_shelve_preflight_build_id(
|
|
902
|
+
shelve_changelist, type=type, stream=get_client_stream(change_obj.client), submit_on_server=(use_server_submit and commit_on_success), content_only_build=use_content_build
|
|
903
|
+
)
|
|
904
|
+
|
|
905
|
+
if use_server_submit:
|
|
906
|
+
secho("\nBuild is requested, it is safe to close this window at any time!")
|
|
905
907
|
|
|
906
908
|
wait_on_teamcity_build(build_id, shelve_changelist, use_server_submit)
|
|
907
909
|
|
|
@@ -912,4 +914,5 @@ def main(
|
|
|
912
914
|
secho("Preflight finished successfully.", fg="green", bold=True)
|
|
913
915
|
if commit_on_success and not use_server_submit:
|
|
914
916
|
commit(shelve_changelist)
|
|
917
|
+
|
|
915
918
|
return
|
|
@@ -135,7 +135,8 @@ def setup(
|
|
|
135
135
|
abort("Workspace path cannot include spaces (sorry)")
|
|
136
136
|
|
|
137
137
|
perforce_path = Path(perforce_path).expanduser()
|
|
138
|
-
|
|
138
|
+
perforce_drive = perforce_path.drive or "C:"
|
|
139
|
+
_, _, free = shutil.disk_usage(perforce_drive)
|
|
139
140
|
free_gb = free // 1024 // 1024 // 1024
|
|
140
141
|
if free_gb < MIN_FREE_GB:
|
|
141
142
|
secho(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.9.23
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|