MCPcopy Create free account
hub / github.com/git/git / update_client_spec_path_cache

Method update_client_spec_path_cache

git-p4.py:2845–2875  ·  view source on GitHub ↗

Caching file paths by "p4 where" batch query.

(self, files)

Source from the content-addressed store, hash-verified

2843 return clientFile[len(self.client_prefix):]
2844
2845 def update_client_spec_path_cache(self, files):
2846 """Caching file paths by "p4 where" batch query."""
2847
2848 # List depot file paths exclude that already cached
2849 fileArgs = [f['path'] for f in files if decode_path(f['path']) not in self.client_spec_path_cache]
2850
2851 if len(fileArgs) == 0:
2852 return # All files in cache
2853
2854 where_result = p4CmdList(["-x", "-", "where"], stdin=fileArgs)
2855 for res in where_result:
2856 if "code" in res and res["code"] == "error":
2857 # assume error is "... file(s) not in client view"
2858 continue
2859 if "clientFile" not in res:
2860 die("No clientFile in 'p4 where' output")
2861 if "unmap" in res:
2862 # it will list all of them, but only one not unmap-ped
2863 continue
2864 depot_path = decode_path(res['depotFile'])
2865 if gitConfigBool("core.ignorecase"):
2866 depot_path = depot_path.lower()
2867 self.client_spec_path_cache[depot_path] = self.convert_client_path(res["clientFile"])
2868
2869 # not found files or unmap files set to ""
2870 for depotFile in fileArgs:
2871 depotFile = decode_path(depotFile)
2872 if gitConfigBool("core.ignorecase"):
2873 depotFile = depotFile.lower()
2874 if depotFile not in self.client_spec_path_cache:
2875 self.client_spec_path_cache[depotFile] = b''
2876
2877 def map_in_client(self, depot_path):
2878 """Return the relative location in the client where this depot file

Callers 2

commitMethod · 0.80

Calls 5

convert_client_pathMethod · 0.95
decode_pathFunction · 0.85
p4CmdListFunction · 0.85
gitConfigBoolFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected