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 RicePost by Biju GeorgeOr 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 RiceAs a bonus, though, you also get the Access time indicating
that last
Post by Matthew Ricetime
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