unknown-cli 0.5.5__tar.gz → 0.6.8__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.5.5 → unknown-cli-0.6.8}/PKG-INFO +6 -4
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/README.md +2 -2
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/setup.py +99 -98
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/PKG-INFO +6 -4
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/requires.txt +1 -0
- unknown-cli-0.6.8/unknowncli/VERSION +1 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/__init__.py +16 -15
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/__main__.py +43 -41
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/commands/project.py +36 -20
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/commands/task.py +498 -486
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/data/.p4ignore.txt +152 -152
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/utils.py +295 -291
- unknown-cli-0.5.5/unknowncli/VERSION +0 -1
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/setup.cfg +0 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/SOURCES.txt +0 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/dependency_links.txt +0 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/entry_points.txt +0 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknown_cli.egg-info/top_level.txt +0 -0
- {unknown-cli-0.5.5 → unknown-cli-0.6.8}/unknowncli/commands/__init__.py +0 -0
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unknown-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.8
|
|
4
4
|
Summary: Unknown Commandline Tool
|
|
5
5
|
Home-page: UNKNOWN
|
|
6
6
|
Author:
|
|
7
7
|
Author-email:
|
|
8
8
|
License: MIT
|
|
9
|
-
Description: # Unknown CLI
|
|
10
|
-
|
|
11
|
-
Internal tool
|
|
12
9
|
Platform: UNKNOWN
|
|
13
10
|
Classifier: Intended Audience :: Developers
|
|
14
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -16,3 +13,8 @@ Classifier: Operating System :: OS Independent
|
|
|
16
13
|
Classifier: Programming Language :: Python :: 3
|
|
17
14
|
Requires-Python: >=3.6
|
|
18
15
|
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Unknown CLI
|
|
18
|
+
|
|
19
|
+
Internal tool
|
|
20
|
+
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
# Unknown CLI
|
|
2
|
-
|
|
1
|
+
# Unknown CLI
|
|
2
|
+
|
|
3
3
|
Internal tool
|
|
@@ -1,98 +1,99 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
import os, sys
|
|
3
|
-
from setuptools import setup, find_packages, Command
|
|
4
|
-
|
|
5
|
-
if sys.version_info < (3, 8):
|
|
6
|
-
raise NotImplementedError("""This tool does not support Python versions older than 3.6""")
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
version_file = os.path.abspath(os.path.join("unknowncli", "VERSION"))
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def get_version():
|
|
13
|
-
with open(version_file) as f:
|
|
14
|
-
return f.readlines()[0].strip()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class BumpCommand(Command):
|
|
18
|
-
description = "Version bump"
|
|
19
|
-
user_options = [("which=", None, "Specify which part of the version to bump")]
|
|
20
|
-
|
|
21
|
-
def initialize_options(self):
|
|
22
|
-
self.which = None
|
|
23
|
-
|
|
24
|
-
def finalize_options(self):
|
|
25
|
-
assert self.which in (None, "major", "minor", "patch"), "Invalid bump pragma"
|
|
26
|
-
|
|
27
|
-
def run(self):
|
|
28
|
-
bump_version(self.which)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def bump_version(which):
|
|
32
|
-
major, minor, patch = (0, 1, 0)
|
|
33
|
-
old_version = get_version()
|
|
34
|
-
major, minor, patch = old_version.split(".")
|
|
35
|
-
|
|
36
|
-
if which == "major":
|
|
37
|
-
major = int(major) + 1
|
|
38
|
-
minor = 0
|
|
39
|
-
patch = 0
|
|
40
|
-
elif which == "minor":
|
|
41
|
-
minor = int(minor) + 1
|
|
42
|
-
patch = 0
|
|
43
|
-
else:
|
|
44
|
-
patch = int(patch.split("-")[0]) + 1
|
|
45
|
-
|
|
46
|
-
new_version = "%s.%s.%s" % (major, minor, patch)
|
|
47
|
-
|
|
48
|
-
with open(version_file, "w") as f:
|
|
49
|
-
f.write(new_version)
|
|
50
|
-
print(f"Version has been bumped from {old_version} to {new_version}")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
with open("README.md", "r") as fh:
|
|
54
|
-
long_description = fh.read()
|
|
55
|
-
|
|
56
|
-
version = get_version()
|
|
57
|
-
|
|
58
|
-
setup(
|
|
59
|
-
name="unknown-cli",
|
|
60
|
-
python_requires=">=3.6",
|
|
61
|
-
version=version,
|
|
62
|
-
license="MIT",
|
|
63
|
-
author="",
|
|
64
|
-
author_email="",
|
|
65
|
-
description="Unknown Commandline Tool",
|
|
66
|
-
long_description=long_description,
|
|
67
|
-
long_description_content_type="text/markdown",
|
|
68
|
-
url="",
|
|
69
|
-
packages=find_packages(exclude=["tests"]),
|
|
70
|
-
package_data={"": ["VERSION", "data/.p4ignore.txt"]},
|
|
71
|
-
install_requires=[
|
|
72
|
-
"typer",
|
|
73
|
-
"click",
|
|
74
|
-
"requests",
|
|
75
|
-
"boto3",
|
|
76
|
-
"psutil",
|
|
77
|
-
"jsonpath-rw",
|
|
78
|
-
"pyyaml",
|
|
79
|
-
"pyjwt",
|
|
80
|
-
"tabulate",
|
|
81
|
-
"colorama",
|
|
82
|
-
"shellingham",
|
|
83
|
-
"boto3",
|
|
84
|
-
"loguru",
|
|
85
|
-
"P4Python"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os, sys
|
|
3
|
+
from setuptools import setup, find_packages, Command
|
|
4
|
+
|
|
5
|
+
if sys.version_info < (3, 8):
|
|
6
|
+
raise NotImplementedError("""This tool does not support Python versions older than 3.6""")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
version_file = os.path.abspath(os.path.join("unknowncli", "VERSION"))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_version():
|
|
13
|
+
with open(version_file) as f:
|
|
14
|
+
return f.readlines()[0].strip()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BumpCommand(Command):
|
|
18
|
+
description = "Version bump"
|
|
19
|
+
user_options = [("which=", None, "Specify which part of the version to bump")]
|
|
20
|
+
|
|
21
|
+
def initialize_options(self):
|
|
22
|
+
self.which = None
|
|
23
|
+
|
|
24
|
+
def finalize_options(self):
|
|
25
|
+
assert self.which in (None, "major", "minor", "patch"), "Invalid bump pragma"
|
|
26
|
+
|
|
27
|
+
def run(self):
|
|
28
|
+
bump_version(self.which)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def bump_version(which):
|
|
32
|
+
major, minor, patch = (0, 1, 0)
|
|
33
|
+
old_version = get_version()
|
|
34
|
+
major, minor, patch = old_version.split(".")
|
|
35
|
+
|
|
36
|
+
if which == "major":
|
|
37
|
+
major = int(major) + 1
|
|
38
|
+
minor = 0
|
|
39
|
+
patch = 0
|
|
40
|
+
elif which == "minor":
|
|
41
|
+
minor = int(minor) + 1
|
|
42
|
+
patch = 0
|
|
43
|
+
else:
|
|
44
|
+
patch = int(patch.split("-")[0]) + 1
|
|
45
|
+
|
|
46
|
+
new_version = "%s.%s.%s" % (major, minor, patch)
|
|
47
|
+
|
|
48
|
+
with open(version_file, "w") as f:
|
|
49
|
+
f.write(new_version)
|
|
50
|
+
print(f"Version has been bumped from {old_version} to {new_version}")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
with open("README.md", "r") as fh:
|
|
54
|
+
long_description = fh.read()
|
|
55
|
+
|
|
56
|
+
version = get_version()
|
|
57
|
+
|
|
58
|
+
setup(
|
|
59
|
+
name="unknown-cli",
|
|
60
|
+
python_requires=">=3.6",
|
|
61
|
+
version=version,
|
|
62
|
+
license="MIT",
|
|
63
|
+
author="",
|
|
64
|
+
author_email="",
|
|
65
|
+
description="Unknown Commandline Tool",
|
|
66
|
+
long_description=long_description,
|
|
67
|
+
long_description_content_type="text/markdown",
|
|
68
|
+
url="",
|
|
69
|
+
packages=find_packages(exclude=["tests"]),
|
|
70
|
+
package_data={"": ["VERSION", "data/.p4ignore.txt"]},
|
|
71
|
+
install_requires=[
|
|
72
|
+
"typer",
|
|
73
|
+
"click",
|
|
74
|
+
"requests",
|
|
75
|
+
"boto3",
|
|
76
|
+
"psutil",
|
|
77
|
+
"jsonpath-rw",
|
|
78
|
+
"pyyaml",
|
|
79
|
+
"pyjwt",
|
|
80
|
+
"tabulate",
|
|
81
|
+
"colorama",
|
|
82
|
+
"shellingham",
|
|
83
|
+
"boto3",
|
|
84
|
+
"loguru",
|
|
85
|
+
"P4Python",
|
|
86
|
+
"rich"
|
|
87
|
+
],
|
|
88
|
+
extras_require={},
|
|
89
|
+
include_package_data=False,
|
|
90
|
+
classifiers=[
|
|
91
|
+
"Intended Audience :: Developers",
|
|
92
|
+
"License :: OSI Approved :: MIT License",
|
|
93
|
+
"Operating System :: OS Independent",
|
|
94
|
+
"Programming Language :: Python :: 3",
|
|
95
|
+
],
|
|
96
|
+
test_suite="tests",
|
|
97
|
+
cmdclass={"bump": BumpCommand},
|
|
98
|
+
entry_points={"console_scripts": ["unknown = unknowncli.__main__:app", "unk = unknowncli.__main__:app"]},
|
|
99
|
+
)
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unknown-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.8
|
|
4
4
|
Summary: Unknown Commandline Tool
|
|
5
5
|
Home-page: UNKNOWN
|
|
6
6
|
Author:
|
|
7
7
|
Author-email:
|
|
8
8
|
License: MIT
|
|
9
|
-
Description: # Unknown CLI
|
|
10
|
-
|
|
11
|
-
Internal tool
|
|
12
9
|
Platform: UNKNOWN
|
|
13
10
|
Classifier: Intended Audience :: Developers
|
|
14
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -16,3 +13,8 @@ Classifier: Operating System :: OS Independent
|
|
|
16
13
|
Classifier: Programming Language :: Python :: 3
|
|
17
14
|
Requires-Python: >=3.6
|
|
18
15
|
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Unknown CLI
|
|
18
|
+
|
|
19
|
+
Internal tool
|
|
20
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.6.8
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from typer import Typer, Context, Argument, Option, echo, secho, confirm
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import os
|
|
2
|
+
from typer import Typer, Context, Argument, Option, echo, secho, confirm
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def read_version():
|
|
6
|
+
directory = os.path.dirname(__file__)
|
|
7
|
+
with open(os.path.join(directory, "VERSION"), "r") as version_file:
|
|
8
|
+
version = version_file.readline().strip()
|
|
9
|
+
return version
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__version__ = read_version()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_version_string():
|
|
16
|
+
return f"unknown-cli/{__version__}"
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import os, sys
|
|
2
|
-
import logging
|
|
3
|
-
import pathlib
|
|
4
|
-
import requests
|
|
5
|
-
from .utils import console_handler, abort, check_version, check_p4config
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
log = logging.getLogger(__name__)
|
|
9
|
-
help_string = """A utility for managing Unknown projects"""
|
|
10
|
-
|
|
11
|
-
base_path = pathlib.Path(os.path.dirname(__file__))
|
|
12
|
-
commands_folder = base_path / "commands"
|
|
13
|
-
|
|
14
|
-
from typer import Typer, Context, Argument, Option, echo, secho, confirm, prompt
|
|
15
|
-
|
|
16
|
-
app = Typer(add_completion=False)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
#
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import os, sys
|
|
2
|
+
import logging
|
|
3
|
+
import pathlib
|
|
4
|
+
import requests
|
|
5
|
+
from .utils import console_handler, abort, check_version, check_p4config
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
log = logging.getLogger(__name__)
|
|
9
|
+
help_string = """A utility for managing Unknown projects"""
|
|
10
|
+
|
|
11
|
+
base_path = pathlib.Path(os.path.dirname(__file__))
|
|
12
|
+
commands_folder = base_path / "commands"
|
|
13
|
+
|
|
14
|
+
from typer import Typer, Context, Argument, Option, echo, secho, confirm, prompt
|
|
15
|
+
|
|
16
|
+
app = Typer(add_completion=False)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@app.callback(context_settings={"allow_extra_args": True, "ignore_unknown_options": True})
|
|
20
|
+
def cli(
|
|
21
|
+
ctx: Context,
|
|
22
|
+
# verbose: str = Option(None, "-v", "--verbose", help="Verbose logging: info or debug"),
|
|
23
|
+
# output: str = Option("text", "-o", "--output", help="Output text or json"),
|
|
24
|
+
):
|
|
25
|
+
"""
|
|
26
|
+
This tool handles the initial setup of Perforce Projects and helps you work with task streams.
|
|
27
|
+
It creates workspaces for you according to naming conventions and sets up a virtual drive.
|
|
28
|
+
Please run the 'project setup' command to get started.
|
|
29
|
+
"""
|
|
30
|
+
# by default we log out to console WARN and higher but can view info with -v
|
|
31
|
+
# if verbose:
|
|
32
|
+
# console_handler.setLevel(getattr(logging, verbose.upper()))
|
|
33
|
+
check_version()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
check_p4config()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
from unknowncli.commands import project
|
|
40
|
+
from unknowncli.commands import task
|
|
41
|
+
|
|
42
|
+
app.add_typer(project.app, name="project", help="Manage initial project setup")
|
|
43
|
+
app.add_typer(task.app, name="task", help="Manage perforce task streams")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import time
|
|
1
|
+
import time
|
|
2
2
|
import sys, os
|
|
3
3
|
import requests
|
|
4
4
|
import logging
|
|
@@ -19,14 +19,12 @@ app = Typer()
|
|
|
19
19
|
|
|
20
20
|
hostname = socket.gethostname().lower()
|
|
21
21
|
SUBST_DRIVE = "S:"
|
|
22
|
-
STREAMS = {
|
|
23
|
-
|
|
24
|
-
"sandbox" : "//project/sandbox"
|
|
25
|
-
}
|
|
26
|
-
is_windows = (os.name == 'nt')
|
|
22
|
+
STREAMS = {"sn2-main": "//project/sn2-main-ue", "sandbox": "//project/sandbox"}
|
|
23
|
+
is_windows = os.name == "nt"
|
|
27
24
|
DEFAULT_FOLDER = "C:\Work" if is_windows else "~/Work"
|
|
28
25
|
MIN_FREE_GB = 200
|
|
29
26
|
|
|
27
|
+
|
|
30
28
|
def get_clientspecs(p4):
|
|
31
29
|
try:
|
|
32
30
|
specs = p4.run_clients("-u", p4.user)
|
|
@@ -39,6 +37,7 @@ def get_clientspecs(p4):
|
|
|
39
37
|
ret[s["Stream"].lower()] = s
|
|
40
38
|
return ret
|
|
41
39
|
|
|
40
|
+
|
|
42
41
|
def get_sync_stats(p4, force=False):
|
|
43
42
|
# gah, p4 wrapper just returns text
|
|
44
43
|
if force:
|
|
@@ -46,7 +45,10 @@ def get_sync_stats(p4, force=False):
|
|
|
46
45
|
else:
|
|
47
46
|
ret = p4.run_sync("-N")
|
|
48
47
|
lst = ret[0].split("=")
|
|
49
|
-
ret = {
|
|
48
|
+
ret = {
|
|
49
|
+
"files": {"added": 0, "updated": 0, "deleted": 0, "total": 0},
|
|
50
|
+
"mbytes": {"added": 0, "updated": 0, "total": 0},
|
|
51
|
+
}
|
|
50
52
|
lst2 = [int(l) for l in lst[1].split(",")[0].split("/")]
|
|
51
53
|
ret["files"]["added"] = lst2[0]
|
|
52
54
|
ret["files"]["updated"] = lst2[1]
|
|
@@ -60,10 +62,14 @@ def get_sync_stats(p4, force=False):
|
|
|
60
62
|
|
|
61
63
|
return ret
|
|
62
64
|
|
|
65
|
+
|
|
63
66
|
@app.command()
|
|
64
|
-
def setup(
|
|
67
|
+
def setup(
|
|
68
|
+
perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep your workspace"),
|
|
69
|
+
force: bool = Option(False, help="Forcefully overwrite an existing setup"),
|
|
70
|
+
):
|
|
65
71
|
"""
|
|
66
|
-
Creates the virtual drive and perforce workspaces from
|
|
72
|
+
Creates the virtual drive and perforce workspaces from
|
|
67
73
|
//Project/[stream] -> s:/[stream]
|
|
68
74
|
|
|
69
75
|
Perforce Setup: https://www.notion.so/unknownworlds/How-To-Version-Control-Setup-0fc38f99d29a4558ac32b24bdfc6904f
|
|
@@ -104,7 +110,7 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
104
110
|
abort(str(e))
|
|
105
111
|
else:
|
|
106
112
|
abort(f"Error fetching workspaces from Perforce: {e}")
|
|
107
|
-
|
|
113
|
+
|
|
108
114
|
secho("OK", fg="green")
|
|
109
115
|
if " " in perforce_path:
|
|
110
116
|
abort("Workspace path cannot include spaces (sorry)")
|
|
@@ -113,7 +119,10 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
113
119
|
_, _, free = shutil.disk_usage(perforce_path.drive)
|
|
114
120
|
free_gb = free // 1024 // 1024 // 1024
|
|
115
121
|
if free_gb < MIN_FREE_GB:
|
|
116
|
-
secho(
|
|
122
|
+
secho(
|
|
123
|
+
f"You need to have at least {MIN_FREE_GB} GB free disk space but you have only {free_gb} GB on drive {perforce_path.drive}",
|
|
124
|
+
fg="yellow",
|
|
125
|
+
)
|
|
117
126
|
y = confirm("Are you sure you want to continue?")
|
|
118
127
|
if not y:
|
|
119
128
|
abort("Aborted")
|
|
@@ -158,7 +167,7 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
158
167
|
secho(f"{SUBST_DRIVE} virtual drive is already set up and pointing to {s_path_resolve}.", fg="green")
|
|
159
168
|
elif not force:
|
|
160
169
|
abort(f"{SUBST_DRIVE} virtual drive is pointing to another folder: {s_path_resolve}.")
|
|
161
|
-
|
|
170
|
+
|
|
162
171
|
if not s_path.exists() or force:
|
|
163
172
|
try:
|
|
164
173
|
call(f"subst {SUBST_DRIVE} /D")
|
|
@@ -167,6 +176,7 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
167
176
|
check_call(subst_cmd)
|
|
168
177
|
|
|
169
178
|
import winreg
|
|
179
|
+
|
|
170
180
|
echo(f"Adding Virtual Drive {SUBST_DRIVE} -> {perforce_path} to startup")
|
|
171
181
|
h = winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Run")
|
|
172
182
|
winreg.SetValueEx(h, "Perforce Work Drive", 0, winreg.REG_SZ, subst_cmd)
|
|
@@ -179,7 +189,9 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
179
189
|
else:
|
|
180
190
|
root_path = str(perforce_path)
|
|
181
191
|
|
|
182
|
-
computer_name = prompt(
|
|
192
|
+
computer_name = prompt(
|
|
193
|
+
"What would you like to call this computer in Perforce (work, home, laptop, etc)", default="work"
|
|
194
|
+
)
|
|
183
195
|
if not computer_name.isalpha() or computer_name != computer_name.lower():
|
|
184
196
|
abort("Computer name must be lowercase with no symbols")
|
|
185
197
|
for stream_name, stream in STREAMS.items():
|
|
@@ -209,10 +221,12 @@ def setup(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep you
|
|
|
209
221
|
p = Path(mapping)
|
|
210
222
|
p.mkdir(parents=True, exist_ok=True)
|
|
211
223
|
|
|
212
|
-
|
|
213
224
|
secho("\nProject setup has been completed. Please sync your workspaces through p4v", fg="green")
|
|
214
|
-
secho(
|
|
215
|
-
|
|
225
|
+
secho(
|
|
226
|
+
"Unreal Game Sync documentation: https://www.notion.so/unknownworlds/How-To-Setup-Unreal-Game-Sync-59cc3348cdde449d8fdc7f39ee60c8b3"
|
|
227
|
+
)
|
|
228
|
+
# sync_workspaces()
|
|
229
|
+
|
|
216
230
|
|
|
217
231
|
@app.command()
|
|
218
232
|
def sync(stream: str = Option(""), force: bool = Option(False)):
|
|
@@ -221,6 +235,7 @@ def sync(stream: str = Option(""), force: bool = Option(False)):
|
|
|
221
235
|
"""
|
|
222
236
|
sync_workspaces(stream, force)
|
|
223
237
|
|
|
238
|
+
|
|
224
239
|
def sync_workspaces(stream="", force=False):
|
|
225
240
|
files_completed = 0
|
|
226
241
|
old_files_completed = 0
|
|
@@ -263,23 +278,23 @@ def sync_workspaces(stream="", force=False):
|
|
|
263
278
|
echo(f"Syncing {s} -> {folder}...")
|
|
264
279
|
p4.client = specs[s]["client"]
|
|
265
280
|
stats = get_sync_stats(p4, force)
|
|
266
|
-
num_files = stats[
|
|
281
|
+
num_files = stats["files"]["total"]
|
|
267
282
|
batch_size = 1000
|
|
268
283
|
threads = 8
|
|
269
284
|
|
|
270
285
|
if force:
|
|
271
286
|
secho(f"Refetching all files in {s} (this will take a while)...")
|
|
272
287
|
ret = p4.run_sync("--parallel", threads, "-f")
|
|
273
|
-
num_files = get_sync_stats(p4)[
|
|
288
|
+
num_files = get_sync_stats(p4)["files"]["total"]
|
|
274
289
|
|
|
275
290
|
if num_files > 0:
|
|
276
291
|
echo(f"Syncing {num_files} files...")
|
|
277
292
|
with progressbar(length=num_files, show_pos=True) as progress:
|
|
278
|
-
for i in range(num_files//batch_size):
|
|
293
|
+
for i in range(num_files // batch_size):
|
|
279
294
|
p4.run_sync("-m", batch_size, "--parallel", threads, "-q")
|
|
280
295
|
progress.update(batch_size)
|
|
281
296
|
p4.run_sync()
|
|
282
|
-
files_remaining = get_sync_stats(p4)[
|
|
297
|
+
files_remaining = get_sync_stats(p4)["files"]["total"]
|
|
283
298
|
if files_remaining == 0:
|
|
284
299
|
secho(f"{s} is now up-to-date", fg="green")
|
|
285
300
|
else:
|
|
@@ -287,6 +302,7 @@ def sync_workspaces(stream="", force=False):
|
|
|
287
302
|
else:
|
|
288
303
|
secho(f"{s} is already up-to-date", fg="green")
|
|
289
304
|
|
|
305
|
+
|
|
290
306
|
@app.command()
|
|
291
307
|
def workspaces():
|
|
292
308
|
"""
|