Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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)

1

1 vote



5 answers

Permanent link
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.

1 vote

Comments

 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 vote

Yes, I agree.

1 vote


Permanent link
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)

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,934
× 1,202

Question asked: Jan 18 '12, 5:00 a.m.

Question was seen: 10,676 times

Last updated: May 24 '16, 11:45 p.m.

Confirmation Cancel Confirm