Jump to content

Sambwise's Content

There have been 246 items by Sambwise (Search limited from 25-September 19)

By content type

See this member's

Sort by                Order  

#26855 Search for the revision the branch is based on

Posted by Sambwise on Yesterday, 08:11 PM in APIs

The exact revision specifier used to branch the files isn't stored in the changelist; each individual file tracks the revision it was branched from, so you can sort of reverse-engineer a changelist out of all those records by doing something like "p4 changes -m2 -i @=CHANGE" where CHANGE is the changelist that branched all the files.  The Java API should have some sort of "get changelists" function that mimics that command, although I'm not sure if the exact syntax for it.

#26854 Retrieving files from 'change-content' from jenkins

Posted by Sambwise on Yesterday, 05:37 PM in General

In a change-content trigger, the in-flight changelist is accessible as something very much like a shelf.  I'm not sure offhand if you can actually "p4 unshelve" the changelist while it's in that state, but I'm positive that commands like "p4 print @=CHANGE" will work.

#26853 Question about folders/workspaces inside depot

Posted by Sambwise on Yesterday, 05:35 PM in P4V

Could you share the actual client spec(s) that are involved in this scenario?  If the root for the first client is Project1, then nothing you add to Project2 is part of that workspace (and hence it will not be added to the depot).  Is the actual Root one folder higher?

#26832 p4 print but output in the format that was used for calculating digest

Posted by Sambwise on 15 September 2020 - 07:33 PM in General

If you can do this in a workspace (i.e. use "p4 sync" instead of "p4 print"), it's much easier, because then you have access to commands like "p4 diff -se" and "p4 clean" that will do the checksum comparison in a LineEnd-aware way.

If you're forced to use "p4 print", I think the easiest option is to do the CRLF->LF normalization yourself after doing the print command, either doing it on disk or doing it in-memory as you compute the checksum.

#26828 Issues with C++ API

Posted by Sambwise on 14 September 2020 - 03:05 PM in APIs


#26824 Issues with C++ API

Posted by Sambwise on 14 September 2020 - 01:12 AM in APIs

The client library is open source (available at workshop.perforce.com); you might have an easier time just building it from source than getting an "official" build that matches the specific environment/settings you need.

#26819 Revert Command takes a lot time on Mac

Posted by Sambwise on 11 September 2020 - 04:37 PM in General

What error did the previous command report?

Does this only happen within your script, or does it happen if you run the revert from a normal p4 client?  If you can reproduce it from the CLI, what does the "-Ztrack" performance tracking show that it's spending its time on?

#26802 Is it possible to "soft ignore" files in a workspace?

Posted by Sambwise on 07 September 2020 - 03:34 PM in General

If you're using streams, you can do this within a single workspace fairly easily -- do most of your work in a filtered virtual stream, and switch to the parent when you want a wider view, being careful which files you sync while you're in the parent (use "p4 client -s -S stream" to switch instead of "p4 switch stream" to avoid auto-syncing everything).

Another possibility for a "soft exclude" would be to "p4 flush" ("p4 sync -k") the files you want to exclude, so that a "p4 sync -f" is required to fetch them.  I'm not sure if this is one that I'd actually recommend using in practice because any time you're deliberately putting the workspace into an inconsistent state the odds of confusing yourself are high -- I'd much rather deal with accidentally syncing files and having to Ctrl-C them than having things break more quietly because I didn't have the files synced that I thought I did.

#26792 fstat -Oa attributes on newly added files don't show up running from a ch...

Posted by Sambwise on 05 September 2020 - 06:03 PM in APIs

Yup, you'd set it on the Client(?) object before initializing the connection.  (I haven't used the .NET API, but in the C++ API it's the ClientApi object, in the Python API it's the P4 object, etc.)

#26789 Reverting all files in a shelf if they are identical to head

Posted by Sambwise on 02 September 2020 - 08:41 PM in General


p4 -F %depotFile% files @=CHANGE | p4 -x - tag -a -l to-revert
p4 -F "diff2 -q %depotFile%@=CHANGE %depotFile%#head" files @=CHANGE | p4 -F %depotFile% -x - run | p4 -x - labelsync -l to-revert -d
p4 -F %depotFile% files @to-revert | p4 -x - shelve -d -c CHANGE
p4 label -d to-revert

Be nice if "p4 diff2" had an -Oi flag that made it only output identical files; then this'd be a one-liner!

#26783 Reverting all files in a shelf if they are identical to head

