unknown-cli 0.9.2__tar.gz → 0.9.3__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.
Files changed (23) hide show
  1. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/PKG-INFO +1 -1
  2. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/PKG-INFO +1 -1
  3. unknown-cli-0.9.3/unknowncli/VERSION +1 -0
  4. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/commands/project.py +5 -4
  5. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/commands/task.py +58 -58
  6. unknown-cli-0.9.2/unknowncli/VERSION +0 -1
  7. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/README.md +0 -0
  8. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/setup.cfg +0 -0
  9. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/setup.py +0 -0
  10. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/SOURCES.txt +0 -0
  11. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/dependency_links.txt +0 -0
  12. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/entry_points.txt +0 -0
  13. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/requires.txt +0 -0
  14. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknown_cli.egg-info/top_level.txt +0 -0
  15. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/__init__.py +0 -0
  16. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/__main__.py +0 -0
  17. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/commands/__init__.py +0 -0
  18. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/commands/preflight.py +0 -0
  19. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/commands/unreal.py +0 -0
  20. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/data/.p4ignore.txt +0 -0
  21. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/set_registry_keys.py +0 -0
  22. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/set_url_handler.py +0 -0
  23. {unknown-cli-0.9.2 → unknown-cli-0.9.3}/unknowncli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.9.2
3
+ Version: 0.9.3
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.9.2
3
+ Version: 0.9.3
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -0,0 +1 @@
1
+ 0.9.3
@@ -24,10 +24,11 @@ STREAMS = {
24
24
  }
25
25
  SUB_STREAMS = {
26
26
  "//project/sn2-main": {
27
- "Project ": "//project/sn2-main-ue",
28
- "Project+Raw": "//project/sn2-main-ue-raw",
29
- "Everything ": "//project/sn2-main",
30
- "Staging ": "//project/sn2-staging",
27
+ "Project" : "//project/sn2-main-ue",
28
+ "Project+RawRecommended": "//project/sn2-main-ue-raw-content",
29
+ "Project+RawAll" : "//project/sn2-main-ue-raw",
30
+ "Everything" : "//project/sn2-main",
31
+ "Staging" : "//project/sn2-staging",
31
32
  }
32
33
  }
33
34
 
@@ -3,6 +3,7 @@ import logging
3
3
  import socket
4
4
  import sys
5
5
  from ..utils import abort
6
+ from .project import SUB_STREAMS
6
7
  from P4 import P4, P4Exception
7
8
  from typing import Optional
8
9
  from subprocess import check_call
@@ -18,7 +19,8 @@ hostname = socket.gethostname().lower()
18
19
  SUBST_DRIVE = "S:"
19
20
  path = f"{SUBST_DRIVE}\\sn2-main\\"
20
21
  BASE_STREAM = "//Project/SN2-Main"
21
- UE_STREAM = "//project/sn2-main-ue"
22
+ STREAM_LIST_LOWER = [s.lower() for s in list(list(SUB_STREAMS.values())[0].values())]
23
+ STREAM_LIST_STRING = "\n\t" + "\n\t".join(STREAM_LIST_LOWER)
22
24
 
23
25
  p4 = None
24
26
 
@@ -53,9 +55,11 @@ def main():
53
55
  stream_name = ret["Stream"]
54
56
  parent = ret["Parent"]
55
57
  secho(f"You are currently working in stream: {stream_name}", fg="blue")
56
- if parent.lower() != UE_STREAM and stream_name.lower() != UE_STREAM:
58
+ if parent.lower() not in STREAM_LIST_LOWER and stream_name.lower() not in STREAM_LIST_LOWER:
57
59
  abort(
58
- 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'"
60
+ f"To use this tool you must be working in a valid stream but your workspace is set to {stream_name}." +
61
+ "\nPlease change to a relevant workspace with 'p4 set p4client=<your_valid_workspace>'" +
62
+ "\nOr set up a workspace with 'unk project setup'."
59
63
  )
60
64
 
61
65
 
@@ -108,7 +112,9 @@ def sync():
108
112
 
109
113
  secho(f"Syncing latest...")
110
114
  try:
111
- ret = p4.run_sync("-q", f"{path}UE/Subnautica2/...")
115
+ ret = p4.run_client("-o")[0]
116
+ root_path = ret["Root"]
117
+ p4.run_sync("-q", f"{root_path}/...")
112
118
  except P4Exception as e:
113
119
  print(e)
114
120
 
@@ -118,37 +124,21 @@ def create(label: str = Option(None, prompt="Task branch label")):
118
124
  """
119
125
  Create a new task branch
120
126
  """
