If the user has configured various parameters, use them.
authorAnand Kumria <wildfire@progsoc.org>
Sun, 10 Aug 2008 18:26:31 +0000 (19:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Aug 2008 01:57:04 +0000 (18:57 -0700)
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>
contrib/fast-import/git-p4

index 2b6ea74d1c6224f8745bb4dd99770430f38ad247..a927e50b255027f7169d040617683e4808a03f87 100755 (executable)
@@ -24,7 +24,29 @@ def p4_build_cmd(cmd):
     location. It means that hooking into the environment, or other configuration
     can be done more easily.
     """
-    real_cmd = "%s %s" % ("p4", cmd)
+    real_cmd = "%s " % "p4"
+
+    user = gitConfig("git-p4.user")
+    if len(user) > 0:
+        real_cmd += "-u %s " % user
+
+    password = gitConfig("git-p4.password")
+    if len(password) > 0:
+        real_cmd += "-P %s " % password
+
+    port = gitConfig("git-p4.port")
+    if len(port) > 0:
+        real_cmd += "-p %s " % port
+
+    host = gitConfig("git-p4.host")
+    if len(host) > 0:
+        real_cmd += "-h %s " % host
+
+    client = gitConfig("git-p4.client")
+    if len(client) > 0:
+        real_cmd += "-c %s " % client
+
+    real_cmd += "%s" % (cmd)
     if verbose:
         print real_cmd
     return real_cmd