[p4] XML output for changelist descriptions

paul.ross at symbian.com paul.ross at symbian.com
Fri Oct 28 07:44:32 PDT 2005


I am talking to Perforce support about this very thing...

For various operational reasons we need for XML output so I wrote some 
Python scripts that use the -G global option. They then capture the Python 
marshalled objects from p4 and then write out the information in XML. It 
occurred to me that this would be even better (and language agnostic) if 
there was a '-X' option in the Perforce client that wrote a response to 
stdout in XML.

The advantages would be that the output of the p4 client with '-X' would 
be:
a) Language agnostic.
b) Structured.
c) Would have a stronger element of contract in place in that perforce 
could control and manage the DTD of the XML output. 

As an example of my scripts, here is the p4 client invoked directly:
$ p4 describe -s 123456
Change 123456 by PaulRo at LON-PAULR001 on 2005/10/11 17:40:49

        Clearer examples in DifferEngine. Slight change to DifferRefdoc 
that allows coloured text for strike and bold.

Affected files ...

... //foo/bar/dev/DifferEngine.py#9 edit
... //foo/bar/dev/DifferRefdoc.py#16 edit
... //foo/bar/dev/GuideXmlWriter.py#4 edit

Here is the result of a python script that unmarshals the p4 -G response:
$ python p4call.py describe 123456

-- Item: 0--
action0: edit
action1: edit
action2: edit
change: 123456
client: LON-PAULR001
code: stat
depotFile0: //foo/bar/dev/DifferEngine.py
depotFile1: //foo/bar/dev/DifferRefdoc.py
depotFile2: //foo/bar/dev/GuideXmlWriter.py
desc: Clearer examples in DifferEngine. Slight change to DifferRefdoc that 
allows coloured text for strike and bold.

rev0: 9
rev1: 16
rev2: 4
status: submitted
time: 1129048849
type0: text
type1: text
type2: text
user: PaulRo

Now here is a posible way of unmarshalling the p4 client output and 
expressing that in XML:
$ python p4client.py describe 123456
<?xml version="1.0" encoding="ISO-8859-1"?>
<P4Client>
  <CompletedCommands>
    <P4Command status="submitted" OK="True" execTime="0.308" 
changelist="123456" command="describe" timeAscii="Tue Oct 11 16:40:49 
2005">
      <Description>Clearer examples in DifferEngine. Slight change to 
DifferRefdoc that allows coloured text for strike and bold.</Description>
      <Files>
        <FileDescription action="edit" type="text" 
depotFile="//foo/bar/dev/DifferEngine.py" revision="9"/>
        <FileDescription action="edit" type="text" 
depotFile="//foo/bar/dev/DifferRefdoc.py" revision="16"/>
        <FileDescription action="edit" type="text" 
depotFile="//foo/bar/dev/GuideXmlWriter.py" revision="4"/>
      </Files>
    </P4Command>
  </CompletedCommands>
  <PendingCommands/>
</P4Client>

I am already talking to Perforce support about this and I am hopeful that 
I might be able to (at least partially) release these scripts to the 
Perforce community.

Regards,

Paul
8<------------------------------->8
Paul Ross
Technology Architect: System Documentation

perforce-user-bounces at perforce.com wrote on 28/10/2005 13:50:40:

> Hi there, 
> 
> Just wondering if anyone has written a tool or knows of a way to get
> a changelist description into XML format?
> 
> Thanks in advance...
> 
> Sean.
> 
> 

> 
> Notice to recipient:
> The information in this internet e-mail and any attachments is 
> confidential and may be privileged. It is intended solely for the 
> addressee. If you are not the intended addressee please notify the 
> sender immediately by telephone. If you are not the intended 
> recipient, any disclosure, copying, distribution or any action taken
> or omitted to be taken in reliance on it, is prohibited and may be 
unlawful.
> 
> When addressed to external clients any opinions or advice contained 
> in this internet e-mail are subject to the terms and conditions 
> expressed in any applicable governing terms of business or client 
> engagement letter issued by the pertinent Bank of America group entity.
> 
> If this email originates from the U.K. please note that Bank of 
> America, N.A., London Branch, Banc of America Securities Limited and
> Banc of America Futures Incorporated are authorised and regulated by
> the Financial Services Authority.
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user



-----------------------------------------
**********************************************************************
Symbian Software Ltd is a company registered in England and Wales with
registered number 4190020 and registered office at 2-6 Boundary Row,
Southwark, London,  SE1 8HP, UK. This message is intended only for use by
the named addressee and may contain privileged and/or confidential
information. If you are not the named addressee you should not disseminate,
copy or take any action in reliance on it. If you have received this
message in error please notify postmaster at symbian.com and delete the
message and any attachments accompanying it immediately. Neither Symbian
nor any of its subsidiaries accepts liability for any corruption,
interception, amendment, tampering or viruses occurring to this message in
transit or for any message sent by its employees which is not in compliance
with Symbian corporate policy.
**********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.perforce.com/pipermail/perforce-user/attachments/20051028/5968f115/attachment-0006.html>


More information about the perforce-user mailing list