A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label p4. Show all posts
Showing posts with label p4. Show all posts

How to list differences between Perforce labels


#!/bin/bash

NOW="/tmp/now_tmp"
BEFORE="/tmp/before_tmp"
LABEL=$1

USAGE="usage: "${0%}" [label]"
if [ "x$LABEL" == "x" ]; then echo $USAGE; exit; fi

p4 changes -l -i ./... > $NOW
p4 changes -l -i ./...@$LABEL &gt $BEFORE
for change_num in $(diff $NOW $BEFORE | perl -lne'/. Change (\d+)/ && print $1');
do
p4 describe $change_num |perl -pne'do { print "-----------------------------------------------------------\n\n"; exit } if m{Differences \.\.\.}'
done


Find files in workspace that perforce doesn't know about

for file in `find . -type f`; do p4 diff -f ./$file; done | grep "not on client" | sed 's/on client/in depot/'

But the sed part doesn't work (wrong stream?)

Set file modes in Perforce

Perforce.

Edit a file and:
  • explicitly set RCS keywords to be expanded (k)
  • have the executable bit set (x)
  • always be writeable on the client (w)
p4 edit -t text+kxw

or if it's already being edited:

p4 reopen -t text+kxw

See also

p4 help filetypes

+w always writable on client
+x exec bit set on client

+k $Keyword$ expansion of Id, Header, Author, Date, DateTime, Change, File, Revision
+ko $Keyword$ expansion of Id, Header only
+l exclusive open: disallow multiple opens

[full article]

Perforce commands

p4 sync -f ./...
p4 diff -f [file]
p4 filelog -l -i -t [file] // complete history (-l = long text, -i = follow branches, -t = include times)
p4 annotate [file] // show file with changes marked

Tagging

// NOTE: If no revision specified, the head revision will be tagged
p4 tag -l ProjectName_R01 [filename]#revision // tag a specific revision of a file.

p4 files @ProjectName_R01 // list files on a tag