Jump to content


Perforce File Specifications and Wildcards

P4V

  • Please log in to reply
6 replies to this topic

#1 mister_wilson

mister_wilson

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts
  • LocationMontreal, Quebec

Posted 23 March 2016 - 06:17 PM

Hi,

Could someone tell me if the following is the normal behavior for file specifications?

According to the perforce documentation for File specifications >> https://www.perforce.../filespecs.html
It says that it uses %%1 to %%9 to indicate positional specifiers for substring rearrangement in filenames, when used in views.

However when I run a command like:
p4 -Ztag where //depot/branch/t*o*u*c*h*t*t*t*ty*k*.txt

I get the following result
... depotFile //depot/branch/t%%100o%%2u%%3c%%4h%%5t%%6t%%7t%%8ty%%9k%%10000.txt
... clientFile //jwilson_PC_TEST-0123/depot/branch/t%%100o%%2u%%3c%%4h%%5t%%6t%%7t%%8ty%%9k%%10000.txt
... path F:\P4\1666\depot\branch\t%%100o%%2u%%3c%%4h%%5t%%6t%%7t%%8ty%%9k%%10000.txt

Notice that %%1 actually becomes %%100 and what i assume to be %%10 becomes %%10000


Thanks,

-Jonathan Wilson


P.S. I am using P4V Rev. Perforce Visual Client/NTX64/2015.2/1312139 on Server version: P4D/LINUX26X86_64/2014.2/1045032 (2015/04/17)
and command line version 2015.2 1366233

#2 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 24 March 2016 - 10:50 PM

View Postmister_wilson, on 23 March 2016 - 06:17 PM, said:

Could someone tell me if the following is the normal behavior for file specifications?

Notice that %%1 actually becomes %%100 and what i assume to be %%10 becomes %%10000

Hi Jonathan,

Thanks for giving your p4 and p4d versions along with the command and output results. I am going to double-check on this but looking at the documentation it shows there are nine (9) positional specifiers (%%1-%%9) that can be used. Your command showed ten (10) which may be why the output looked odd.

Normally if you ran the command with more than nine (9) such as using eleven (11) like this:

p4 -Ztag where //depot/branch/t*o*u*c*h*t*t*t*t*y*k*.txt

You would receive a message that says:

Too many *'s in '//depot/branch/t*o*u*c*h*t*t*t*t*y*k*.txt'.

It could just be a small oversight or bug but I think you should have received the Too many *'s message.

#3 mister_wilson

mister_wilson

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts
  • LocationMontreal, Quebec

Posted 25 March 2016 - 01:48 AM

Indeed, if I use 11 wildcards I get the message "Too many *'s..."

#4 mister_wilson

mister_wilson

    Advanced Member

  • Members
  • PipPipPip
  • 90 posts
  • LocationMontreal, Quebec

Posted 29 March 2016 - 07:00 PM

Hi P4Shimada,

Were you able to confirm if this is a bug?

-Jonathan

#5 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 29 March 2016 - 07:08 PM

View Postmister_wilson, on 29 March 2016 - 07:00 PM, said:

Were you able to confirm if this is a bug?

Yes, it was indeed a bug that you received garbled output instead of the message indicating that you had used too many wildcards:

    "Too many *'s..."

You have been added to the existing bug report for this issue.

#6 Br.Bill

Br.Bill

    Member

  • Members
  • PipPip
  • 20 posts

Posted 09 January 2018 - 11:41 PM

Can we add to this bug the fact that the documentation has ZERO EXAMPLES? How the heck are we supposed to use Positional Specifiers? I've been searching for help on this for 15 minutes, came across this topic. And it really doesn't help me use positional specifiers either.

#7 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 569 posts

Posted 10 January 2018 - 12:02 AM

My advice on positional specifiers is "don't" (and in fact this is my advice almost any time you're using multiple wildcards on a line; there is frequently a better way), but here's the doc on them:

https://www.perforce...ls.html#1040502

In a nutshell, %N is the same as *, but each %N maps to a specific matching %N and they don't have to be in the same order (whereas with * they match in the same order on both sides).  That is:

//depot/*/* -> //client/*/*

is the same as:

//depot/%1/%2 -> //client/%1/%2

e.g. in both cases //depot/foo/bar -> //client/foo/bar.

With the %N syntax you can swap them around:

//depot/%1/%2 -> //client/%2/%1

which means that //depot/foo/bar -> //client/bar/foo.





Also tagged with one or more of these keywords: P4V

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users