Discussion:
[p4] Printing name of original author
p4user_2011
2011-01-13 19:15:01 UTC
Permalink
Posted on behalf of forum user 'p4user_2011'.

Hi

I would like to print name of original author of each line of my source code in
p4. I could not find an option in p4 print command to do that. Is there a way to
do this ?

For example a file containing following -

#include <stdio.h>

main()
{
printf("Hello world\n");
printf("Hellor world from me : user2\n");
}

should come out like -

>user1 : #include <stdio.h>
>user1 :
>user1 : main()
>user1 : {
>user1 : printf("Hello world\n");
>user2 : printf("Hello world\n");
>user1 : }



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author

Please note that the Perforce Mailing lists are being deprecated. We therefore
recommend that you join the new Perforce forums at: http://forums.perforce.com
David Weintraub
2011-01-13 21:12:15 UTC
Permalink
You can use "p4 annotate" to find the version number when the change
was made, but I don't believe it lists the author. You probably have
to run "p4 filelog" to get the name of the user who submitted that
particular revision.

That means you can write a script to do this for you, but it also
means you HAVE to roll your own script to do just this.

On Thu, Jan 13, 2011 at 2:15 PM, p4user_2011
<perforce-user-***@forums.perforce.com> wrote:
>
> Posted on behalf of forum user 'p4user_2011'.
>
> Hi
> I would like to print name of original author of each line of my source code
> in
> p4. I could not find an option in p4 print command to do that. Is there a
> way to
> do this ?
>
> For example a file containing following -
>
> #include <stdio.h>
>
> main()
> {
> printf("Hello world\n");
> printf("Hellor world from me : user2\n");
> }
>
> should come out like -
>
>> user1 : #include <stdio.h>
>> user1 : user1 : main()
>> user1 : {
>> user1 : printf("Hello world\n");
>> user2 : printf("Hello world\n");
>> user1 : }
>
>
>
> --
> Please click here to see the post in its original format:
>  http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author
>
> Please note that the Perforce Mailing lists are being deprecated. We
> therefore
> recommend that you join the new Perforce forums at:
> http://forums.perforce.com
> _______________________________________________
> perforce-user mailing list  -  perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



--
David Weintraub
***@gmail.com
Matt Janulewicz
2011-01-13 21:30:26 UTC
Permalink
This is true. P4V runs a 'p4 filelog' as well as 'p4 annotate' to build the GUI for the 'Time-lapse View'. Which is another option if you don't need this information displayed in Text. The Time-lapse View tool displays the author of the change for each line/section.

--
Matt Janulewicz
Lucasfilm Entertainment Company Ltd.

________________________________________
From: perforce-user-***@perforce.com [perforce-user-***@perforce.com] on behalf of David Weintraub [***@gmail.com]
Sent: Thursday, January 13, 2011 1:12 PM
To: perforce-***@perforce.com
Subject: Re: [p4] Printing name of original author

You can use "p4 annotate" to find the version number when the change
was made, but I don't believe it lists the author. You probably have
to run "p4 filelog" to get the name of the user who submitted that
particular revision.

That means you can write a script to do this for you, but it also
means you HAVE to roll your own script to do just this.

On Thu, Jan 13, 2011 at 2:15 PM, p4user_2011
<perforce-user-***@forums.perforce.com> wrote:
>
> Posted on behalf of forum user 'p4user_2011'.
>
> Hi
> I would like to print name of original author of each line of my source code
> in
> p4. I could not find an option in p4 print command to do that. Is there a
> way to
> do this ?
>
> For example a file containing following -
>
> #include <stdio.h>
>
> main()
> {
> printf("Hello world\n");
> printf("Hellor world from me : user2\n");
> }
>
> should come out like -
>
>> user1 : #include <stdio.h>
>> user1 : user1 : main()
>> user1 : {
>> user1 : printf("Hello world\n");
>> user2 : printf("Hello world\n");
>> user1 : }
>
>
>
> --
> Please click here to see the post in its original format:
> http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author
>
> Please note that the Perforce Mailing lists are being deprecated. We
> therefore
> recommend that you join the new Perforce forums at:
> http://forums.perforce.com
> _______________________________________________
> perforce-user mailing list - perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



--
David Weintraub
***@gmail.com

_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
Thandesh V.K
2011-01-14 03:00:48 UTC
Permalink
-c and -i for annotate might be of some help here.

The -c flag tells annotate to output change numbers rather than
revision numbers with each line.

The -i flag follows branches. If a file was created by branching
'p4 annotate' includes the revisions of the source file up to the
branch point
On Fri, Jan 14, 2011 at 3:00 AM, Matt Janulewicz <
***@lucasfilm.com> wrote:

