unknown-cli 0.9.5__tar.gz → 0.9.7__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.5 → unknown-cli-0.9.7}/PKG-INFO +1 -1
  2. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/PKG-INFO +1 -1
  3. unknown-cli-0.9.7/unknowncli/VERSION +1 -0
  4. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/commands/preflight.py +4 -5
  5. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/commands/project.py +2 -1
  6. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/commands/task.py +45 -20
  7. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/commands/unreal.py +3 -3
  8. unknown-cli-0.9.5/unknowncli/VERSION +0 -1
  9. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/README.md +0 -0
  10. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/setup.cfg +0 -0
  11. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/setup.py +0 -0
  12. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/SOURCES.txt +0 -0
  13. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/dependency_links.txt +0 -0
  14. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/entry_points.txt +0 -0
  15. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/requires.txt +0 -0
  16. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknown_cli.egg-info/top_level.txt +0 -0
  17. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/__init__.py +0 -0
  18. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/__main__.py +0 -0
  19. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/commands/__init__.py +0 -0
  20. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/data/.p4ignore.txt +0 -0
  21. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/set_registry_keys.py +0 -0
  22. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/set_url_handler.py +0 -0
  23. {unknown-cli-0.9.5 → unknown-cli-0.9.7}/unknowncli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unknown-cli
3
- Version: 0.9.5
3
+ Version: 0.9.7
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.5
3
+ Version: 0.9.7
4
4
  Summary: Unknown Commandline Tool
5
5
  Home-page: UNKNOWN
6
6
  Author:
@@ -0,0 +1 @@
1
+ 0.9.7
@@ -504,7 +504,7 @@ def sync_scripts():
504
504
  # Use 'p4 where' on the local path to figure out where the scripts depot path would be.
505
505
  # Note this is needed because the stream path can be different from the actual depot path.
506
506
  try:
507
- scripts_depot_path = p4.run_where(f"{client_root}\{SCRIPTS_DIR}\*")[0]["depotFile"]
507
+ scripts_depot_path = p4.run_where(os.path.join(client_root, SCRIPTS_DIR, "*"))[0]["depotFile"]
508
508
  except:
509
509
  # Path is not under the root which will be the case for generated unix Swarm workspaces.
510
510
  continue
@@ -517,17 +517,16 @@ def sync_scripts():
517
517
 
518
518
 
519
519
  def get_script_path(script_file_name):
520
- main_root = f"s:/sn2-main/{SCRIPTS_DIR}"
521
- main_path = f"{main_root}/{script_file_name}"
520
+ main_path = os.path.join("s:", os.sep, "sn2-main", SCRIPTS_DIR, script_file_name)
522
521
  if os.path.isfile(main_path):
523
522
  return main_path
524
523
  if p4_client:
525
- p4_path = f"{get_client_root(p4_client)}/{SCRIPTS_DIR}/{script_file_name}"
524
+ p4_path = os.path.join(get_client_root(p4_client), SCRIPTS_DIR, script_file_name)
526
525
  if os.path.isfile(p4_path):
527
526
  return p4_path
528
527
  client_root = p4.run_info()[0]["clientRoot"]
529
528
  if client_root:
530
- p4_path = f"{client_root}/{SCRIPTS_DIR}/{script_file_name}"
529
+ p4_path = os.path.join(client_root, SCRIPTS_DIR, script_file_name)
531
530
  if os.path.isfile(p4_path):
532
531
  return p4_path
533
532
  abort(f"Failed to find script '{script_file_name}', post for help on Slack!")
@@ -19,6 +19,7 @@ app = Typer()
19
19
 
20
20
  hostname = socket.gethostname().lower()
21
21
  SUBST_DRIVE = "S:"
22
+ BASE_STREAM = "//Project/SN2-Main"
22
23
  STREAMS = {
23
24
  "sn2-main": "//project/sn2-main-ue"
24
25
  }
