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

Function p4_build_cmd

git-p4.py:97–142  ·  view source on GitHub ↗

Build a suitable p4 command line. This consolidates building and returning a p4 command line into one location. It means that hooking into the environment, or other configuration can be done more easily.

(cmd)

Source from the content-addressed store, hash-verified

95
96
97def p4_build_cmd(cmd):
98 """Build a suitable p4 command line.
99
100 This consolidates building and returning a p4 command line into one
101 location. It means that hooking into the environment, or other
102 configuration can be done more easily.
103 """
104 real_cmd = ["p4"]
105
106 user = gitConfig("git-p4.user")
107 if len(user) > 0:
108 real_cmd += ["-u", user]
109
110 password = gitConfig("git-p4.password")
111 if len(password) > 0:
112 real_cmd += ["-P", password]
113
114 port = gitConfig("git-p4.port")
115 if len(port) > 0:
116 real_cmd += ["-p", port]
117
118 host = gitConfig("git-p4.host")
119 if len(host) > 0:
120 real_cmd += ["-H", host]
121
122 client = gitConfig("git-p4.client")
123 if len(client) > 0:
124 real_cmd += ["-c", client]
125
126 retries = gitConfigInt("git-p4.retries")
127 if retries is None:
128 # Perform 3 retries by default
129 retries = 3
130 if retries > 0:
131 # Provide a way to not pass this option by setting git-p4.retries to 0
132 real_cmd += ["-r", str(retries)]
133
134 real_cmd += cmd
135
136 # now check that we can actually talk to the server
137 global p4_access_checked
138 if not p4_access_checked:
139 p4_access_checked = True # suppress access checks in p4_check_access itself
140 p4_check_access()
141
142 return real_cmd
143
144
145def git_dir(path):

Callers 7

p4_write_pipeFunction · 0.85
p4_read_pipeFunction · 0.85
p4_read_pipe_linesFunction · 0.85
p4_has_commandFunction · 0.85
p4_has_move_commandFunction · 0.85
p4_systemFunction · 0.85
p4CmdListFunction · 0.85

Calls 3

gitConfigFunction · 0.85
gitConfigIntFunction · 0.85
p4_check_accessFunction · 0.85

Tested by

no test coverage detected