Note that there are some explanatory texts on larger screens.

plurals
  1. POTFS2010: Retrieve all changesets associated with a branch (full recursion)
    primarykey
    data
    text
    <p>This follows <a href="https://stackoverflow.com/questions/8429040/tfs-2010-how-to-produce-a-changelog-ie-list-of-work-items-between-two-releas">my previous question</a> about TFS 2010 and the possibility to create a changelog.</p> <p>I was previously using labels to identify a version of the program, but as labels are not fixed points in time, now I'm using branches.</p> <p>Here's how the branch hierarchy looks like:</p> <p><img src="https://i.stack.imgur.com/OmjWJ.png" alt="branch hierarchy"></p> <p>As you can see, there are two different applications that are branches of the trunk: <code>APP_A</code> (application A) and <code>APP_B</code> (application B). Both are almost identical, but there are some functional differences.</p> <p>Here is the process to create a new version of the application (say version 1.3):</p> <ol> <li>The <code>Main trunk</code> is modified (new functionalities are added, bug fixes...)</li> <li>From the modified <code>Main trunk</code>, a new branch is created: <code>Main trunk 1.3</code></li> <li><code>APP_A</code> branch might be modified, so unique functionalities of <code>APP_A</code> will work with modification of v1.3</li> <li><code>APP_B</code> branch might be modified, so unique functionalities of <code>APP_B</code> will work with modification of v1.3</li> <li><code>Main trunk 1.3</code> is merged to <code>APP_A</code> and <code>APP_B</code>, so both <code>APP_A</code> and <code>APP_B</code> applications receive the modifications of the <code>Main trunk</code></li> <li>From the modified <code>APP_A</code> branch, a new branch is created: <code>APP_A_1.3</code></li> <li>From the modified <code>APP_B</code> branch, a new branch is created: <code>APP_B_1.3</code></li> </ol> <p>My goal is to be able to produce a changelog between <code>APP_A_1.3</code> and <code>APP_A_1.2</code>.</p> <p><strong>By changelog I mean a list of WorkItems.</strong> Each changeset that is checked-in is associated with one or more WorkItem (for instance a Bug item). <strong>I would like to be able to get the list of all workitems that were linked to a changeset that has impacted <code>APP_A_1.3</code></strong>: those changesets might come from the <code>Main trunk</code> (step 1 above), the <code>APP_A branch</code> (step 3 above) or even the <code>APP_A_1.3</code> branch itself (if hotfixes are checked-in after the branch has been created).</p> <p>To get this list of workitems, I tried to get <strong>the list of all changesets that are "linked" to <code>APP_A_1.2</code></strong> (<strong>"linked" = the code that was checked-in in the changeset is now on the branch <code>APP_A_1.2</code></strong>) and the list of all changesets that are "linked" to <code>APP_A_1.3</code>.</p> <p>Then, I'll be able to know which changesets are "linked" to <code>APP_A_1.3</code> and not "linked" to <code>APP_A_1.2</code>. From this subset of changesets, I'll get all associated WorkItems and thus my changelog.</p> <p>Here's my problem: how could I get the list of <strong>ALL</strong> changesets that are "linked" with a specified branch? I'm using the TFS 2010 API for C# code.</p> <p>The input of my program (that would retrieve all changesets for a specified branch) would be the name of the branch (say <code>APP_A_1.2</code>), and the output would be the list of following changesets:</p> <ul> <li>changesets applied on <code>APP_A_1.2</code> branch itself</li> <li>changesets applied on <code>APP_A</code> branch before <code>APP_A_1.2</code> was created</li> <li>changesets applied on <code>Main trunk 1.2</code> branch before it has been merged to <code>APP_A</code></li> <li>changesets applied on <code>Main trunk</code> branch before <code>Main trunk 1.2</code> was created</li> </ul> <p>I've wrote the following pieces of code to get all those changesets:</p> <pre><code>// Gets the list of all changesets ID from APP_A_1.2 branch var branch1ChangeSets = myVersionControlServer.QueryHistory( "$/PATH/APP_A_1.2/", VersionSpec.Latest, 0, RecursionType.Full, null, null, null, int.MaxValue, false, false).OfType&lt;Changeset&gt;().Select(z =&gt; z.ChangesetId).ToList(); </code></pre> <p>Even if <code>RecursionType.Full</code> is specified, the above code <strong>only</strong> returns changesets that were checked-in on the <code>APP_A_1.2</code> branch itself. This is identical to the "History" command on Source Code Explorer view in Visual Studio.</p> <p>Then I tried the following piece of code:</p> <pre><code>// Gets the list of all changesets ID from APP_A_1.2 branch var branch1MergedChangeSets = myVersionControlServer.QueryMerges( null, null, "$/PATH/APP_A_1.2/", VersionSpec.Latest, null, null, RecursionType.Full).Select(z =&gt; z.SourceVersion).ToList(); </code></pre> <p>This returns changesets that were checked-in on <code>APP_A_1.2</code> branch + those that were cheked-in on <code>APP_A</code> branch before <code>APP_A_1.2</code> was created. Much better, but not sufficient. I can't find a way to make the recursion work with branches that are "above" <code>APP_A</code> (<code>Main trunk</code> in my case)...</p> <p>Anyone has an idea?</p> <p>Also, any better ideas to get the changelog between two branches are welcome... Thx.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload