TFS: Email diffs - email

Eric suggests that you read your team's diffs every morning. Can I get TFS to automate this in some way? Ideally I'd like an email with all of the differences in, but I'd settle for a link to each of the commits.

As someone who works for Eric and who has the behaviour of checking the diffs each morning let me explain what I do. I'd like to think that I was one of the people he was thinking about when he wrote the post, but I know for a fact that he didn't know I did the diff checking each morning :-)
In Eclipse I use the Team, Synchronize... functionality to compare my local workspace with the latest on the server. As I do a get latest frequently, this tells me what has happened since I last did this (i.e. what changed while I wasn't looking).
In Visual Studio, I can do a similar thing by right clicking on the root folder of the area that interests me and selecting Compare... and then doing a compare of the Workspace version with the latest version.
Alternatively, you can just do a "History..." on the folder that is of interest and a brief scan down the history view will show you what has been happening and you can go look at what is interesting. It also encourages you to leave good check-in comments, and to encourage your developers to do the same :-)
I used to have email alerts configured for each check-in (Team, Project Alerts...), but I just ended up ignoring them most of the time. I even have a robotic rabbit configured to talk to me when someone does a check-in or runs a build - but this is only useful during the day, not checking what has happened the previous day while I was asleep (I live in a different time-zone to the rest of my colleagues so they do a lot of work while I sleep and vice-versa, making the practise of diff-checking even more useful)
In theory it would be possible to write a program that did generate you a diff each day between the latest version and your workspace version, however I've never bothered myself. This is partly because as I find the most value of the practise comes in exploring the changes that were made each day rather than just reading about them. I also admit that I wasn't aware that anyone else in the world was doing this daily diff routine - I figured I was alone in my code voyerisum, but obviously not!
UPDATE Feb 12, 2009: The following blog post just came to my attention.
http://blogs.msdn.com/abhinaba/archive/2008/07/07/auto-generating-code-review-email-for-tfs.aspx
It talks about (and provides source for) a tool called CRMail that will generate an email from a shelveset that will contain links back to Team System Web Access to show the diffs for each change in the changeset. It would be possible to modify this source to get it to show you diffs between changesets if you wanted to. Then you would just need to hook it up to run either as a nightly scheduled task or on every check-in by subscribing to the check-in event from TFS.

Have you explored setting up a report on the project portal that would show diffs based on date? I haven't done this (and I'm at home now so I can't investigate it), but I know that there is a lot of information you can get out of the portal. Whether you can get code diffs, I don't know.
The other alternative would be automating something with tfsadmin or the power tools. Again, not at work so I can't look at it, though the power tools seem like they may make it possible to do what you want from the docs.

A quick solution would be to configure project alerts to send you one email per changeset.
Filter these into a separate folder in your email client, and review them at your leisure.

Related

Website may have up to 10 files with same name/purpose, no version control

I am new at working for a large company with various people working on the same files. Sadly we don’t have version control and I often find myself cross eyed. For lack of better terminology, we have a dev site, quality-assurance site, and the live site. We have most files in two languages. Since the network connected drives have an average transfer rate of 15kb/sec we often copy the files locally before working on them. Also contractors send us new versions of files, but we may have made changes on our side and everything gets screwed up.
Basically I’m working with 6-10 files with the same name and same purpose. Does anyone have any tips on how I can keep them straight? I use Beyond Compare 2 to see the differences but if there’s a program that compares all files time stamps to see which is most current may help.
Thoughts:
1) Get version control system (Git), otherwise you will continue to have more and more pain.
2) Create a includes/lib folder and reduce that 6-10 files down (to 1).
I'll suggest, take a lead and put your code in version control and push your team to move to new repository. It'll make everybody's life easier and most important reduce chances of any merge error.
Assuming you cannot convince the powers that be to actually use source code control, why not try using Mercurial purely locally. Hopefully you can insulate yourself from some of the noise. You could even make fake users for the contractors and commit & push those changes as though they were actually doing it.
It shouldn't be too hard to get a bureaucrat to see how nice a good gatekeeper like Mercurial or Git would be. Its kind of like helpful red tape!

How do I do source code management without version control tools?

