unknown-cli 0.6.7__tar.gz → 0.6.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.6.7
3
+ Version: 0.6.9
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.6.7
3
+ Version: 0.6.9
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -0,0 +1 @@
1
+ 0.6.9
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  from typer import Typer, Context, Argument, Option, echo, secho, confirm
3
3
 
4
+
4
5
  def read_version():
5
6
  directory = os.path.dirname(__file__)
6
7
  with open(os.path.join(directory, "VERSION"), "r") as version_file:
@@ -15,11 +15,12 @@ from typer import Typer, Context, Argument, Option, echo, secho, confirm, prompt
15
15
 
16
16
  app = Typer(add_completion=False)
17
17
 
18
+
18
19
  @app.callback(context_settings={"allow_extra_args": True, "ignore_unknown_options": True})
19
20
  def cli(
20
21
  ctx: Context,
21
- #verbose: str = Option(None, "-v", "--verbose", help="Verbose logging: info or debug"),
22
- #output: str = Option("text", "-o", "--output", help="Output text or json"),
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"),
23
24
  ):
24
25
  """
25
26
  This tool handles the initial setup of Perforce Projects and helps you work with task streams.
@@ -27,10 +28,11 @@ def cli(
27
28
  Please run the 'project setup' command to get started.
28
29
  """
29
30
  # by default we log out to console WARN and higher but can view info with -v
30
- #if verbose:
31
+ # if verbose:
31
32
  # console_handler.setLevel(getattr(logging, verbose.upper()))
32
33
  check_version()
33
34
 
35
+
34
36
  check_p4config()
35
37
 
36
38
 
@@ -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
- "sn2-main": "//project/sn2-main-ue",
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 = {"files": {"added": 0, "updated": 0, "deleted": 0, "total": 0}, "mbytes": {"added": 0, "updated": 0, "total": 0}}
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(perforce_path: str = Option(DEFAULT_FOLDER, prompt="Folder to keep your workspace"), force: bool = Option(False, help="Forcefully overwrite an existing 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(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}", fg="yellow")
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("What would you like to call this computer in Perforce (work, home, laptop, etc)", default="work")
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("Unreal Game Sync documentation: https://www.notion.so/unknownworlds/How-To-Setup-Unreal-Game-Sync-59cc3348cdde449d8fdc7f39ee60c8b3")
215
- #sync_workspaces()
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['files']['total']
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)['files']['total']
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)['files']['total']
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
  """
@@ -1,27 +1,15 @@
1
- import random
2
1
  import datetime
3
- import json
4
- import time
5
- import sys, os
6
- import requests
7
2
  import logging
8
3
  import socket
9
- from tabulate import tabulate
10
- from pathlib import Path
11
- from pprint import pprint
12
- from ..utils import dumps, abort, get_datafile
13
- from subprocess import check_call, call
4
+ from ..utils import abort
14
5
  from P4 import P4, P4Exception
15
- import shutil
16
6
  from typing import Optional
7
+
17
8
  log = logging.getLogger(__name__)
18
9
 
19
10
  from typer import echo, secho, Option, Typer, confirm, prompt
20
- from rich.progress import track, Progress, SpinnerColumn, MofNCompleteColumn, TimeRemainingColumn, TimeElapsedColumn, BarColumn
11
+ from rich.progress import Progress, MofNCompleteColumn, TimeRemainingColumn, BarColumn
21
12
 
22
- from multiprocessing import Pool, Manager
23
- import multiprocessing
24
- from concurrent.futures import ProcessPoolExecutor
25
13
  app = Typer()
26
14
 
27
15
  hostname = socket.gethostname().lower()
@@ -32,6 +20,7 @@ UE_STREAM = "//project/sn2-main-ue"
32
20
 
33
21
  p4 = None
34
22
 
23
+
35
24
  def connect_p4():
36
25
  p4_conn = P4()
37
26
  try:
@@ -45,7 +34,7 @@ def connect_p4():
45
34
  def main():
46
35
  """
47
36
  Manage task streams.
48
-
37
+
49
38
  This tool is highly opinionated and expects you to be using the //Project/SN2-Main-UE stream and be working in a workspace called <username>_<label>_sn2-main
