func (t *treeItem) String(indent int, buf *bytes.Buffer) {
	for i, b := range t.remoteBranches {
		buf.WriteString(b)
		if t.remoteBranchWriting[i] {
			buf.WriteString("(w)")
		} else {
			buf.WriteString("(r)")
		}
		if i < len(t.remoteBranches)-1 {
			buf.WriteString(", ")
		}
	}
	buf.WriteString("\n")
	names := make([]string, 0, len(t.children))
	for n := range t.children {
		names = append(names, n)
	}
	sort.Strings(names)
	for _, n := range names {
		i := t.children[n]
		buf.WriteString(stringutil.GenerateRollingString(" ", indent*2))
		buf.WriteString(fmt.Sprintf("%v/: ", n))
		i.String(indent+1, buf)
	}
}
/*
String returns a string representation of this item and its children.
package rufs
import (
	"bytes"
	"fmt"
	"path"
	"sort"
	"devt.de/krotik/common/errorutil"
	"devt.de/krotik/common/stringutil"
)
type treeItem struct {
	children            map[string]*treeItem  
	remoteBranches      []string              
	remoteBranchWriting []bool                
}
func (t *treeItem) findPathBranches(treePath string, branchPath []string,
	recursive bool, visit func(*treeItem, string, []string, []string, []bool)) {
	visit(t, treePath, branchPath, t.remoteBranches, t.remoteBranchWriting)
	if len(branchPath) > 0 {
		if c, ok := t.children[branchPath[0]]; ok {
			c.findPathBranches(path.Join(treePath, branchPath[0]),
				branchPath[1:], recursive, visit)
		}
	} else if recursive {
		var childNames []string
		for n := range t.children {
			childNames = append(childNames, n)
		}
		sort.Strings(childNames)
		for _, n := range childNames {
			t.children[n].findPathBranches(path.Join(treePath, n),
				branchPath, recursive, visit)
		}
	}
}
func (t *treeItem) addMapping(mappingPath []string, branchName string, writable bool) {
	if len(mappingPath) > 0 {
		childName := mappingPath[0]
		rest := mappingPath[1:]
		errorutil.AssertTrue(childName != "",
			"Adding a mapping with an empty path is not supported")
		child, ok := t.children[childName]
		if !ok {
			child = &treeItem{make(map[string]*treeItem), []string{}, []bool{}}
			t.children[childName] = child
		}
		child.addMapping(rest, branchName, writable)
		return
	}
	t.remoteBranches = append(t.remoteBranches, branchName)
	t.remoteBranchWriting = append(t.remoteBranchWriting, writable)
}