Discussion:
[p4] Displaying 'owner' information in a 'p4 branches' command
Biju George
2003-11-26 13:03:37 UTC
Permalink
Hi Group,

Is there a way to display/extract the 'branch owner'
information using 'p4 branches' command (or p4 labels
in case of labels).

Or is there any other command (other than p4 branch
-o) that can be used for this purpose.

I am writing a script to isolate branches owned by
specific users that have not been used for a while.
Hence this requirement.

WIll be grateful for any help.

Regards,
Biju George


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
Matthew Rice
2003-11-26 14:45:41 UTC
Permalink
Post by Biju George
Or is there any other command (other than p4 branch
-o) that can be used for this purpose.
I am writing a script to isolate branches owned by specific users that have
not been used for a while. Hence this requirement.
You seem to get this info with: p4 -G branches

If you aren't using Python, you'll have to massage the output a little.

As a bonus, though, you also get the Access time indicating that last time
that the branch spec was used in an integration.

HTH,
--
matthew rice <***@starnix.com> starnix inc.
phone: 905-771-0017 x242 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
David Jones
2003-11-26 16:13:45 UTC
Permalink
Post by Matthew Rice
Post by Biju George
Or is there any other command (other than p4 branch
-o) that can be used for this purpose.
I am writing a script to isolate branches owned by specific users that have
not been used for a while. Hence this requirement.
You seem to get this info with: p4 -G branches
If you aren't using Python, you'll have to massage the output a little.
As a bonus, though, you also get the Access time indicating that last time
that the branch spec was used in an integration.
p4 -ztag branches

Is perhaps more friendly to those not using python.

Both -G and -ztag are in help undoc so not supported. But I'm sure
there are large numbers of scripts and tools that use both anyway.

David Jones
Ravenbrook Limited
m***@acterna.com
2003-11-26 15:18:05 UTC
Permalink
You also get this information with "tagged output" mode:

p4 -Ztag branches

Its output is a little easier to "massage" if you're not using Python. :-)

- Mike

--
Mike Allard, Software Engineer, NetOptimize OSS
Acterna - 300 East Campus Drive, Terre Haute, IN 47802
812-231-5055 -- ***@acterna.com






Matthew Rice <***@starnix.com>
Sent by: perforce-user-***@perforce.com
11/26/2003 09:45 AM


To: Biju George <***@yahoo.com>
cc: perforce-***@perforce.com
Subject: Re: [p4] Displaying 'owner' information in a 'p4 branches' command
Post by Biju George
Or is there any other command (other than p4 branch
-o) that can be used for this purpose.
I am writing a script to isolate branches owned by specific users that
have
Post by Biju George
not been used for a while. Hence this requirement.
You seem to get this info with: p4 -G branches

If you aren't using Python, you'll have to massage the output a little.

As a bonus, though, you also get the Access time indicating that last time
that the branch spec was used in an integration.

HTH,
--
matthew rice <***@starnix.com> starnix inc.
phone: 905-771-0017 x242 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
Matthew Rice
2003-11-26 16:25:12 UTC
Permalink
Post by m***@acterna.com
p4 -Ztag branches
Its output is a little easier to "massage" if you're not using Python. :-)
Absolutely. I keep forgetting that option because it is still in the undoc
section. It seems like a well intentioned and innocuous option. I don't
know why it isn't an official feature option.

TTYL,
--
matthew rice <***@starnix.com> starnix inc.
phone: 905-771-0017 x242 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
Robert Cowham
2003-11-26 16:56:25 UTC
Permalink
And with the new release (2003.2 currently in beta), you have marshalled
Ruby format available as well (via -R):

C:\bruno_ws>p4 -R branches | ruby -e "begin while o = Marshal.load($stdin);
o.each{|key,val| print \"#{key}=#{val}\n\"}
; end; rescue EOFError; end"

Options=unlocked direct
Owner=
code=stat
Access=0
branch=b827
Update=946889777
Description=Source + doc branch for release 827.
Label s810 is the base (for source).
Using current doc.

Options=unlocked direct
Owner=bruno
code=stat
Access=1068811937
branch=dev
Update=1068649311
Description=Created by bruno.

Note the the Ruby code more nicely formatted (not all on one line) is:

begin
while o = Marshal.load($stdin)
o.each{|key,val| print "#{key}=#{val}\n"}
end
rescue EOFError
end



You can access the (update) time in readable format using:

print Time.at(o['Update'].to_i).to_s

Giving:

Fri Nov 14 12:14:42 GMT Standard Time 2003

Or similar

Robert
-----Original Message-----
Sent: 26 November 2003 16:14
Cc: Biju George
Subject: Re: [p4] Displaying 'owner' information in a 'p4
branches' command
Post by Matthew Rice
Post by Biju George
Or is there any other command (other than p4 branch
-o) that can be used for this purpose.
I am writing a script to isolate branches owned by specific users
that have
not been used for a while. Hence this requirement.
You seem to get this info with: p4 -G branches
If you aren't using Python, you'll have to massage the
output a little.
Post by Matthew Rice
As a bonus, though, you also get the Access time indicating
that last
Post by Matthew Rice
time
that the branch spec was used in an integration.
p4 -ztag branches
Is perhaps more friendly to those not using python.
Both -G and -ztag are in help undoc so not supported. But I'm sure
there are large numbers of scripts and tools that use both anyway.
David Jones
Ravenbrook Limited
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
Kevin Wang
2003-11-26 18:10:51 UTC
Permalink
Is anyone at all interested in a perl library that wraps perforce, parsing
it out into a hierarchy of objects? I've partially implemented a library,
though it's still mostly just a framework and has a several limitations,
it's somewhat useful. For example, doing a p4 filelog returns a Filelog
object with N number of Revision objects, where each one is a specific #1 or
#2 version, and each of those contain a Integration object which contains
all the data from each line of "branch into" etc.

So far it's just a parsing and encapsulation library, but soon I'm going to
start adding some higher level logic to parse things out better, like to
determin the actual action that happened in an integration. The Integration
object is insufficient, because you still need the "integrate|edit|add"
keyword from the Revision object. Only together does "edit, copy from" make
sense (versus "integrate, copy from").

Also, this is in pure perl, no local binary objects used. Yes, this means
that I'm parsing the output of p4 text directly which is a pain (and
incomplete), but it gives me the platform independence that I need.

