tags:

views:

91

answers:

2

I've dug through the interwebs all I can, and I can't for the lack of me find any way of easily stashing or branching locally with perforce. I know of the git wrapper for perforce, but it really doesn't seem too well developed or reliable from everything I've read about it.

+2  A: 

Regarding branching, I doubt you can "branch" locally in Perforce, nor could you natively stash.

  • Git is based on a graph of commits (a DAG - Directed Acyclic Graph actually), which will display only the content of a commit (trees and blobs)
  • Perforce is a linear VCS, based on composition of selection rules (it will compose what to display based on local selection rules)

Regarding branching:

  • A branch in Git is just a path within the graph
  • A branch in Perforce is:
    • a codeline (most likely meaning when used as a noun)
    • a branch view specification (as in the entity created by "p4 branch" command - also a noun) - these are talked about below
    • when used as a verb ("to branch") it means to use the "p4 integrate" command to create a new codeline (or branch!) of one or more files

As mentioned in this introduction to perforce branching, Perforce, being heavily linked to its central depo, need to create the relevant metadata for each files to create a branch.
Git would only write some bits to register the creation of a new branch!

VonC
Sigh. I'm really starting to detest Perforce. Why do people pay for this?
bergyman
@Chris: Well... http://stackoverflow.com/questions/1444427/commercial-version-control/1444454#1444454 or http://stackoverflow.com/questions/1346031/is-perforce-worth-it/1346196#1346196
VonC
Perforce seems to be lacking many of the, what I've come to recognize as almost essential at least to myself, workflows.I've used cvs, svn, git and now Perforce. Hands down git made the most sense to me. Now with perforce, if I'm in the middle of a bug fix and something else comes along, there seems to be little I can do aside from manually shifting around files in the changelists to make sure I'm not checking in unfinished, unrelated work to whatever has just popped up that requires my attention. Locally stashing or branching make this cakeAm I missing some asy way to do this with Perforce?
bergyman
@Chris: in a composition-based system for version selection (akin to the ClearCase system, as I detail it in http://stackoverflow.com/questions/763099/flexible-vs-static-branching-git-vs-clearcase-accurev/764219#764219), what you need to do "when unrelated work" pops up, is to leave your current work untouched, and create *another* Perforce view or workspace, with the right configuration, in order to address that unrelated work.
VonC
+3  A: 

Perforce 2009.2 has shelve and unshelve, that let you put modifications on the server, without checking them in. http://blog.perforce.com/blog/?p=1872

I think that provides the sort of functionality you want?

If you aren't yet using 2009.2, there are also P4_Shelve and p4tar as possible alternatives.

Douglas Leeder
Very interesting and useful. +1
VonC