<commit_before># dep-tree #

Allows you to create a tree and resolve the parents of any child. Each child can have multiple parents.

Note: no checking is done to stop adding cyclic dependencies. That is up to you.

## Example Usage ##

In the past I've named my database patches in a sequential manner. e.g. '001', '002', '003', but we all know that can
cause problems when two or more developers try and grab the next number in the patch series.

Instead, now I call them 'yyyymmdd-name' and each depends on something before it, usually a release number.

Let's say that 'create-user-table' depends on 'create-database'.

And that 'release-1' depends on 'create-user-table'.

Let's now add a few more patches which depend on 'release-1' : 'create-item-table' and 'update-user-table'.

Finally, 'release-2' depends on both 'create-item-table' and 'update-user-table'.

```
var DepTree = require('dep-tree').
var tree = new DepTree();

// patches for release-1
tree.add('create-database', 'create-user-table');
tree.add('create-user-table', 'release-1');

// -> [ 'create-database', 'create-user-table', 'release-1' ]
tree.solve('release-1');

// patches for release-2
tree.add('release-1', 'create-item-table');
tree.add('release-1', 'update-user-table');
tree.add('create-item-table', 'release-2');
tree.add('update-user-table', 'release-2');

// [
//     'create-database', 'create-user-table', 'release-1',
//     'create-item-table', 'update-user-table', 'release-2'
// ]
tree.solve('release-2');
```

This example shows a tree which widens between releases and comes together for each release. You don't have to do it
this way but it probably makes it more manageable.

## Examples ##

### Simple ###

```
tree.add('grandparent', 'parent');
tree.solve('grandparent'); // [ 'grandparent' ]
tree.solve('parent'); // [ 'grandparent', 'parent' ]
```

### Multi ###

```
tree.add('grandparent', 'parent1');
tree.add('grandparent', 'parent2');
tree.add('child', 'parent1');
tree.add('child', 'parent2');
tree.solve('grandparent'); // [ 'grandparent' ]
tree.solve('parent1');     // [ 'grandparent', 'parent1' ]
tree.solve('parent2');     // [ 'grandparent', 'parent2' ]
tree.solve('child');       // [ 'grandparent', 'parent1', 'parent2', 'child' ]
```

# Author #

Written by [<NAME>](http://chilts.org/) - [Blog](http://chilts.org/blog/) -
[Twitter](https://twitter.com/andychilton).

# License #

* [Copyright 2013 <NAME>.  All rights reserved.](http://chilts.mit-license.org/2013/)

(Ends)<commit_msg>Fix the parent/child order<commit_after># dep-tree #

Allows you to create a tree and resolve the parents of any child. Each child can have multiple parents.

Note: no checking is done to stop adding cyclic dependencies. That is up to you.

## Example Usage ##

In the past I've named my database patches in a sequential manner. e.g. '001', '002', '003', but we all know that can
cause problems when two or more developers try and grab the next number in the patch series.

Instead, now I call them 'yyyymmdd-name' and each depends on something before it, usually a release number.

Let's say that 'create-user-table' depends on 'create-database'.

And that 'release-1' depends on 'create-user-table'.

Let's now add a few more patches which depend on 'release-1' : 'create-item-table' and 'update-user-table'.

Finally, 'release-2' depends on both 'create-item-table' and 'update-user-table'.

```
var DepTree = require('dep-tree').
var tree = new DepTree();

// patches for release-1
tree.add('create-database', 'create-user-table');
tree.add('create-user-table', 'release-1');

// -> [ 'create-database', 'create-user-table', 'release-1' ]
tree.solve('release-1');

// patches for release-2
tree.add('release-1', 'create-item-table');
tree.add('release-1', 'update-user-table');
tree.add('create-item-table', 'release-2');
tree.add('update-user-table', 'release-2');

// [
//     'create-database', 'create-user-table', 'release-1',
//     'create-item-table', 'update-user-table', 'release-2'
// ]
tree.solve('release-2');
```

This example shows a tree which widens between releases and comes together for each release. You don't have to do it
this way but it probably makes it more manageable.

## Examples ##

### Simple ###

```
tree.add('grandparent', 'parent');
tree.solve('grandparent'); // [ 'grandparent' ]
tree.solve('parent'); // [ 'grandparent', 'parent' ]
```

### Multi ###

```
tree.add('grandparent', 'parent1');
tree.add('grandparent', 'parent2');
tree.add('parent1', 'child');
tree.add('parent2', 'child');
tree.solve('grandparent'); // [ 'grandparent' ]
tree.solve('parent1');     // [ 'grandparent', 'parent1' ]
tree.solve('parent2');     // [ 'grandparent', 'parent2' ]
tree.solve('child');       // [ 'grandparent', 'parent1', 'parent2', 'child' ]
```

# Author #

Written by [<NAME>](http://chilts.org/) - [Blog](http://chilts.org/blog/) -
[Twitter](https://twitter.com/andychilton).

# License #

* [Copyright 2013 <NAME>.  All rights reserved.](http://chilts.mit-license.org/2013/)

(Ends)
{'fraction_non_alphanumeric': 0.1849492335257814, 'fraction_numerical': 0.016723073860242882, 'mean_word_length': 4.1740473738414, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5021358', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1610, 'n_words': 482}