10 messages in com.perforce.perforce-user[p4] p4patch tool?| From | Sent On | Attachments |
|---|---|---|
| Kaelin Colclasure | 11 Jul 2001 18:26 | |
| Steve Cogorno | 12 Jul 2001 10:47 | |
| Chuck Karish | 12 Jul 2001 11:38 | |
| Kaelin Colclasure | 12 Jul 2001 11:52 | |
| Kaelin Colclasure | 12 Jul 2001 12:01 | |
| Gareth Rees | 12 Jul 2001 12:13 | |
| Gareth Rees | 12 Jul 2001 12:51 | |
| barries | 12 Jul 2001 13:26 | |
| Stephen Vance | 12 Jul 2001 18:10 | |
| Jeremy Fitzhardinge | 14 Jul 2001 15:32 |
| Subject: | [p4] p4patch tool?![]() |
|---|---|
| From: | Steve Cogorno (cogo...@village.eng.sun.com) |
| Date: | 07/12/2001 10:47:37 AM |
| List: | com.perforce.perforce-user |
Kaelin Colclasure said:
I am contemplating trying to keep a Linux kernel tree in Perforce in sync with the latest kernel releases from kernel.org. When a new kernel comes out, a patch is prepared against the previous version of the kernel. I am wondering if anyone has perhaps built a Perforce-aware version of `patch'?
Such a tool would:
* `p4 edit' files updated by the patch * `p4 add' files introduced by the patch * `p4 delete' files obsoleted by the patch (if indeed you can delete a file in a patch)
I'm thinking this would be considerably less error-prone than the alternative of using `p4 diff -se', etc. to try to figure out everything the patch did *after* the fact...
Actually, p4 diff is the way to go. I have a simple shell script that compares a client against the depot. I'll paste it below. Use the -update flag to issue the p4 commands. If you don't use -update, then the program merely reports the difference.
Steve Cogorno Sun Microsystems
#!/bin/sh
DIR=`pwd` UPDATE="no"
for arg do if test "$arg" = "-update" then UPDATE="yes" else DIR="$arg" fi done
printf "Checking $DIR...\n\n"
printf "Files: SERVER=yes, CLIENT=no " if test $UPDATE = "yes" then printf " (Updating server with p4 delete)\n" p4 diff -sd $DIR/... | p4 -x - delete else printf " (To sync, use p4 delete)\n" p4 diff -sd $DIR/... fi
printf "\n\n"
printf "Files: SERVER=no, CLIENT=yes " find $DIR ! -type d | p4 -x - files 1>/dev/null 2>/tmp/perforcefiles
if test $UPDATE = "yes" then printf " (Updating server with p4 add)\n" sed -n "s/\(.*\) - no such file.*/\1/p" /tmp/perforcefiles | p4 -x - add else printf " (To sync, use p4 add)\n" sed -n "s/\(.*\) - no such file.*/\1/p" /tmp/perforcefiles fi
printf "\n\n"
printf "Files: SERVER=yes, CLIENT=yes, content differs " if test $UPDATE = "yes" then printf " (Updating server with p4 edit)\n" p4 diff -se $DIR/... | p4 -x - edit else printf " (To sync, use p4 edit)\n" p4 diff -se $DIR/... fi
printf "\n\n" if test $UPDATE = "yes" then printf "All files have been opened with add/delete/edit. You must submit\n" printf "to update the server.\n" fi
printf "Finished.\n"




