GithubHelp home page GithubHelp logo

ace-design / git-merge-adv Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 89.63 MB

New merging tool for Python and Java source code

License: MIT License

Python 100.00%
ast cst git gumtree java python tree-sitter

git-merge-adv's Introduction

Git Merge ADV

Table of Contents
  1. Project Description
  2. Getting Started
  3. Contacts
  4. Acknowledgments
  5. Licence

Project Description

Rationale

Source code merging has always been an issue for developers. When colloborating on complex projects, developers must inevitably use multiple branches, which is the cause for numerous merge conflicts. These conflicts often waste a lot of their time.

Existing 3-way merge algorithms developed by Git rely on textual difference, which often leads it to incorrectly resolve the conflicts or cause merge conflicts.

Other 3-way merge algorithms such as JDime or Spork take a strucutred approach which use Abstract Syntax Trees, however are limited in the scope in which they can be used.

As such, our purpose is to develop a new 3-way merge tool for Python and Java Source Code.

Developed Data Structure

Mainly focused on Java & Python code to develop a general data structure that can represent statically & dynamically typed languages.

We used the CST (Concrete Syntax Tree) generated by Tree-Sitter (for Java), and the AST (Abstract Syntax Tree) generated using Python's ast library to provide the prelimary code structures. We then queried the Syntax Trees to construct our Abstract Data Structure.

This is relevant to CompressedTree and MethodUnion tools.

Selective Set Union

Our tools use the following heuristics:

Built with:

  • Python

Getting Started

Required Modules

  • Before using any tool or any script, install all the dependencies using pipenv

    pipenv install
    
  • Then, start a pipenv shell from which you can navigate the project, and run any scripts:

    pipenv shell
    

Usage

  • The extracting-scripts directory contains all the tools needed to extract case studies from various github repositories
  • The merge-algorithms directory includes all the merge tools that were developed in this project. The two main tools being CompressedTree and MethodUnion.
  • The demos directory includes all the case studies that were tested, and the overall results obtained from this project. It also contains the next steps for the MethodUnion tool, that we couldn't yet get to.

Tool Prerequisites

Run Tools:

python3 <path to alg init.py> --left <left parent path> --right <right parent path> --base <base file path> --out <output file>
  • Assumption: Input files are of correct syntax. Tools will not work with incorrect syntax.

Git-Integration

  1. Create a .gitattributes file in your repo
  2. add following lines to it
*.java merge=gitadv
*.py merge=gitadv 
  1. Run command git config --global --edit
  2. Add following lines to config file
[merge "gitadv"]
name = gitadv
driver = python3 /path/to/repo/git-merge-adv/merge-algorithms/CompressedTree/init.py --left %A --right %B --base %O --output %A --file %P

Contacts

Acknowledgements

Licence

Distributed under the MIT License. See LICENSE.txt for more information.

git-merge-adv's People

Contributors

immortalcodes avatar mosser avatar nirmal-code avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.