[p4] perforce labels

David Weintraub qazwart at gmail.com
Wed Aug 15 13:13:27 PDT 2007


In CVS, if I check out a file by a label, and the file is on the head
of that branch, I cannot do a "cvs commit" on that file. Perforce is
different in that respect. CVS kept track of the label used when you
did a sync. Perforce only tracks the absolute revision of each file in
your client work area. Perforce won't let you modify a file that is
not at the head revision of a branch, but if I do a "p4 sync
... at REL_1.0", and one of the files retrieved is at the head of the
branch, I could modify that file.

Locking the label won't prevent me from creating a new revision.

On 8/15/07, Kilaru Sambaiah <ksambaiah at gmail.com> wrote:
> Thanks for your reply.
> I am from CVS background and once created label in CVS, you can checkout
> using label, but
> can't modify a file in label and commit to the repository.
>
> My question is does Perforce has same concept?
>
> thanks and regards,
> Sam
>
>
> On 8/15/07, David Weintraub <qazwart at gmail.com> wrote:
> > A good way to think of labels is as a snapshot of the source archive.
> > For example, I have a depot with only three files in it, and I am
> > ready to do a release. The revisions of the files in my release are:
> >
> > //depot/MAIN/foo.cpp#5
> > //depot/MAIN/bar.cpp#1
> > //depot/MAIN/Makefile#3
> >
> > If I want to rebuild my release, I would have to somehow track each
> > revision of each file, and pull up each file with the correct
> > revision. However, by applying a label, I can now reference these
> > files with a single label:
> >
> >     $ p4 label REL_1.0
> >     $ p4 labelsync -l REL_1.0    #Labels all the files in my client with
> REL_1.0
> >
> > Now, if I need to pull up the old source, all I have to do is use the
> label:
> >
> >     $ p4 sync .../@REL_1.0
> >     //depot/MAIN/foo.cpp#5
> >     //depot/MAIN/bar.cpp#1
> >     //depot/MAIN/Makefile#3
> >
> > Everything is all good and fine, except what if someone moves a label
> > to another revision of a file?
> >
> >    $ p4 labelsync -l REL_1.0 //depot/MAIN/foo.cpp#6
> >
> > Now, if I try to sync to that label, I would end up getting revision
> > #6 of foo.cpp and not revision #5:
> >
> >     $ p4 sync .../@REL_1.0
> >     //depot/MAIN/foo.cpp#6   <--Wrong Revision!
> >     //depot/MAIN/bar.cpp#1
> >     //depot/MAIN/Makefile#3
> >
> > In order to prevent that from happening, I can lock the label. Now,
> > anyone attempting to move the label to another revision of a file,
> > adding a label to a particular revision, or deleting a label on a
> > particular file will get an error message stating that the label was
> > locked. No one can move a locked label. Not the Perforce
> > administrator. Not the owner of the label. In order to change the
> > label, I would first have to unlock it, and only the owner or Perforce
> > administrator can do that.
> >
> > I am still not clear what your exact question is, but let's see if I
> > can answer it:
> >
> > * Can anyone other than Bob or the Administrator modify the contents
> > of these files?
> > Yes. However, they would be creating a new revision of the file, so
> > the revision with the label isn't changed. That's the way all revision
> > control systems work. No matter what changes someone makes to the
> > file, the revisions labeled with REL_1.0 will not be modified.
> >
> > * How can I prevent people from modifying these files?
> > You need to use the "p4 protect" command. This allows you to specify
> > who can edit, or even read what files in your archive. By default, "p4
> > protect" is off. You can use it even if you don't have a license, but
> > your Perforce depot will only have a maximum of two users. This is
> > enough to play around with protection (Make one user an administrator,
> > and play with the restrictions on the other user). That way, you'll
> > get a taste of the way Perforce does protections.
> >
> > On 8/15/07, Kilaru Sambaiah <ksambaiah at gmail.com > wrote:
> > > Thanks David. I have still question.
> > >
> > > On 8/15/07, David Weintraub <qazwart at gmail.com> wrote:
> > > > Okay, let me get the question straight:
> > > >
> > > > Joe created label, set the owner as Bob, and locked the label. Only
> > > > the owner or the administrator can edit, delete, or modify the label
> > > > itself. No one can attach, remove, or move the label from a revision
> > > > of a file until it is unlocked.
> > > >
> > > > > Bob only can modify the files with that label. Is it possible?
> > > > I'm not sure whether you're talking about the label itself or the
> > > > files marked by that label. If you're talking about the label itself,
> > > > the answer is "Yes, only Bob (and the administrator) can modify the
> > > > label. No one can attach that label to a particular revision of a
> > > > file, remove the label from a particular revision of a file, or move
> > > > the label from one revision to another unless someone unlocks the
> > > > label first.
> > > >
> > > > If you are talking about restricting what Bob can do and see to
> > > > particular files. The answer is no. Bob can still edit any file -- no
> > > > matter what the label is.
> > >
> > >  Only Bob ( and the administrator) can modify the file contents or
> > >   any one can modify the contents?
> > >
> > > thanks and regards,
> > > Sam
> > >
> > > > On 8/15/07, Kilaru Sambaiah <ksambaiah at gmail.com> wrote:
> > > > > Hi All,
> > > > >    I have one basic question. I am learning perforce by installing
> demo
> > > > > version. I don't have any security mechanism enabled.
> > > > >     Joe created label and lock it, make owner as bob.
> > > > >     Bob only can modify the files with that label. Is it possible?
> > > > >    My testing environment, after assigning to Bob, Joe still able to
> > > edit
> > > > > labelspec. Is it because protection mechanism not
> > > > >    enabled?
> > > > >
> > > > > thanks and regards,
> > > > > Sam
> > > > > _______________________________________________
> > > > > perforce-user mailing list  -   perforce-user at perforce.com
> > > > >
> > >
> http://maillist.perforce.com/mailman/listinfo/perforce-user
> > > > >
> > > >
> > > >
> > > > --
> > > > --
> > > > David Weintraub
> > > > qazwart at gmail.com
> > > >
> > >
> > >
> >
> >
> > --
> > --
> > David Weintraub
> > qazwart at gmail.com
> >
>
>


-- 
--
David Weintraub
qazwart at gmail.com



More information about the perforce-user mailing list