would like to write a powershell script. If I give it a target branch, it should tell me if any members are not merged to that branch. Is this possible ?
I keep thinking that it should be possible to create a query for this. The query would cover the following data (but don't know how to get to the data yet).
It would look for all change packages in a project without a propagated by value and a member rev timestamp > X where X is the last timestamp for when a merge was performed.
Just to make sure I understand this:
Given a branch B, you want a command that tells you if any members are not merged to B compared to a target branch of B?
So in a situation where you have something like this:
Mainline M: 1.1 .. 1.10
Branch B: 184.108.40.206 .. 220.127.116.11
Branch C: 18.104.22.168 .. 22.214.171.124
Branch 😧 126.96.36.199.1.1 .. 188.8.131.52.1.7
If you run your script targeting B, does it tell you which members on D (a sub-branch of B) don't exist in B, or which members on the mainline M are not on B, or both?
What about for a different branch C?
I want to give the script two parameters. From release and To Release. So if my from release is A, and my to release is B, if I run the script, it should give all members that were not merged into B. Also it should tell me if they were not merged correctly to B.
So any members of A which are not members of B get listed, but not members of B which are not members of A. What happens if a member was merged, but subsequently dropped on B? Is there an expectation that the script goes and looks at the historical state of the project? What happens if two members have the same name, but are actually not the same?
What do you mean be "a member of A was not merged correctly to B"? Obviously you don't just mean "not merged at all", because that's caught by your first condition. If you're asking if you could ensure that every member of A has a revision which matches a revision of the member of the same name in B, with a large and active project your script could take quite a while, be intensive on the server, and potentially the bulk data cache.
I'll have to investigate more, but after looking at the CLI documentation quickly, I think the command you want to do the actual comparison is si diff. From the command line, the si diff command diffs all members on a project. You'll want to specify -r twice to specify which revisions to compare in a project. See the documentation on si diff for more information.
The command to see the members in a project is si viewproject with --projectRevision either --devpath to specify the relevant devpath/checkpoint. You'll need to do that once for each devpath to do your comparison of members, and you might need to do that recursively (-R) if you're also concerned about subprojects.
Our script will handle adding members in A which are not in B. I'm asking about existing members in A and B. If a member in A is not merged to B, then yes it should be listed which means it was merged or propagated. And no there is no backward merges involved. As far as having two members with the same name but are not actually the same, we can ignore those cases. Those will be investigated manually.
What I mean "when A is not merged correctly to B" is when it looks like it got merged but there were no differences. I don't know if that's possible. But cases like that will have to be diff'd manually through the client to see what happened. But I'm asking if there is a command line to weed those types of incorrect merges and list them out.
There is no out-of-the-box command that will do this. Implementing most of what you are asking for should be possible with scripting or the use of the API.
Are you saying there is no way to check whether each member in a change package is merged to specific branch ? I can check each change package whether it is propagated to the next branch but I need a way to check whether each member in a given change package is merged to a specific branch. For example, I have a change package that has 3 members. If 2 out of the 3 members are merged, then that change package has been propagated and my script would tell me that change package is merged but in fact, it is not all all merged. Because there is a 3 member in that change package that is not merge. So I'm asking if there is a command line ( I am scripting this and I don't want to use the API), that will show that member was not in fact merged.
If there is no way to check this, then I would like to suggest this as an enhancement to the tool. This is a valuable and necessary enhancement to be able to audit merges.
Hello Hector Magnanao,
What I'm saying is what you really want is either RFC 101307 and especially RFC 376268. Please open cases with PTC Integrity Lifecycle Management Support for these two enhancements.