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

Re: git-p4: Clone p4 path with bidirectional integrations

From
AMAaron Miller <aaronkmiller@gmail.com>
Date
Aug 20, 2019, 22:52 UTC
Message-ID
<CALSvhyagGHY+JOaygd5++-GbNYskd3ys9ZQH3ha1pkeJaKQp1Q@mail.gmail.com>
In-Reply-To
<CAE5ih78UOor3XT_hDofanoGUPLD1BC2y=pCbzF-Edm2mpRvjyQ@mail.gmail.com>
Hi Luke,
> It's possible that running with "-v" might give a bit more information.

Here's the output from that. I've set git-p4.branchUser in this test to avoid needlessly cluttering the output since I have a huge amount of branches in my Perforce repo, but otherwise I used the exact script which I've included later in this email:

Importing from //depot/testing/...@all into . Reinitialized existing Git repository in /home/amiller/Code/git-migration/repos/testing/.git/ Reading pipe: ['git', 'config', '--bool', 'git-p4.useclientspec'] Reading pipe: ['git', 'config', 'git-p4.branchUser'] Reading pipe: ['git', 'config', 'git-p4.user'] Reading pipe: ['git', 'config', 'git-p4.password'] Reading pipe: ['git', 'config', 'git-p4.port'] Reading pipe: ['git', 'config', 'git-p4.host'] Reading pipe: ['git', 'config', 'git-p4.client'] Reading pipe: ['git', 'config', '--int', 'git-p4.retries'] Reading pipe: ['git', 'config', '--int', 'git-p4.retries'] Opening pipe: ['p4', '-r', '3', '-G', 'login', '-s'] Opening pipe: p4 -r 3 -G branches -u amiller Reading pipe: ['git', 'config', '--get-all', 'git-p4.branchList'] p4-git branches: [] initial parents: {} Getting p4 changes for //depot/testing/... Opening pipe: ['p4', '-r', '3', '-G', 'changes', '-m', '1'] Opening pipe: ['p4', '-r', '3', '-G', 'changes', '//depot/testing/...@1,1048577'] Opening pipe: ['p4', '-r', '3', '-G', 'changes', '//depot/testing/...@1048578,1206544'] Opening pipe: ['p4', '-r', '3', '-G', 'describe', '-s', '1206099'] Importing revision 1206099 (25%)Reading pipe: ['git', 'config', '--bool', 'core.ignorecase'] branch is master

    Importing new branch testing/master
Opening pipe: ['p4', '-r', '3', '-G', 'changes',
'//depot/testing/master/...@1,1048577']
Opening pipe: ['p4', '-r', '3', '-G', 'changes',
'//depot/testing/master/...@1048578,1206098']
    Resuming with change 1206099
parent determined through known branches: staging
looking for initial parent for refs/remotes/p4/testing/master; current
parent is refs/remotes/p4/testing/staging
Creating temporary branch: refs/git-p4-tmp/1206099
commit into refs/git-p4-tmp/1206099
Reading pipe: ['git', 'config', '--bool', 'git-p4.keepEmptyCommits']
Opening pipe: ['p4', '-r', '3', '-G', '-x', '-', 'print']
//depot/testing/master/test1 --> test1 (0 MB)
checkpoint finished: progress checkpoint
Reading pipe: ['git', 'rev-list', '--reverse', '--no-merges',
'refs/remotes/p4/testing/staging']
fatal: ambiguous argument 'refs/remotes/p4/testing/staging': unknown
revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Traceback (most recent call last):
  File "/home/amiller/.bin/git-p4.py", line 4173, in <module>
    main()
  File "/home/amiller/.bin/git-p4.py", line 4167, in main
    if not cmd.run(args):
  File "/home/amiller/.bin/git-p4.py", line 3923, in run
    if not P4Sync.run(self, depotPaths):
  File "/home/amiller/.bin/git-p4.py", line 3790, in run
    self.importChanges(changes)
  File "/home/amiller/.bin/git-p4.py", line 3451, in importChanges
    blob = self.searchParent(parent, branch, tempBranch)
  File "/home/amiller/.bin/git-p4.py", line 3374, in searchParent
    "--no-merges", parent]):
  File "/home/amiller/.bin/git-p4.py", line 237, in read_pipe_lines
    die('Command failed: %s' % str(c))
  File "/home/amiller/.bin/git-p4.py", line 165, in die
    raise Exception(msg)
Exception: Command failed: ['git', 'rev-list', '--reverse',
'--no-merges', 'refs/remotes/p4/testing/staging']
> Can you write a test case, or even just a shell script, that might
> help figure out what's going on.
No problem:
#!/bin/bash

# perforce setup - assumes PWD is mapped to //depot/... mkdir -p testing/master touch testing/master/test1 p4 add testing/master/test1 p4 submit -d 'test changelist 1'

p4 integrate //depot/testing/master/... //depot/testing/staging/... p4 submit -d 'test changelist 2'

touch testing/staging/test2 p4 add testing/staging/test2 p4 submit -d 'test changelist 3'

p4 integrate //depot/testing/staging/... //depot/testing/master/... p4 submit -d 'test changelist 4'

# clone with git-p4: git init p4_git_test cd p4_git_test git config git-p4.branchList master:staging git config --add git-p4.branchList staging:master git p4 clone //depot/testing/...@all --detect-branches --verbose .

Thanks, Aaron

Previous: Luke DiamandNext: Andrey
Message 3 of 6 in “git-p4: Clone p4 path with bidirectional integrations”
  1. Aaron MillerAug 19, 2019
  2. Luke DiamandAug 19, 2019
  3. Aaron MillerAug 20, 2019
  4. AndreyAug 20, 2019
  5. Aaron MillerAug 20, 2019
  6. AndreyAug 23, 2019

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.