git-p4: ensure submit clientPath exists before chdir

Submitting patches back to p4 requires a p4 "client". This is a mapping from server depot paths into a local directory. The directory need not exist or be populated with files; only the mapping on the server is required. When there is no directory, make git-p4 automatically create it. [ reword description --pw ] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Gary Gibbons committed Dec 9, 2011 at 18:48 UTC 0591cfa8d89aa63eaaaab3fdd5ba458f408fe4cb
1 file changed +4
contrib/fast-import/git-p4
+4
@@ -1116,6 +1116,10 @@ class P4Submit(Command, P4UserMap):
1116 print "Perforce checkout for depot path %s located at %s" % (self.depotPath, self.clientPath)
1117 self.oldWorkingDirectory = os.getcwd()
1118
1119 + # ensure the clientPath exists
1120 + if not os.path.exists(self.clientPath):
1121 + os.makedirs(self.clientPath)
1122 +
1123 chdir(self.clientPath)
1124 print "Synchronizing p4 checkout..."
1125 p4_sync("...")