I work on a software project which has a suite of source code that undergoes periodic change. The code is typically promoted to a production environment, and development continues in a development environment. Emergency hotfixes in production need to be backported to development. A third environment for testing may also exist from time to time. Many developers work on this code at the same time, often needing to make changes to the same individual file.
In short, a classic use-case for version control software. Unfortunately, we have a stone age IT department, and we do all our development in a stock Windows XP environment with absolutely no possibility of using any other software without approval - which never happens. We are lucky to have Winzip.
So what's the best way of managing the above workflow without any real tools? At the moment we are just editing files on a Windows shared drive, making ad-hoc working copies into folders with names like "James's Copy of X", doing backups with Winzip, and calling across the room, "is anybody working on this file at the moment?"
Thanks,
James
Edit: Some clarifications:
The irony is that the system is hardly locked down at all - I could download, install and configure TortoiseHg in about 7 minutes. But I need to do this by the book.
I am also actively pursuing getting version control software through official channels, but ETA for that is 6-9 months if ever, so I'm just trying to do the best I can with what I have now.
Finally, trust me, you will be reading about this project on TheDailyWTF one day, so please help me out with what I can do now rather than what management should have done last week.
Get source control. Talk to management, refuse to work, do whatever you can to get it in.
Bring in a netbook, install a SVN server and use that. Run Git off USB drives.
Really - anything.
It is not just an industry standard now - it is irresponsible of you and your management to continue working like this.
After notifying management and explaining that this is an issue, if they do nothing, just let the inevitable happen. Something that shouldn't have been promoted to production will be (regression, bug, new feature, whatever). When they come to blame you, explain how source control can help ensure that such things do not happen again. Perhaps they will listen then.
Ok, two actual options occur to me here.
First. You have Winzip, and you appear to have web access since you're posting on Stack Overflow. Assuming you have the ability to upload files (which isn't a given, since you're still using a generic StackOverflow avatar) you could find - or build - an externally-hosted service that'll allow you to upload a ZIP file via a web browser, unzip it, and then commit the unzipped contents to a Git or Subversion repository. Stick a secure web front end on it (Apache + mod-dav-svn) and you'll have the ability to browse, review and commit changes to individual files. You won't get the benefits of local SVN/GIT capabilities like merging, but you'll have centralized project history. There could even be a quite lucrative business model in this - selling web-based SCM to developers who are stuck on IE6 and WinXP and can't install anything.
Second: You find a junior/admin in your IT team who's just as frustrated as you are at the draconian restrictions being enforced, persuade them that you know what you're doing, and get them to 'accidentally' set up a local administrator account on your workstation. WinXP is sufficiently insecure out of the box that this shouldn't be too hard to make this look like an accident.
Copy and paste the files into a seperate folder and call that folder vers_x, or get the windows backup utility to save them each day, or another backup utility to do the same? though the first post is correct, strike till vers cont is implemented.
Get git. git init on the current source "repository". Install git on everyone's pc's.
Also, the strike idea is definitely not so bad in this case.

What is the use of commit messages?

