> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/product-development/mariadb-internals/mariadb-internals-documentation-merging-into-mariadb/creating-a-new-merge-tree.md).

# Creating a New Merge Tree

{% hint style="info" %}
This page contains background information for MariaDB developers.
{% endhint %}

This article is obsolete. We don't use bzr anymore. This howto needs to be rewritten to explain how to create a merge tree in git.

**Merge tree** in the context of this HOWTO is a tree created specifically to simplify merges of third-party packages into MariaDB. WIth a merge tree there's a clear separation between upstream changes and our changes and in most cases bzr can do the merges automatically.

Here's how I created a merge tree for pcre:

* prerequisites: we already have pcre in the MariaDB tree, together with our changes (otherwise one can trivially create a bzr repository out of source pcre tarball).
* create an empty repository:

```
mkdir pcre
cd pcre
bzr init
```

* download pcre source tarball of the same version that we have in the tree — `pcre-8.34.tar.bz2`
* unpack it in the same place where the files are in the source tree:

```
tar xf ~/pcre-8.34.tar.bz2
mv pcre-8.34 pcre
```

* Add files to the repository with the same file-ids as in the MariaDB tree!

```
bzr add --file-ids-from ~/Abk/mysql/10.0
```

* All done. Commit and push

```
bzr commit -m pcre-8.34
bzr push --remember lp:~maria-captains/maria/pcre-mergetree
```

* Now null-merge that into your MariaDB tree. Note, that for the initial merge you need to specify the revision range `0..1`

```
cd ~/Abk/mysql/10.0
bzr merge -r 0..1 ~/mergetrees/pcre/
```

* Remove pcre files that shouldn't be in MariaDB tree, revert all changes that came from pcre (remember — it's a null-merge, pcre-8.34 is already in MariaDB tree), rename files in place as needed, resolve conflicts:

```
bzr rm `bzr added`
bzr revert --no-backup `bzr modified`
bzr resolve pcre
```

* Verify that the tree is unchanged and commit:

```
bzr status
bzr commit -m 'pcre-8.34 mergetree initial merge'
```

* Congratulations, your new merge tree is ready!

Now see [Merging with a merge tree](/docs/server/reference/product-development/mariadb-internals/mariadb-internals-documentation-merging-into-mariadb/merging-with-a-merge-tree.md).

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mariadb.com/docs/server/reference/product-development/mariadb-internals/mariadb-internals-documentation-merging-into-mariadb/creating-a-new-merge-tree.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
