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)
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
This is the code I'm using to do it:
It's very similar to your, but if I don't use sbox.allShares() I obtain no local changes.
Best Regards,
Michele.
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.
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:
"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)
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.
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.
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.
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.
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.
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.