unknown-cli 0.9.24__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.24 → unknown-cli-0.9.26}/PKG-INFO +1 -1
- {unknown-cli-0.9.24 → 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.24 → unknown-cli-0.9.26}/unknowncli/commands/preflight.py +68 -59
- unknown-cli-0.9.24/unknowncli/VERSION +0 -1
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/README.md +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/setup.cfg +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/setup.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknown_cli.egg-info/SOURCES.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknown_cli.egg-info/dependency_links.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknown_cli.egg-info/entry_points.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknown_cli.egg-info/requires.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknown_cli.egg-info/top_level.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/__init__.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/__main__.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/commands/__init__.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/commands/project.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/commands/task.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/commands/unreal.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/data/.p4ignore.txt +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/set_registry_keys.py +0 -0
- {unknown-cli-0.9.24 → unknown-cli-0.9.26}/unknowncli/set_url_handler.py +0 -0
- {unknown-cli-0.9.24 → 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:
|
|
@@ -767,6 +767,13 @@ def move_open_files_to_default(shelve_changelist: str):
|
|
|
767
767
|
reopen_changelist_to_default(shelve_changelist)
|
|
768
768
|
return opened_file_list
|
|
769
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
|
+
|
|
770
777
|
def commit(shelve_changelist: str):
|
|
771
778
|
"""
|
|
772
779
|
Commit a shelve
|
|
@@ -819,16 +826,36 @@ def commit(shelve_changelist: str):
|
|
|
819
826
|
return
|
|
820
827
|
|
|
821
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
|
+
|
|
822
844
|
def main(
|
|
823
845
|
changelist: str = Option("", help="The changelist you own and want to preflight."),
|
|
824
846
|
commit_on_success: Optional[bool] = Option(True, help="Commit the shelve on successful preflight."),
|
|
825
847
|
type: PreflightType = Option(PreflightType.QUICK, help="The type of preflight to run."),
|
|
826
848
|
p4v_config_type: P4VConfigType = Option(None, help="The command to use when running from P4V context menus."),
|
|
827
|
-
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.")
|
|
828
850
|
):
|
|
829
851
|
"""
|
|
830
852
|
Preflight a changelist
|
|
831
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
|
+
|
|
832
859
|
try:
|
|
833
860
|
install_p4v_tools(p4v_config_type)
|
|
834
861
|
except Exception as e:
|
|
@@ -840,62 +867,43 @@ def main(
|
|
|
840
867
|
except Exception as e:
|
|
841
868
|
abort(f"Failed to sync scripts; ask for help!\n{e}...")
|
|
842
869
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
shelve.change, find=True, print_output=False, abort_on_fail=False
|
|
849
|
-
)
|
|
850
|
-
if not attempted_build_id:
|
|
851
|
-
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)
|
|
852
875
|
|
|
853
|
-
build_json = get_teamcity_build_json(attempted_build_id)
|
|
854
|
-
build_state = get_build_state(build_json)
|
|
855
|
-
secho(f" Build state: {build_state}")
|
|
856
|
-
if build_state in [BuildState.QUEUED, BuildState.RUNNING]:
|
|
857
|
-
secho(f"Existing preflight in progress for shelve {shelve.change}...\n", fg="green", bold=True)
|
|
858
|
-
build_id = attempted_build_id
|
|
859
|
-
shelve_changelist = shelve.change
|
|
860
|
-
break
|
|
861
|
-
elif build_state == BuildState.FINISHED and is_build_success(build_json):
|
|
862
|
-
if confirm(f"Shelve '{shelve.change}' was successful, do you want to commit it now?", prompt_suffix=""):
|
|
863
|
-
commit(shelve.change)
|
|
864
|
-
if changelist == shelve.change:
|
|
865
|
-
secho("Requested shelve was committed; refresh P4V.", fg="green", bold=True)
|
|
866
|
-
return
|
|
867
|
-
|
|
868
|
-
# Get an updated change list in case some changes were submitted.
|
|
869
876
|
sorted_change_obj_list = get_sorted_change_obj_list()
|
|
870
|
-
if
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
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.")
|
|
875
885
|
else:
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
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?"):
|
|
888
|
-
abort("Aborting preflight due to open files in CL..")
|
|
889
|
-
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
|
|
890
897
|
else:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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!")
|
|
899
907
|
|
|
900
908
|
wait_on_teamcity_build(build_id, shelve_changelist, use_server_submit)
|
|
901
909
|
|
|
@@ -906,4 +914,5 @@ def main(
|
|
|
906
914
|
secho("Preflight finished successfully.", fg="green", bold=True)
|
|
907
915
|
if commit_on_success and not use_server_submit:
|
|
908
916
|
commit(shelve_changelist)
|
|
917
|
+
|
|
909
918
|
return
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.9.24
|
|
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
|
|
File without changes
|