clamp
clamp

Reputation: 34006

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 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!

Upvotes: 9

Views: 3703

Answers (5)

Greg Whitfield
Greg Whitfield

Reputation: 5729

See also this question:

Sending my changelist to someone else without checking in.

It's basically the same thing.

Upvotes: 2

raven
raven

Reputation: 18135

  • 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.

Upvotes: 1

user100766
user100766

Reputation:

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.

Upvotes: 7

Douglas Leeder
Douglas Leeder

Reputation: 53310

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.

Upvotes: 5

Brett Bim
Brett Bim

Reputation: 3308

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

Upvotes: 5

Related Questions