diff options
author | Simon Hausmann <simon@lst.de> | 2007-03-24 09:15:11 +0100 |
---|---|---|
committer | Simon Hausmann <simon@lst.de> | 2007-03-24 09:15:11 +0100 |
commit | cb2c9db507cda6804f85ebbacb58a7458ab127a6 (patch) | |
tree | 701b7c4783c50168012102cc307d1bbbb3a3682f /contrib/fast-import | |
parent | Use the new incremental import style by default (diff) | |
download | tgif-cb2c9db507cda6804f85ebbacb58a7458ab127a6.tar.xz |
Different versions of p4 have different output for the where command ;(
Signed-off-by: Simon Hausmann <simon@lst.de>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-x | contrib/fast-import/git-p4 | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 61978c3da6..9503786207 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -36,6 +36,22 @@ def p4Cmd(cmd): result.update(entry) return result; +def p4Where(depotPath): + if not depotPath.endswith("/"): + depotPath += "/" + output = p4Cmd("where %s..." % depotPath) + clientPath = "" + if "path" in output: + clientPath = output.get("path") + elif "data" in output: + data = output.get("data") + lastSpace = data.rfind(" ") + clientPath = data[lastSpace + 1:] + + if clientPath.endswith("..."): + clientPath = clientPath[:-3] + return clientPath + def die(msg): sys.stderr.write(msg + "\n") sys.exit(1) @@ -318,11 +334,7 @@ class P4Sync(Command): print "Internal error: cannot locate perforce depot path from existing branches" sys.exit(128) - if not depotPath.endswith("/"): - depotPath += "/" - clientPath = p4Cmd("where %s..." % depotPath).get("path") - if clientPath.endswith("..."): - clientPath = clientPath[:-3] + clientPath = p4Where(depotPath) if len(clientPath) == 0: print "Error: Cannot locate perforce checkout of %s in client view" % depotPath |