I struggled asking that question but here it is.
I am using source control since several years for multiple projects using different systems (svn, hg, git) and I learned how to improve my messages by following guidelines etc.
But as far as I can remember I never ever had a look at them afterwards.
So ... how do you profit from your own commit messages? When I need to go back because I smashed something and need a fresh start, I usually just go back to the latest "node" (where I started or merged a branch). Do I write those messages just for people monitoring the project who are curious what is going on?
Regards
You write them as an aid to your future self, and others on the team. To give you some background of when I have found them useful:
I used to work on a project where commit messages were invaluable - on more than one occasion I used them to track down code that was years old. On that project our bug tracking system was also integrated with our VCS (ClearCase). So when you checked in a change, it would record the bug number in the commit comments. This was very helpful to allow you to trace back exactly what was changed and why.
So to sum it up, although commit messages may seem pointless if you are just starting out (especially if you are the only one working on the project), they become invaluable once you have a successful product that is supported in production by multiple developers.
Update
Another useful feature of commit messages is that they require you to review and summarize the changes you just made. Even if I remember what I have changed, I will often do a quick diff of a file before checking it in. I will briefly read it all over again to make sure there are no typo's, that I changed everything I meant to, etc. This is a simple way to review your code for those small little bugs that would otherwise find their way into your code. Anyway, after doing this I have a clear picture of what changed, so I use this to write a concise summary of the change when checking in the file. This is a simple habit that helps increase code quality with little effort on your part.
"Send me a list of the things you did in the past two weeks" - Boss
Your messages are more for other users than yourself. Although I make sure to place good commit messages even on personal repos as well. Helps when you get sidetracked on a project and visit it months down the line to get a handle of the recent work done on a project.
One thing I've found is that the commit messages are a good way to keep myself from not committing often enough. If I can't put the changes into a short commit message I probably should have committed the changes earlier.
In the best case, a commit is bound to a work item in a feature/bug tracker. That way you will be able to easily see which feature/bug has been implemented/fixed. This is not only useful to know if a certain revision contains a feature or bug fix but also to easily create a release note.
What would be the point of a commit without a note to tell you what it is? It's like asking 'Why do books have titles on the sides?', or perhaps 'Why do books have indexes and page numbers?'. It seems to me that a source control log that didn't have a description for each change wouldn't be very useful.
Reasons you may need to refer to the commit message include
A bug has surfaced and you want to find when that part of the code was changed last
You decide to undo some changes and need to decide which revision to revert to
For either of these possibilities, without good commit messages, you would be left looking through the diffs for every single commit until you found what you were looking for in the code.

How do I select changesets to merge that are attached to work items?

I have a set of work items that are completed and I am ready to move their changes to our production branch. Is it possible to find the changesets that are attached to them and selectively merge them with the target branch?
Not easily is the short answer.
Currently there is no real link between work items and code promotion. You can associate a changeset with a work item on check-in (or indeed at any time), but that is about as far as things go.
Basically you would have to do this by hand using the provided UI in Visual Studio (i.e. look up the work items, get the changeset ID's and then do (possibly several) merges by selecting the appropriate changeset ranges. If this is a regular way of working then you could write a program in .NET that used the Microsoft TFS API to talk to the work item tracking component to get the changesets required and then either did the merges programatically or kicked off the command line client (tf) to bring up appropriate UI for the merges.
Sorry it's not a more helpful answer. I know that the team at Microsoft have heard this scenario a few times now however I've not heard of any plans to have it better supported "out the box" in the current or the next release of TFS. That said, there are a lot of improvements to the branching ad merging stuff in TFS2010 so it is possible that something is/will be in there that might help you. It may be worth you logging some feedback on http://connect.microsoft.com/VisualStudio for this feature if it is important to you.
Good luck,
Martin.

Keep sources from external repositories up-to-date

After you start tracking the source of a bunch of open source software, how do you keep your code in sync? Run svn update every time you want to look at or play with the code?
It strikes me that it would be better to essentially start mirroring the code with (say) a cron job every night. Have people set up workflows to do this sort of thing? (With alerts when/if any changes you make to the code end up conflicting with the latest update?)
Or am I on my own? (I'm running Mac OS X but interested in general as well as specific solutions.)
The general workflow recommended by the Subversion book is to update your working copy often; at the start of every work-day is a good time. But you don't have to. Just update whenever you feel like seeing the latest changes.
I have a number of open source repositories checked out under a src/ directory. Every couple of days, I remember to run 'svn up *' from that directory, and it updates all the working copies contained there.
If your repository sends you an email every time someone checks in, why not have a program that checks for those emails and then updates the working copy at that time? This way you're always up to date. Caveats include needlessly burning bandwidth and the possibility of getting odd conflicts when a file you're working on gets updated.
Just updating once a day, or once every few days, is only useful when there are a limited number of people working on a project, all in disparate areas of it. When you've got more than five people, and the possibility that they are working in similar parts of the code, updating once an hour, or more frequently, is much better.
I will update often really only when I use an open source library in my own application, the external repository will actually be part of my project tree, when I update my project it also updates the external repository. I think when you only look at code for research it will only make sense if you want to look at a new feature they released and then update.
You might want to look into using svn:externals: http://svnbook.red-bean.com/en/1.0/ch07s03.html