@@ -223,7 +224,7 @@ def setup(
223
224
  else:
224
225
  computer_name = input
225
226
  for stream_name, stream in STREAMS.items():
226
- mapping = f"{root_path}/{stream_name}"
227
+ mapping = os.path.join(root_path, stream_name)
227
228
  found = False
228
229
  for r in all_client_specs:
229
230
  root = r["Root"].lower()
@@ -1,9 +1,10 @@
1
1
  import datetime
2
2
  import logging
3
+ import os
3
4
  import socket
4
5
  import sys
5
6
  from ..utils import abort
6
- from .project import SUB_STREAMS
7
+ from .project import BASE_STREAM, SUB_STREAMS
7
8
  from P4 import P4, P4Exception
8
9
  from typing import Optional
9
10
  from subprocess import check_call
@@ -18,7 +19,6 @@ app = Typer()
18
19
  hostname = socket.gethostname().lower()
19
20
  SUBST_DRIVE = "S:"
20
21
  path = f"{SUBST_DRIVE}\\sn2-main\\"
21
- BASE_STREAM = "//Project/SN2-Main"
22
22
  STREAM_LIST_LOWER = [s.lower() for s in list(list(SUB_STREAMS.values())[0].values())]
23
23
  STREAM_LIST_STRING = "\n\t" + "\n\t".join(STREAM_LIST_LOWER)
24
24
 
@@ -63,8 +63,9 @@ def main():
63
63
  )
64
64
 
65
65
 
66
- def get_task_streams(owner):
67
- lst = p4.run_streams("-F", f"Owner={owner} Type=task baseParent={BASE_STREAM}")
66
+ def get_task_streams(owner: str=""):
67
+ streams_filter = f"Type=task baseParent={BASE_STREAM}" + ( f" Owner={owner}" if owner else "" )
68
+ lst = p4.run_streams("-F", streams_filter)
68
69
  return lst
69
70
 
70
71
 
@@ -114,7 +115,7 @@ def sync():
114
115
  try:
115
116
  ret = p4.run_client("-o")[0]
116
117
  root_path = ret["Root"]
117
- p4.run_sync("-q", f"{root_path}/...")
118
+ p4.run_sync("-q", os.path.join(root_path, "..."))
118
119
  except P4Exception as e:
119
120
  print(e)
120
121
 
@@ -202,25 +203,29 @@ Paths:
202
203
 
203
204
 
204
205
  @app.command()
205
- def switch():
206
+ def switch(owned: Optional[bool] = Option(True, help="See only owned task streams")):
206
207
  """
207
208
  Lists your current task streams and lets you switch between them
208
209
  """
209
210
  stream = get_current_stream()
210
211
  old_stream_name = stream["Stream"]
211
212
  client = p4.run_client("-o")[0]
212
- client_owner = client["Owner"]
213
- task_streams = get_task_streams(client_owner)
213
+ task_streams = get_task_streams(client["Owner"] if owned else "")
214
+ if owned and not task_streams:
215
+ secho("You have no owned task streams. You can create one with the 'create' command.", bold=True)
216
+ if confirm("\nDo you want to instead see other streams that you don't own?"):
217
+ switch(owned=False)
218
+ abort("")
214
219
  parent = None
215
220
  if stream["Type"] == "task":
216
221
  parent = stream["Parent"]
217
222
  for i, t in enumerate(task_streams):
218
223
  secho(f"{i+1} : {t['Stream']}")
219
224
  if parent:
220
- secho(f"0 : {parent}")
225
+ secho(f"0 : (Parent stream) {parent}")
226
+ if owned:
227
+ secho(f"99 : <See other streams, including task streams that you don't own>")
221
228
 
222
- if not task_streams:
223
- abort("You have no task streams. You can create one with the 'create' command")
224
229
  n = prompt("\nSelect a stream to work in")
225
230
  if n is None:
226
231
  abort("No stream selected")
@@ -228,8 +233,11 @@ def switch():
228
233
  n = int(n)
229
234
  except:
230
235
  abort("Aborted.")
231
- if n == 0:
236
+ if parent and n == 0:
232
237
  new_stream = parent
238
+ elif owned and n == 99:
239
+ switch(owned=False)
240
+ abort("")
233
241
  else:
234
242
  try:
235
243
  new_stream = task_streams[n - 1]["Stream"]
@@ -326,7 +334,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
326
334
  echo(str(e))
327
335
  progress.update(task, advance=1, description="..." + depotFile[-50:])
328
336
  try:
329
- ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
337
+ ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", os.path.join(root_path, "..."))
330
338
  except P4Exception as e:
331
339
  echo(str(e))
332
340
 
