git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tor Arvid Lund <torarvid@gmail.com>
To: Dmitry Smirnov <divis1969@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: P4 Sync problem
Date: Wed, 11 Nov 2009 13:00:39 +0100	[thread overview]
Message-ID: <1a6be5fa0911110400l1fe931afmbb53ceba8704e029@mail.gmail.com> (raw)
In-Reply-To: <loom.20091111T100646-406@post.gmane.org>

On Wed, Nov 11, 2009 at 10:43 AM, Dmitry Smirnov <divis1969@gmail.com> wrote:
> Tor Arvid Lund <torarvid <at> gmail.com> writes:
>
>> Hi. So - I think the problem is that git-p4 doesn't understand what it
>> is you want to sync.
>
> I believe it will never understand that until self.depotPaths
> will be initialized.

Correct.

> It looks like it is intitilized from argument list only (or from already saved
> settings). See P4Sync.run().

Also correct, me thinks.

> But self.getClientSpec() which is called some time before, does not init neither
> self.depotPaths nor args.

Correct again. The useclientspec flag was created (by me) as a simple
way to filter out files that I did not want to download (the reason
being my company tends to mix binaries with source files causing
unnecessary long sync times). So it was never used to tell git-p4
_what_ to sync, but rather what to _not_ sync.

So - in your case, you could have tried to just say "git p4 sync
//depot@all", and if your clientspec contained, say, only
"//depot/path/projectX", then projectX should be the only thing that
got downloaded. Keep in mind, though, that git-p4 would still ask the
p4 server for _all_ of its changelists, loop through them, and check
each file in each changelist against the clientSpecDirs array...

> I had fixed this with the following code (new lines marked with +):
>        if self.useClientSpec or gitConfig("git-p4.useclientspec") == "true":
> +            if self.verbose:
> +                print "Get client spec"
>            self.getClientSpec()
> +            if self.verbose:
> +                print "Client Spec Dirs: %s" % self.clientSpecDirs
> +            if len(args) == 0:
> +                for item in self.clientSpecDirs:
> +                      k,v = item
> +                      args.append(k)

Well, I see what you're trying to do, but I would not want to see that
patch in the official script, because some (most?) people (myself, at
least) use git-p4 to clone single projects out of a perforce depot
that may contain many projects. I do this myself by doing:

git p4 clone //depot/path/to/projectX@all

I usually use one clientspec in perforce, and I do not want to change
that... With your patch, I would be in trouble since my clientspec
contains "//depot/..." (followed by a lot of lines starting with '-')

> Unfortunately, this fails on another stage:
>
>>git p4 sync --verbose
<snip>
> Opening pipe: p4 -c MYCLIENT-G files <my paths here appended with ...#head >
> p4 returned an error: //MYCLIENT/path/file.c/...#head> - file(s) not in client
> view.
>
> My client spec contains some line to the file:
> -//depot/path/... //MYCLIENT/null/...
> //depot/path/file.cs //MYCLIENT/path/file.cs
>
> This means that I wish to sync only file.cs into my client and get rid of other
> files in this directory.
> BTW, note that file extension is truncated in the log

Yep - this is a bug (or lack of a feature, if you will...). The
clientspec functionality in git-p4 supports directories only. If you
look at the getClientSpec function, you see that it looks for "...".
It's probably an easy fix if you want to support having single files
in the client spec. I didn't (and don't) need it, so it didn't occur
to me at the time...

If you want to fix it, you might want to rename clientSpecDirs to
clientSpecEntries or something like that.

Btw... Am I understanding correctly what it is you wish to accomplish?
I'm guessing that you have a perforce server with a client spec set
up, and you want to sync everything on the entire server according to
that client spec?

-Tor Arvid-

  reply	other threads:[~2009-11-11 12:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 13:56 P4 Sync problem Dmitry Smirnov
2009-11-11  8:43 ` Tor Arvid Lund
2009-11-11  9:43   ` Dmitry Smirnov
2009-11-11 12:00     ` Tor Arvid Lund [this message]
2009-11-11 12:39       ` Dmitry Smirnov
2009-11-11 13:54         ` Tor Arvid Lund
2009-11-11 14:57           ` Dmitry Smirnov
2010-07-22 18:21             ` masonk
2009-11-15 13:00         ` Pete Wyckoff

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

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

  git send-email \
    --in-reply-to=1a6be5fa0911110400l1fe931afmbb53ceba8704e029@mail.gmail.com \
    --to=torarvid@gmail.com \
    --cc=divis1969@gmail.com \
    --cc=git@vger.kernel.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.
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 NNTP newsgroup(s).