Giter Site home page Giter Site logo

conflict's Introduction

conflict

A git merge conflict parser

usage

Parsing contents

Git has a pretty well defined format for representing merge conflicts in textual format.

This is the README file.
<<<<<<< HEAD
    This line was added from the 'master' branch.
=======
   The 'test' branch version is here.
>>>>>>> test
One more line.

You can parse these with conflict.Parse(conflictStr) which returns Option[Contents]

Contents resents the conflicting file's contents. Contents stores a sequence of Content which may either be Text or a Conflict.

A Conflict stores a reference to our Change and their Change including a ref name and contents of the change.

conflict.ours.contents
conflict.theirs.contents

A Conflict also exposes the index at which the two contents diverge as Conflict#divergePoint. This is exposed as a starting point for extra tooling. When scanning a merge conflict by eye, this point is most likely the first thing you want to find in order to identify what changed. As such, it's included as part of the Conflict interface.

Showing contents

This library also provides an type class for showing the contents of a merge conflict called Show which takes the Contents of a merge conflict and returns a String.

By default conflict.Show(contents) will return the same representation as git shows you.

conflict.Show(conflict)

Doug Tangren (softprops) 2013

conflict's People

Contributors

softprops avatar

Stargazers

Ryan LeCompte avatar

Watchers

 avatar Ryan LeCompte avatar James Cloos avatar  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.