I accidentally a label:
p4 labelsync -l foobar-rc3
How can I bring the label's files back to the revisions they were at before I labelsynced?
I'm not sure if that's easy to undo. You can lock labels to prevent accidental modification, of course. If it's critical you should ask Perforce support, as they might have a trick I haven't heard of.
Related
Hi I have two p4 clients, say client_a and client_b.
I made a shelf in client_a by:
$> p4 shelve ...
and I got a shelf CL 123456.
Then I want to unshelve the changes in client_b, but I want to keep the same CL# there.
The following command doesn't work:
$> p4 unshelve -s 123456 -c 123456
Change 123456 belongs to client client_a
How can I achieve that?
(FWIW, the reason I want to keep the CL# is because if I make further changes in client_b, I want to be able to archive the changes in the same CL# by
$> p4 shelve -r -c 123456
because multiple people are relying on the same CL# to get their work done. I don't want to create a new CL# and pass it around among many collaborators.)
Hope I made myself clear enough. Thanks in advance.
While it is technically possible to accomplish this by changing ownership of the shelf, it's the wrong tool for the job, like using the butt end of a screwdriver to pound a nail in. You almost might as well give up using version control and just email the files to each other.
Submit this change to a branch that all of the collaborators can access. This will allow everyone's work to be versioned. Shelves are not versioned and are generally only suitable for workflows that involve a single author and little or no iteration (e.g. reviewing or backing up a one-off change).
I've performed integration (p4 integrate) and then resolved conflicts in all files (p4 resolve ...). After that I noticed that one conflict could be resolved better by providing additional edits.
I want Perforce to think that the additional edits (after p4 edit file/in/question and vim file/in/question) are part of resolution, not an separate edit.
How can achieve this using p4 command line tool?
If you do p4 edit and make the edits, they will be part of the same atomic changelist and the same revision.
(It is possible to make the edits in such a way as to have them not get propagated back to the source on a reverse integrate, by "hiding" them in the merge, but you probably don't want to do this because it likely means you'll end up re-resolving the conflict later.)
I've tried to shelve files today and checked the Revert checked out files after they are shelved option, and after shelving the files some files have been reverted, but some remained. It appeared that these were new files added through p4 add. Is it default behavior to not remove such files after shelving? Is there a way to remove them as part of shelving process?
What you did in P4V (shelve with reverting) is really a plain combination of two commands: shelve and revert. Behind the scenes, P4V will shelve your work (as it surely did) and then revert everything in your changelist.
Now, the revert command reverts p4 adds in such a way that they disappear from your changelist (the essence of reverting) but they remain on the local filesystem (to prevent inadvertent loss of code/data). Yes, you can argue that in this respect revert does not do a very good job of reverting your work completely, but obviously Perforce have decided to play it safe by not deleting your work.
As #Bryan Pendleton says, you can use p4 revert -w instead of plain p4 revert when you want to also delete your p4 adds from the filesystem. It's not a separate command, just a variant of p4 revert. However, there's no way to specify the -w flag (the -w behaviour) when running the "Shelve-and-Revert" combo action from P4V. (In fact, there's no way to specify -w even in the plain "Revert" action from P4V.)
I'm assuming you won't switch from P4V to the command-line (to run p4 shelve followed by p4 revert -w) just for this reason, so just remember that P4V has this little quirk and if needed, delete your local files after reverting them.
I'm working on a script that processes the contents of a Perforce changelist. Each file in the changelist will be handled differently depending on the action associated with it.
I've already tackled the actions edit, add, integrate, and delete. So far, so good. However, for move/add and move/delete, I need a reliable means of determining the file's origin and destination, respectively. I've looked through the documentation for p4 fstat and haven't turned up anything of use.
Any ideas? Thanks.
Look at p4 filelog . It will give you the history of the moves. The -ztag output might or might not be useful for your purposes.
in perforce, i have a pending list with some changed files. now i want to revert to the base, but without loosing my changes, so i want to back them up somewhere. like saving the DIFFs of each file. at a later time, i want to restore those changes and continue my work.
is this possible? if so, how?
thanks!
there is no need for external tools at all, assuming you are on a unix machine (or have a proper cygwin setup under Windows, haven't tested it.) The only caveat is that Perforce's p4 diff produces an output that is slightly incompatible with patch, therefore you need it to point to your unix diff-command. In your client-root you can do
P4DIFF=/usr/bin/diff p4 diff -du > pending-changes.patch
optional (if you want to revert the open files from the command-line, otherwise use p4v):
p4 revert `p4 opened|awk -F\# '{print $1}'`
Later you would open the files for edit (can be automated by extracting the affected files from the patchfile pending-changes.patch and then:
patch < pending-patches
Depending on your path-layout in your client-root, you have to use the -p#num option of patch to get the patch applied cleanly.
You should be able to do a shelve. It's a way of saving a changelist for future editing. The link below is a Python add-in for Perforce that implements shelve. Also, I know that Practical Perforce has a couple of ways to shelve current changes without an external script. I don't have the book in front of me but I'll try to update this question tonight when I do.
http://public.perforce.com/wiki/P4_Shelve
Linked to from P4Shelve, is P4tar which looks very useful, and does the operations on the client, rather than branching on the server.
Certainly I'll be looking into doing similar things soon.
See also this question:
Sending my changelist to someone else without checking in.
It's basically the same thing.
Create a branch of these files in some appropriate location
Check out the branch versions of the files you have edited
Copy the edited files over from the trunk and submit them
Revert the files on the trunk
Now you've got those "diffs" you wanted safely archived. When your ready to apply those changes later on, just integrate them back into the trunk.
This is what the Python script, that Brett mentioned, does. This is the way to do it manually without any special tools.