121
-
127
+
122
128
  if not label:
123
129
  abort("Aborted.")
124
- clients = get_clients()
125
- current_stream = get_current_stream()["Stream"].lower()
126
- if current_stream != UE_STREAM:
127
- abort(f"You are in the {current_stream} stream. Please switch to the {UE_STREAM} main stream before creating a new task stream")
128
-
129
- ue_stream_client = None
130
- for k, c in clients.items():
131
- if k == UE_STREAM:
132
- ue_stream_client = c
133
- if not ue_stream_client:
134
- abort(f"You have no workspace mapped to the {UE_STREAM} stream. Please set one up.")
130
+ current_stream = get_current_stream()["Stream"]
131
+ if current_stream.lower() not in STREAM_LIST_LOWER:
132
+ abort(f"You are working in stream {current_stream}. Please first run 'unk task switch' to a parent stream.\nValid parent streams:{STREAM_LIST_STRING}")
135
133
 
136
134
  ret = p4.run_opened()
137
135
  if len(ret):
138
136
  abort("You have opened files. Please revert or submit before creating new task stream.")
139
137
 
140
- # print(ue_stream_client)
141
- # task_client_name = ue_stream_client["client"] + "_task"
142
- # task_client = None
143
- # for k, c in clients.items():
144
- # if c["client"] == task_client_name:
145
- # echo(f"Reusing existin workspace {k}")
146
- # task_client = c
147
- # break
148
- # sync latest from parent
149
- echo(f"Syncing parent branch {path}...")
138
+ client_root = get_current_client()["Root"]
139
+ echo(f"Syncing parent branch {client_root}\...")
150
140
  try:
151
- ret = p4.run_sync("-q", f"{path}...")
141
+ ret = p4.run_sync("-q", f"{client_root}\...")
152
142
  except P4Exception as e:
153
143
  secho(str(e), fg="yellow")
154
144
  abort("Please fix the issues above before continuing")
@@ -157,12 +147,12 @@ def create(label: str = Option(None, prompt="Task branch label")):
157
147
  label = label.replace(" ", "_").lower()
158
148
  stream_name = f"{p4.user}-{d}-{label}"
159
149
  full_stream_name = f"//Project/{stream_name}"
160
- secho(f"Creating task stream {stream_name} from {UE_STREAM}...")
150
+ secho(f"Creating task stream {stream_name} from {current_stream} ...")
161
151
  args = f"""
162
152
  Stream: {full_stream_name}
163
153
  Owner: {p4.user}
164
154
  Name: {stream_name}
165
- Parent: {UE_STREAM}
155
+ Parent: {current_stream}
166
156
  Type: task
167
157
  Description:
168
158
  Created by {p4.user}.
@@ -181,14 +171,14 @@ Paths:
181
171
  TextColumn("Populating {task.description}"),
182
172
  transient=True,
183
173
  ) as progress:
184
- progress.add_task(description=f"{full_stream_name}...", total=None)
174
+ progress.add_task(description=f"{full_stream_name} ...", total=None)
185
175
  ret = p4.run_populate("-o", "-S", full_stream_name, "-r", "-d", "Initial branch")
186
-
176
+
187
177
  except P4Exception as e:
188
178
  if e.errors:
189
179
  secho(e.errors[0], fg="yellow")
190
180
 
191
- secho(f"Switching current workspace {p4.client} to {full_stream_name}...")
181
+ secho(f"Switching current workspace {p4.client} to {full_stream_name} ...")
192
182
  p4.run_client("-s", "-S", full_stream_name)
193
183
  ret = p4.run_client("-o")[0]
194
184
  root_path = ret["Root"]
@@ -201,7 +191,7 @@ Paths:
201
191
  abort(f"Something went wrong. Current stream {stream_name} is not a task stream")
202
192
 
203
193
  # update the server without syncing
204
- ret = p4.run_sync("-q", "-k", f"{path}...")
194
+ ret = p4.run_sync("-q", "-k", f"{root_path}\...")
205
195
 
206
196
  secho(f"You are now working in task stream {stream_name} from parent {parent}", bold=True, fg="green")
207
197
 
@@ -270,7 +260,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
270
260
  """
271
261
  ret = p4.run_stream("-o")[0]
272
262
  stream_name = ret["Stream"]
273
- parent = ret["Parent"]
263
+ parent_stream = ret["Parent"]
274
264
  if ret["Type"] != "task":
