git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-p4import.py robustness changes

From
SLScott Lamb <slamb@slamb.org>
Date
Jun 3, 2007, 20:12 UTC
Message-ID
<839AEF71-ED29-4A79-BE97-C79EAFEDC466@slamb.org>
In-Reply-To
<200706031511.31157.simon@lst.de>
On Jun 3, 2007, at 6:11 AM, Simon Hausmann wrote:
Show 11 quoted lines
> On the topic of git integration with perforce, what are the chances  
> of getting
> git-p4 ( http://repo.or.cz/w/fast-export.git ) into git's contrib/ 
> fast-export
> area? :)
>
> git-p4 can do everything git-p4import can do plus a lot more (it  
> can track
> multiple branches, it's a hell of a lot faster, it can export back  
> to p4 and
> it also works on Windows!).

I missed that one...I just saw Tailor and the Perl script someone else had written.

Ergh. git-p4 imports both "subprocess" and "popen2" and also uses "system" and "os.popen". Why use four different modules to launch git and p4?

The branch support's interesting. Have you considered tracking integration history? I was pondering it and am not sure if it's feasible. Perforce doesn't seem to have an efficient way of displaying it (just "p4 integrates" that will fetch *all* revisions even if you want incremental results and "p4 filelog" which would have to be done on each file). Also, I think there's some mismatch between the Perforce and git models.

git-p4import.py should work fine on Windows, too - the binary mode on the pipe should be all handled by "subprocess", and git-p4's data.replace("\r\n", "\n") is not necessary if you use "LineEnd: unix" or "share" in the Perforce client specification.

As for performance...hmm. Looks like git-p4import.py runs these commands for each Perforce revision:

     realtime  operation
         3.4%  p4 describe -s N
        66.6%  p4 sync ...@N
    [*] 10.2%  git ls-files -m -d -o -z | git update-index --add -- 
remove -z --stdin
         2.6%  git rev-parse --verify HEAD
         4.2%  git write-tree
         2.8%  git commit-tree xxxxxx
         7.5%  git tag -f p4/N xxxxxx
         2.7%  git update-ref HEAD xxxxxx
That's with Perforce running over the network. Are you running locally?

git-p4 seems to use "git fast-import". I guess the big performance improvement there is removing the ls-files operation? So we're talking about a 0-10% speedup, right? Plus some fork()/exec() overhead.

[*] - Note that I just discovered a big performance regression in my patches. Reading the ls-files into Python, through a regexp, and back out through update-index was a horrible idea. The times above are with that fixed.

-- 
Scott Lamb <http://www.slamb.org/>
Previous: Simon HausmannNext: Shawn O. Pearce
Message 8 of 26 in “git-p4import.py robustness changes”
  1. Scott LambMay 31, 2007
  2. Junio C HamanoMay 31, 2007
  3. Scott LambJun 2, 2007
  4. Junio C HamanoJun 2, 2007
  5. Scott LambJun 2, 2007
  6. Junio C HamanoJun 2, 2007
  7. Simon HausmannJun 3, 2007
  8. Scott LambJun 3, 2007
  9. Shawn O. PearceJun 4, 2007
  10. Dana HowJun 4, 2007
  11. Shawn O. PearceJun 4, 2007
  12. Scott LambJun 4, 2007
  13. Simon HausmannJun 5, 2007
  14. Marius Storm-OlsenJun 4, 2007
  15. Shawn O. PearceJun 4, 2007
  16. Simon HausmannJun 12, 2007
  17. Scott LambJun 13, 2007
  18. Simon HausmannJun 13, 2007
  19. Shawn O. PearceJun 14, 2007
  20. Simon HausmannJun 14, 2007
  21. Shawn O. PearceJun 15, 2007
  22. Marius Storm-OlsenJun 15, 2007
  23. 1/4 git-p4import: fix subcommand error handlingScott Lamb, Jun 3, 2007
  24. 2/4 git-p4import: use lists of subcommand argumentsScott Lamb, Jun 3, 2007
  25. 3/4 git-p4import: resume on correct p4 changesetScott Lamb, Jun 3, 2007
  26. 4/4 git-p4import: partial historyScott Lamb, Jun 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.