Posted by Sambwise on 02 September 2020 - 02:44 PM in General

I'd probably do this by a sequence like this:

p4 unshelve -s SHELF
p4 sync ...
p4 resolve -as
p4 revert -a (or p4 diff -sr | p4 -x- revert)
p4 shelve -r -s SHELF

You could also do this by some scripting to directly remove the identical files in the shelf, but it feels more straightforward to me to just use your workspace to do the work of "rebasing" the shelf to the head revision and then using "p4 shelve -r" to replace the shelf with the result.

#26777 fstat -Oa attributes on newly added files don't show up running from a ch...

Posted by Sambwise on 01 September 2020 - 03:07 PM in APIs

Does your script run within the context of the submitting client (i.e. by setting P4CLIENT and P4HOST appropriately to have it spoof the submitting client)?  I don't think fstat shows you pending attributes for other clients, but it should show them for the current client.

C:\Perforce\test\main>p4 fstat -Oa attrib
... depotFile //depot/main/attrib
... clientFile c:\Perforce\test\main\attrib
... isMapped
... action add
... change default
... type text
... actionOwner Samwise
... workRev 1
... openattr-new like this

#26776 Changelist submission trigger

Posted by Sambwise on 01 September 2020 - 03:02 PM in General

  • You want a "change-content" trigger.  At the time the trigger is executed, the changelist will be in a "shelved" state, and you can access the files from most commands via the revision specifier @=CHANGE (where CHANGE is the changelist number, which you can get passed to your script as the %changelist% arg).
  • I think you want the command p4 grep -L -e "COPYRIGHT NOTICE" @=CHANGE

#26775 Moving Perforce folder to new drive

Posted by Sambwise on 01 September 2020 - 02:57 PM in Administration


Stop the server, move the root folder, update P4ROOT to point at the new root folder, start the server.

When you start the server, P4ROOT must match the location you moved the server root to.  That's really all there is to it.  :)

#26774 System for Unreal Engine

Posted by Sambwise on 01 September 2020 - 02:53 PM in Administration

View PostTwist, on 23 August 2020 - 10:03 PM, said:

What operating system (Windows or Linux) works best with Perforce Helix Core Server?

If you're running a large-scale commercial server, I'd say Linux, unhesitatingly.

