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

Re: git-p4 cannot use perforce client created by p4java — "Expected view key View1 missing"

From
Luke Diamand <luke@diamand.org>
Date
Jan 29, 2020, 10:35 UTC
Message-ID
<CAE5ih79j+o87yEPbj+nFR6b4rx_NU2eLJite69=+qMdpXdEidw@mail.gmail.com>
In-Reply-To
<CAPgZwKbZ0g+VXjnD03hGkRXfwU2DpygLhLBFG3xv1W9c8oQ1fQ@mail.gmail.com>
On Tue, 7 Jan 2020 at 15:53, Ivan Selin <ivan.selin@toptal.com> wrote:
Show 26 quoted lines
>
> Hello!
>
> If I create a perforce client from java using p4java, it gets created
> with an extra key "ViewDepotType" in client definition. When I try to
> do `git p4 sync --use-client-spec`, git-p4 dies with message like
> "Expected view key View1 missing" — because it assumes that all keys
> starting with "View" are "View0", "View1" and so on.
>
> How to reproduce:
> 1) Create perforce repository;
> 2) Create a perforce client (let's name it "my-client") in said
> perforce repository using p4java; add one view mapping to the client
> on creation;
> 3) Run `P4CLIENT=my-client git p4 sync --use-client-spec`;
> 4) git p4 finishes with error "Expected view key View1 missing".
>
> Attaching hexdumped/unmarshalled examples of "regular" client
> definition and client created with p4java. Note that p4java's version
> has "ViewDepotType" key and regular client does not. Also,
> "ViewDepotType" key is not showing up in text output of `p4 client
> -o`, only in binary format (`p4 -G client -o`). And I'm attaching a
> patch that solved the issue for me.
>
> Is that information enough or should I add anything else? I'm new to
> git community, but willing to help.
I suspect the problem lies at around line 4220 of git-p4, where it does this:
     view_keys = [ k for k in entry.keys() if k.startswith("View") ]

I think changing that startswith to a regex match would fix this, although I have not tried it. Something like:

is_view = re.compile(r'^View\d+$') view_keys = [ k for k in entry.keys() if is_view.match(k) ]

>
> Regards,
> Ivan.
Previous: Ivan SelinNext: Ivan Selin
Message 2 of 5 in “git-p4 cannot use perforce client created by p4java — "Expected view key View1 missing"”
  1. Ivan SelinJan 7, 2020
  2. Luke DiamandJan 29, 2020
  3. Ivan SelinJan 31, 2020
  4. Luke DiamandJan 31, 2020
  5. Junio C HamanoJan 31, 2020

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.