It's all about the answers!

Ask a question

How to detect local changes in order to check-in and deliver


1
1
Eray İzgin (1161724) | asked Jan 18 '12, 5:00 a.m.
edited May 24 '16, 11:45 p.m. by David Lafreniere (4.8k7)
Hi,
I'm trying to determine how to detect local changes with scm.

The scenario:
-Make changes to a file or adding a file.
-Then check whether there is a change or new file, and then check these changes into a new change set and deliver it.

How can I determine local changes (changes that are not checked-in)?
(I should copy files from another path to current workspace and determine changes)

5 answers



permanent link
Geoffrey Clemm (30.1k33035) | answered Jan 20 '12, 12:08 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
If you are using Eclipse or Visual Studio, there should be an
"Unresolved" folder which shows you your local changes. If you've made
changes outside of Eclipse, you'll need to hit the "refresh" tool
button, which will cause Eclipse to scan the sandbox files, to find any
new changes.

Cheers,
Geoff

On 1/18/2012 5:08 AM, erayizgin wrote:
Hi,
I'm trying to determine local changes with scm.
On the scenario,
Making changes to a file or adding a file.
Then checking whether there is a change or new file.
and create changeset and deliver.

How can I determine local changes not checkin ?
(I should copy files from another path to current workspace and
determine changes)

permanent link
Eray İzgin (1161724) | answered Jan 20 '12, 5:20 a.m.
I work on RTC Client and I use plain-java-client libraries.
I try to determine local changes with this way.

IWorkspaceSearchCriteria wsSearchCriteria = WorkspaceSearchCriteria.FACTORY.newInstance();
wsSearchCriteria.setKind(IWorkspaceSearchCriteria.WORKSPACES);
wsSearchCriteria.setExactName("Example Workspace");

List<IWorkspaceHandle> workspaces = wm.findWorkspaces(wsSearchCriteria, 10, monitor);
IWorkspaceHandle workspaceHandle = workspaces.get(0);
IWorkspaceConnection workspaceLocal = wm.getWorkspaceConnection(workspaceHandle, null);
IComponent currentComponent....
IWorkspaceConnection iwc = wm.getWorkspaceConnection(workspaceHandle, null);

IPath copyFileAreaRoot = new Path("Z:\\RTC 3.0.1 Workspaces\\workspaceDeliverChangeset");
//it's my eclipse workarea folder. it's loaded folder in rtc component by click load on component. I hope I could tell.
ILocation location = new PathLocation(copyFileAreaRoot);
ISandbox sbox = sm.getSandbox(location, false);

ILocalChangeManager lcm = FileSystemCore.getSharingManager().getLocalChangeManager();
ILocalChange[] localChange = lcm.getPendingChanges(workspaceLocal.getContextHandle(),currentComponent,test);

I try to run this code, during debug process on ILocalChange
org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.

Is this right way to handle not checkin codes with api? And next I will deliver them. (unresolved -> checkin-changeset-> deliver) I try to get only modified files and new files.

permanent link
Michele Pegoraro (1.8k14118103) | answered Jan 24 '12, 6:41 a.m.
This is the code I'm using to do it:

ILocation sboxPath = new PathLocation(wsPath);

String[] targetPaths = target.split("/");
IRelativeLocation targetPath = new RelativeLocation(Arrays.asList(targetPaths));

ISharingManager sm = FileSystemCore.getSharingManager();
ISandbox sbox = sm.getSandbox(sboxPath, false);

IShare[] shares = sbox.allShares(null);

IShareable shareable = sbox.findShareable(targetPath, ResourceType.FOLDER);
IComponentHandle component = null;

ILocalChangeManager lcm = sm.getLocalChangeManager();

lcm.refreshChanges(new ISandbox[]{sbox}, RefreshType.TRAVERSE_ALL_WITH_RECOMPUTE_OF_KNOWN, null);
ILocalChange[] localChanges = lcm.getPendingChanges(new IShareable[]{shareable}, null);


It's very similar to your, but if I don't use sbox.allShares() I obtain no local changes.

Best Regards,
Michele.

Comments
1
Stefano Antoniazzi commented May 11 '16, 10:29 a.m.

 Just a comment on this: if you need to reuse the sandbox it's necessary not to leave a .jazzlock. I found that I may close "clean" with something like


sharingManager.deregister(sandbox, progressMonitor);


1
Michele Pegoraro commented May 17 '16, 5:36 a.m.

Yes, I agree.


permanent link
Eray İzgin (1161724) | answered Jan 25 '12, 3:43 a.m.
I tried your code . But localChanges had 0, no local change.
Can you also share sample target and wsPath values?

I tried wsPath like "Z:/RTC 3.0.1 Workspaces/workspaceWSBase"

String target = "Z:/RTC 3.0.1 Workspaces/workspaceTargetBase"

On debug process, ILocalChange[] localChanges line gave the message like..

"org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array."


Thanks.

permanent link
Michele Pegoraro (1.8k14118103) | answered Jan 25 '12, 6:38 a.m.
Target must be the relative path inside the repository workspace load directory and is not equals to wsPath. I use these values:

D:\\temp\\rtcWS as wsPath
/IMG as target (I've an IMG folder already versioned on my repository workspace).

Michele.

I tried your code . But localChanges had 0, no local change.
Can you also share sample target and wsPath values?

I tried wsPath like "Z:/RTC 3.0.1 Workspaces/workspaceWSBase"

String target = "Z:/RTC 3.0.1 Workspaces/workspaceTargetBase"

On debug process, ILocalChange[] localChanges line gave the message like..

"org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array."


Thanks.

Your answer


Register or to post 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.