50
39
  """
51
40
  global p4
@@ -53,20 +42,26 @@ def main():
53
42
  ret = get_current_stream()
54
43
  ignore_file = (path + ".p4ignore.txt").lower()
55
44
  if p4.ignore_file.lower() != ignore_file:
56
- abort(f"Your p4ignore file should be set to '{ignore_file}', not '{p4.ignore_file}'.\nPlease change the setting in your {p4.env('P4CONFIG')} file")
57
-
45
+ abort(
46
+ f"Your p4ignore file should be set to '{ignore_file}', not '{p4.ignore_file}'.\nPlease change the setting in your {p4.env('P4CONFIG')} file"
47
+ )
48
+
58
49
  if "Stream" not in ret:
59
50
  abort("Invalid workspace. You must be working in Streams to use this tool")
60
51
  stream_name = ret["Stream"]
61
52
  parent = ret["Parent"]
62
53
  secho(f"You are currently working in stream: {stream_name}", fg="blue")
63
54
  if parent.lower() != UE_STREAM and stream_name.lower() != UE_STREAM:
64
- abort(f"To use this tool you must be working in the {UE_STREAM} stream but your workspace is set on {stream_name}. Please change your workspace with 'p4 set'")
55
+ abort(
56
+ f"To use this tool you must be working in the {UE_STREAM} stream but your workspace is set on {stream_name}. Please change your workspace with 'p4 set'"
57
+ )
58
+
65
59
 
66
60
  def get_task_streams(owner):
67
61
  lst = p4.run_streams("-F", f"Owner={owner} Type=task baseParent={BASE_STREAM}")
68
62
  return lst
69
63
 
64
+
70
65
  def get_current_stream():
71
66
  try:
72
67
  ret = p4.run_stream("-o")[0]
@@ -77,13 +72,17 @@ def get_current_stream():
77
72
  client_name = client["Client"]
78
73
  except:
79
74
  pass
80
- abort(f"Unable to get a stream from your current workspace, {client_name}. Make sure you are working in the {BASE_STREAM} stream. Error: {e}")
75
+ abort(
76
+ f"Unable to get a stream from your current workspace, {client_name}. Make sure you are working in the {BASE_STREAM} stream. Error: {e}"
77
+ )
81
78
  return ret
82
79
 
80
+
83
81
  def get_current_client():
84
82
  ret = p4.run_client("-o")[0]
85
83
  return ret
86
84
 
85
+
87
86
  def get_clients():
88
87
  try:
89
88
  specs = p4.run_clients("-u", p4.user)
@@ -98,18 +97,20 @@ def get_clients():
98
97
  ret[s["Stream"].lower()] = s
99
98
  return ret
100
99
 
100
+
101
101
  def sync():
102
102
  s = confirm("Sync latest?")
103
103
 
104
104
  if not s:
105
105
  return
106
-
106
+
107
107
  secho(f"Syncing latest...")
108
108
  try:
109
109
  ret = p4.run_sync("-q", f"{path}UE/Subnautica2/...")
110
110
  except P4Exception as e:
111
111
  print(e)
112
112
 
113
+
113
114
  @app.command()
114
115
  def create(label: str = Option(None, prompt="Task branch label")):
115
116
  """
@@ -129,14 +130,13 @@ def create(label: str = Option(None, prompt="Task branch label")):
129
130
  abort(f"You have no workspace mapped to the {UE_STREAM} stream. Please set one up.")
130
131
 
131
132
  ret = p4.run_opened()
132
- if (len(ret)):
133
+ if len(ret):
133
134
  abort("You have opened files. Please revert or submit before creating new task stream.")
134
135
 
135
-
136
- #print(ue_stream_client)
137
- #task_client_name = ue_stream_client["client"] + "_task"
138
- #task_client = None
139
- #for k, c in clients.items():
136
+ # print(ue_stream_client)
137
+ # task_client_name = ue_stream_client["client"] + "_task"
138
+ # task_client = None
139
+ # for k, c in clients.items():
140
140
  # if c["client"] == task_client_name:
141
141
  # echo(f"Reusing existin workspace {k}")
142
142
  # task_client = c
