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.
This commit is contained in:
parent
972e9ca689
commit
e5a84235cb
20
p4Helper.py
20
p4Helper.py
|
@ -196,7 +196,8 @@ def get_client_root( ):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
local_path = normpath( line[ len( clientFile_tag ) : ].strip( ) )
|
local_path = normpath( line[ len( clientFile_tag ) : ].strip( ) )
|
||||||
|
if local_path == "null":
|
||||||
|
local_path = None
|
||||||
return local_path
|
return local_path
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -230,22 +231,33 @@ class P4Workspace:
|
||||||
ldirectory = self.directory.lower()
|
ldirectory = self.directory.lower()
|
||||||
oldworkspace_name = None
|
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()):
|
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 + "' ...")
|
#print("\nCurrent directory not in client view, checking other workspaces for user '" + username + "' ...")
|
||||||
|
|
||||||
oldworkspace_name = parse_info_from_command('p4 info', 'Client name: ')
|
oldworkspace_name = parse_info_from_command('p4 info', 'Client name: ')
|
||||||
|
|
||||||
# get user workspaces
|
# get user workspaces
|
||||||
result = get_p4_py_results('workspaces -u ' + username)
|
results = get_p4_py_results('workspaces -u ' + username)
|
||||||
workspaces = []
|
workspaces = []
|
||||||
for r in result:
|
for r in results:
|
||||||
whost = get_str_from_process_stdout(r[b'Host'])
|
whost = get_str_from_process_stdout(r[b'Host'])
|
||||||
if whost is not None and len(whost) != 0 and client_host != whost:
|
if whost is not None and len(whost) != 0 and client_host != whost:
|
||||||
continue
|
continue
|
||||||
workspace = {'root': get_str_from_process_stdout(r[b'Root']), 'name': get_str_from_process_stdout(r[b'client'])}
|
workspace = {'root': get_str_from_process_stdout(r[b'Root']), 'name': get_str_from_process_stdout(r[b'client'])}
|
||||||
workspaces.append(workspace)
|
workspaces.append(workspace)
|
||||||
|
|
||||||
del result
|
del results
|
||||||
|
|
||||||
# check current directory against current workspace, see if it matches existing workspaces.
|
# check current directory against current workspace, see if it matches existing workspaces.
|
||||||
for w in workspaces:
|
for w in workspaces:
|
||||||
|
|
Loading…
Reference in New Issue