Precise Version Control of Trees with Line-Based Version Control Systems

  • Dimitar Asenov
  • Balz Guenat
  • Peter MüllerEmail author
  • Martin Otth
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10202)


Version control of tree structures, ubiquitous in software engineering, is typically performed on a textual encoding of the trees, rather than the trees directly. Applying standard line-based diff and merge algorithms to such encodings leads to inaccurate diffs, unnecessary conflicts, and incorrect merges. To address these problems, we propose novel algorithms for computing precise diffs between two versions of a tree and for three-way merging of trees. Unlike most other approaches for version control of structured data, our approach integrates with mainstream version control systems. Our merge algorithm can be customized for specific application domains to further improve merge results. An evaluation of our approach on abstract syntax trees from popular Java projects shows substantially improved merge results compared to Git.


Version control Trees Structured editor Software evolution 


  1. 1.
    Altmanninger, K., Schwinger, W., Kotsis, G.: Semantics for accurate conflict detection in SMoVer: specification, detection and presentation by example. IJEIS 6(1) (2010)Google Scholar
  2. 2.
    Altmanninger, K., Seidl, M., Wimmer, M.: A survey on model versioning approaches. Int. J. Web Inf. Syst. 5(3), 271–304 (2009)CrossRefGoogle Scholar
  3. 3.
    Apel, S., Leßenich, O., Lengauer, C.: Structured merge with auto-tuning: balancing precision and performance. In: Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering, ASE 2012. ACM (2012)Google Scholar
  4. 4.
    Apel, S., Liebig, J., Brandl, B., Lengauer, C., Kästner, C.: Semistructured merge: rethinking merge in revision control systems. In: Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering, ESEC/FSE 2011. ACM (2011)Google Scholar
  5. 5.
    Asenov, D., Müller, P.: Envision: A fast and flexible visual code editor with fluid interactions (overview). In: 2014 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC), July 2014Google Scholar
  6. 6.
    Asenov, D.: Envision: Reinventing the Integrated Development Environment. Ph.D. thesis, ETH Zurich (to appear, 2017)Google Scholar
  7. 7.
    Dig, D., Manzoor, K., Johnson, R., Nguyen, T.N.: Refactoring-aware configuration management for object-oriented programs. In: 29th International Conference on Software Engineering (ICSE 2007), May 2007Google Scholar
  8. 8.
    Ekman, T., Asklund, U.: Refactoring-aware versioning in Eclipse. Electron. Not. Theor. Comput. Sci. 107, 57–69 (2004)CrossRefGoogle Scholar
  9. 9.
    Falleri, J.R., Morandat, F., Blanc, X., Martinez, M., Montperrus, M.: Fine-grained and accurate source code differencing. In: Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering, ASE 2014. ACM (2014)Google Scholar
  10. 10.
    Fluri, B., Wuersch, M., Pinzger, M., Gall, H.: Change distilling: tree differencing for fine-grained source code change extraction. IEEE Trans. Softw. Eng. 33(11), 725–743 (2007)CrossRefGoogle Scholar
  11. 11.
    Ghezzi, G., Würsch, M., Giger, E., Gall, H.C.: An architectural blueprint for a pluggable version control system for software (evolution) analysis. In: Proceedings of the Second International Workshop on Developing Tools As Plug-Ins, TOPI 2012. IEEE Press (2012)Google Scholar
  12. 12.
    Guenat, B.: Tree-based Version Control in Envision. BSc. Thesis, ETH Zurich (2015)Google Scholar
  13. 13.
    Kehrer, T., Kelter, U.: Versioning of ordered model element sets. Technical report 2, University of Siegen (2014)Google Scholar
  14. 14.
    Koegel, M., Helming, J.: EMFstore: a model repository for EMF models. In: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering, ICSE 2010, vol. 2. ACM (2010)Google Scholar
  15. 15.
    Koegel, M., Herrmannsdoerfer, M., von Wesendonk, O., Helming, J.: Operation-based conflict detection. In: Proceedings of the 1st International Workshop on Model Comparison in Practice, IWMCP 2010 (2010)Google Scholar
  16. 16.
    Lindholm, T.: A three-way merge for XML documents. In: Proceedings of the 2004 ACM Symposium on Document Engineering, DocEng 2004. ACM (2004)Google Scholar
  17. 17.
    Lorenz, D.H., Rosenan, B.: Source code management for projectional editing. In: Proceedings of the 2013 Companion Publication for Conference on Systems, Programming, Languages & Applications: Software for Humanity, SPLASH 2013. ACM (2013)Google Scholar
  18. 18.
    Mens, T.: A state-of-the-art survey on software merging. IEEE Trans. Softw. Eng. 28(5), 449–462 (2002)CrossRefGoogle Scholar
  19. 19.
    Mikhaiel, R., Tsantalis, N., Negara, N., Stroulia, E., Xing, Z.: Differencing UML models: a domain-specific vs. a domain-agnostic method. In: International Summer School on Generative and Transformational Techniques in Software Engineering IV, GTTSE 2011 (2013)Google Scholar
  20. 20.
    Miller, W., Myers, E.W.: A file comparison program. Softw. Pract. Exp. 15(11), 1025–1040 (1985)CrossRefGoogle Scholar
  21. 21.
    Murta, L., Corrêa, C., Prudêncio, J.G., Werner, C.: Towards Odyssey-VCS 2: improvements over a UML-based version control system. In: Proceedings of the 2008 International Workshop on Comparison and Versioning of Software Models, CVSM 2008. ACM (2008)Google Scholar
  22. 22.
    Myers, E.W.: An O(ND) difference algorithm and its variations. Algorithmica 1(1) (1986)Google Scholar
  23. 23.
    Nguyen, H.V., Nguyen, M.H., Dang, S.C., Kästner, C., Nguyen, T.N.: Detecting semantic merge conflicts with variability-aware execution. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015. ACM (2015)Google Scholar
  24. 24.
    Nguyen, T., Munson, E., Boyland, J.: An infrastructure for development of object-oriented, multi-level configuration management services. In: Proceedings of the 27th International Conference on Software Engineering, (ICSE 2005), May 2005Google Scholar
  25. 25.
    Nguyen, T.T., Nguyen, H.A., Pham, N.H., Nguyen, T.N.: Operation-based, fine-grained version control model for tree-based representation. In: Rosenblum, D.S., Taentzer, G. (eds.) FASE 2010. LNCS, vol. 6013, pp. 74–90. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-12029-9_6 CrossRefGoogle Scholar
  26. 26.
    Oliveira, H., Murta, L., Werner, C.: Odyssey-VCS: a flexible version control system for UML model elements. In: Proceedings of the 12th International Workshop on Software Configuration Management, SCM 2005. ACM (2005)Google Scholar
  27. 27.
    Protzenko, J., Burckhardt, S., Moskal, M., McClurg, J.: Implementing real-time collaboration in TouchDevelop using AST merges. In: Proceedings of the 3rd International Workshop on Mobile Development Lifecycle, MobileDeLi 2015. ACM (2015)Google Scholar
  28. 28.
    Schwägerl, F., Uhrig, S., Westfechtel, B.: A graph-based algorithm for three-way merging of ordered collections in EMF models. Sci. Comput. Program. 113(Pt. 1), 51–81 (2015). Model Driven Development (Selected & extended papers from MODELSWARD 2014)CrossRefGoogle Scholar
  29. 29.
    Ukkonen, E.: International conference on foundations of computation theory algorithms for approximate string matching. Inf. Control 64(1), 100–118 (1985)CrossRefzbMATHGoogle Scholar
  30. 30.
    Voelter, M., Siegmund, J., Berger, T., Kolb, B.: Towards user-friendly projectional editors. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds.) SLE 2014. LNCS, vol. 8706, pp. 41–61. Springer, Cham (2014). doi: 10.1007/978-3-319-11245-9_3 Google Scholar
  31. 31.
    Westfechtel, B.: A formal approach to three-way merging of EMF models. In: Proceedings of the 1st International Workshop on Model Comparison in Practice, IWMCP 2010. ACM (2010)Google Scholar

Copyright information

© Springer-Verlag GmbH Germany 2017

Authors and Affiliations

  • Dimitar Asenov
    • 1
  • Balz Guenat
    • 1
  • Peter Müller
    • 1
    Email author
  • Martin Otth
    • 2
  1. 1.Department of Computer ScienceETH ZurichZurichSwitzerland
  2. 2.Ergon Informatik AGZurichSwitzerland

Personalised recommendations