If the user has configured various parameters, use them.
Some repositories require authentication and access to certain hosts. Allow git-p4 to pull this information from the configuration Signed-off-by: Anand Kumria <wildfire@progsoc.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Anand Kumria committed
Aug 10, 2008 at 19:26 UTC
abcaf07360357cf2e9ce4b34e44adc09bb5587f0
1 file changed
+23
-1
contrib/fast-import/git-p4
+23
-1
@@ -24,7 +24,29 @@ def p4_build_cmd(cmd):
24
location. It means that hooking into the environment, or other configuration
25
can be done more easily.
26
"""
27
- real_cmd = "%s %s" % ("p4", cmd)
27
+ real_cmd = "%s " % "p4"
28
+
29
+ user = gitConfig("git-p4.user")
30
+ if len(user) > 0:
31
+ real_cmd += "-u %s " % user
32
+
33
+ password = gitConfig("git-p4.password")
34
+ if len(password) > 0:
35
+ real_cmd += "-P %s " % password
36
+
37
+ port = gitConfig("git-p4.port")
38
+ if len(port) > 0:
39
+ real_cmd += "-p %s " % port
40
+
41
+ host = gitConfig("git-p4.host")
42
+ if len(host) > 0:
43
+ real_cmd += "-h %s " % host
44
+
45
+ client = gitConfig("git-p4.client")
46
+ if len(client) > 0:
47
+ real_cmd += "-c %s " % client
48
+
49
+ real_cmd += "%s" % (cmd)
50
if verbose:
51
print real_cmd
52
return real_cmd