Friday, 24 May 2013

HOW-TO: Apply a “baseless merge” in Team Foundation Server 2010 (and 2012)

Another purely technical post on TFS...

The scenario

We wish to migrate code between branches that do not have a branch/merge relationship, in order to expedite urgent changes being made by a project team, without disrupting on-going BAU development work.

Sample branch hierachy/strategy

Imagine the following branching strategy in TFS (visible by connecting to TFS via Visual Studio 2010 or 2012):

Essentially you have a "DEV" branch, which has a "QA" branch, which in turn has a "PROD" branch. DEV is the branch that you would be using for BAU development. As a piece of development matures, you move it into QA, where it is tested by your internal QA team. There may be further changes made in DEV that are moved into the QA branch as the QA team pick up issues. Once the QA team are happy with a packaged of changes, they will move them into PROD, which is essentially the hand-over to the customer. The PROD branch represents the software that the customer has.

Movement between these branches is "change controlled".

The "DEV-ProjectX" branch, is a branch off of DEV, that is being used to develop a package of work that is independent of BAU work that is going on. Perhaps for example, this represents an urgent or complex change that we do not want to get caught up with day-to-day activities in the codebase.

You can visualise this branching strategy by right clicking DEV and then selecting "View Hierarchy":

Sometimes a picture really can say a thousand words - I find that the visualisation tools provided for TFS by Visual Studio really help.

Our objective

So, imagine that in order to "skip" getting caught up in BAU developments, there is a desire to merge code from the DEV-ProjectX branch directly into the QA branch; this expedites the change and avoids getting it mixed up with other on-going development. To achieve this, we follow these steps:
  • Merge changes from DEV-ProjectX into QA using a “baseless merge”. This is a feature of both TFS 2010 and 2012 where a merge can be made into an unrelated branch. History of both the files/branches being merged are retained, but the files/branches do not have a branch/merge relationship:
  • Once DEV-ProjectX passes QA and is released into PROD, a merge should be performed from QA back into DEV, so that on-going development is integrated with DEV-ProjectX as soon as possible.

Baseless merge in TFS 2010

A baseless merge can be performed on a TFS2010 server, but is not available using the VS2010 UI – it is only available using the command line. In the UI, the only target branch available to be merged into, is the one that the source branch was originally branched from. Note in the following image that when you go to merge the DEV-ProjectX branch using VS2010, the "target branch" DDL only has a single entry in it:

This is what the same popup looks like when you go to merge DEV-ProjectX from VS2012:

You can see that you basically get a browse option for both the source and the target, enabling a baseless merge via the UI.

The UI will advise that you are about to do a baseless merge - it gives a little warning, like this:

Once the baseless merge has been performed, there is a link established between the branches, and subsequent baseless merges can be performed from VS2010 (the branch will appear as being available for merging into in the VS2010 DDL).

Visualising the merge

Once you have "checked in" your changes, a neat feature of VS2010 and VS2012 is the ability to visualise the changeset histories. We can even visualise the baseless merge. Right click and "View History" of the branch, and select the event associated with the baseless merge, the follow these steps to get a neat visualisastion of the baseless merge - select the baseless merged changeset and hit "Track Changeset":

Select the associated branches in the "Track Changeset" screen to show all relevant branches:

Hit the "Visualise" button" - the baseless merge is represented by the dashed line:

To get a view of the timeline of the change, hit the "Timeline Tracking" view at the top of the screen:


This approach may be useful if you have not fully migrated to VS2012 yet and want to perform these type of merges without having to use the command line.

Also note that as mentioned earlier, a baseless merge can be in TFS 2010 using the command line - but since VS2012 is available now, I haven't covered that here. 

And finally, (if you are using a branching strategy like the one described above you will already know this I guess) it's worth noting that when making changes QA/PROD branches prior to making them in DEV, those changes should be merged back down into DEV as soon as possible in order to avoid messy business later on.

Thursday, 23 May 2013

HOW-TO: Add/edit a field in Team Foundation Server 2012 using Visual Studio 2012

It's been a while since I made a purely technical post...

