MCPcopy Index your code
hub / github.com/git/git / p4Where

Function p4Where

git-p4.py:948–982  ·  view source on GitHub ↗
(depotPath)

Source from the content-addressed store, hash-verified

946
947
948def p4Where(depotPath):
949 if not depotPath.endswith("/"):
950 depotPath += "/"
951 depotPathLong = depotPath + "..."
952 outputList = p4CmdList(["where", depotPathLong])
953 output = None
954 for entry in outputList:
955 if "depotFile" in entry:
956 # Search for the base client side depot path, as long as it starts with the branch's P4 path.
957 # The base path always ends with "/...".
958 entry_path = decode_path(entry['depotFile'])
959 if entry_path.find(depotPath) == 0 and entry_path[-4:] == "/...":
960 output = entry
961 break
962 elif "data" in entry:
963 data = entry.get("data")
964 space = data.find(" ")
965 if data[:space] == depotPath:
966 output = entry
967 break
968 if output is None:
969 return ""
970 if output["code"] == "error":
971 return ""
972 clientPath = ""
973 if "path" in output:
974 clientPath = decode_path(output['path'])
975 elif "data" in output:
976 data = output.get("data")
977 lastSpace = data.rfind(b" ")
978 clientPath = decode_path(data[lastSpace + 1:])
979
980 if clientPath.endswith("..."):
981 clientPath = clientPath[:-3]
982 return clientPath
983
984
985def currentGitBranch():

Callers 1

runMethod · 0.85

Calls 2

p4CmdListFunction · 0.85
decode_pathFunction · 0.85

Tested by

no test coverage detected