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.
So far the closest I have been able to come is a list of the most recent changeset that modified each file, using scm history, but I don't seem to be able to get dates out of this.
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
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.
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.
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
Comments
Tim Mok
JAZZ DEVELOPER Jan 17 '13, 4:14 p.m.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?
Peter Verdon
Jan 18 '13, 4:45 a.m.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.
Tim Mok
JAZZ DEVELOPER Jan 18 '13, 2:46 p.m.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.
Peter Verdon
Jan 21 '13, 6:58 a.m.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.
Tim Mok
JAZZ DEVELOPER Jan 21 '13, 10:42 a.m.https://jazz.net/wiki/bin/view/Main/RTCSDK20_SourceControl
Peter Verdon
Jan 21 '13, 11:01 a.m.Thanks - I'll take a look at that and see how I get on.