@@ -169,7 +169,7 @@ Paths:
169
169
  """
170
170
  p4.input = args
171
171
  ret = p4.run_stream("-i", "-t", "task")
172
- #print(ret[0])
172
+ # print(ret[0])
173
173
 
174
174
  secho(f"Populating stream {full_stream_name}...")
175
175
  try:
@@ -195,13 +195,14 @@ Paths:
195
195
 
196
196
  secho(f"You are now working in task stream {stream_name} from parent {parent}", bold=True, fg="green")
197
197
 
198
+
198
199
  @app.command()
199
200
  def switch():
200
201
  """
201
202
  Lists your current task streams and lets you switch between them
202
203
  """
203
204
  stream = get_current_stream()
204
- old_stream_name = stream['Stream']
205
+ old_stream_name = stream["Stream"]
205
206
  client = p4.run_client("-o")[0]
206
207
  client_owner = client["Owner"]
207
208
  task_streams = get_task_streams(client_owner)
@@ -212,7 +213,7 @@ def switch():
212
213
  secho(f"{i+1} : {t['Stream']}")
213
214
  if parent:
214
215
  secho(f"0 : {parent}")
215
-
216
+
216
217
  if not task_streams:
217
218
  abort("You have no task streams. You can create one with the 'create' command")
218
219
  n = prompt("\nSelect a stream to work in")
@@ -226,10 +227,10 @@ def switch():
226
227
  new_stream = parent
227
228
  else:
228
229
  try:
229
- new_stream = task_streams[n-1]["Stream"]
230
+ new_stream = task_streams[n - 1]["Stream"]
230
231
  except:
231
232
  abort("Aborted.")
232
-
233
+
233
234
  secho(f"\nSwitching to stream {new_stream}", bold=True)
234
235
  try:
235
236
  p4.run_client("-s", "-S", new_stream)
@@ -252,17 +253,6 @@ def switch():
252
253
  secho(f"Aborted. {err}", fg="red")
253
254
 
254
255
 
255
- def resolve(progress, task_id, files):
256
- p4 = connect_p4()
257
- len_of_task = len(files)
258
- for n, filename in enumerate(files):
259
- progress[task_id] = {"progress": n + 1, "total": len_of_task}
260
- try:
261
- ret = p4.run_resolve("-f", "-am", "-as", filename)
262
- except P4Exception as e:
263
- echo(str(e))
264
-
265
-
266
256
  @app.command()
267
257
  def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the changelist after resolving")):
268
258
  """
@@ -283,19 +273,8 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
283
273
  if r["change"] == "default":
284
274
  abort("Your default changelist must be empty before merging down from main.")
285
275
 
286
- secho(f"Integrating latest from parent {parent} to task stream {stream_name}...", bold=True)
287
-
288
- p4.input = f"""
289
- Change: new
290
- Client: {client}
291
- User: {p4.user}
292
-
293
- Description:
294
- Automatically merge {UE_STREAM} to {stream_name}
295
-
296
- """
297
276
  secho(f"Merging files from {UE_STREAM} to {stream_name}...", bold=True)
298
-
277
+ merge_response = []
299
278
  try:
300
279
  cmd = ["-Af", "-S", stream_name, "-r", f"{stream_name}/..."]
301
280
  merge_response = p4.run_merge(*cmd)
@@ -316,7 +295,7 @@ Description:
316
295
  TimeRemainingColumn(),
317
296
  MofNCompleteColumn(),
318
297
  "{task.description}",
319
- refresh_per_second=0.5, # bit slower updates
298
+ refresh_per_second=10, # bit slower updates
320
299
  ) as progress:
321
300
  task = progress.add_task("", total=num_files)
322
301
  for resp in merge_response:
@@ -327,7 +306,7 @@ Description:
327
306
  resolves.append(ret)
328
307
  except P4Exception as e:
329
308
  echo(str(e))
330
- progress.update(task, advance=1, description="..."+depotFile[-50:])
309
+ progress.update(task, advance=1, description="..." + depotFile[-50:])
331
310
  try:
332
311
  ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
333
312
  except P4Exception as e:
@@ -343,9 +322,11 @@ Description:
343
322
  secho(f" {r['clientFile']}... conflict", fg="yellow")
