Is there a way to see what a branch view looked like in the past? Can this information be determined from "filelog" output?
Unfortunately, p4 filelog does not give you a synopsis; it gives you detail. So, to regenerate a branch view, you'd have to write a script that does quite a bit of analysis of the p4 filelog output. In fact, since p4 filelog reports the entire history of files, a very clever script could reproduce a branch view as it looked at any point in time. But I have to admit I'd rather look in old checkpoints to find a lost branch view than write this clever script...
The branch view is one of several data entities that are stored in a Perforce server's metadata but not versioned. Other such entities include clients, users, depots, labels, and jobs. These are fairly static entities, and the original Perforce philosophy was (1) versioning these entities would add more overhead than value, (2) users can store and version specs for these entities at will, and (3) these entities can always be restored from checkpoints.
Nevertheless, customers have requested some way of versioning these entities, and we have talked about this as a future enhancement. In the interim, we advise users who are interested in versioning any of these entities to simply output the specs to files and check the files in.
To version branch views, you could use a wrapper script for the p4 branch command. E.g., say you had a script called 'verbranch' which was invoked as 'verbranch neptune'. The script would do something like this to allow the user to edit the 'neptune' branch view and submit the new branch view automatically:p4 sync //depot/entities/neptune.branch p4 edit //depot/entities/neptune.branch p4 branch neptune p4 branch -o > $MYCLIENT/entities/neptune.branch p4 submit //depot/entities/neptune.branchYour script could also restore previous versions of the branch view. E.g., 'verbranch neptune -r@456' would restore the branch view to the way it looked back when the highest changelist in the depot was 456:p4 sync //depot/entities/neptune.branch p4 edit //depot/entities/neptune.branch p4 print -q //depot/entities/neptune.branch@456 | p4 branch -i neptune p4 branch -o > $MYCLIENT/entities/neptune.branch p4 submit //depot/entities/neptune.branch