When we search the Linux box hosting perforce I only see normal depots. What's the mapping from the front end to the backend for stream depots please?
i.e. In the p4 client I see depot, main, and mynewstream.
In linux I see, var/perforce/depot and var/perforce/main but no streamdepots.
Thanks.
It's the same as for any other depot. Run p4 depot -o DEPOTNAME and look at the Map: field -- that tells you the directory where the archives are stored on the back end. It defaults to DEPOTNAME/... (relative to P4ROOT) but can also be an absolute path pointing to any writable filesystem.
Note that if a depot only includes files that are branched or copied from other depots, there are no physical back end copies (the database "lazy copies" them by reference from archives in other depots). If you've just seeded your stream depot by branching from another depot and haven't made any edits to it, that'd explain why you don't see a directory for it on the back end.
Related
I recently lost a lot of files, due to a hard disk error, but still have a Perforce folder containing files from a particular project. Trouble is, it's not the actual project files, but some kind of Perforce storage format, with files ending in ",d" and ",v"
Is there any way I can restore the original files from what I have?
I imagined Perforce would be able to open the folder as a depot, and I'd simply be able to get the files into a new workspace, but I can't see any way to open an existing depot. I tried editing the depot's "Storage location for versioned files" to point at the folder, but the depot still shows as empty.
I only used Perforce briefly (comparing it to Git) so I don't really understand how it works. Any help or advice would be much appreciated.
The thing you're missing is the database (the db.* files), which need to be in the server root (P4ROOT) when you start the server. If you don't have database files in P4ROOT, the server will create an empty database on startup. The database is the source of truth for a Perforce server, so if it's empty, the server is empty.
If you have a checkpoint (a file called checkpoint.N) and/or journal file, that contains the metadata you need to reconstruct the database; recover the server with p4d -jr checkpoint.N journal, and then you can use the p4 depot command to make sure the Map of your depot(s) points at the directory where your archive files are, and use other commands to inspect the actual files (start with p4 verify to see which files are in the database but missing/corrupted in the archive backup).
If you only have the archive files but no database (and no checkpoint or journal to recover it from), you're in a more difficult spot since the database is what maps the archive files into the actual depot structure (e.g. it includes all the copy-by-reference pointers that constitute branches in Perforce). However, you can extract the contents of the archive files one file at a time using conventional tools; the ,v files are in RCS format (use the co command to retrieve their content), and the ,d directories contain regular old .gz files, one per revision.
Using the deep magic to synthesize a database from the archive files on their own is also a possibility, but the RCS/CVS conversion scripts are so old I'd expect a lot of fiddling to be required to get them working with a current version of Perforce.
I have accidentally added a few folders to my default changelist that I don't want to submit to the server. How can I move these changes to another changelist, or remove them from the changelist without affecting the files on disk?
I have created a new changelist and moved some individual files / changes to this list but the folder contains many autogenerated files and this will take too long to do file by file.
I also looked at using the "revert" option but I think some of these files may have been previously added to the server in error. Reverting seems like it will change these files on disk to the previous server version.
You can specify the folder path in "Find File".
And use "*" to match all files in the contains filed.
Now you can select all the files in your folder by using "Ctrl+A"
From P4V you can multi-select the files in the pending changes window and then drag them into a new changelist. If they're all in the same directory they'll all be grouped together since it's sorted by depot path.
If you just want to have them not be open but also not modify them on disk, go to the command line and do:
p4 revert -k //depot/path/...
The -k option lets you keep your local files. This isn't available from P4V as far as I know (since it leaves your workspace out of sync with the depot state, it's usually a bad idea).
If you have generated files in your workspace that aren't supposed to go into the depot, you should exclude them from your client's View, e.g.:
View:
//depot/... //myclient/...
-//depot/path_to_generated_files/... //myclient/path_to_generated_files/...
This will essentially "hide" these files from all Perforce operations; you will never be able to add files from this workspace path, and if somebody else adds files to that depot path, you won't sync them down to your workspace. Two notes on this:
If you already have some of these files in the depot and they're currently synced, excluding them from your view and then syncing your client will remove them from your client. You can use sync -k, much like revert -k, to keep your local copies while telling the server that your client is properly up to date.
If you're using streams, you can do this for ALL clients of the stream by adding an Ignored path.
I have a lot of files within the file structure of the perforce depot that I am unable to see with the perforce clients p4 command line or p4v gui even when logged in as admin.
I have tried to find any meta data I can through p4 files and p4 filelog commands but it always returns:
"- no such file(s)."
Also I have run p4 verify and p4 dbverify to see if there we were any errors on the server but they returned no errors. There just seems to be no records of the files except for the fact that they are taking up room on the HDD.
My current theory is that they are from failed commits but I do not know how to get perforce to acknowledge the files so I can obliterate them.
Background info:
This is a simple perforce setup with just the main depot and an archive depot for old projects. (The mystery files are in the main depot)
The server version is: P4D/NTX64/2012.2/551823 (2012/11/09).
There isn't necessarily a one-to-one mapping between what's in the server's depot filesystem and the actual structure of the depot as defined in the metadata -- depot revisions are written once and are not moved or duplicated even if they're moved or duplicated from the point of view of the client. So you definitely shouldn't make the assumption that because a given file in the depot filesystem doesn't correspond to a depot file path that it's not actually providing the underlying storage for some other existing file (especially if you've used obliterate on some branches of a file while leaving others intact -- the remaining archive file may be the content for one of the ones you left).
That said, it is also possible for archives to become "orphaned" as part of a failed submit as you suggest. If the amount of space involved is small I'd suggest not worrying about it (the orphaned files won't cause any problems in terms of collisions), but if it's important to be able to clean them up, your best bet is to use "snap -n" to make sure there aren't any of those dependencies and then delete them manually (just to be safe I'd keep a backup of them at least until you've run your next verify to make sure nothing important has gone missing). Run:
p4 snap -n //... //depot/path/to/mystery/file
This says "show me files anywhere in the depot (//...) with archive dependencies on //depot/path/to/mystery/file". If you run the command without the -n it will actually break those dependencies by making physical copies (don't do this if you're worried about space since you'll end up with N redundant copies of the archive).
The inverse of p4 snap -n (i.e. "where does the archive for this depot file live?") is p4 fstat -Oc //depot/file.
When I am running p4 files ... and p4 dirs ... all the returned values have paths relative to the depot root folder. Is there a command that has the same functionality as files and dirs that returns the actual workspace path?
Given a path you can get the workspace path in a couple of different ways (that have subtle differences):
Run p4 where //depot/path/... to see the view mapping for the depot path, i.e. where the client view says this depot path maps.
Run p4 have //depot/path/... to see where the depot files are synced, i.e. where they are physically located on the client. If the files are not synced this will show you nothing (even if the files are mapped), and if the files are synced but the view mapping has changed in the meantime it will show where they were synced according to the old mapping, not where they should be according to the new mapping (i.e. what p4 where will show you).
When you're looking at an entire directory, either of these may yield a one-to-many answer, since different subpaths within a depot directory may map to different client directories. Since there isn't a one-to-one relationship there isn't a p4 dirs-style equivalent that will give you a path like //client/dir; everything will be at the file level or at the mapping (i.e. //depot/dir/... -> //client/dir/...) level.
Note that most commands (including p4 have and p4 where) will accept local paths as well as depot paths, so you can run e.g. p4 have ... to see all files that you've synced under the current directory (and its output will include the depot path as well as the client path).
I use P4Admin to create Stream Depot (named streamDepot) in perforce, then I create a Stream(main) by client, I populated it with client workspace and with a project. But when I try to obliterate the files and delete that streamDepot depot with P4Admin, I got no luck. Message says:
Depot 'streamDepot' is the location of existing streams; cannot delete until they are removed.
So what is the meaning of existing streams? I already deleted client namespace and files which mapped to streamDepot's Stream(main). What should I do? I dont see any files in streamDepot (no main stream or stream types) with viewing P4Admin by Depots Tab.
When you created the Streamdepot you created a main stream along with it (I believe, its been a while since we set ours up.) I would hazard a guess you just need to delete that stream and then you should be good to delete the depot. look for //streamdepot/Main obliterate the files, obliterate the stream, obliterate the depot.
To delete a stream depot use the command below, WARNING Make sure you clean out the depot before attempting this command.
p4 depot -d depotname
If this fails you might have files still connected to the stream depot, here is a link to the full procedure for cleaning up and deleting a depot.
https://community.perforce.com/s/article/2546
Initially none of the above solutions worked because when I created the stream, I didn't notice the checkbox that said Create a workspace to use with this steam as shown below:
Naturally this lead to the same error as reported by the OP when I tried to delete the streams and depot later:
Depot 'xxx' is the location of existing streams; cannot delete until they are removed.
Eventually I realised the cause (the workspace) and deleted the offending workspace(s) from the Workspaces tab:
With the workspaces deleted, I was able to delete the stream(s) and depot from the Streams tab and P4Admin respectively. No need for command-line.