[p4] Tag and Label via cmd line with description

Gabor Maghera gmaghera at gmail.com
Tue Oct 21 16:14:33 PDT 2008


I was under the same impression when I started working with this task, but
it does actually label the files.

>From the Ant manual:

P4LabelDescription:
>
> Create a new label and set contents to reflect current client file
> revisions.
>

Gabor


On Tue, Oct 21, 2008 at 4:07 PM, Tony Sweeney <sweeney at addr.com> wrote:

> Gabor Maghera wrote:
>
>> Hi Peter,
>>
>> Have you considered using the Perforce tasks which come with Ant?  Here is
>> a snippet from an Ant build file, using the p4label task:
>>
>>        <target name="p4.label" depends="init, p4.where"
>>    description="Tag source in Perforce">
>>            <p4sync
>>                view="${p4.view}/..."
>>            />
>>            <p4label
>>                name="${build.label}"
>>                desc="${build.label}"
>>                view="${p4.view}/..."
>>            />
>>        </target>
>>
>>  If you do go this route, don't forget that this will only create the
> named label spec, not actually tag any files with the label.  For that you
> will need the <p4labelsync/> task (analogous to the separate 'p4 tag'
> command in your command line version).
>
> http://ant.apache.org/manual/OptionalTasks/perforce.html
>
> Tony.
>
>>
>> Cheers,
>> Gabor
>>
>>
>> On Tue, Oct 21, 2008 at 12:55 PM, Tony Sweeney <sweeney at addr.com <mailto:
>> sweeney at addr.com>> wrote:
>>
>>    peter mcgrath wrote:
>>    > Hi
>>    >
>>    > I have an ANT script where I'm trying to create a label and I'm
>>    using that
>>    > label to Tag a Project, I want to have the description\comment
>>    for the label
>>    > go in with the tag, which presently I have not found any info
>>    on. When I
>>    > execute the command  <arg line="p4 label -i ${label}
>>    //depot/test/..."/> I
>>    > get the error:
>>    > [exec] Usage: label [ -d -f -i -o -t template ] labelname
>>    >      [exec] Missing/wrong number of arguments.
>>    >      [exec] Result: 1
>>    >
>>    > So if anyone knows how I can create a label without the above
>>    error would be
>>    > great, but that aside I need to know how to add the description
>>    to a TAG as
>>    > the code is tagged but there is no description only who created
>>    the tag. Any
>>    > and all help and hints are welcome.
>>    >
>>    > <target name="test-label">
>>    >
>>    >    <echo>Label: P4: labelling tree //depot/test/... ${label}</echo>
>>    >   <exec executable="cmd">
>>    >        <arg value="/c"/>
>>    >         <arg line="p4 label -i ${label} //depot/test/..."/>
>>    >      </exec>
>>    >
>>    'p4 label -i' expects to read the label spec from stdin.  The quickest
>>    way to generate a valid label spec is with 'p4 label -o
>>    labelname'.  Try
>>    it to see the format.  That won't actually create the a label called
>>    'labelname' if it doesn't already exist, it just prints out  a valid
>>    spec.  Pipe the output to 'p4 label -i', however, and your label
>>    will be
>>    created.  You can use '-t template' as an additional argument to 'p4
>>    label -o' if you want the view restricted to some subset of your depot
>>    as specified in an existing label.
>>
>>    >   <exec executable="cmd">
>>    >        <arg value="/c"/>
>>    >         <arg line="p4 tag -l ${label} //depot/test/..."/>
>>    >      </exec>
>>    >  </target>
>>    >
>>    This part should be fine.
>>
>>    Tony.
>>    > _______________________________________________
>>    > perforce-user mailing list  -  perforce-user at perforce.com
>>    <mailto:perforce-user at perforce.com>
>>    > http://maillist.perforce.com/mailman/listinfo/perforce-user
>>    >
>>    >
>>    >
>>    _______________________________________________
>>    perforce-user mailing list  -  perforce-user at perforce.com
>>    <mailto:perforce-user at perforce.com>
>>    http://maillist.perforce.com/mailman/listinfo/perforce-user
>>
>>
>>
>



More information about the perforce-user mailing list