[p4] Commiting partial-files

Stephen Vance steve at vance.com
Wed Apr 9 15:43:13 PDT 2008


Evgeny --

Quick answer: Perforce doesn't have this, although it has the building 
blocks to build it.

A file can only be in one changelist in a given workspace. Perforce 
gives you the diff tools to take the patch approach that he details in 
the git article, but it's definitely the roll-your-own approach that 
he's complaining about. (I would ask if he's done it enough to complain 
about it, why didn't he script it?)

Probably 99% of the occurrence of this could be avoided with a little 
thinking ahead. Even the most evolutionary software processes to date 
don't tell you that you don't need to think ahead. They may discourage 
certain types of long range and large chunk planning, but this doesn't 
fall in that category. I would relegate his example situation to a niche 
case, but regardless, people make mistakes and foreknowledge is not 
perfect, so sometimes it legitimately happens despite the best 
intentions and practices.

The Perforce way for this would be either to serialize your work 
(perhaps with the assistance of one of the shelve scripts in the Public 
Depot) or to use different workspaces (a less formally supported for 
this purpose version of the staging area).

Hope that helps,
Steve

Evgeny wrote:
> Hello perforce users,
>
> I recently read about how git allows to send partial files in a
> commit, using a staging area.
> (Like explained here: http://tomayko.com/writings/the-thing-about-git)
>
> and in bazaar there is a feature called "shelve"
> (http://bazaar-vcs.org/BzrShelveExample),
> that can be used for a similar thing.
>
> These two techniques come to address the "The Tangled Working Copy Problem".
>
> >From using Perforce I know that I can separate the files I intend to
> commit into separate changelists, and commit these changelists at
> different times and unrelated to one another. But is there a way to
> have a single file appear in two different changelists? -- while in
> one changelist the file has a certain change (function A added), and
> in the other it's a different change (function B, but in the same
> file).
>
> I doubt it exists with perforce, but I'd love to hear it if I am mistaken.
>
> Regards,
> Evgeny
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>   

-- 
Stephen Vance
www.vance.com


More information about the perforce-user mailing list