Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for December 5, 2013
Deadline scheduling: coming soon?
LWN.net Weekly Edition for November 27, 2013
ACPI for ARM?
LWN.net Weekly Edition for November 21, 2013
In a centralized system no one ever considers such a timeline which mixes different branches. Why would you shoot yourself in the foot like this? It would not make any sense.
The unfortunate side-effect of a decentralized system is that you cannot avoid considering such timelines, because of the incredible ease of branching and merging that you have there.
Finding a patch's kernel version with git
Posted Jun 20, 2010 21:35 UTC (Sun) by farnz (guest, #17727)
Consider the following arrangement (which isn't uncommon); development takes place on the main branch (trunk in SVN terminology). When a release is made, the release manager tags it with a tag like "release-4-0-0", and they also create a "maint-4-0" branch for bugfixes only. Development of new features continues apace on trunk, leading towards a 4.1 release (tag "release-4-1-0", branch "maint-4-1").
During a deployment of 4.0.0, a bug report comes in; as the sustaining engineer responsible for 4.0, I have a copy of the maint-4-0 branch checked out, as well as a copy of trunk. It's late on a Friday, but as the bug reporter is important, I diagnose the bug, discovering that it's an obscure interaction between something very specific in their configuration and our software. Because it's an obscure interaction, it's unlikely to be seen by anyone else, and automated testing won't catch it. However, it's a simple bug to fix, so I code the fix, check it in, and send the reporter a hotfix to test.
I duly note in the bug tracker that I've checked in a fix, SVN revision 155234. Process tells me that I need to forward port the fix to trunk as well as check it in to maintenance, but I'm now very tired, and don't trust myself to forward port it properly, so I leave it, fully intending to come back and do the rest of the job later.
Life intervenes, and I forget. The only formal record of the problem says it was fixed in revision 155234; my colleages note that trunk is now at 156974, and assume that the fix is in trunk. Because we got ahead of plan on feature development, 4.1.0 is ready before we've accumulated enough minor bugs to make a 4.0.1 release worthwhile; we can tell from the revision number that my fix is after 4.0 was released, but before 4.1 was ready. The resulting assumption upsets the original bug reporter, because they saw a 4.0 release that failed, a quick fix that I said was checked in, and a 4.1 release that fails again in the same way.
And before you claim this is unrealistic, that no-one uses SVN like this, please be aware that I've not worked anywhere in the last 10 years that uses centralised VCS (not just SVN, but commercial VCS as well), and doesn't use it like this. Most large projects have a need for branches - if nothing else, one for development, one for maintenance, so that users can pick up just bug fixes to the latest release without picking up half-baked new features too.
Posted Jun 21, 2010 8:24 UTC (Mon) by marcH (subscriber, #57642)
This is the unrealistic part. The above assumes that you *and* your colleagues have never heard about branching in their entire life.
Everyone using SVN knows well that a revision number is meaningless without a branch. In the real (and centralized) world, you duly note in the bug tracker in which revision *and branch* you committed the fix. Even if you are clueless and forget the branch information, then your less incompetent colleagues will notice your mistake and find this information instantly in just one simple "svn log -r 155234" command: much easier than in decentralized, branching-fest system.
Posted Jun 21, 2010 8:52 UTC (Mon) by farnz (guest, #17727)
Actually, this is based on real events - it does happen like this in the real world, because I've been there to experience it. My colleague noted the revision number in bugtracker, expecting it to be obvious and implicit that he was working on the maint branch, because he was the sustaining engineer for that version (as well as working on features for the new version). He forgot (human error, it happens) to forward port it, or to flag that he hadn't done so.
When the release manager looked to see if all bugs were fixed, they assumed (because this is true for most bugs in our bugtracker, and because we'd decided relatively early in the process to skip 4.0.1, so very little work had been done on maint - it was just bad luck that this was one of the first "in-the-field" bugs for that release) that the fixed-in revision was for trunk, and thus assumed that it was fixed in trunk but not maint.
Had we done a 4.0.1 release, this would have been caught, as the release manager would have noticed then that he had a bug fixed in maint but not on trunk, or in trunk but not maint (either way round, not acceptable). Had we not decided relatively early to skip 4.0.1, it would have been obvious that we had bugs from 4.0.0 which only had one fixed in revision, so that we couldn't have fixed them on both trunk and maint. However, most bugs from 4.0.0 were just fixed on trunk, because we knew we weren't going to do a 4.0.1.
Had the revision number not been so "obviously" ordered, we'd have not made the mistake either; CVS style revision numbers would have protected us, because it would have been clear that the fix was on a branch only, and DVCS-style commit hashes would have protected us, because we'd have to ask the tools to tell us which branches contained the fix. Indeed, had we not had "obviously" ordered revision numbers, the release manager would have used the tools we'd built on top of SVN to confirm that bug fixes were in trunk as well as maint - it was the combination of very few fixes actually made to maint, and the hassle of running the tool when it was "obvious" from revision numbers that the fix was in the release we were about to make that resulted in this bit of human error.
Of course, this takes us a long way from your claim that this is an advantage of CVCS - you had said that all I had to do was look at revision numbers; I've given you a counterexample from experience where the ordering of revision numbers resulted in human confusion, and you're saying that it couldn't have happened like that, because people don't make that sort of mistake.
Posted Jun 21, 2010 11:46 UTC (Mon) by marcH (subscriber, #57642)
Yes, all you have to do is to look at revision numbers *in the same branch* (otherwise the order is obviously meaningless). SVN makes this very easy whereas git does not (because branches are so much more flexible in git). That's all really.
The rest is just about the day you overlooked SVN branches, not very relevant to this discussion.
As long as you use "branchless" SVN revision numbers + make wild guesses about these numbers then you will hit the same problem again and again. Simply stop making guesses; how difficult is that? By the way your painfully long explanation above demonstrates that this type of mistake is not common, even for your team.
Posted Jun 21, 2010 12:11 UTC (Mon) by farnz (guest, #17727)
The problem is that because revision numbers are not per-branch in most CVCSes (CVS is one exception), it's far too easy to accidentally compare revision numbers in different branches, without realising that that's what you've done. You're never going to stop people throwing around branchless revision numbers (whether they be SVN repository versions, or git SHA tags), because they're a convenient shorthand and happen to work just fine most of the time.
Further, because it's "obvious" that r176594 came after r176593, it's all too easy to assume that whatever changed in r176593 is also changed in r176594. This isn't a safe assumption in a world with branches, but in a CVCS world, you normally get away without explicitly stating which branch a revision is on. Same applies in the DVCS world, but because there's no "obvious" order to DVCS commit IDs, people don't make assumptions when they see a bare revision number; they'll check one way or another.
The painfully long explanation is simply because you refused to believe that people did this sort of thing when I presented it without explanation. Now I've added an explanation, you're complaining that it's unrealistic because I've had to tell you in great detail just how it happens, since you didn't believe that it did happen at all unless you had it explained in great detail?!? Oh, and your initial example didn't include branch names as part of the revision ID, either; if you really expect that developers don't use bare revision IDs, but use the combination of branch name and revision ID, why didn't your example include them?
Posted Jun 21, 2010 16:12 UTC (Mon) by marcH (subscriber, #57642)
If you cannot see the contradiction above then there is not much that can be done.
> The painfully long explanation is simply because you refused to believe that people did this sort of thing when I presented it without explanation.
The only reason your explanation is long is because it has to enumerate an unlikely long chain of mistakes, oversights and clueless SVN users. Or are you seriously saying such branch confusion happens often at your place? And yet you are still using branchless numbers? Hard to believe.
I asked for more detail because your first "explanation" was just: "thanks to human error, the developer forgot to ensure that the fix was present on TRUNK". This did not explain anything.
> and your initial example didn't include branch names as part of the revision ID, either;[...] why didn't your example include them?
Because you were supposed to read the entire post, not just the beginning of it. OK: this second post of mine sucked. Believe it or not, but I am glad you pushed me in clarifying the whole thing.
Posted Jun 21, 2010 16:43 UTC (Mon) by bronson (subscriber, #4806)
Obviously he sees the contradiction -- he pointed it out. "You're never going to stop people throwing around branchless revision numbers" means that until 'svn st' includes the branch name so people will copy-n-paste both into an email in one swipe, svn users will tend to use branchless revision numbers even when they know better.
You both are doing a great job of slinging insults and quote mining, making very little forward progress on what is ultimately an absurdly simple concept.
Posted Jun 21, 2010 15:48 UTC (Mon) by anselm (subscriber, #2796)
The underlying problem here is that SVN, being conceptually a souped-up CVS, basically deals in »snapshots of trees«. A branch in SVN is essentially just another subdirectory inside the repository (alongside »trunk«), and snapshots of the whole repository tree get numbered consecutively no matter where any changes happen.
DVCSes like git, on the other hand, normally work in terms of »changesets«, i.e., atomic collections of patches to files in the repository. A branch is just a sequence of changesets that hasn't yet been applied to the main repository (the »trunk« if you will).
The advantage of the changeset-based approach is that it is a lot easier to tell whether a repository contains a given change(set), where with SVN the system needs to try to infer this after the fact from looking at the files in question – which is why DVCSes are generally much better at merging than SVN. If the previous poster had used a DVCS instead of SVN, it would have been very obvious that the 4.0.1 bug fix had not been reintroduced to the mainline (i.e., the changeset incorporating the fix had not been merged), where SVN, on the other hand, didn't really help with this. The idea of numbering revisions consecutively even if that doesn't mean anything in the context of a branched repository is not one of the high points of SVN's design.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds