开发者

unable to import with git-p4 on windows

I've been trying to import a p4 depot path to git using git-p4 python script. After configuring my environment (git 1.7.1, python 2.7, Windwos XP, p4 env variables) I tried to run the git-p4 script, geetting the following ouptut:

F:\gitp4>c:\Python27\python.exe git-p4.py clone --destination=master //depot/quake/main/...@all
Reading pipe: git config git-p4.syncFromOrigin
Importing from //depot/quake/main/...@all into master
Initialized empty Git repository in F:/gitp4/master/.git/
Traceback (most recent call last):
  File "git-p4.py", line 1926, in <module>
    main()
  File "git-p4.py", line 1921, in main
    if not cmd.run(args):
  File "git-p4.py", line 1798, in run
    if not P4Sync.run(self, depotPaths):
  File "git-p4.py", line 1501, in run
    self.hasOrigin = originP4BranchesExist()
  File "git-p4.py", line 439, in originP4BranchesExist
    return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master")
  File "git-p4.py", line 332, in gitBranchExists
    stderr=subprocess.PIPE, stdout=subprocess.PIPE);
  File "c:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite)
  File "c:\Python27\lib\subprocess.py", line 882, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Does anybody know what's going on here? If I try to run the git command that line #332 states (git rev-parse origin) from the command line shell, the command开发者_运维问答 is correctly executed.

Thanks.

Update: Seems that the script is unable to launch any process whose exec file is not in the execution path. I think it's an initialization issue with python on windows...


In response to Restuta's comment:

  1. I've created a batch file to call "git.cmd" exec file on a custom path. Contents of my batch file:
    @"C:\Program Files\Git\cmd\git.cmd" %*

  2. I've modified the git-p4.py file to call that batch file instead of just "git".
    Eg. (line 2237) Original line: init_cmd = [ "git", "init" ]
    Replace with: init_cmd = [ "PATH_TO_BATCH_FILE\git.bat", "init" ]
    E.g:
    init_cmd = [ "f:\gitp4\git.bat", "init" ]

  3. Do the same for all the git calls on the file (subprocess.Popen calls) (I've a total of 6 changes)

Hope it helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