It's all about the answers!

Ask a question

fetch file "revisions" from a Component


Giacomo Ghezzi (161) | asked Mar 17 '08, 11:21 a.m.
Hi,
given a component/baseline is it possible to fetch from the repository all the checked in "revisions" of a specific file of that component/baseline?
If it is possible, how can I do that?
with the following pseudocode I'm able to get the latest "revision" of every IFileItemHandle (and thus also the source code) in the repository for a Component/Baseline:


IConfiguration conf = temp.configuration(tempComp);
Collection<IVersionableHandle> col = conf.childEntriesForRoot(null);
for(Iterator<IVersionableHandle> colIter = col.iterator(); colIter.hasNext();){
.....
....
}


How can I fetch the past "revisions" of files, that I assume are saved in the repository anytime they are modified and checked in?
cheers
Giacomo

5 answers



permanent link
Alan King Lun Lai (263) | answered Jan 22 '09, 4:11 a.m.


connection.changeHistory().getHistoryFor( ... )




Is there a way to get IComponentHandle as required by changeHistory()

from IResource?


I tried looking around but don't know where should I look/ what should I search for.


**Edit**

just figured it out,

IWorkspaceManager.findComponents() did the job for me


****

permanent link
John Camelon (1.7k14) | answered Jan 04 '09, 7:38 p.m.
JAZZ DEVELOPER
ghezzi wrote:
Hi,
given a component/baseline is it possible to fetch from the repository
all the checked in "revisions" of a specific file of that
component/baseline?
If it is possible, how can I do that?
with the following pseudocode I'm able to get the latest
"revision" of every IFileItemHandle (and thus also the
source code) in the repository for a Component/Baseline:


IConfiguration conf = temp.configuration(tempComp);
Collection<IVersionableHandle> col =
conf.childEntriesForRoot(null);
for(Iterator<IVersionableHandle> colIter = col.iterator();
colIter.hasNext();){
....
...
}

How can I fetch the past "revisions" of files, that I assume
are saved in the repository anytime they are modified and checked in?
cheers
Giacomo


Try IComponent#getInitialBaseline() for the starting point.
Workspaces have a historic baseline audit trail which can be referenced
off of IWorkspaceConnection.

HTH,
JohnC
SCM Server

permanent link
Alan King Lun Lai (263) | answered Dec 29 '08, 6:44 a.m.
Can you please tell me how can I get the baseline in the first place?

Thanks

permanent link
John Camelon (1.7k14) | answered Mar 17 '08, 2:05 p.m.
JAZZ DEVELOPER
If you have a baseline, then you can get a baseline connection for it
from the workspace manager.

To get all the revisions from that baseline, I would use

connection.changeHistory().getHistoryFor( ... ) which returns data
structures which contain the change-sets that modify this item.

You can sort through this result and collect the change-set handles,
which you can fetch if you require the ability to look at the
content/file items themselves.

HTH,
JohnC
SCM Server

ghezzi wrote:
Hi,
given a component/baseline is it possible to fetch from the repository
all the checked in "revisions" of a specific file of that
component/baseline?
If it is possible, how can I do that?
with the following pseudocode I'm able to get the latest
"revision" of every IFileItemHandle (and thus also the
source code) in the repository for a Component/Baseline:


IConfiguration conf = temp.configuration(tempComp);
Collection<IVersionableHandle> col =
conf.childEntriesForRoot(null);
for(Iterator<IVersionableHandle> colIter = col.iterator();
colIter.hasNext();){
....
...
}

How can I fetch the past "revisions" of files, that I assume
are saved in the repository anytime they are modified and checked in?
cheers
Giacomo

permanent link
John Camelon (1.7k14) | answered Mar 17 '08, 1:55 p.m.
JAZZ DEVELOPER
If you have a baseline, then you can get a baseline connection for it
from the workspace manager.

To get all the revisions from that baseline, I would use

connection.changeHistory().getHistoryFor( ... ) which returns data
structures which contain the change-sets that modify this item.

You can sort through this result and collect the change-set handles,
which you can fetch if you require the ability to look at the
content/file items themselves.

HTH,
JohnC
SCM Server

ghezzi wrote:
Hi,
given a component/baseline is it possible to fetch from the repository
all the checked in "revisions" of a specific file of that
component/baseline?
If it is possible, how can I do that?
with the following pseudocode I'm able to get the latest
"revision" of every IFileItemHandle (and thus also the
source code) in the repository for a Component/Baseline:


IConfiguration conf = temp.configuration(tempComp);
Collection<IVersionableHandle> col =
conf.childEntriesForRoot(null);
for(Iterator<IVersionableHandle> colIter = col.iterator();
colIter.hasNext();){
....
...
}

How can I fetch the past "revisions" of files, that I assume
are saved in the repository anytime they are modified and checked in?
cheers
Giacomo

Your answer


Register or to post your answer.