344
323
  else:
345
324
  secho(f" {r['clientFile']}... ok", fg="green")
346
-
325
+
347
326
  if unresolved:
348
- secho(f"\nThere are conflicting files where you have changed files which have also been changed in {UE_STREAM}.\nYou can force overwrite these files in your task stream or resolve yourself via p4v.")
327
+ secho(
328
+ f"\nThere are conflicting files where you have changed files which have also been changed in {UE_STREAM}.\nYou can force overwrite these files in your task stream or resolve yourself via p4v."
329
+ )
349
330
  overwrite_all = False
350
331
  overwrite_none = False
351
332
  num_skipped = 0
@@ -354,7 +335,9 @@ Description:
354
335
  if not overwrite_all and not overwrite_none:
355
336
  y = prompt(f"[{i+1}/{len(unresolved)}] Overwrite {r['clientFile']} [Yes/No/None/All] ").upper()
356
337
  if y not in ("YES", "Y", "NO", "N", "NONE", "ALL"):
357
- abort(f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}")
338
+ abort(
339
+ f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}"
340
+ )
358
341
  if y in ("ALL"):
359
342
  overwrite_none = False
360
343
  overwrite_all = True
@@ -367,10 +350,12 @@ Description:
367
350
  if y in ("N", "NO") or overwrite_none:
368
351
  secho(f"Skipping {r['clientFile']}...")
369
352
  num_skipped += 1
370
-
353
+
371
354
  if num_skipped:
372
- abort(f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}")
373
-
355
+ abort(
356
+ f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}"
357
+ )
358
+
374
359
  secho("All Unresolved files have been overwritten by parent stream")
375
360
 
376
361
  try:
@@ -382,26 +367,22 @@ Description:
382
367
  if "unresolved" in r:
383
368
  abort("There are still unresolved files in your pending changelist. Please resolve them in p4v")
384
369
  filelist += f" {r['depotFile']}\n"
385
-
386
370
  mr = ""
387
371
  if unresolved:
388
372
  mr = f"{len(unresolved)} unresolvable files were overwritten."
389
373
 
390
-
391
374
  if not nosubmit:
392
-
393
375
  txt = f"""
394
- Change: new
395
- Client: {client}
396
- User: {p4.user}
397
-
398
- Description:
399
- Automatically merge {UE_STREAM} to {stream_name}. {mr}
400
- Files:
401
- {filelist}
402
- """
376
+ Change: new
377
+ Client: {client}
378
+ User: {p4.user}
379
+
380
+ Description:
381
+ Automatically merge {UE_STREAM} to {stream_name}. {mr}
382
+ Files:
383
+ {filelist}"""
403
384
  p4.input = txt
404
- p4.run_submit('-i')
385
+ p4.run_submit("-i")
405
386
 
406
387
  try:
407
388
  ret = p4.run_resolve("-f", "-am", "-as", f"{root_path}/...")
@@ -411,7 +392,7 @@ Description:
411
392
  try:
412
393
  ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
413
394
  except P4Exception as e:
414
- if 'not opened on this client.' in str(e) or "no such file(s)." in str(e):
395
+ if "not opened on this client." in str(e) or "no such file(s)." in str(e):
415
396
  secho(f"Your task stream is now up to date with {UE_STREAM}", fg="green")
416
397
  return
417
398
  else:
@@ -421,7 +402,10 @@ Description:
421
402
  else:
422
403
  abort("Something is amiss. Your task stream is not up to date after the merge. Take a look at p4v")
423
404
  else:
424
- echo(f"Your merge changelist is now ready for submitting. Use this description: 'Automatically merge {UE_STREAM} to {stream_name}. {mr}")
405
+ echo(
406
+ f"Your merge changelist is now ready for submitting. Use this description: 'Automatically merge {UE_STREAM} to {stream_name}. {mr}"
407
+ )
408
+
425
409
 
426
410
  @app.command()
427
411
  def copyup():
@@ -432,13 +416,13 @@ def copyup():
432
416
  if ret:
433
417
  abort("There are unsubmitted files in your workspace")
434
418
 
435
- ## p4 copy -Af -S //Project/jonb-2023-03-03-plugin_functional_tests //Project/SN2-Main/...
419
+ ## p4 copy -Af -S //Project/jonb-2023-03-03-plugin_functional_tests //Project/SN2-Main/...
436
420
  ret = get_current_stream()
437
421
  stream_name = ret["Stream"]
438
422
  parent = ret["Parent"]
439
423
  if ret["Type"] != "task":
440
424
  abort(f"Current stream {stream_name} is not a task stream")
441
-
425
+
442
426
  echo(f"Switching to parent stream {parent}...")
443
427
  p4.run_client("-s", "-S", parent)
444
428
 
@@ -459,6 +443,7 @@ def copyup():
459
443
 
460
444
  secho(f"You can now submit your changelist to {parent} in p4v", fg="green")
461
445
 
446
+
462
447
  @app.command()
463
448
  def delete(current: Optional[bool] = Option(False, help="Delete the current task stream")):
464
449
  """
