December 28, 2011

How I Use Surround SCM: Changelists

Surround SCM
While they are not required by Surround SCM, I have to admit, I love a good changelist. In fact, it was only until recently that I was the #1 changelist user in our entire development department. Sadly, I've now slipped to #2. (Darn you Mitch.) So let's imagine that I've had a defect assigned to me in TestTrack about the user interface of the app I'm working on being choppy under certain situations. The next hour is a flurry of activity, keys are pressed, code is compiled, curses are muttered, and the interns are afraid to approach my desk for fear that I'll hit them with a copy of K&R. Note: No interns were harmed in the writing of this blog post.Note 2: Legal made me say that.Note 3: It might even be true. Anyhow, once I've got the situation fixed, I need to check this code in so QA will get off my case about it and I can go back to browsing the Internet. A check in is straightforward so I bring it up for the file or files I've changed. [caption id="attachment_10606" align="alignnone" width="412" caption="Check in Files dialog"][/caption] The important bit with changelists is that I have to make sure the "Check in as part of the following changelist" option is selected. This is actually a Surround SCM user option so you can have it set up to do this by default every time. (I do.) The drop-down next to it gives you a list of pending changelists that you haven't committed yet that could be used. For this example I'll just leave it as <New changelist> to create a new changelist. Clicking "OK" opens the Name Changelist dialog: [caption id="attachment_10605" align="alignnone" width="405" caption="Name Changelist dialog"][/caption] By default, it is populated with your username and a timestamp of when the changelist was created. You could actually make this anything you want. For example: "QA is demanding the UI be smooth in animation" "Man I wish I was reading reddit right now" "That new intern sure can duck fast" I use the default value most of the time. However, when I'm fixing a bug, I always click the "Attach to TestTrack..." button. That opens the dialog where I can select the defect I'm working on to attach the code change to: [caption id="attachment_10604" align="alignnone" width="502" caption="TestTrack Browser dialog"][/caption] Let me point out a couple of things about this dialog. First, you not only can attach your code changes to defects but you can also attach them to test cases or requirements too. That's pretty sweet in and of itself, but I can also apply all my TestTrack filters (like the <Currently Assigned to me> above) to filter the list to into something manageable. If that weren't enough, I can also view defects/test cases/requirements from here and even add or edit defects from here. This is super handy when you are working on a piece of code, find a bug in that code, and want to create a defect for it as you check in. Just to prove it, here is the dialog that opens when I click the "View" button. This is TestTrack, with all its fields and graphs and goodies, inside Surround SCM. [caption id="" align="alignnone" width="684" caption="View Defect dialog"][/caption] OK, back to attaching the code to the defect. Clicking the "Attach" button after you've selected the right bug gives you even more things you can do... [caption id="attachment_10603" align="alignnone" width="468" caption="Attach to TestTrack dialog"][/caption] ...the most important of those being that you can FIX the defect from right inside of Surround SCM. I haven't opened the TestTrack client once during all of this. I'm not jumping back and forth between apps, I'm just getting things done. Clicking "Fix..." opens the fix dialog where I leave a little note for QA saying that I've saved the day once again. [caption id="attachment_10610" align="alignnone" width="428" caption="Fix dialog"][/caption] After I click "OK", a new pending event is listed in the Attach dialog. Click "OK" again to return to the changelist. [caption id="attachment_10609" align="alignnone" width="468" caption="Event pending dialog"][/caption] This is the pending changelist dialog, and we are at the last stop on the road. [caption id="attachment_10608" align="alignnone" width="658" caption="Pending Changelist dialog"][/caption] There are loads of things you can do here like diffs, merges, etc. But, I want to commit my changes and mark the defect as fixed, so I click the "Commit Changelist" button. My changes are committed and the defect is marked as fixed in a big shot of atomic goodness. Now, if you'll excuse me, there's a pressing article on ESPN that needs my attention.