Domanda

For the latest file in a stream, how can I get the timestamp associated with the version? I tried accurev hist <elem>, but that returns the entire history and now I have to parse through it.

Edit:

When I tried accurev hist -t highest <fileName>

the result is:

element: /./a/b/c/Ver_2.xlsm
eid: 461
transaction 1335; promote; 2012/10/30 16:50:01 ; user: scrubbed
  version 1/3 (46/1)

So extracting just the timestamp i.e. 2012/10/30 16:50:01 from this entire result seemed more work. So, my first question in comments was if we can just get the timestamp back i.e. 2012/10/30 16:50:01

After trying the new command accurev hist -fx -t highest -p mydepot Ver_2.xlsm, the return value is an xml value :

......
    <transaction
        id="1335"
        type="promote"
        time="1351630201"
        user="scrubbed">
........

This time, the timestamp is returned as epoch value. I guess I can find a way to convert this to timestamp value, but if it is possible to have a return value of 2012/10/30 16:50:01, that would work best.

È stato utile?

Soluzione

Try tossing in the "-t highest" flag for your hist command, that will retrieve only the latest transaction information for the file in that stream...

This is for latest version in a specific stream:
accurev hist -fx -t highest -s stream_name .\path_to_element

This is for the latest version in the depot:
accurev hist -fx -t highest -p depot_name .\path_to_element

After your edit, I now understand that you JUST want the timestamp value. There's no way to return a single attribute. I'd suggest you use the -fx option and parse for the correct attribute. To convert epoch time to a readable value, use this:

c:>perl -e "print scalar localtime(1334932836);"
Fri Apr 20 10:40:36 2012

Hope this helps.
~James

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top