Browse Source

Fix issue where clientRoot is null due to multiple view mappings that

don't share one root. TODO: should probably leave getClientRoot to
return the "null". It's different than returning None.
testing
leetNightshade 5 years ago
parent
commit
e5a84235cb
  1. 20
      p4Helper.py

20
p4Helper.py

@ -196,7 +196,8 @@ def get_client_root( ):
continue
local_path = normpath( line[ len( clientFile_tag ) : ].strip( ) )
if local_path == "null":
local_path = None
return local_path
return None
@ -230,22 +231,33 @@ class P4Workspace:
ldirectory = self.directory.lower()
oldworkspace_name = None
# If workspace root is null, it could be because there are multiple views and not a single root.
if client_root is None:
results = get_p4_py_results('where', self.directory)
for result in results:
path = result[b'path']
path = re.sub('...$', '', path)
path = normpath(path)
if ldirectory.startswith(path.lower()):
client_root = path
break
if client_root is None or not ldirectory.startswith(client_root.lower()):
#print("\nCurrent directory not in client view, checking other workspaces for user '" + username + "' ...")
oldworkspace_name = parse_info_from_command('p4 info', 'Client name: ')
# get user workspaces
result = get_p4_py_results('workspaces -u ' + username)
results = get_p4_py_results('workspaces -u ' + username)
workspaces = []
for r in result:
for r in results:
whost = get_str_from_process_stdout(r[b'Host'])
if whost is not None and len(whost) != 0 and client_host != whost:
continue
workspace = {'root': get_str_from_process_stdout(r[b'Root']), 'name': get_str_from_process_stdout(r[b'client'])}
workspaces.append(workspace)
del result
del results
# check current directory against current workspace, see if it matches existing workspaces.
for w in workspaces:

Loading…
Cancel
Save