I have two files I tried to shelve with a one-liner that did not work.
How do I shelve multiple files? Below is what I tried.
p4 edit uv5_ni_llp_rcv_crd_m.sv uv5_ni_llp_rcv_crd_vc_m.sv
Made some updates before shelving these files.
p4 shelve uv5_ni_llp_rcv_crd_m.sv uv5_ni_llp_rcv_crd_vc_m.sv
Usage: shelve [ files ]
Missing/wrong number of arguments.
Thanks for any help.
p4 shelve [files] takes only a single files argument, which can include a wildcard. Try this:
p4 edit uv5_ni_llp_rcv_crd_m.sv uv5_ni_llp_rcv_crd_vc_m.sv
p4 shelve ...
Running "p4 shelve" without any arguments will "shelve" all open files.
Note well: You can still edit which files will be shelved.
The command will open a changelist description page in editor.
The description has a list of files which you can edit.
You can remove files from list, which you do not want to shelve/save.
Related
I shelved files from another branch and unshelved them in the current branch. The problem is that now I have around 1500 files in the changelist and I want to remove the files that are identical between the branches. I've tried with Revert Unchanged Files and it reverts 0 files, but when I individually diff them I get the message that they are identical.
So, how can I remove them from the changelist if they are identical to the current version.
I don't think P4V has an equivalent to this, but this is a one-liner at the command line:
p4 diff -sr | p4 -x - revert
In P4V you can "open command prompt" to get a command prompt that already has the P4 client settings configured correctly; then just copy and paste the above.
How do i download only the set of files that are modified in a changelist. I was able to find the list of files modified with p4 describe.
To sync them to your workspace, do:
p4 sync #=CHANGE
If you want to download them to arbitrary locations and/or stdout, see the p4 print command.
I have created a changelist for review by shelving some files. Now I want to implement the review comments. For that I tried unshelving the files but p4 opened still shows that the files are in the shelved changelist and not in the default changelist. I want to work on these files and again shelve the modified files in the same changelist. How to do this using p4 commands.
If you intend to update the same shelved changelist, it's actually best if the unshelved open files are open in the same changelist number, and not in the default changelist.
The overall process for updating one of your existing shelves (number NNN) is:
Make sure your workspace is empty of any work in progress: p4 opened should say "file(s) not opened on this client".
p4 unshelve -s NNN -c NNN
work on your files using your text editor, etc. If you open any new files, make sure you do: p4 edit -c NNN so that the new files, too, are in the same changelist number. You can also discard a file from this changelist number by doing p4 revert if that need should arise.
When you are ready to update your shelved changelist, do: p4 shelve -r -c NNN. This replaces all the files in the shelved changelist with the files that you have open in your workspace at that changelist number. If there is only one (or a couple) of files that you wish to replace in the shelved changelist, you can alternatively do: p4 shelve -f -c NNN //path/to/file to replace just that one file in the shelved changelist
p4 revert -w -c NNN //... to clean all those modified files out of your workspace and leave the changed versions only in the shelved changelist
You can repeat this sequence over and over to revise your shelved changelist through multiple code review cycles.
Note that this is not the only workflow that you can use with shelves. For example, it's also perfectly fine, and quite common, for developers to prefer to create multiple shelves, where each shelved changelist represents a point in time through the evolution of your work as you respond to review comments, etc.
But updating a shelved changelist in place is also a good workflow, and I use it regularly.
Watch out for one particular "gotcha", though, which is why the p4 revert -w is so important: files opened for add. If you have a file opened for add in your shelved changelist, and if you do a simple p4 revert, rather than a p4 revert -w, Perforce will leave the added file's data in your workspace on your laptop, whereas the -w flag tells Perforce to delete that file from your laptop entirely. When you do the p4 unshelve -s NNN -c NNN, if the shelved changelist contains a file opened for add, and if a file by that name is already present on your laptop, Perforce won't unshelve that file (because it doesn't want to clobber the data that's already present on your laptop), and so it won't re-open that file for add in your workspace. It will give you a "can't clobber writable file" message when it does so, but if you absent-mindedly overlook that message, then you'll not have the file open for add anymore, and when you do the p4 shelve -r -c NNN, Perforce will remove that file from the shelf, and you'll have accidentally deleted that file from your shelf. It's easy to avoid this problem if you always reliably use p4 revert -w (so put 'revert => revert -w' in your P4ALIASES file).
I have a changelist with large number of files. I have to work on other request so I shelved the changes using p4 shelve -c 899. But when I do a p4 opened the files are still showing up in workspace.
Since the number is large I want to revert all files at once. I have tried p4 revert -c 899 * but this didn't work(by * it is taking all files in current directory rather than the changelist).
How can this be done?
From the root of your client, do:
p4 revert -c 899 .... This will revert all open files in the current directory and in all subdirectories that are in changeset 899.
Is there a command to open for edit all files found in a previously submitted changelist at their latest version?
I don't want to rollback a changelist; I'm looking for a shortcut to open all the files for edit instead of resorting to finding all of the files and opening them one by one.
The best I can do is format the output of p4 describe and pipe it into p4 edit.
There is an example of this on the perforce public depot...
http://public.perforce.com/wiki/Perforce_Command_Line_Recipes
Look for Open all the files in a submitted changelist for edit
There are a few flavours of this on that page, but the basic shell command is
p4 files ...#<change num>,<change num> | sed s/\#.*// | p4 -x - edit
Disclaimer: I've not actually tried this