> This is true. P4V runs a 'p4 filelog' as well as 'p4 annotate' to build the
> GUI for the 'Time-lapse View'. Which is another option if you don't need
> this information displayed in Text. The Time-lapse View tool displays the
> author of the change for each line/section.
>
> --
> Matt Janulewicz
> Lucasfilm Entertainment Company Ltd.
>
> ________________________________________
> From: perforce-user-***@perforce.com [
> perforce-user-***@perforce.com] on behalf of David Weintraub [
> ***@gmail.com]
> Sent: Thursday, January 13, 2011 1:12 PM
> To: perforce-***@perforce.com
> Subject: Re: [p4] Printing name of original author
>
> You can use "p4 annotate" to find the version number when the change
> was made, but I don't believe it lists the author. You probably have
> to run "p4 filelog" to get the name of the user who submitted that
> particular revision.
>
> That means you can write a script to do this for you, but it also
> means you HAVE to roll your own script to do just this.
>
> On Thu, Jan 13, 2011 at 2:15 PM, p4user_2011
> <perforce-user-***@forums.perforce.com> wrote:
> >
> > Posted on behalf of forum user 'p4user_2011'.
> >
> > Hi
> > I would like to print name of original author of each line of my source
> code
> > in
> > p4. I could not find an option in p4 print command to do that. Is there a
> > way to
> > do this ?
> >
> > For example a file containing following -
> >
> > #include <stdio.h>
> >
> > main()
> > {
> > printf("Hello world\n");
> > printf("Hellor world from me : user2\n");
> > }
> >
> > should come out like -
> >
> >> user1 : #include <stdio.h>
> >> user1 : user1 : main()
> >> user1 : {
> >> user1 : printf("Hello world\n");
> >> user2 : printf("Hello world\n");
> >> user1 : }
> >
> >
> >
> > --
> > Please click here to see the post in its original format:
> >
> http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author
> >
> > Please note that the Perforce Mailing lists are being deprecated. We
> > therefore
> > recommend that you join the new Perforce forums at:
> > http://forums.perforce.com
> > _______________________________________________
> > perforce-user mailing list - perforce-***@perforce.com
> > http://maillist.perforce.com/mailman/listinfo/perforce-user
> >
>
>
>
> --
> David Weintraub
> ***@gmail.com
>
> _______________________________________________
> perforce-user mailing list - perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
> _______________________________________________
> perforce-user mailing list - perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



--
-------------------------------------------------------------------------------------------------------------
"The only thing worse than losing is quitting"

Your Non-Quiting Friend
Thandesha V.K
----------------------------------------------------------------------------------------------------------------------
Kevin Calman
2011-01-14 20:20:01 UTC
Permalink
Posted on behalf of forum user 'Kevin Calman'.

p4 annotate build.xml | \ awk 'BEGIN{getline};cmd="p4 -ztag
filelog " F; \ while (cmd | getline) { if (match($0,"^...
rev")) R=$3; else if (match($0,"^... user"))
U[R]=$3}}; \ {
R=substr($0,1,index($0,":")-1);
sub("^[0-9]:",""); printf "%s
(%s):\t%s\n", U[R], R, $0}' F=build.xml



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author

Please note that the Perforce Mailing lists are being deprecated. We therefore
recommend that you join the new Perforce forums at: http://forums.perforce.com
Kevin Calman
2011-01-14 20:25:01 UTC
Permalink
Posted on behalf of forum user 'Kevin Calman'.

You could do this in a POSIX environment:
p4 annotate build.xml | \ awk 'BEGIN{getline};cmd="p4 -ztag
filelog " F; \ while (cmd | getline) { if (match($0,"^...
rev")) R=$3; else if (match($0,"^... user"))
U[R]=$3}; close cmd}; \ {
R=substr($0,1,index($0,":")-1);
sub("^[0-9]:",""); printf "%s
(%s):\t%s\n", U[R], R, $0}' \ F=file.name
which produces results like,
(...) p4username_foo (1): <fail unless="build.number"
message="Please define build.number=0 or a more reasonable build
number" /> p4username_foo (1): p4username_bar (2): <property
name="lib.dir" value="${basedir}/lib" />
p4username_bar (2): <property name="main.dir"
value="${basedir}/main" /> (...)



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author

Please note that the Perforce Mailing lists are being deprecated. We therefore
recommend that you join the new Perforce forums at: http://forums.perforce.com
Chuck Karish
2011-01-17 01:54:12 UTC
Permalink
p4 changes -i <file_name> and look for the person who submitted the
first revision.

On Fri, Jan 14, 2011 at 12:25 PM, Kevin Calman
<perforce-user-***@forums.perforce.com> wrote:
>
> Posted on behalf of forum user 'Kevin Calman'.
>
> You could do this in a POSIX environment:
> p4 annotate build.xml | \ awk 'BEGIN{getline};cmd="p4 -ztag
> filelog " F; \ while (cmd | getline) { if (match($0,"^...
> rev")) R=$3; else if (match($0,"^... user"))
> U[R]=$3}; close cmd}; \ {
> R=substr($0,1,index($0,":")-1);
> sub("^[0-9]:",""); printf "%s
> (%s):\t%s\n", U[R], R, $0}' \ F=file.name which produces results like,
> (...) p4username_foo (1): <fail unless="build.number"
> message="Please define build.number=0 or a more reasonable build
> number" /> p4username_foo (1): p4username_bar (2): <property
> name="lib.dir" value="${basedir}/lib" />
> p4username_bar (2): <property name="main.dir"
> value="${basedir}/main" /> (...)
>
>
> --
> Please click here to see the post in its original format:
>  http://forums.perforce.com/index.php?/topic/704-printing-name-of-original-author
>
> Please note that the Perforce Mailing lists are being deprecated. We
> therefore
> recommend that you join the new Perforce forums at:
> http://forums.perforce.com
> _______________________________________________
> perforce-user mailing list  -  perforce-***@perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



--
Chuck Karish   ***@well.com   (650) 283-7864
Continue reading on narkive:
Loading...