275
265
  abort(f"Current stream {stream_name} is not a task stream")
276
266
 
@@ -291,7 +281,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
291
281
  TextColumn("{task.description}"),
292
282
  transient=True,
293
283
  ) as progress:
294
- progress.add_task(description=f"Merging files from {UE_STREAM} to {stream_name}...", total=None)
284
+ progress.add_task(description=f"Merging files from {parent_stream} to {stream_name}/...", total=None)
295
285
  try:
296
286
  cmd = ["-Af", "-S", stream_name, "-r", f"{stream_name}/..."]
297
287
  merge_response = p4.run_merge(*cmd)
@@ -302,7 +292,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
302
292
  if e.warnings:
303
293
  secho(e.warnings[0], fg="yellow")
304
294
  if "already integrated" in str(e):
305
- secho(f"Your task stream is already up to date with {UE_STREAM}", fg="green")
295
+ secho(f"Your task stream is already up to date with {parent_stream}", fg="green")
306
296
  return
307
297
 
308
298
  except P4Exception as e:
@@ -342,13 +332,13 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
342
332
  for r in ret:
343
333
  if "unresolved" in r:
344
334
  unresolved.append(r)
345
- secho(f" {r['clientFile']}... conflict", fg="yellow")
335
+ secho(f" {r['clientFile']} ... conflict", fg="yellow")
346
336
  else:
347
- secho(f" {r['clientFile']}... ok", fg="green")
337
+ secho(f" {r['clientFile']} ... ok", fg="green")
348
338
 
349
339
  if unresolved:
350
340
  secho(
351
- 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."
341
+ f"\nThere are conflicting files where you have changed files which have also been changed in {parent_stream}.\nYou can force overwrite these files in your task stream or resolve yourself via p4v."
352
342
  )
353
343
  overwrite_all = False
354
344
  overwrite_none = False
@@ -359,7 +349,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
359
349
  y = prompt(f"[{i+1}/{len(unresolved)}] Overwrite {r['clientFile']} [Yes/No/None/All] ").upper()
360
350
  if y not in ("YES", "Y", "NO", "N", "NONE", "ALL"):
361
351
  abort(
362
- f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}"
352
+ f"Please resolve remaining files in p4v. You can use this description: Automatically merge {parent_stream} to {stream_name}"
363
353
  )
364
354
  if y in ("ALL"):
365
355
  overwrite_none = False
@@ -371,12 +361,12 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
371
361
  if y in ("Y", "YES") or overwrite_all:
372
362
  ret = p4.run_resolve("-f", "-at", f"{r['clientFile']}")
373
363
  if y in ("N", "NO") or overwrite_none:
374
- secho(f"Skipping {r['clientFile']}...")
364
+ secho(f"Skipping {r['clientFile']} ...")
375
365
  num_skipped += 1
376
366
 
377
367
  if num_skipped:
378
368
  abort(
379
- f"Please resolve remaining files in p4v. You can use this description: Automatically merge {UE_STREAM} to {stream_name}"
369
+ f"Please resolve remaining files in p4v. You can use this description: Automatically merge {parent_stream} to {stream_name}"
380
370
  )
381
371
 
382
372
  secho("All Unresolved files have been overwritten by parent stream")
@@ -401,7 +391,7 @@ Client: {client}
401
391
  User: {p4.user}
402
392
 
403
393
  Description:
404
- Automatically merge {UE_STREAM} to {stream_name}. {mr}
394
+ Automatically merge {parent_stream} to {stream_name}. {mr}
405
395
  Files:
