Merge quiz - find the common ancestor

April 2, 2014

Edit:There's a conversation going on in LinkedIn.

Suppose you have a branch hierarchy like the one below and you need to merge changeset “18” (the ‘source of the merge’) to changeset “22” (‘the destination of the merge’).

In order to perform a 3-way merge your version control system will need to find the ‘common ancestor’ of the two changesets.

This is something your version control will do for you (depending on which one you’re using :P) but, in the branch diagram below, can you calculate which one is the changeset (or changesets!) that is the common ancestor of commits “18” and “22”?

Notes:

  • Green arrows are merge links.

  • Grey arrows going back to the parent changeset just indicate how the changesets are linked to each other.

Solution!

Edit April 10th 2014:I'm going to add the solution here just in case anyone is interested.

Here goes the solution: there are 3 possible ancestors (ancestors that are not parent of a another ancestor).

So, recursive merge will have to deal with the situation. Another choice would be selecting one of the three (maybe the 'nearest') but it would potentially lead to errors as I explained here.

What 'recursive' is going to do is:

  • It will take two of the ancestors and will merge them creating a new 'virtual ancestor 0'
  • Virt ancestor 0 will be merged with the remaining ancestor (remember there were three) creating 'virtual ancestor 1'
  • The 'virtual ancestor 1' will be used as the base to merge 18 and 22 ('src' and 'dst')

Check the following figure for an explanation:

Hope it helps digging into the different merge algorithms available! :-) Enjoy!

Cocoa 101 for C# developers – Dissecting SemanticMerge to learn Xamarin.Mac

March 24, 2014

As a C# developer on Windows and Mono, have you ever considered developing a full GUI for Mac using C#?

Getting used to the new ‘constraints’ (instead of anchors), the controls and a few other topics to get started is a very interesting experience.

We developed SemanticMerge for Mac using Xamarin.Mac and we learned a couple of things along the way that we’re now sharing with everyone. Basically we started dissecting SemanticMerge to explain how it was built.

The following screenshot is part of the 101 blog post explaining how to get used to the way to specify alignments on Mac.

Enjoy!

JIRA 6 integration improvement

March 21, 2014

Note: This funcionality is not available in the current Plastic SCM release. It will be available in the next public release.

Some of our customers requested in UserVoice a better integration with JIRA, the popular issue tracker by Atlassian. Our JIRA extension is able to log checkin information into a JIRA custom field. The problem is that if you change a lot of files, this field grows a lot, and sometimes got unusable.

Now the data logged can be customized

With the new version, it’s possible to define a constant in the JIRA server to customize what data can be logged into the custom field, so the JIRA administrator can decide what information wants to see there, for example, the following:

Also you can view changeset diffs from JIRA

Also, we have added a mechanism to view the changeset differences from JIRA. There are two possibilities. If you have installed the PlasticSCM WebUI, you can show a link to the WebUI diff changeset URL:


If you don’t have the WebUI installed in your company, you can open the changeset in your PlasticSCM client using the following:

How to configure it

And now, the tricky part. In order to configure it, you need to:

  1. Configure your JIRA as a PlasticSCM extension:
    1. Open PlasticSCM -> Preferences -> IssueTracking and configure Plastic to use you JIRA server:
  2. Configure the JIRA server:
    1. Create or edit a file called jira-config.properties in the JIRA home directory:
C:/Program Files/Atlassian/Application Data/JIRA (on Windows)
/var/atlassian/application-data/jira (on Linux)
    1. Add the following content:
jira.websudo.is.disabled=true
plastic.diffchangeset.url=DIFF_URL
plastic.formatdata=FORMAT_DATA_STRING
    1. Restart the JIRA server

Configuring the diff URL

There are three variables that the extension replaces:
$changeset$ -> the changeset number
$repository$ -> the repository name
$server$ -> the server name
Configuration examples:

To open the plastic GUI to see changeset differences, configure the following URL:
plastic://showchangeset=cs:$changeset$@$repository$@$server$
To open the WebUI to see changeset differences, configure the following URL:
http://yourwebuiserver/$repository$/ViewChanges?changeset=$changeset$

Configuring the log format data