- Kevin

For example:

p4 filelog Makevars#1

Filelog:Revision:... #1 change 1 add on 2001/12/01 by
***@p4_p4datacvsimport_trunk (text) 'import from cvs to p4'
Filelog:Revision:Integration:... ... branch into
//depot/dev_2001_12_01_goalori/src/Makevars#1
Filelog:Revision:Integration:... ... branch into
//depot/dev_2001_12_01_howard/src/Makevars#1
Filelog:Revision:Integration:... ... branch into
//depot/dev_2001_12_01_rmws/src/Makevars#1
Filelog:Revision:Integration:... ... branch into
//depot/dev_2001_12_03_will/src/Makevars#1

and you can do something like
$filelog=...
$revision=($filelog->getRevisions())[1];
$integration=($revision->getIntegrations())[0];
print $integration->getDstDepot(); ==>
dev_2001_12_01_goalori
print $integration->getDstDepotDir(); ==>
//depot/dev_2001_12_01_goalori/src/
print $integration->getDstDepotDirFilename(); ==>
//depot/dev_2001_12_01_goalori/src/Makevars
print $integration->getDstDepotDirFilenameRevision(); ==>
//depot/dev_2001_12_01_goalori/src/Makevars#1
print $integration->getDstDir(); ==> src/
print $integration->getDstDirFilename(); ==> src/Makevars
print $integration->getDstDirFilenameRevision(); ==> src/Makevars#1

and more.

-----Original Message-----
From: perforce-user-***@perforce.com
[mailto:perforce-user-***@perforce.com]On Behalf Of Robert Cowham
Sent: Wednesday, November 26, 2003 8:56 AM
To: perforce-***@perforce.com
Subject: RE: [p4] Displaying 'owner' information in a 'p4 branches'
command


And with the new release (2003.2 currently in beta), you have marshalled
Ruby format available as well (via -R):

C:\bruno_ws>p4 -R branches | ruby -e "begin while o = Marshal.load($stdin);
o.each{|key,val| print \"#{key}=#{val}\n\"}
; end; rescue EOFError; end"

Options=unlocked direct
Owner=
code=stat
Access=0
branch=b827
Update=946889777
Description=Source + doc branch for release 827.
Label s810 is the base (for source).
Using current doc.

Options=unlocked direct
Owner=bruno
code=stat
Access=1068811937
branch=dev
Update=1068649311
Description=Created by bruno.

Note the the Ruby code more nicely formatted (not all on one line) is:

begin
while o = Marshal.load($stdin)
o.each{|key,val| print "#{key}=#{val}\n"}
end
rescue EOFError
end



You can access the (update) time in readable format using:

print Time.at(o['Update'].to_i).to_s

Giving:

Fri Nov 14 12:14:42 GMT Standard Time 2003

Or similar

Robert
-----Original Message-----
Sent: 26 November 2003 16:14
Cc: Biju George
Subject: Re: [p4] Displaying 'owner' information in a 'p4
branches' command
Post by Matthew Rice
Post by Biju George
Or is there any other command (other than p4 branch
-o) that can be used for this purpose.
I am writing a script to isolate branches owned by specific users
that have
not been used for a while. Hence this requirement.
You seem to get this info with: p4 -G branches
If you aren't using Python, you'll have to massage the
output a little.
Post by Matthew Rice
As a bonus, though, you also get the Access time indicating
that last
Post by Matthew Rice
time
that the branch spec was used in an integration.
p4 -ztag branches
Is perhaps more friendly to those not using python.
Both -G and -ztag are in help undoc so not supported. But I'm sure
there are large numbers of scripts and tools that use both anyway.
David Jones
Ravenbrook Limited
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
Kevin Wang
2003-11-26 18:13:50 UTC
Permalink
AUGH! I wish I knew about this option before I implemented my p4 parsing
wrapper. (see other post) At least I used -s, but this is far far more
useful.

sigh

<goes off to cry>

- Kevin

-----Original Message-----
From: perforce-user-***@perforce.com
[mailto:perforce-user-***@perforce.com]On Behalf Of Matthew Rice
Sent: Wednesday, November 26, 2003 8:25 AM
To: ***@acterna.com
Cc: Biju George; perforce-***@perforce.com
Subject: Re: [p4] Displaying 'owner' information in a 'p4 branches'
command
Post by m***@acterna.com
p4 -Ztag branches
Its output is a little easier to "massage" if you're not using Python. :-)
Absolutely. I keep forgetting that option because it is still in the undoc
section. It seems like a well intentioned and innocuous option. I don't
know why it isn't an official feature option.

TTYL,
--
matthew rice <***@starnix.com> starnix inc.
phone: 905-771-0017 x242 thornhill, ontario, canada
http://www.starnix.com professional linux services & products
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Continue reading on narkive:
Loading...