406
396
  {filelist}"""
407
397
  p4.input = txt
@@ -416,17 +406,17 @@ Files:
416
406
  ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
417
407
  except P4Exception as e:
418
408
  if "not opened on this client." in str(e) or "no such file(s)." in str(e):
419
- secho(f"Your task stream is now up to date with {UE_STREAM}", fg="green")
409
+ secho(f"Your task stream is now up to date with {parent_stream}", fg="green")
420
410
  return
421
411
  else:
422
412
  echo(str(e))
423
413
  if not ret:
424
- secho(f"Your task stream is now up to date with {UE_STREAM}", fg="green")
414
+ secho(f"Your task stream is now up to date with {parent_stream}", fg="green")
425
415
  else:
426
416
  abort("Something is amiss. Your task stream is not up to date after the merge. Take a look at p4v")
427
417
  else:
428
418
  echo(
429
- f"Your merge changelist is now ready for submitting. Use this description: 'Automatically merge {UE_STREAM} to {stream_name}. {mr}"
419
+ f"Your merge changelist is now ready for submitting. Use this description: 'Automatically merge {parent_stream} to {stream_name}. {mr}"
430
420
  )
431
421
 
432
422
 
@@ -446,17 +436,20 @@ def copyup():
446
436
  if ret["Type"] != "task":
447
437
  abort(f"Current stream {stream_name} is not a task stream")
448
438
 
449
- echo(f"Switching to parent stream {parent}...")
439
+ secho(f"Switching to parent stream {parent} ...", fg="blue")
450
440
  p4.run_client("-s", "-S", parent)
451
441
 
452
442
  p4.run_sync("-q")
453
- echo(f"Performing copy from {stream_name} to {ret['baseParent']}...")
443
+ echo(f"Performing copy from {stream_name} to {ret['baseParent']}/...")
454
444
  try:
455
445
  copy_ret = p4.run_copy("-Af", "-S", stream_name, ret["baseParent"] + "/...")
456
446
  except P4Exception as e:
457
447
  if "up-to-date" in str(e):
458
448
  secho(f"Nothing to do. Parent {parent} is identical to task stream {stream_name}", fg="green")
459
449
  return
450
+ elif "No such file(s)" in str(e):
451
+ secho(f"Nothing to do. No changes were made yet in task stream {stream_name}", fg="green")
452
+ return
460
453
  else:
461
454
  raise
462
455
  else:
@@ -475,13 +468,12 @@ def delete(current: Optional[bool] = Option(False, help="Delete the current task
475
468
  ret = p4.run_stream("-o")[0]
476
469
  current_stream_name = ret["Stream"]
477
470
  parent = ret["Parent"]
471
+ root_path = get_current_client()["Root"]
478
472
 
479
473
  if current:
480
474
  if ret["Type"] != "task":
481
475
  abort(f"Current stream {current_stream_name} is not a task stream")
482
-
483
- if confirm("Are you sure you want to delete the current task stream?"):
484
- streams_to_delete = [current_stream_name]
476
+ streams_to_delete = [current_stream_name]
485
477
  else:
486
478
  client = p4.run_client("-o")[0]
487
479
  client_owner = client["Owner"]
@@ -505,24 +497,32 @@ def delete(current: Optional[bool] = Option(False, help="Delete the current task
505
497
  if n <= 0 or n > len(task_streams):
506
498
  abort("Aborted.")
507
499
  stream_name = task_streams[n - 1]["Stream"]
508
- if confirm(f"Are you sure you want to delete the task stream {stream_name}?"):
509
- streams_to_delete = [stream_name]
500
+ streams_to_delete = [stream_name]
510
501
 
511
502
  if streams_to_delete:
503
+ streams_to_delete_string = "\n\t" + "\n\t".join(
504
+ [f"(**YOUR CURRENT TASK STREAM**) {x}" if current_stream_name == x else x for x in streams_to_delete]
505
+ )
506
+ if not confirm(
507
+ f"==============\nTask stream(s) to delete:{streams_to_delete_string}" +
508
+ "\nAre you sure you want to delete these task stream(s)?"
509
+ ):
510
+ abort("Aborted.")
511
+
512
512
  if current_stream_name in streams_to_delete:
513
513
  if not parent:
514
- abort("Please switch to sn2-main stream before continuing")
515
- secho(f"Switching to {parent}...")
514
+ abort(f"Please run 'unk task switch' to a parent stream before continuing:{STREAM_LIST_STRING}")
515
+ secho(f"Switching to {parent} before deleting the task stream ...")
516
516
  p4.run_client("-s", "-S", parent)
517
- ret = p4.run_sync("-q", f"{path}...")
517
+ ret = p4.run_sync("-q", f"{root_path}\...")
518
518
 
519
519
  for stream_name in streams_to_delete:
520
520
  cmd = [sys.executable, "s:/sn2-main/BuildScripts/trigger_task_stream_deletion.py", stream_name]
521
- secho(f"Deleting task stream {stream_name}...")
521
+ secho(f"Deleting task stream {stream_name} ...")
522
522
 
523
523
  check_call(cmd)
524
524
  secho("Request to delete selected streams has been sent. It might take a few minutes to finish", fg="green")
525
525
  else:
526
526
  abort("Aborted")
527
- ret = p4.run_sync("-q", "-k", f"{path}...")
527
+ ret = p4.run_sync("-q", "-k", f"{root_path}\...")
528
528
  # sync()
@@ -1 +0,0 @@
1
- 0.9.2
File without changes
File without changes
File without changes