So, today I wanted to make a change to a Microsoft Team Foundation Server 2012 (TFS2012) instance that I am working with to reflect "Actual" time spent on a task - mainly for reporting purposes, and because I have found in the past that making this minor process adjustment yields a relatively useful metric over the long-term.

I am using the Microsoft Scrum 2.1 Process Template ( for a project that I am working with. So that I don't forget how to do this (again!) I will blog-post the procedure I've used to add this field to the template as a screen-shot-based tutorial, as follows...


Assuming you are familiar with the Scrum Process Template (2.1-ish) - open a task and take a look at the "Details" section, as follows:

 This is where I want my "Actual" field to show up.

Get the Power Tools

Download and install the latest version of the Microsoft Visual Studio Team Foundation Server 2012 Power Tools:

Open Work Item Type

You need the Power Tools to see this menu item:

Select the "Task" type

Make a "New " field

Set the field up as being a "Measure" that shows up in reports - if it doesn't show up in reports, frankly it's probably not going to be of much use (and most likely a hinderance).

Give the field a Field Reference name that makes sent to you and your colleagues - ideally, use the standard .NET namespace practice for your company.

If you want to jazz things up a bit or add a different type of field, you can get an idea how best to set the field up by looking at the configuration of other similarly typed fields - double click or "Edit" them to open and view.

Add the field to the UI

Associate the UI with the new field

Find the Field Reference in the DDL for the Field Name that you want to use in the UI.

Again, you can get an idea as best to set this up by looking at the configuration of other similarly typed fields in the UI hierarchy.

Save it...

After (Success!)

Open your task again and you should now find that there is an "Actual" field there, as above, ready to be used! You might need to refresh your browser before it shows.

For reporting purposes - you should also see that the "Actual" field shows up when you go to run a query now, or at least is available to be selected and reported on - as per the above image, showing the Query Editor.


Couple of caveats - this tutorial shows how to make the change directly at the server; to be safe, you might want to download the template and edit it locally, then upload it back to your TFS server. As I mentioned earlier, adding a field like this is not much use if it doesn't show up in reporting - worth reiterating.

TFS2012 (and TFS2010) Power Tools enable you to edit a range of features of the Scrum - and any other - Process Templates, including the actual associated workflow. That does not mean to say that it's a good idea to do that willy-nilly. 

These templates are the way they are because they represent the most flexible, and close to best-practice approach that the developers could get to. Any modifications you make will likely be diverting the process away from what's considered best-practice - certainly as far as Scrum is concerned for example, there's nothing in Scrum that requires the tracking of "Actual" time spent...

The "official" Scrum Guide:

Wednesday, 15 May 2013

Lean Startup in Politics

I was reading a paper this-morning written by NZ politician Sir Roger Douglas, in preparation for a talk that I'll be attending by this fellow as part of an economics course that I'm doing at the moment. The paper was written in 1990 and is entitled "Politics of Successful Structural Reform" - here is a link to it:

The paper is generally about policy reform in New Zealand through the 1980s and to some extent, as with most political rhetoric, is about the writer patting himself and his colleagues on the back. There is a clear tone in this paper however of an urge to improve the nation and look past petty political posturing and toward the "long game" of improving the nation's situation. Sir Roger urges the reduction of wasteful posturing and a focus on developing policy that will improve the long-term prospects of a/the nation - regardless of what party is in control. Lean Thinking comes to mind.

While reading, I stumbled across the following passage:

"Before you can plan your perfect move in the perfect way at the perfect time, the situation has already changed anyway. Instead of a perfect result, you wind up with a missed opportunity."

...regardless of what you may know of Sir Roger Douglas or what you might think of him; and despite the fact that other parts of the paper perhaps imply thinking to the contrary - this passage seems to light up the philosophy of the Lean Startup movement very, very neatly. At least, I find it to be insightful and relevant (to the Lean Startup movement), and worth quoting!

For a quick overview of "Lean Startup", take a look at this recent HBR article:

Or even better, I can highly recommend that you borrow or buy and read Eric Reis' book. If you have an interest in business or product/process development, this book I reckon, is in-fact probably on it's way to making the "must-read list" for our time:

Wednesday, 1 May 2013

Clarification: "our planet does not need to be saved"

Following a robust debate/discussion with a good friend at the weekend, on topics related to a previous post I have made, I thought it would be worth exploring further details of that previous post (made just under a year ago) and clarifying. The post was entitled "our planet does not need to be saved". If you find the title of this post intriguing and you intend to read further, I suggest you jump back and read the following link first (otherwise the following discussion will not make much sense):

My friend believes that the original post comes across as deeply pessimistic, and in some respects, nihilistic - whereas from my perspective, it is the opposite. So I'll try here to more effectively express myself and clarify my point.


To clarify up-front; from a young age I have been quite concerned about the environment and the damage that our species appears to be doing to it  (like, as a kid, I used to sometimes lose sleep over it) - that's, I guess, a 30+ year legacy of thinking about this matter. And this post reflects the current state of my thinking on this matter. 

If I examine the thought process behind this (previous) post, it leads to a notion that I currently entertain, which is that all life on Earth (the biosphere) having evolved essentially from the same single celled organisms, starting a few billion years ago, is connected, in a way that we are barely able to consciously perceive. I would go so far as to suggest that the biosphere is more-or-less sentient, and that human intelligence and conciseness is a component of that sentience. Perhaps, that is why people have an innate sense of right and wrong - and despite our various up-bringings that may compel us to be more-or-less selfish (and of course, the Theory of Evolution, which says that we are at essence, as individuals, 100% selfish) - we do stuff like worry about the environment, the planet, and each other; sometimes we even act on those worries, possibly to our personal disadvantage. I theorise that at some deep level, our species act individually and collectively, in the interest of the biosphere - not only the species - and that it's "built-in" to us (genetically?) to do so. Think of the way that migratory birds sense how to reach a precise destination, thousands of miles away without a map - I guess, like a sixth sense.

[Human tech and nature living side-by-side in downtown Auckland -]

So, at heart I am essentially an environmentalist. And, I have also come to think that supporting a(ny) cause without purpose and understanding is lost, perhaps even dangerous. I don't believe that campaigning for the saving of the environment/"planet" for the sake of "being part of a worthy cause", is in itself, a worthy cause. I think that people should truly understand why they stand for something. Here is the crux - my original post expresses from my perspective, what my cause is. I think that one of the worthiest causes that we as individuals, a species, and members of the biosphere can strive for, is to propagate the awesome, beautiful life that has bloomed on Earth, on to other planets (thus, as I say, providing redundancy). And I think that the best way that we can support that cause is simply by following our innate sense of right and wrong, and by doing our best at whatever we choose to do in life (whether we choose to be an environmental activist, a computer engineer, a road worker, or anything else), with purpose and understanding.

A couple of questions to play the devil's advocate:

  • Q: What if we are not the dominant species on the planet? 
  • A: OK, we may not be - in fact it is perhaps naive and arrogant to think that we are. The real questions are then - if we were not the dominant (or most technologically advanced) species on the planet, how would we identify that? How for example, do seagulls (assuming that humans are a more advanced species than seagulls that is!) identify that? And, would there be any benefit in being able to identify that? Personally, I think there would not be any benefit - it would in-fact only make us frustrated and sad - surely for example, seagulls don't bother thinking about how amazing human technology is; they most likely just get on with their business and believe that they are the kings of the world! Wouldn't you?
  • Q: What if it were humanity that were to be wiped out?
  • A: This question helps clarify one of my initial points in the original post; that I think although we should be aware of it and concerned about it, we should not fret too much over the destruction of some species. Think of it this way; almost all of the things that you and I take for-granted and use every day (spoons, food, tables, cars, computers, clothes, etc) directly or indirectly contribute to the destruction of species - for example, as rain forest is cleared to make way for farms and factories, etc. If you truly wanted to absolutely halt any further extinction, would you not need to give up using almost all modern technology? And so, the argument for the conservation of all species is deeply political - deeper I suspect than for any individual to successfully navigate. That being said - yes, I would most certainly take exception if it turned out that some other species decided it were no big deal if humanity were wiped out!


This "clarification" may turn out to be a further confusion on what evidently is already a confusing post. I hope that it is not though, and I would be more than happy dear reader, to discuss this matter in further detail, should you with to consider it further with me - write me a comment and/or let me get you a coffee one day - a Fairtrade one!