It's all about the answers!

Ask a question

Understanding after state and before State of Changeset


vinitha dsouza (1271364) | asked Jun 13 '18, 6:09 a.m.

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


permanent link
Luca Martinucci (1.0k282109) | answered Jun 13 '18, 7:03 a.m.

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.

vinitha dsouza selected this answer as the correct answer

Comments

Your answer


Register or to post your answer.