three-merge


Namethree-merge JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/spyder-ide/three-merge
SummarySimple library for merging two strings with respect to a base one
upload_time2020-07-22 23:41:56
maintainer
docs_urlNone
authorSpyder Project Contributors
requires_python
licenseMIT
keywords merge files three-way
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # three-merge
[![Project License - MIT](https://img.shields.io/pypi/l/three-merge.svg)](https://raw.githubusercontent.com/spyder-ide/three-merge/master/LICENSE)
[![pypi version](https://img.shields.io/pypi/v/three-merge.svg)](https://pypi.org/project/three-merge/)
[![conda version](https://img.shields.io/conda/vn/conda-forge/three-merge.svg)](https://www.anaconda.com/download/)
[![download count](https://img.shields.io/conda/dn/conda-forge/three-merge.svg)](https://www.anaconda.com/download/)
[![Downloads](https://pepy.tech/badge/three-merge)](https://pepy.tech/project/three-merge)
[![PyPI status](https://img.shields.io/pypi/status/three-merge.svg)](https://github.com/spyder-ide/three-merge)
![Linux tests](https://github.com/spyder-ide/three-merge/workflows/Linux%20tests/badge.svg)
![MacOS tests](https://github.com/spyder-ide/three-merge/workflows/MacOS%20tests/badge.svg)
![Windows tests](https://github.com/spyder-ide/three-merge/workflows/Windows%20tests/badge.svg)

*Copyright © 2020– Spyder Project Contributors*

## Overview
Simple Python library to perform a 3-way merge between strings, based on [diff-match-patch](https://github.com/google/diff-match-patch). This library performs merges at a character level, as opposed to most VCS systems, which opt for a line-based approach.


## Installing
To install three-merge, you can use both conda or pip package managers:

```bash
# Using conda (Recommended)
conda install three-merge -c spyder-ide

# Using pip
pip install three-merge
```

## Dependencies
This package depends on [diff-match-patch](https://github.com/google/diff-match-patch) to compute and track the differences across the source and target strings with respect to the base one.

## Installing locally
To install and develop three-merge locally, you will need to install diff-match-patch:

```bash
# Using conda
conda install diff-match-patch

# Using pip
pip install diff-match-patch
```

Then, you can install the package locally using pip:

```bash
pip install -U -e .
```

## Running tests
We use pytest to run tests as it follows:

```bash
pytest -x -v three_merge/tests
```

## Package usage
Three-merge provides a ``merge`` function to merge changes from two strings (source, target) with respect a original string (base). This library is able to handle additions, deletions and preserved sections across both strings, while detecting and highlighting possible merge conflicts (like Git).

```python
# Package import
from three_merge import merge

# Strings have non-conflicting additions
base = '123456789101112'
source = '0123456789101112'
target = '12345678910111213'

# merged = '012345678910111213'
merged = merge(source, target, base)

# Strings have an addition conflict
base = '123456789101112'
source = '123a456789101112'
target = '123b456789101112'

# merged = '123<<<<<<< ++ a ======= ++ b >>>>>>>456789101112'
merged = merge(source, target, base)

# Strings have non-conflicting addition/deletions
base = '123456789101112'
source = '123456789ab101112'
target = '123789101112'

# merged = '123789ab101112'
merged = merge(source, target, base)
```

For more examples, please take a look at our [tests](https://github.com/spyder-ide/three-merge/blob/master/three_merge/tests/test_merge.py).


## Changelog
Please see our [CHANGELOG](https://github.com/spyder-ide/three-merge/blob/master/CHANGELOG.md) file to learn more about our new features and improvements.


## Contribution guidelines
We follow PEP8 and PEP257 for all Python modules. We use MyPy type annotations for all functions and classes declared on this package. Feel free to send a PR or create an issue if you have any problem/question.




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/spyder-ide/three-merge",
    "name": "three-merge",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Merge,Files,Three-way",
    "author": "Spyder Project Contributors",
    "author_email": "spyder.python@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4d/d1/86f4a088f2ebdc3ff1a9cb653aab91e588a8d0930b41c2e066e6a2920ae7/three-merge-0.1.1.tar.gz",
    "platform": "",
    "description": "# three-merge\n[![Project License - MIT](https://img.shields.io/pypi/l/three-merge.svg)](https://raw.githubusercontent.com/spyder-ide/three-merge/master/LICENSE)\n[![pypi version](https://img.shields.io/pypi/v/three-merge.svg)](https://pypi.org/project/three-merge/)\n[![conda version](https://img.shields.io/conda/vn/conda-forge/three-merge.svg)](https://www.anaconda.com/download/)\n[![download count](https://img.shields.io/conda/dn/conda-forge/three-merge.svg)](https://www.anaconda.com/download/)\n[![Downloads](https://pepy.tech/badge/three-merge)](https://pepy.tech/project/three-merge)\n[![PyPI status](https://img.shields.io/pypi/status/three-merge.svg)](https://github.com/spyder-ide/three-merge)\n![Linux tests](https://github.com/spyder-ide/three-merge/workflows/Linux%20tests/badge.svg)\n![MacOS tests](https://github.com/spyder-ide/three-merge/workflows/MacOS%20tests/badge.svg)\n![Windows tests](https://github.com/spyder-ide/three-merge/workflows/Windows%20tests/badge.svg)\n\n*Copyright \u00a9 2020\u2013 Spyder Project Contributors*\n\n## Overview\nSimple Python library to perform a 3-way merge between strings, based on [diff-match-patch](https://github.com/google/diff-match-patch). This library performs merges at a character level, as opposed to most VCS systems, which opt for a line-based approach.\n\n\n## Installing\nTo install three-merge, you can use both conda or pip package managers:\n\n```bash\n# Using conda (Recommended)\nconda install three-merge -c spyder-ide\n\n# Using pip\npip install three-merge\n```\n\n## Dependencies\nThis package depends on [diff-match-patch](https://github.com/google/diff-match-patch) to compute and track the differences across the source and target strings with respect to the base one.\n\n## Installing locally\nTo install and develop three-merge locally, you will need to install diff-match-patch:\n\n```bash\n# Using conda\nconda install diff-match-patch\n\n# Using pip\npip install diff-match-patch\n```\n\nThen, you can install the package locally using pip:\n\n```bash\npip install -U -e .\n```\n\n## Running tests\nWe use pytest to run tests as it follows:\n\n```bash\npytest -x -v three_merge/tests\n```\n\n## Package usage\nThree-merge provides a ``merge`` function to merge changes from two strings (source, target) with respect a original string (base). This library is able to handle additions, deletions and preserved sections across both strings, while detecting and highlighting possible merge conflicts (like Git).\n\n```python\n# Package import\nfrom three_merge import merge\n\n# Strings have non-conflicting additions\nbase = '123456789101112'\nsource = '0123456789101112'\ntarget = '12345678910111213'\n\n# merged = '012345678910111213'\nmerged = merge(source, target, base)\n\n# Strings have an addition conflict\nbase = '123456789101112'\nsource = '123a456789101112'\ntarget = '123b456789101112'\n\n# merged = '123<<<<<<< ++ a ======= ++ b >>>>>>>456789101112'\nmerged = merge(source, target, base)\n\n# Strings have non-conflicting addition/deletions\nbase = '123456789101112'\nsource = '123456789ab101112'\ntarget = '123789101112'\n\n# merged = '123789ab101112'\nmerged = merge(source, target, base)\n```\n\nFor more examples, please take a look at our [tests](https://github.com/spyder-ide/three-merge/blob/master/three_merge/tests/test_merge.py).\n\n\n## Changelog\nPlease see our [CHANGELOG](https://github.com/spyder-ide/three-merge/blob/master/CHANGELOG.md) file to learn more about our new features and improvements.\n\n\n## Contribution guidelines\nWe follow PEP8 and PEP257 for all Python modules. We use MyPy type annotations for all functions and classes declared on this package. Feel free to send a PR or create an issue if you have any problem/question.\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple library for merging two strings with respect to a base one",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/spyder-ide/three-merge"
    },
    "split_keywords": [
        "merge",
        "files",
        "three-way"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23bea52588102605ec52b4e88340d65a290b6465c1dbcd2d943ab149b012908b",
                "md5": "09c71e83711f5962c30e2b7c25066ee9",
                "sha256": "dd219f4696aa0bbec6099ac3528b4de0450ff9bde862dd8f6d6f52e745f83464"
            },
            "downloads": -1,
            "filename": "three_merge-0.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "09c71e83711f5962c30e2b7c25066ee9",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 6430,
            "upload_time": "2020-07-22T23:41:55",
            "upload_time_iso_8601": "2020-07-22T23:41:55.213068Z",
            "url": "https://files.pythonhosted.org/packages/23/be/a52588102605ec52b4e88340d65a290b6465c1dbcd2d943ab149b012908b/three_merge-0.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4dd186f4a088f2ebdc3ff1a9cb653aab91e588a8d0930b41c2e066e6a2920ae7",
                "md5": "31746f7ec935ded29def046321c7dcb1",
                "sha256": "60f6afe144595560d63ae32625351bcef3b94733b54eb97800a9feb0f3d9d970"
            },
            "downloads": -1,
            "filename": "three-merge-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "31746f7ec935ded29def046321c7dcb1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5898,
            "upload_time": "2020-07-22T23:41:56",
            "upload_time_iso_8601": "2020-07-22T23:41:56.780148Z",
            "url": "https://files.pythonhosted.org/packages/4d/d1/86f4a088f2ebdc3ff1a9cb653aab91e588a8d0930b41c2e066e6a2920ae7/three-merge-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-07-22 23:41:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "spyder-ide",
    "github_project": "three-merge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "three-merge"
}
        
Elapsed time: 0.19014s