A format data string is a string that can have free text and some variables. The variables are numbered and are written between brackets. You have 8 variables that you can use as format data, and are the following:
{0} -> Prints the changeset date
{1} -> Prints the changeset number
{2} -> Prints the Plastic SCM repository
{3} -> Prints the Plastic SCM server
{4} -> Prints the author of the changeset
{5} -> Prints the diff URL configured in the JIRA server
{6} -> Prints the changeset branch
{7} -> Prints the checkin comments
{8} -> Prints the list of the items modified in the changeset
These are some valid expressions. Note that you can use \r\n for a new line character:
Date: {0}\r\nChangeset {1}@{2}@{3} by {4}\r\nDiff: {5}\r\nNranch: {6}\r\nComments: {7}\r\nItems:\r\n{8}
Changeset {1}: {5}
{0}{1}{2}{3}{4}{5}{6}{7}{8}
Changeset {1} by {4}\r\nViewDiffs: {5}

New release Plastic SCM 5.0.44.534 is out

February 27, 2014

The new release BL534 is finally out.

It is the first release that we announce this year in the blog although there have been several releases that we published directly inside the download area in January and February. We wanted to fix some issues before announcing to everyone.

I’m going to describe the most important new features included in this release.

Branch Explorer improved filters – inclusion and exclusion rules

This is the most important usability feature added to the release. So far filters were only able to highlight branches but now it is finally possible to hide or show branches based on queries. It has been requested several times by different customers and also added to our UserVoice.

The former “conditional format” tab has been modified and now it includes 3 buttons: “add inclusion”, “add exclusion” and “add format”. The last one is the old ‘format rule’ still able to color the branches based on queries.

The new inclusion and exclusion rules work as follows:

  • Inclusion rule: the branches selected by the query will be displayed.
  • Exclusion rule: the branches selected will be hidden.

Both inclusion and exclusion rules have additional options as the following picture shows:

As you can see we the options are:

  • Add child branches: will add (to inclusion or exclusion) the child branches of the branches selected by the query.
  • Add parent branches: adds the parent branches of the selected ones.
  • Add branches that are source of a merge: adds the branches that are source of a merge to the selected branches.
  • Add branches that are destination of a merge: adds to the list the branches that receive merges from the selected ones in the rule.

Combining all these options it is possible to configure quite flexible and powerful inclusion and exclusion rules.

Let’s go with a short example: suppose I just want to keep the main branch in the diagram. Then I’d set a rule like the following:

And the resulting Branch Explorer will be:

Suppose that now we want to exclude the branch ‘task3005’. The rule will be set as follows:

And the resulting diagram won’t have the branch ‘task3005’.

Now let’s try a slightly more complex query: display only the branches containing changesets created after the 15th of July of 2013 (note that the screenshot shows the date n dd/mm/yyyy format).

Once the query is set all the branches without changesets after the given date are cleaned up.

Using this filter system it would also be possible to run queries based on attributes and then show only branches with ‘tested’ attr equals to ‘true’ and things like that.

Custom Branch Explorer renders newly created branches

This was also a frequent request and was also asked at our UserVoice.

Suppose you create a subdiagram to render a given release branch and then you decide to create a subbranch out of it. If the newly created subbranch doesn’t match the rules that define the branch explorer it was immediately hidden. Well, this wasn’t very comfortable because maybe you just wanted to keep your new branch and work on it. And that’s exactly what we fixed.

New GUI shortcuts

We added some new shortcuts to the GUI:

  • Ctrl+D to show branch and changeset differences from the Branches View, Changeset View and Branch Explorer.
  • Ctrl+V will focus an item in the Items View if you have copied the item path in the clipboard.

The diff view (diff branch, changeset) uses the following shortcuts:

  • Ctrl + Alt + + to navigate to the next file
  • Ctrl + Alt + - to navigate to the previous file
  • Ctrl + Shift + Alt + + to navigate to the last file
  • Ctrl + Shift + Alt + - to navigate to the first file
  • There is no need to focus the differences control to navigate through differences (Ctrl+ + or Ctrl + -).

Maven plugin

We have developed a Plastic SCM Maven SCM plugin, according to the http://maven.apache.org/scm/maven-scm-plugin specifications.

Here are the commands supported by the plugin:

  • scm:add
  • scm:branch
  • scm:checkin
  • scm:checkout
  • scm:tag
  • scm:update

In order to configure the connection in a pom.xml the syntax is as follows (everything inside a single line):

scm:plasticscm:[objectSpec]@[rep:]repository_name@[repserver:]
        @servername:portnumber[:path:repository_path_to_download]

Where:

  • "objectSpec" is: (br:/name | cs:N | lb:name)
  • "repository_path_to_download": is only affected by the checkout and update commands.

NOTE: The plugin is not provided by the installers. A manual installation in the maven repository is required instead (using the "mvn install:install-file" or "mvn deploy:deploy-file" plugins).

Improved navigation in diff view

We have improved the navigation in the diff views (branches, changesets, labels and so on). Now the diff view remembers your navigation and you can go back and forward, and also a new column lets you see if you have already viewed a file.