If you're hosting a personal project, I'd say use whichever you're more comfortable with.  I've seen many posts on this forum from people who have never used Linux before and are trying to set up a Linux server to use for an Unreal project (because some tutorial said to) and consequently struggling with very basic system administration tasks (managing disk space, etc) that would have been trivial on a platform they were familiar with.  So the hypothetical filesystem performance benefits of using Linux (which, tbh, I'm not sure still exist -- the last time I looked at performance benchmarks was more than a decade ago, and Windows has made some strides since then) may not outweigh the hassle, and in any case aren't really a factor with a relatively small server.


How much storage would all databases take up roughly and how quickly? I am trying to work out if i should get an extra SSD.

The database doesn't grow very quickly; its size is proportionate to the number of files (not the combined size of the actual files) and the number of users.  Unless your project has a very large number of generated files, the database for a project that only has a few people working on it is going to be measured in megabytes rather than gigabytes.

The depot (which can live on a different drive from the database, and does not need to be on a fast SSD because it's accessed much less frequently) is a function of the actual files in your project, including all their revisions.  For an Unreal project this is likely to actually reach a significant size since the art assets are likely to get pretty big.  If you have a rough idea of how big a snapshot of your project is, multiply that by about ten to allow for versioning (and keep in mind that you might want to cap the number of revisions you store for large assets, or plan to upgrade your disk once the average number of versions per file exceeds ten).


I see in the manual it is recommended that the Journal should be on a different drive to the metadata. I would also need to find a way to connect another drive in case one begins to fill up .

Storing the journal on a different drive is mostly a matter of resiliency, where if the disk holding the database fails completely you want to be able to use the journal to restore it with absolutely zero data loss.  Again, for a small personal project, you may not care that much; assuming you're taking daily backups/checkpoints and storing them offsite (which is trivial in the modern days of commodity cloud storage), you can never lose more than a day of work (which for a five-person project is a much smaller financial loss than a five-thousand-person project), you probably don't have stringent auditing/compliance requirements that require you to ensure a record of every transaction no matter what, and in a worst-case disaster scenario (like, the entire server machine gets destroyed AND you forgot to take any backups ever), the latest content will probably live in someone's workspace, and can just be resubmitted (minus the history).

Being able to handle eventualities like connecting another drive (which you might want to do to expand storage, etc) plus routine maintenance (backups, monitoring, etc) goes back to my earlier recommendation that you run this on a platform you're comfortable with.  :)

#26773 Workspace views of Streams

Posted by Sambwise on 01 September 2020 - 02:18 PM in Streams

If you want your own unique view of the depot, that view needs to exist somewhere -- in a "classic" model it's in your workspace (which is unique anyway), and in a "stream" model the view is the stream spec (which can be shared between arbitrarily many workspaces that want the same view).  So if each individual user wants their own view, then in a stream model it means they each have their own stream.

Note that just working on your own files doesn't necessarily mean that you need a view which maps only those files; you can just avoid syncing the files you don't want to work on!  (In a classic model I'd typically map the entire depot and just sync the files I wanted.)

#26745 P4 Reconcile is trying to add ignored files

Posted by Sambwise on 23 August 2020 - 02:55 PM in P4V

Exclude the folder from the client view:

	//depot/... //Scott_LAPTOP-HACFIQTQ_3015/...
	-//depot/CC/Library/... //Scott_LAPTOP-HACFIQTQ_3015/CC/Library/...

The ignore file only works to stop you from adding new files to that folder (and only if it's not overridden by the -I flag).  Excluding files from your client view tells Perforce to treat them like they aren't even part of your workspace.

#26728 Windows knows the file is in the directory; P4V doesn't

Posted by Sambwise on 18 August 2020 - 04:08 PM in P4V

If it shows up in P4V eventually, as opposed to being absent because of some kind of filtering, then it sounds like it's a bug in P4V's refresh logic.

#26724 Windows knows the file is in the directory; P4V doesn't

Posted by Sambwise on 17 August 2020 - 08:00 PM in P4V

Do you have any filters defined in the workspace tab?

Does the file show up in the native shell (Explorer etc)?

What happens if you "p4 add" it from the command line?

#26719 change-commit in Python

Posted by Sambwise on 17 August 2020 - 02:39 PM in P4V

Python's official docs are pretty good: https://www.python.o...gettingstarted/

IMO if you have a working script (especially a relatively simple one like this) there's no particular reason to port it to a different language, especially one you aren't already familiar with.

#26716 Make all check in/out of the same user, me

Posted by Sambwise on 14 August 2020 - 02:47 PM in Administration

Yes, setting P4HOST in the config file would be a way to ensure that everywhere that config file goes, the environment looks the same.

#26710 Make all check in/out of the same user, me

Posted by Sambwise on 13 August 2020 - 11:36 PM in Administration

You can clear the Host field, but I don't generally recommend doing that because your workspace will end up in an inconsistent state if you use it from multiple hosts simultaneously.  Setting a Host field helps enforce that you only use it from one host at a time -- it's fine to move a workspace from one host to another (at which point you update the Host field to reflect the move), but then you have to consistently use it from the new one from that point on.

Another option is to just set a P4HOST value that follows you from machine to machine.  (I used to do this when I had a whole bunch of workspaces that I'd migrate when I got a new machine -- it was easier to just set my P4HOST to the name of the old machine than to update 20 client specs).


Also can I consolidate, all my Administrator and Bhavbhuti records into one?

That's pretty much up to you -- if you consistently use the same username everywhere (as defined by your P4USER setting), then you'll only have one username.  It's as simple as that.  If you don't set P4USER, then it defaults to your login name on the local OS.

#26707 Make all check in/out of the same user, me

Posted by Sambwise on 13 August 2020 - 04:54 PM in Administration

Run "p4 client" and change the "Host" field from "DEVE1" to "Bhav".  That will tell Perforce that your workspace (which used to live on DEVE1) now lives on a client host called "Bhav".

#26702 Make all check in/out of the same user, me

Posted by Sambwise on 12 August 2020 - 03:51 PM in Administration

So you set your user name to "Administrator" and your workspace name to "Bhavbuti" -- this is a little confusing but as long as you use the same names consistently it doesn't really matter what they are.  :)  Could you go to the command line and run "p4 edit <file>" on the file that you were trying to check out in SCC and paste the result you get back?

#26698 P4 extension

Posted by Sambwise on 12 August 2020 - 02:41 PM in Administration

"p4 extension" is a relatively new command (I had no idea it existed until I googled it just now), so you'll need to upgrade to the latest version of the server to be able to use it.