Features I Would Love Source Control Tools to Have
Join the DZone community and get the full member experience.Join For Free
lucas ward and i published a source control maturity model article nearly three years ago. i had been thinking of it for a many years (particularly the pvc dimensions being level -1) and lucas was a great collaborator to publish it, and crystalize the ideas. it was inspired by the capability maturity model of course.
this article is a follow up. it talks of where i’d like source-control to go, and reevaluates the article lucas and i previously wrote.
recap the feb-2010 blog entry.
summarizing the previously defined levels:
- no source control.
- systems that remotely hold revisions safely, but really work best if they that remote server isn’t too far away, and staff don’t step on each other’s toes too much in terms of the same source files, while mostly avoiding branching because it is expensive, and everything is slow.
- faster without atom commits, multi-user mode bearable.
- faster still + atomic commits, branching capabilities are decent, with merge-point-tracking.
- faster again, merge-point-tracking better, merge-through-rename rudimentary.
- all history locally available, cheap local branching, merge-through-rename is smooth.
level -1 was reserved for tool that’s so bad that using nothing at all was preferable.
things i’d like to see in the next generation of source-control tools
this is alluding to a level 6 on the scmm. diffs can be too noisy because the tools can’t give a break to specific languages. consider tidied json. add one element in a list, is a new line and a changed line (the comma). it does not need to as ignorant as:
better, perhaps, would be this:
sure, some of the advanced diffing/merging tools like beyondcompare , p4merge , and kdiff3 do a good job of this visualization, but it takes some effort to hook them into a source-control tool-chain, when the built-in merge technology should be as smart, but without having to prompt as much for human arbitration when there are conflicts.
taking it further, a source-control tool at the top level, should also be able to understand “method rename” (and other refactorings), rather than a series of adds and deletes. another example is “method reorder” where one method/function is moved below another. there are many others that are closer to our understanding of refactoring operations.
this matters for merging of course. most of all “merge-through-rename”, but not only that. we want merges to be automatic and safe, and that’s more likely with smarter tools. merge-through-rename was the high-bar for the 2010 article, and it was referent to three-way merges that understood carriage-return delimited text really well. with a team wanting to refactor with impunity, and have merges work across branches (or as you frequently update working-copy in your local checkout), then having the source-control tool understand what you did and allow auto-merge through conflict resolutions is key. at least it would move the bar for what a conflict is.
there is a sub-chapter of “programming” that is called intentional. charles simonyi’s (friend of thoughtworks) intentional software solves some of the same problems with a non-text, non cr-delimited ‘source’ concept. i’m not talking about that tech.
syndication using source-control
this is substantially smarter sub-modules or externals, and mechanisms to get different implementations of source-control tools to collaborate. i mentioned at the end of january, about something that would be useful to allow local modifications to a sub-module to better allow syndication of versioned content, and maintained divergence. sure it’s pretty much only me that’s asking for this, but i think it would be a logical next step for repos. here’s that rambling article that uses uses cms and content syndication as a justification. refer to the permissions item below too.
this we forgot, or didn’t underline enough in 2010.
perforce, tfs and subversion have the ability to maintain separate read and write access for individual branches, or directories within branches. git and mercurial do not. if you have, say, database passwords in a production or release branch, and didn’t want developers to see them, then perforce, subversion and tfs are going to be stronger tools as you can restrict read-access to that branch. you also may not want developers to be able to change code in a branch that’s mapped to production, or is a staging release, but still allow them to have read access to the source. debugging could be a reason for that. these tools allow you to restrict access to sub-directories too. this is hugely powerful , and perhaps i’ll drill into it in a follow up article.
github has forks (which do have separate permissions ), but it’s not the same thing as being able to be fine grained down to the branch/directory/resource level.
mercurial and git (the two at level 5 as we had it), are the two that qualify as dvcs amongst the one we listed. while a corporate user of source control making a single deployable thing (say a shopping site) are going to consider one repo (and one branch within that) to be the canonical place that work is categorized as “definitely done” in terms of development at least, there are other some of source control that do not need a canonical server repo. maintained divergence of code as seen by more than one ‘authority’ is one example. the source-control tools that must have master (like perforce, tfs and subversion) are much weaker for that usage scenario. the ‘local branching’ that git/mercurial offer is tremendously empowering, but some enterprises are going to feel better from having a single anointed master repository on some controlled-access server. subversion as the definitive central repo, with git-svn doing the checkout is popular. there’s something similar with perforce’s git-fusion too.
some of the ‘canonical server’ tools ensure that history is not re-written over the client api. some of the dvcs tools don’t have a restriction in that regard. sometimes the sarbanes oxley act (sox) is mentioned, often by non-lawyers like me. there’s a hypothesis that being able to rewrite (modify or delete) history works against sox compliance. mercurial has a mode of operation that prevents the rewriting of history, so i’m told, but i can’t find online info for that.
source-control tool ‘cruft’.
in the case of subversion there was a .svn folder in every folder under scm. that was neat in that it allowed you quickly copy that folder (and keep is’s source control linkage) to another place. it was cruft though. asp.net developers used to have a hack to have _svn folders instead of .svn folders to allow their tools to be compatible with subversion. in recent releases of subversion, this has been done away with. actually, there’s just one .svn folder and it is at root now.
also in the case of subversion (historically) there were “property-lists” that were associated with the source file. that’s useful for meta-data, but a previous choice was to use it for merge-point tracking. in use, for complex branch designs it was an incredible mess.
partial tree checkout.
this very much relates to permissions above. subversion, perforce and tfs can checkout a subdirectory of any branch. normally that means trunk, a tag or a branch:
$svn checkout http://svn.apache.org/repos/asf/spamassassin/trunk # works $svn checkout http://svn.apache.org/repos/asf/spamassassin/branches/3.0 # works
it does not stop there though, you can go down to a sub-directory, and checkout that directory and all lower, or even a single resource (perforce, tfs). for subversion single files are not allowed, as there would be nowhere to put the .svn folder.
$svn checkout http://svn.apache.org/repos/asf/spamassassin/trunk/build/ # works $svn checkout http://svn.apache.org/repos/asf/spamassassin/trunk/meta.yml svn: e200007: url 'http://svn.apache.org/repos/asf/spamassassin/trunk/meta.yml' refers to a file, not a directory # fails for subversion
secondly to variable degrees a client specification can be configured to create a mask of what’s wanted in a checkout. perforce has client specs that allow such configuration (including locally renaming directories), tfs has workspaces and working folder mappings & cloaking . subversion can omit the checkout of subdirectories via sparse checkout which is also powerful, but a little different. it leaves you with the option of checking them out later. you’re not going to need anything more than the simplest default configuration 99% of the time, but sometimes you’ll be happy you had the choice for something more sophisticated.
of course, a lot of things have changed in three years.
plastic scm comes on the scene as a force. it’s supposed to be quite competitive, but i’ve not had a chance to try it. it’s not even the only new-kid on the block. let’s not even begin to talk about alternate source-control science around the likes of darcs .
microsoft’s team foundation server (tfs) gets a lot better. microsoft used ‘source depot’ (‘sd’ on the command line) internally from the late nineties onwards . it was a discrete recompilation of perforce (‘p4’ on the command line) for them. tfs is microsoft’s own attempt at the same idea. i’m not sure if it entirely the same though. internally they flipped over from source depot somewhere between 2008 & 2009. even today there are less menu options in the ui, than for perforce. perforce (the company) have a 12 page pdf comparison you may want to read if you care . perforce (the tool) is foremost a command-line tool. ui tools for perforce (p4v & p4merge) seem secondary. for tfs visual studio feels like the primary interface, and the command line feels secondary. there’s no doubt that tfs will keep pushing though. it is possible the intelligensia will never be happy with the amount of client-server i/o that can happen during “open for edit” (flipping the read-only bit) that dogs tfs and perforce.
subversion moves forward too. better branching and merge-point tracking. the .svn folders that were sprayed all over the place are gone. a bug that cost a team i was on hundreds of hours of lost time was fixed.
Published at DZone with permission of Paul Hammant, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.