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).
Related
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.
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.
New to perforce (and stackoverflow). I'm trying determine what has changed in my local view: I want to list all the recent changes under a directory in my workspace.
Perforce documentation seems to suggest everything is file based. Is there not a simple solution that does not require either probing each file individually and recursively down the directory tree, or filtering and processing changelists (multiple projects are sharing the same depot in my case)?
Ideally, I'm looking for the SVN equivalent of "svn log -v" (i.e., no path specification).
I'm also looking for a command-line solution.
Take a look at p4 changes and the documentation.
There are some examples, which might already help you. Moreover there are some global options, which you can use to specify the client, port, etc.
You are probably looking for something like
p4 changes -m 5 -s submitted //depot/project/..., which return the last 5 submitted changelists under the given depot path.
To see the last N changes under a particular workspace directory, do:
p4 changes -m N path/...
Note that path/... can be a relative local path, an absolute local path, or an absolute depot path. This is true for almost any Perforce command that accepts a file argument -- if you can specify one file you can usually specify an arbitrary pattern like "foldername/...", and you can usually specify it in either local or depot syntax.
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.
If I issue
p4 sync ...
it only syncs the files in my CWD and below to HEAD.
However, I am trying to sync a single directory to a label name
p4 sync #LABEL_NAME ...
and the result seems to be that the entire workspace (all files tagged with that label) is then sync'ed to that label, as though I had not added the "...".
Is this expected? And if so, how do I achieve what I want?
The #LABEL_NAME is a "revision specification", while the ... is a file pattern; what you want to do is to combine them, and specify both (the files in this directory and any sub-directories, at the revision in which they were tagged in the label).
To do that, you stick the revision specification after the file pattern, with no spaces between them:
p4 sync ...#LABEL_NAME
For more information about the things you can stick after the file pattern to refine your set of files, run:
p4 help revisions