开发者

perforce: create a local backup of current pendinglist

in perforce, i have a pending list with some changed files. now i want to revert to the base, but without loosing my ch开发者_Python百科anges, 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