@matheusbsbs / matheus-bagliano / commits / c4cf2d4f87
Fork 0

Minor cleanups and print an error message of git fast-import if it fails.

Signed-off-by: Simon Hausmann <hausmann@kde.org>

Simon Hausmann committed Feb 7, 2007 at 22:57 UTC c4cf2d4f8793ea8f889052391d72dd4066e88155
1 file changed +12 -5
contrib/fast-import/p4-fast-export.py
+12 -5
@@ -154,6 +154,9 @@ if len(changeRange) == 0:
154 sys.stderr.write("\n")
155
156 tz = - time.timezone / 36
157 +tzsign = ("%s" % tz)[0]
158 +if tzsign != '+' and tzsign != '-':
159 + tz = "+" + ("%s" % tz)
160
161 if len(revision) > 0:
162 print "Doing initial import of %s from revision %s" % (prefix, revision)
@@ -165,21 +168,25 @@ if len(revision) > 0:
168
169 fileCnt = 0
170 for info in p4CmdList("files %s...%s" % (prefix, revision)):
171 + change = info["change"]
172 + if change > newestRevision:
173 + newestRevision = change
174 +
175 if info["action"] == "delete":
176 continue
177 +
178 for prop in [ "depotFile", "rev", "action", "type" ]:
179 details["%s%s" % (prop, fileCnt)] = info[prop]
180
173 - change = info["change"]
174 - if change > newestRevision:
175 - newestRevision = change
176 -
181 fileCnt = fileCnt + 1
182
183 details["change"] = newestRevision
184
185 gitOutput, gitStream, gitError = popen2.popen3("git-fast-import")
182 - commit(details)
186 + try:
187 + commit(details)
188 + except:
189 + print gitError.read()
190
191 gitStream.close()
192 gitOutput.close()