Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Bitbucket Launches Snippets for Teams

Bitbucket Launches Snippets for Teams

Atlassian's popular source code hosting site Bitbucket launched Snippets for teams, a collaboration oriented solution to "create and manage multi-file snippets of all kinds". Snippets can be created via drag and drop, owned by a user or a team and optionally shared publicly. They are backed by Git or Mercurial repositories and can be managed via a REST API.

Snippets are a new top level Bitbucket entity surfaced like repositories on either the owning team's or the user's profile pages. Both can be managed together alongside pull requests and issues on the dashboard. Users can create new snippets comprised of one or many files, clone, edit and delete existing ones, and inspect a snippets revision history. Snippets can also be watched to get notified on changes and of course commented on with Markdown syntax.

Bitbucket Snippets Editor

All Snippets features available in the Bitbucket UI can be used and integrated via a dedicated API, which also makes it trivial to create snippets from arbitrary HTTP clients with a single command, for example:

$ curl -X POST{user or team} \
-u {username} -F file=@example.txt

Atlassian emphasizes having taken a "different approach than standard pastebin or gist" by building snippets with the over 330,000 existing teams using Bitbucket in mind. According to Alison Huselid (Head of Product Marketing Developer Tools), introducing a new feature requires careful consideration so that it is "very useful for teams who are collaborating on building software".

InfoQ reached out to Ike DeLorenzo (Principal Product Manager Bitbucket) for some details around the new Snippets solution.

InfoQ: Bitbucket Snippets has been one of the long standing and most requested features among developers. What led to your decision to finally tackle it now?

DeLorenzo: We are focused on providing team functionality for teams of professional users [and] we have noticed as of late that […] when you talk about software teams, there is a graphics artist, there are Ops people [and many other experts involved] – and all those people need to share images, assets and all different kinds of files as a team.

Those factors combined made this the time for us to release Snippets. And we wanted to make it a useful sharing mechanism for […] all things other than traditional code, and for new kinds of code bundles like in mobile development, where you have CSS, HTML, JavaScript and assets all in one bundle.

You will find Snippets optimized for [these scenarios] and it is something that maybe a couple of years ago would not have made tons of sense, but now it is just the perfect solution for the way that we see teams moving.

InfoQ: Snippets come with extensive MIME type support including image, audio and video – does this mean users can simply drag and drop media files onto the Snippets UI and be done?

DeLorenzo: Yes […] when you add a file, there is a very smart and sophisticated way to recognize what MIME type it is. It will adjust the file extension if you change the MIME type – say you are typing a text file and it turns out to be a script file for a given IT hardware – it will recognize that, or if you change it via the menu yourself, it will change the file type for you. […] It is really designed for professional environments in which people are working with multiple media types and where the communication of those types is relevant for team members.

InfoQ: The Snippets editor features "syntax highlighting for over 90 programming languages". Is this the same user experience as with the regular Bitbucket editor?

DeLorenzo: Yes, it is the same editor – we obviously added some features to it such as drag and drop and the file extension mapping that I talked about. In all probability it will be folded into the main Bitbucket editor, because, in our internal testing with Atlassian, it is a very popular feature.

InfoQ: Snippets can be backed by either Git or Mercurial repositories. Are there any feature differences between the two DVCS options?

DeLorenzo: Technically the features are identical, […] we support both distributed version control systems, and so we support both for Snippets and we think that will delight our Mercurial users.

InfoQ: Are there any limitations concerning the usage of snippets as regular DVCS repositories?

DeLorenzo: There are some things that do not necessarily make sense for a snippet like pushing branches or tags, so those are not supported in the snippets UI […].

InfoQ: Just like Bitbucket repositories, snippets can be owned by a user, owned by a team, and also shared with the public. Can ownership also be transferred later on?

DeLorenzo: No – this is something that we are thinking about, but when you develop features like this, you want them to be absolutely solid in a version 1.0 release […]. So for now, when you assign a snippet to your team [and] you leave the team, your team still owns the snippets.

As we talk about it – there are a lot of edge cases in a corporate environment where a team member could transfer a snippet to their personal account and then leave the company, and the team would kind of be out of luck, so we are being very conservative on the initial release and not allowing transfer of ownership until we see how the user base uses it and what they want.

InfoQ: Do you offer support for embedding snippets in third party websites?

DeLorenzo: We do not yet allow that functionality, and for sort of the same reasons I outlined about why we do not allow transfer of ownership quite yet. We want to see usage patterns and we do want to see if there are edge cases that present problems in a corporate environment.

InfoQ: Are snippets discoverable by means of a search interface which respects the permission scope, i.e. public vs. team etc.?

DeLorenzo: Yes – on your team page you can discover all the snippets that accrued, and on your individual page, you can discover all the snippets that are owned by you.

There is not yet a search interface for public snippets, because with some three million users there will be an enormous amount of public snippets and we are not convinced that just globally searching them would be any more useful than searching for the content on Google.

InfoQ: Snippets are backed by an API to access and extend the functionality. Are you also going to offer a CLI client for snippet management?

DeLorenzo: We anticipate a lot of third party developers are going to want to create CLIs and all sorts of different wrappers and innovations with the snippets API. Python is the language in which Bitbucket is developed, so we are going to release a Python wrapper and command line interface […] as demonstrations for third party users that may want to do similar things.

Bitbucket has recently published an infographic highlighting its 2014 year in review, notably gaining several team collaboration oriented features like:

The Bitbucket documentation for Snippets and Teams provides more details, including a permissions matrix. The REST APIs reference features a dedicated section for the new snippets endpoint, and its usage is demonstrated by the referenced Python wrapper and command line interface. Bitbucket offers unlimited public and private repositories for free for up to five users and monthly subscription plans for additional users. Support is offered via the Bitbucket support portal and the public issue tracker.

Rate this Article