@@ -479,7 +464,7 @@ def delete(current: Optional[bool] = Option(False, help="Delete the current task
479
464
  parent = None
480
465
  for i, t in enumerate(task_streams):
481
466
  secho(f"{i+1} : {t['Stream']}")
482
-
467
+
483
468
  if not task_streams:
484
469
  abort("You have no task streams.")
485
470
  n = prompt("\nSelect a stream to delete")
@@ -489,8 +474,8 @@ def delete(current: Optional[bool] = Option(False, help="Delete the current task
489
474
  abort("Aborted.")
490
475
  if n < 0 or n > len(task_streams):
491
476
  abort("Aborted.")
492
- stream_name = task_streams[n-1]["Stream"]
493
- delete = confirm(f"Are you sure you want to delete the task stream {stream_name}?")
477
+ stream_name = task_streams[n - 1]["Stream"]
478
+ delete = confirm(f"Are you sure you want to delete the task stream {stream_name}?")
494
479
 
495
480
  if delete:
496
481
  if current:
@@ -506,5 +491,4 @@ def delete(current: Optional[bool] = Option(False, help="Delete the current task
506
491
  else:
507
492
  abort("Aborted")
508
493
  ret = p4.run_sync("-q", "-k", f"{path}...")
509
- #sync()
510
-
494
+ # sync()
@@ -206,6 +206,7 @@ def fmt_date(dt: str):
206
206
  except:
207
207
  return dt
208
208
 
209
+
209
210
  def check_version():
210
211
  """
211
212
  Check for new version on pypi every 10 minutes
@@ -228,21 +229,26 @@ def check_version():
228
229
  v = contents["info"]["version"]
229
230
  my_version = read_version()
230
231
 
231
- if (v != my_version):
232
- secho(f"Version {v} of this tool is available while you are on version {my_version}. Please upgrade using: pip install unknown-cli -U", fg="green", bold=True)
232
+ if v != my_version:
233
+ secho(
234
+ f"Version {v} of this tool is available while you are on version {my_version}. Please upgrade using: pip install unknown-cli -U",
235
+ fg="green",
236
+ bold=True,
237
+ )
233
238
  else:
234
239
  with version_check_file.open("w") as f:
235
240
  f.write(f"{fmt_date(datetime.utcnow())}")
236
241
  except:
237
242
  raise
238
243
 
244
+
239
245
  def check_p4config():
240
246
  try:
241
247
  is_changes = False
242
248
  p4 = P4()
243
249
  ignore_file = "s:\\sn2-main\\.p4ignore.txt".lower()
244
250
  p4_port = "ssl:perforce.reginald.cloud:1666"
245
- cfg = Path(p4.env('P4CONFIG'))
251
+ cfg = Path(p4.env("P4CONFIG"))
246
252
  if p4.ignore_file.lower() != ignore_file:
247
253
  secho(f"Your p4ignore file should be set to '{ignore_file}', not '{p4.ignore_file}'.", fg="yellow")
248
254
  y = confirm(f"Would you like to change the setting in your {cfg} file?")
@@ -286,4 +292,4 @@ def check_p4config():
286
292
  exit(0)
287
293
 
288
294
  except Exception as e:
289
- pass
295
+ pass
@@ -1 +0,0 @@
1
- 0.6.7
File without changes
File without changes
File without changes