This one closes the UserVoice request.

Multiline comments in autocomments

Now it is possible to add multiline autocomments for checkin.

Go to the preferences window, "Comment options", select "Custom" in the Comments section.

In addition to User ({0}) and Date ({1}) you can add new lines ({2}).

Full repository list now available while creating a new workspace

When creating a workspace it is possible to see a repository list showing all the repositories in all the registered servers.

Bug fixes

And the release also includes a full list of bug fixes. Check the release notes for more info.

Enjoy!

The Plastic SCM team

Early adopters for SemanticMerge -Mac version

February 19, 2014

Finally, we’re ready to ship a Xamarin Studio powered SemanticMerge release running on Mac. You can sign up to get one here. We’re looking for the feedback of early adopters!

In the picture you can see the “visual merge” rendering a “Listen()” method being moved to two different classes in parallel:

  • Moved to class “ClientSocket” on the left – where left means “theirs”
  • Moved to the class “DNS” on the right – where right means “yours”
  • Modified on both (icon “c” stands for “changed” and “m” for “moved”)

This is the type of conflict that will break down in tears any other merge tool, but not Semantic :-)

Merge magic for C# and Java developers on Mac

SemanticMerge is a “language aware merge tool” which means it needs to understand the language to calculate the merge. So it is programming language dependent which in turn means that we have to develop support for new languages one by one because we need to parse each file and handle the language particular constructs.

So far we’ve released support for C#, Vb.net and Java, but this release also includes support for C language. In fact you can see all the examples once you start up the tool:

Obviously to really rock on Mac we’ll need Objective-C support (vote for it if you are interested) but this release is really focused on the growing community of developers using Xamarin who write C# code on the Mac on a daily basis. We love the idea of C# running everywhere and SemanticMerge for Mac is meant to contribute on that goal.

By the way there are also many developers coding in Java on Mac who will also benefit from this new release.

C support

Yes, C support (another frequent UserVoice request) is included in this release.

We’ve done quite an amount of work to make this happen since C is by far more complex to deal with than the other languages we supported so far.

We use libclang to parse the code (the same libraries we’ll use to implement C++ support) and create the intermediate trees that we use to merge. So initially parsing is not a big deal since libclang takes care of it. The problems come from the nature of C itself:

  • More often than not you face ambiguous situations where the parser needs the header files to figure out how to deal with a define or macro.
  • Including the headers is not a big deal for a compiler, but Semantic needs to be as standalone as possible (and as easy to configure as possible) so ideally you don’t have to define where the headers files are in order to process the merge of a file. While certainly doable it would complicate the setup of the tool (per project basis).

So we’ve implemented some logic (I’ll be blogging about it in more detail in a future blog post) to try to avoid these external dependencies as much as possible although we’ve also added ways to define commonly used symbols (like macros and so on) to solve situations where the parser can’t proceed alone.

We used the Linux source code to benchmark (among many others, since we total a couple of millions C file for testing) and this approach is able to deal with 99.32% of the declarations. As I said, I’ll be adding more info in an upcoming post :-)

UserVoice

The Mac version has been the number one request in our UserVoice for months and it is finally closed :-) Of course this is just an initial release and we’ll continue working to come up with new features, create the standalone diff tool (now only the merge tool is available) and many more.

Powered by Xamarin Studio

C# is our language of choice and hence using Xamarin to create a new native GUI on Mac has been a key factor. We use other languages on a daily basis (especially to develop Plastic SCM) but C# is where we feel more comfortable.

We had to get up to speed with Mac development, the Cocoa underlying libraries, new concepts, the entire layout definition language and many more, but everything was greatly simplified by Xamarin. At the end of the days you have the same tools, the same language and concepts. Coming from a mostly Windows background in GUIs, you find yourself in a new world but helped by known tools.

Want to join?

The Mac version is still work in progress. While it uses the same core as the Windows and Linux versions, we’ll need to improve its usability with special detail to the Mac way of doing things.

If you want to join and help us creating the smartest possible merge tool, please sign up here.

Edit: for more info take a look at the SemanticMerge blog here.

SemanticMerge 1.0.53 is out with embedded diff

January 24, 2014

We’re happy to announce the new version of SemanticMerge: 1.0.53 is now out! It includes a good number of improvements that users have been asking for, so we hope you really like this new version!

As usual the binaries are ready in semanticmerge.com

Embedded diff and rearranged controls

We have finally added the embedded diff so now you don’t have to launch an external tool to diff the methods if you don’t want to (it is still doable by clicking SHIFT + the diff button). This way diffing becomes way much faster. It was one of the top requests in UserVoice too.

