I am developing an application that is supposed to be integrated with Perforce. In the learning phase of basic Perforce command, I have a question of how 'p4 changes' work. Once a changelist get submitted, say, affecting files at
- '//depot/Web/content/main.css'
- '//depot/Tool/app/init.py'
If we now issue a command:
'p4 changes //depot/Web/...'
then the changelist will show in the result. So how Perforce manage this information? Does it break down the paths and store? Or does it do an online substring query?
I saw there is a field "common path" in Perforce database schema, in this case, the value should be:
'//depot/...'
So in this case, how does Perforce get the information?
For each change, the Perforce server records which files were affected by that change.
This is one of many pieces of metadata about the changelist which are recorded in the server's database.
That information is used by commands like 'p4 describe' to find the correct set of files.
The Perforce server contains a sophisticated pattern matching engine which can rapidly search through the database to locate the set of changes which affected a certain set of files, as described by a file pattern.
This is a core operation of the server, so it's highly optimized for this behavior.