On Wed, Nov 11, 2009 at 10:43 AM, Dmitry Smirnov <divis1969@xxxxxxxxx> 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- -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html