How can I programmatically obtain a list of files modified since a certain date?
For bureaucratic purposes, I need to produce a list of files that have been modified (in our main development stream) since a given date. This needs to happen as part of a build (using Ant in JBE, but I don't mind shelling out to bash, writing Java, or hitting Web APIs if required). I realise the definition of "modified since" might have some tricky edge cases, but I'm willing to ignore a few false positives or negatives as they won't have any technical impact. Delivery of the last changeset that touched it is ideally what I'd regard as modification time, but any events likely to happen around the same time will do.
The number of files may potentially be large, so I don't want to end up making an individual request for each one if I can avoid it.
I am using RTC 3.0.1
I'm not really familiar with the RTC Java or ReST APIs, so if a response involves using them then a bit of hand-holding would not go amiss!
I'm doing this inside IBM, so can use any code that other IBMers may have.
Thanks,
Pete
showing 5 of 6
show 1 more comments
|
2 answers
I did some similar work in CLM to publish the child builds work items in the RTC build result by running 'scm compare' in Ant. Please see the wiki https://jazz.net/wiki/bin/view/Main/CLMBuildsComparer#Work_item_changes_included_in_th.
Unfortunately it does not give the list of files changes. I'm wondering if you could run build snapshot comparison, then go to the Change Explorer view. There is a "Save Change log" option. Select 'Filesystem changes' in the Elements to include section, you will get the list of files changes in Clipboard or a specified file. Comments
Peter Verdon
commented Jan 21 '13, 6:53 a.m.
Sorry, this all appears to be GUI stuff rather than something I can incorporate into a build. |
I don't know if your question has been answered, but I asked a similar question recently and got a couple of ideas: List of files changed since 1st january
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Can you create baselines or snapshots where you can use them in a comparison later? This would help simplify what you need to do. Or are the dates arbitrary?
Well, it's happening in a build, so I guess I have the "now" snapshot automatically. The "then" snapshot doesn't currently exist, and it wouldn't be tied to a particular development activity but to an arbitrary date. These aren't happening all that frequently, so I guess we could manually create them when required, but I'd prefer not to do that if possible.
Thanks.
Because you don't have snapshots of the "then" state, it'll be more work to get the information that you need. It might be best to use the Java APIs and go through each file to see when it was last modified in a stream. I think you'll have to go the route of checking the date on the last change set in the stream that includes the file.
This does sound like the approach I'll need to take. You're right that it doesn't need to happen often, so provided it completes in less than a few hours it will be acceptable.
https://jazz.net/wiki/bin/view/Main/RTCSDK20_SourceControl
Thanks - I'll take a look at that and see how I get on.