git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-p4: Fix regression in p4Where method.
@ 2008-12-09 15:41 Tor Arvid Lund
  0 siblings, 0 replies; only message in thread
From: Tor Arvid Lund @ 2008-12-09 15:41 UTC (permalink / raw)
  To: Junio C Hamano, Simon Hausmann; +Cc: git, Tor Arvid Lund

Unfortunately, I introduced a bug in commit 7f705dc36 (git-p4: Fix bug in
p4Where method). This happens because sometimes the result from
"p4 where <somepath>" doesn't contain a "depotFile" key, but instead a
"data" key that needs further parsing. This commit should ensure that both
of these cases are checked.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
---
 contrib/fast-import/git-p4 |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index ee504e9..a85a7b2 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -249,9 +249,16 @@ def p4Where(depotPath):
     outputList = p4CmdList("where %s" % depotPath)
     output = None
     for entry in outputList:
-        if entry["depotFile"] == depotPath:
-            output = entry
-            break
+        if "depotFile" in entry:
+            if entry["depotFile"] == depotPath:
+                output = entry
+                break
+        elif "data" in entry:
+            data = entry.get("data")
+            space = data.find(" ")
+            if data[:space] == depotPath:
+                output = entry
+                break
     if output == None:
         return ""
     if output["code"] == "error":
-- 
1.6.0.2.1172.ga5ed0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-09 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 15:41 [PATCH] git-p4: Fix regression in p4Where method Tor Arvid Lund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).