When "p4 describe changelist#" is issued, sometimes the affected files are listed; sometimes they are not and just show:
Affected files ...
Anyone knows why that is?
Most likely explanation: You do not have 'list' rights for the affected files. The docu for p4 protect explains the respective rights.
For example, if you have list, but no read rights, p4 describe will output:
Affected files:
//depot/path/to/file
Difference:
...
Likewise, if the list right is also missing, p4 describe will have the output that you saw. Check with your Perforce admin what the rights are for the respective depot path (let him issue p4 describe for the mentioned checklist :))
If the changelist only contains shelved files, you will see that behavior. For example:
d:\projects>p4 describe -s 925745
Change 925745 by mark.allender#client-mark.allender on 2011/08/11 07:48:04 *pending*
New SDK
Affected files ...
but since I have files that are shelved, I can use the -S option with describe to see the files that are shelved.
d:\projects>p4 describe -S -s 925745
Change 925745 by mark.allender#client-mark.allender on 2011/08/11 07:48:04 *pending*
New SDK
Shelved files ...
... //path/to/fileA#8 edit
... //path/to/fileB#11 edit
... //path/to/fileC#1 edit
... //path/to/fileD#3 edit
Also, it will display no files if there are indeed no files in the changelist, which might be the case for pending changelists. Notice that the first line of the describe output above says pending, which means that this changelist hasn't been submitted yet. Pending changelists can be empty, contain files, contain files and shelved file, or only shelved files. Depending on that state, the output of 'p4 describe' might not show any files.
Another possibility: files or file revisions have been obliterated.
Obliterating can leave submitted changelists that refer to no files.
Related
Does perforce track the time and date at which changes were made to changelists? For example, updating the description text, or shelving different revisions of files into the changelist? And if so, can this information be accessed using p4 command line?
p4 changes -t will include information about the creation time of the changelist, but not the update. p4 describe doesn't seem to include any flags related to time. p4 fstat can show time information about the files in a changelist, but not the changelist itself.
No, changelists are not versioned objects (not even in the spec depot, annoyingly). The only ways to track changes to changelists are to go under the covers, e.g.:
Scrape information from the journal file (this requires some understanding of Perforce's db schema)
Add triggers on each command that might update a changelist in the ways you want to track (this requires exhaustive understanding of Perforce's command API so you don't "miss" anything that you need to trigger on).
My p4 client version is P4/NTX64/2018.1/1705517.
I noticed that some files had accidentally been deleted in my workspace. I synced, but even so, the files did not appear.
I then ran the p4 have command and saw that it contained the missing files, and so p4 will not include those files in the sync.
Of course I can give the p4 sync command with the -f flag, but my workspace is rather large, so that would take a long time.
I then ran the flush command even with the -f flag thinking that it would correct my have list to reflect what I actually had on the filesystem of my workspace, but it didn't. What am I doing wrong?
p4 flush changes the have list to match whatever you tell it to match (if no arguments, then #head is the default). If that's not what your workspace actually contains, then the have list is now out of sync with the workspace, and future p4 sync commands will probably skip a bunch of files (exactly like you're seeing now).
The command you want is p4 clean, which syncs your workspace to match your have list. (If you have changes in unopened files, including "new" files that you haven't opened with p4 add, this will irrevocably blast them. Careful!)
If you want to open the files that don't match your have list, use p4 reconcile instead. (You can follow it up with p4 revert to discard the changes, or p4 submit to keep them permanently.)
I am very new to Perforce and just started using it.
After syncing my code using $p4 sync command i started editing a few files.
$p4 edit file1
$p4 edit file2
$p4 edit file3
These files were getting added to my default changelist. For collaborating with my team i wanted to create a changelist. For creating a changelist i ran $p4 change and removed "file1" from the changelist description. Now when i run $p4 opened. It gives an output similar to this.
//depot/... /file1 edit default change (text)
//depot/... /file2 edit default 111 (text+k)
//depot/... /file3 edit default 111 (text+k)
Now i have the following questions in my mind:
Which changelist am i currently working on is it default or 111 ??
what is the meaning of (test + k)?
When i make changes to file2 and file3 it is getting synced to changelist 111 and when i make changes to file1 it gets synced to default changelist . I am highly confused how is this happening ?
Also one more thing i am confused about is if do $p4 shelve will my changes disappear and will be reapplied only when i run unshelve command for the changelist created ?? Is this similar to git stash and git stash apply ?
It will be great if someone can answer these questions in detail. Any tutorial suggestions for Perforce will also be of great help.
Thanks in advance.
My recommendation for a Perforce tutorial is the Perforce User's Guide. Here's the section on changelists:
https://www.perforce.com/perforce/r15.1/manuals/intro/chapter.working_in_perforce.html#working_in_perforce.working_with_files.changelists
Which changelist am i currently working on is it default or 111 ??
Both! Both of these are pending changelists in your workspace.
what is the meaning of (text+k)?
The thing in parentheses is the "filetype". +k is a "filetype modifier" meaning that keywords (special words like $Id$ and $Revision$ and $Author$ in this file will be automatically expanded to appropriate values when you submit.
When i make changes to file2 and file3 it is getting synced to changelist 111 and when i make changes to file1 it gets synced to default changelist . I am highly confused how is this happening ?
Nothing is getting "synced" anywhere yet -- the pending changelists are just containers that reference the different files. When you shelve or submit, then the files associated with those changelists will get sent to the server and will be accessible by other clients. Since shelve and submit are changelist-level operations, only the files in those changelists are affected -- that's the point of having different pending changelists. You have all of the pending files in your workspace, but you can split up which ones get sent to the server at which times (it's a little like pushing different branches in git, but not -- you can do this on every operation in Perforce even when you aren't branching because each file is versioned individually rather than having the entire tree versioned as one atomic blob).
Also one more thing i am confused about is if do $p4 shelve will my changes disappear and will be reapplied only when i run unshelve command for the changelist created ?? Is this similar to git stash and git stash apply ?
No, p4 shelve only syncs the shelved change on the server with the local files in your workspace -- it doesn't in itself change your workspace. The equivalent of "stashing" would be to p4 shelve and then to p4 revert to wipe out the workspace changes. shelve on its own is a little more like doing a git push to a branch -- you keep your local copy but now it's also on the server (but not part of the "master" history). (It's not exactly the same though -- to be honest if you're brand new to Perforce I'd stick to regular old "submit" in a regular old branch since that's the basic workflow. Sharing work via shelves requires a lot more manual work since each shelf is like its own little mini-branch with no versioning.)
Is there a direct command that can compare the workspace file with the depot file and return the state of the file?
e.g.
p4 fstat D:/path/my_file.txt => inwork
p4 fstat D:/path/my_file.txt => up-to-date
In answer to the rephrased question:
Is there a direct command that can compare the workspace file with the
depot file and return the state of the file?
p4 diff -f [filename] will force a comparison (diff) regardless of whether the file is open.
The question is a bit unclear since you don't define what exactly you mean by "state" -- the p4 fstat command returns a lot of information about a file's state, and it sounds like you want some subset of that but you don't specify what.
That said, I'm guessing that you might like the p4 status command.
https://www.perforce.com/perforce/r16.2/manuals/cmdref/p4_status.html
This will tell you about files that are currently open as well as files that have been modified without being opened.
It sounds like you're looking for the -s flag to p4 diff, which I always mnemonically remember as the 'summary' flag.
https://www.perforce.com/perforce/r17.1/manuals/cmdref/Content/CmdRef/p4_diff.html
For example, p4 diff -sa: Show only the names of opened files that are different from the revision in the depot, or are missing.
I'm new to perforce, coming from a history of cvs->svn->git. I'm having a difficult time seeing a compact representation of the most recent changes impacting a set of file. For instance, if I go to a directory and type:
% p4 filelog .
It doesn't do anything useful. More interesting is
% p4 filelog *
However this shows me the change history of every file individually. I'd rather see a unified view of changes in a format showing: change number, submit message, changed files for the most recent N submits.
You can almost get this with:
p4 changes -lt [file[RevRange]...]
This will show you the changelists that affected the files in question. It doesn't show which files were affected by each change, however. You could write a script that took the output of p4 changes and used p4 describe -s to get the file listing for each changelist.
Note that p4 changes includes pending changes by default. Add -s submitted for only submitted changelists. There are other flags to narrow it down further, like -u username and -m max (to limit the number of changelists returned -- it returns newest first).
To list the files that have changed between your #start,#stop times,
p4 -c WORKSPACENAME files //Path/You/Care/About/...#2013/03/20:13:40,#2014/06/016:17:00