git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ivan Selin <ivan.selin@toptal.com>
To: Luke Diamand <luke@diamand.org>
Cc: Git Users <git@vger.kernel.org>
Subject: Re: git-p4 cannot use perforce client created by p4java — "Expected view key View1 missing"
Date: Fri, 31 Jan 2020 16:42:49 +0300	[thread overview]
Message-ID: <CAPgZwKbYKPbZeEY2O22DJBvDpjHRR2XVW9hQ7-tML-UE2bkXYA@mail.gmail.com> (raw)
In-Reply-To: <CAE5ih79j+o87yEPbj+nFR6b4rx_NU2eLJite69=+qMdpXdEidw@mail.gmail.com>

Yes, that's exactly the way that I've tried it and it worked for me.
Can we have that integrated into git-p4? What can I do to make it
happen?

On Wed, Jan 29, 2020 at 1:35 PM Luke Diamand <luke@diamand.org> wrote:
>
> On Tue, 7 Jan 2020 at 15:53, Ivan Selin <ivan.selin@toptal.com> wrote:
> >
> > 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.

  reply	other threads:[~2020-01-31 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 15:53 git-p4 cannot use perforce client created by p4java — "Expected view key View1 missing" Ivan Selin
2020-01-29 10:35 ` Luke Diamand
2020-01-31 13:42   ` Ivan Selin [this message]
2020-01-31 15:52     ` Luke Diamand
2020-01-31 18:15       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPgZwKbYKPbZeEY2O22DJBvDpjHRR2XVW9hQ7-tML-UE2bkXYA@mail.gmail.com \
    --to=ivan.selin@toptal.com \
    --cc=git@vger.kernel.org \
    --cc=luke@diamand.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).