Understanding after state and before State of Changeset
![](http://jazz.net/_images/myphoto/12e972b7803e8594eb74ac131f5f520a.jpg)
Hello Team,
We are actually developing a tool which can sync our Source code from RTC to our Legacy Tool. As part of this we have below questions, please answer,
- Question 1: In API, we see Change.after state and before state. What exactly is this?
- Question 2: We have Change-set which is Merge type- after state and before state both returned Null. In what cases this will happen.
- Question 3: What is ICHANGE.NONE, in what cases we get this?
Accepted answer
![](http://jazz.net/_images/myphoto/12e972b7803e8594eb74ac131f5f520a.jpg)
I can answer about question 1.
before and after methods return an IVersionableHandle object: it is, basically, a version of a file under source control in RTC.
So, when you use before, you retrieve the the file as it was before the change; when you use after, you retrieve the file as it is after the change.
I suggest that you execute:
Integer changeKind = change.kind();
in order to get the kind of the change, i.e. whether the file has been added (changeKind=1), deleted (changeKind=16) or modified (changeKind=2) by the change.
When it has been added, you should only retrieve the after version; when it has been deleted, you should only retrieve the before version, when it has been modified, you can retrieve both before and after versions, according to your needs.
Comments
![](http://jazz.net/_images/myphoto/12e972b7803e8594eb74ac131f5f520a.jpg)
For other questions, answered here
https://jazz.net/forum/questions/253798/understanding-afterstate-and-before-for-merge-scenarios