@@ -377,7 +385,7 @@ def mergedown(nosubmit: Optional[bool] = Option(False, help="Do not submit the c
377
385
  secho("All Unresolved files have been overwritten by parent stream")
378
386
 
379
387
  try:
380
- ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
388
+ ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", os.path.join(root_path, "..."))
381
389
  except P4Exception as e:
382
390
  echo(str(e))
383
391
  filelist = ""
@@ -403,14 +411,19 @@ Files:
403
411
  p4.run_submit("-i")
404
412
 
405
413
  try:
406
- ret = p4.run_resolve("-f", "-am", "-as", f"{root_path}/...")
414
+ ret = p4.run_resolve("-f", "-am", "-as", os.path.join(root_path, "..."))
407
415
  except P4Exception as e:
408
416
  if "no file(s) to resolve" not in str(e):
409
417
  raise
410
418
  try:
411
- ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", f"{root_path}/...")
419
+ ret = p4.run_fstat("-Olhp", "-Rco", "-e", "default", os.path.join(root_path, "..."))
412
420
  except P4Exception as e:
413
- if "not opened on this client." in str(e) or "no such file(s)." in str(e):
421
+ empty_changelist_msg_list = [
422
+ "not opened on this client.",
423
+ "not opened in that changelist",
424
+ "no such file(s)."
425
+ ]
426
+ if any([msg for msg in empty_changelist_msg_list if msg in str(e)]):
414
427
  secho(f"Your task stream is now up to date with {parent_stream}", fg="green")
415
428
  return
416
429
  else:
@@ -426,7 +439,7 @@ Files:
426
439
 
427
440
 
428
441
  @app.command()
429
- def copyup():
442
+ def copyup(force: Optional[bool] = Option(False, help="Use p4 copy force arguments: -f -F")):
430
443
  """
431
444
  Finish the task and copy into the parent stream
432
445
  """
@@ -445,9 +458,12 @@ def copyup():
445
458
  p4.run_client("-s", "-S", parent)
446
459
 
447
460
  p4.run_sync("-q")
448
- echo(f"Performing copy from {stream_name} to {ret['baseParent']}/...")
461
+ copy_target = f"{ret['baseParent']}/..."
462
+ echo(f"Performing copy from {stream_name} to {copy_target}")
463
+ copy_args = [ "-Af", "-S", stream_name, copy_target ]
464
+ force_copy_args = [ "-f", "-F" ]
449
465
  try:
450
- copy_ret = p4.run_copy("-Af", "-S", stream_name, ret["baseParent"] + "/...")
466
+ copy_ret = p4.run_copy(*(force_copy_args if force else []), *copy_args)
451
467
  except P4Exception as e:
452
468
  if "up-to-date" in str(e):
453
469
  secho(f"Nothing to do. Parent {parent} is identical to task stream {stream_name}", fg="green")
@@ -455,6 +471,15 @@ def copyup():
455
471
  elif "No such file(s)" in str(e):
456
472
  secho(f"Nothing to do. No changes were made yet in task stream {stream_name}", fg="green")
457
473
  return
474
+ elif not force and "cannot 'copy' over outstanding 'merge' changes" in str(e):
475
+ # Occurs when mergedown is not complete but it can be the case when P4 has issues
476
+ # merging rename/move+edit and the fix is to force merge which causes "outstanding...".
477
+ secho(f"\n{str(e)}", fg="yellow")
478
+ if confirm("Try a force copy? (Do this if you're sure that you're done with mergedowns)"):
479
+ copy_ret = p4.run_copy(*force_copy_args, *copy_args)
480
+ else:
481
+ secho("No action taken.")
482
+ return
458
483
  else:
459
484
  raise
460
485
  else:
@@ -1,4 +1,4 @@
1
- import time
1
+ import time
2
2
  import requests
3
3
  import logging
4
4
  from pathlib import Path
@@ -49,7 +49,7 @@ def diff(first, second):
49
49
  abort(f"{first} or {second} not found")
50
50
  secho(f"Diffing the following files:\n {first}\n {second}", bold=True)
51
51
 
52
- # with open("c:/temp/out.log", "w") as f:
52
+ # with open("c:\\temp\\out.log", "w") as f:
53
53
  # f.write(f"Diffing the following files:\n {first}\n {second}")
54
54
  left = quote_plus(first)
55
55
  right = quote_plus(second)
@@ -60,7 +60,7 @@ def diff(first, second):
60
60
  print(resp.text)
61
61
  except Exception as e:
62
62
  raise
63
- # with open("c:/temp/out.log", "w") as f:
63
+ # with open("c:\\temp\\out.log", "w") as f:
64
64
  # f.write(str(e))
65
65
 
66
66
  @app.command()
@@ -1 +0,0 @@
1
- 0.9.5
File without changes
File without changes
File without changes