I have highlighted some of the differences in the screenshot below.

We’re applying both requests from users and also the recommendations from a usability study we’ve just completed with the help of another company. We still have to apply some additional usability improvements.

We’ve also replaced most of the notifications made with dialogs by a new notification area:

And the VisualMerge also benefits from the embedded diff as you can see below:

Now you can also click on the ‘change icons’ in the graphic (the “c” and “m” for instance) and it will show the difference between the corresponding members in the embedded diff. Really useful!

Shortcuts!

We just solved one of the top requests in our UserVoice: add keyboard shortcuts.

Press “ALT” and the available shortcuts will show up:

Redesigned diff tool

The SemanticDiff has also been redesigned and now it is more similar to SemanticMerge:

Other improvements and UserVoice tasks closed

Now working on the next release! Enjoy!

Release 5.0.44.519 is out!

December 23, 2013

A new release is now out, this time 5.0.44.519 including a few interesting new features! Enjoy Christmas together with the new Plastic release :-)

New “time lapse” view

We’ve improved 2d history tree so that it now includes an embedded diff viewer making much, much easier to understand the evolution of a file.

Improved diff navigation

Whenever you’re just running a diff or doing a code review it is very useful to know which files you already viewed. If you navigate in order it is not a problem but sometimes you have to go back and forth to better follow the changes.

We’ve added a small improvement that will be of great help: now each time you click on a file it is marked as “viewed” so it is now straightforward to see which ones are still pending. Navigation buttons also help you go back (and forth) to the previous ones you visited.

Merge-to: merge to a branch instead of from a branch

There are times when you just want to merge your changes to a different branch and there are no conflicts involved so it can be slow to switch to the destination branch and then merge from the source.

Although we always recommend to build the code just after the merge (and run the tests!) sometimes it is useful to be able to directly merge without being on the destination branch.

That’s why we’ve introduced ‘merge-to’: click on a branch and merge it to another one. If there are no conflicts involved it will proceed and create a new checkin on the destination branch.

Let’s see it in action:

You want to merge “task003” into “main” and as you can see there can be conflicts considering the branch structure.

So you just right click on the branch, go to “advanced merge” and then select “merge this branch to…”. Then you will choose the destination branch from a list.

The merge tab will show up to let you do a preview of the merge:

Since there are no conflicts all you have to do is to just click on “process merges”. Plastic will prompt you for a comment for the new checkin.

Once you’re done the Branch Explorer will look at follows:

Annotate/Blame can now tell you if a line was changed during the merge

Most of the manual merge conflicts will be solved just by choosing one of the merge contributors as result. But sometimes you’ve to manually modify the code during merge. Now the annotate/blame can track it and display it as follows:

Since lines modified during the merge are potentially more dangerous this new feature helps tracking these changes.

Also, if you run a blame through your entire codebase (doing some scripting) it will be possible to count how many lines on your current codebase were modified during merge.

We’re working on a tool called “repoblamer” which is able to do this and also calculate some other interesting stats.

Additional new features

We’ve included some other minor new features:

  • Branch Explorer: Now it is possible to search changesets by GUID.
  • Installer: Now the first time that Plastic SCM is installed on a machine, the client wizard checks if there's a server up and running in localhost:8087 (which is the most common scenario, especially during evaluation) and if that is the case then the client field is filled with these information; therefore the user doesn't need to type it and the configuration process is faster and more comfortable.
  • Oracle backend: Connector upgraded to a version that supports the .NET 4 framework, so now the .NET 4 Plastic SCM version can be used with this backend.

And some bug fixes too

  • When searching on a textbox (diff viewer, annotate, ... ), it only found the first occurrence of a search pattern on a line. Fixed.
  • GUI and CLI: When the server location was changed, the "update" operation was throwing "No channel found" errors, when it was suposed to connect against the new server location. Fixed.
  • GUI and CLI: The "Browse repository on this branch/changeset/label" feature on GUI, and "cm ls" command on Command Line Client were not showing any results if an involved xlink cannot be resolved (the server the xlink repository belongs is down, the target changeset was not replicated yet, not enough permissions...). Fixed.
  • Exclusive checkout: The exclusive checkout operation was showing an error message under the following conditions: the branch doesn’t have changesets yet, the branch base is not the last changeset on the parent branch, the "requirehead" lock rule was set. Fixed.
  • Sync dialog: Aesthetical issues regarding labels not shown and progress cut fixed in Linux and Mac.
  • Admin tool and User Mode Tool GUI: These applications did not load the user configuration correctly.

Enjoy!

Real Time Web Analytics