# Path: meld/vc/_vc.py
# (STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE,
#     STATE_ERROR, STATE_EMPTY, STATE_NEW,
#     STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED,
#     STATE_MISSING, STATE_NONEXIST, STATE_MAX) = list(range(13))
# (CONFLICT_MERGED, CONFLICT_BASE, CONFLICT_LOCAL,
#     CONFLICT_REMOTE, CONFLICT_MAX) = list(range(5))
# CONFLICT_OTHER = CONFLICT_REMOTE
# CONFLICT_THIS = CONFLICT_LOCAL
# DATA_NAME, DATA_STATE, DATA_REVISION, DATA_OPTIONS = list(range(4))
#     VC_DIR = None
#     VC_ROOT_WALK = True
#     VC_METADATA = None
#     VC_COLUMNS = (DATA_NAME, DATA_STATE)
#     NULL = open(os.devnull, "wb")
# def partition(pred, iterable):
#     def __init__(self, path, name, state):
#     def __str__(self):
#     def __repr__(self):
#     def get_status(self):
#     def __init__(self, path, name, state):
#     def __init__(self, path, name, state, rev="", options=""):
#     def __init__(self, location):
#     def commit_command(self, message):
#     def update_command(self):
#     def add_command(self):
#     def remove_command(self, force=0):
#     def revert_command(self):
#     def resolved_command(self):
#     def get_files_to_commit(self, paths):
#     def get_commit_message_prefill(self):
#     def update(self, runner, files):
#     def push(self, runner):
#     def revert(self, runner, files):
#     def get_commits_to_push_summary(self):
#     def remove(self, runner, files):
#     def resolve(self, runner, files):
#     def get_path_for_repo_file(self, path, commit=None):
#     def get_path_for_conflict(self, path, conflict):
#     def check_repo_root(self, location):
#     def find_repo_root(self, location):
#     def get_working_directory(self, workdir):
#     def cache_inventory(self, topdir):
#     def uncache_inventory(self):
#     def update_file_state(self, path):
#     def valid_repo(self):
#     def listdir(self, path="."):
#     def lookup_files(self, dirs, files, directory=None):
#     def _get_dirsandfiles(self, directory, dirs, files):
#     def get_entry(self, path):
#     def __init__(self, location):
#     def cache_inventory(self, directory):
#     def uncache_inventory(self):
#     def _lookup_tree_cache(self, directory):
#     def _get_tree_cache(self, directory):
#     def __init__(self, vc, path, err):
#     def __str__(self):
#     def __init__(self, vc, rev, err):
#     def __str__(self):
# def popen(cmd, cwd=None):
# def call(cmd, cwd=None):
# class Entry(object):
# class Dir(Entry):
# class File(Entry):
# class Vc(object):
# class CachedVc(Vc):
# class InvalidVCPath(ValueError):
# class InvalidVCRevision(ValueError):


import os
import gobject
import gtk
import pango
from meld.vc._vc import \
    STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \
    STATE_ERROR, STATE_EMPTY, STATE_NEW, \
    STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \
    STATE_MISSING, STATE_NONEXIST, STATE_MAX, \
    CONFLICT_BASE, CONFLICT_LOCAL, CONFLICT_REMOTE, \
    CONFLICT_MERGED, CONFLICT_OTHER, CONFLICT_THIS

    def value_paths(self, it):
        return [self.value_path(it, i) for i in range(self.ntree)]

    def value_path(self, it, pane):
        path = self.get_value(it, self.column_index(COL_PATH, pane))
        if path is not None:
            path = path.decode('utf8')
        return path

    def column_index(self, col, pane):
        return self.ntree * col + pane

    def add_entries(self, parent, names):
        child = self.append(parent)
        for pane, path in enumerate(names):
            self.set_value(child, self.column_index(COL_PATH, pane), path)
        return child

    def add_empty(self, parent, text="empty folder"):
        it = self.append(parent)
        for pane in range(self.ntree):
            self.set_value(it, self.column_index(COL_PATH, pane), None)
            self.set_state(it, pane, STATE_EMPTY, text)

    def add_error(self, parent, msg, pane):
        it = self.append(parent)
        for i in range(self.ntree):
            self.set_value(it, self.column_index(COL_STATE, i),
                           str(STATE_ERROR))

# Path: meld/vc/_vc.py
# (STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE,
#     STATE_ERROR, STATE_EMPTY, STATE_NEW,
#     STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED,
#     STATE_MISSING, STATE_NONEXIST, STATE_MAX) = list(range(13))
# (CONFLICT_MERGED, CONFLICT_BASE, CONFLICT_LOCAL,
#     CONFLICT_REMOTE, CONFLICT_MAX) = list(range(5))
# CONFLICT_OTHER = CONFLICT_REMOTE
# CONFLICT_THIS = CONFLICT_LOCAL
# DATA_NAME, DATA_STATE, DATA_REVISION, DATA_OPTIONS = list(range(4))
#     VC_DIR = None
#     VC_ROOT_WALK = True
#     VC_METADATA = None
#     VC_COLUMNS = (DATA_NAME, DATA_STATE)
#     NULL = open(os.devnull, "wb")
# def partition(pred, iterable):
#     def __init__(self, path, name, state):
#     def __str__(self):
#     def __repr__(self):
#     def get_status(self):
#     def __init__(self, path, name, state):
#     def __init__(self, path, name, state, rev="", options=""):
#     def __init__(self, location):
#     def commit_command(self, message):
#     def update_command(self):
#     def add_command(self):
#     def remove_command(self, force=0):
#     def revert_command(self):
#     def resolved_command(self):
#     def get_files_to_commit(self, paths):
#     def get_commit_message_prefill(self):
#     def update(self, runner, files):
#     def push(self, runner):
#     def revert(self, runner, files):
#     def get_commits_to_push_summary(self):
#     def remove(self, runner, files):
#     def resolve(self, runner, files):
#     def get_path_for_repo_file(self, path, commit=None):
#     def get_path_for_conflict(self, path, conflict):
#     def check_repo_root(self, location):
#     def find_repo_root(self, location):
#     def get_working_directory(self, workdir):
#     def cache_inventory(self, topdir):
#     def uncache_inventory(self):
#     def update_file_state(self, path):
#     def valid_repo(self):
#     def listdir(self, path="."):
#     def lookup_files(self, dirs, files, directory=None):
#     def _get_dirsandfiles(self, directory, dirs, files):
#     def get_entry(self, path):
#     def __init__(self, location):
#     def cache_inventory(self, directory):
#     def uncache_inventory(self):
#     def _lookup_tree_cache(self, directory):
#     def _get_tree_cache(self, directory):
#     def __init__(self, vc, path, err):
#     def __str__(self):
#     def __init__(self, vc, rev, err):
#     def __str__(self):
# def popen(cmd, cwd=None):
# def call(cmd, cwd=None):
# class Entry(object):
# class Dir(Entry):
# class File(Entry):
# class Vc(object):
# class CachedVc(Vc):
# class InvalidVCPath(ValueError):
# class InvalidVCRevision(ValueError):


# Path: meld/tree.py
import os
import gobject
import gtk
import pango
from meld.vc._vc import \
    STATE_IGNORED, STATE_NONE, STATE_NORMAL, STATE_NOCHANGE, \
    STATE_ERROR, STATE_EMPTY, STATE_NEW, \
    STATE_MODIFIED, STATE_CONFLICT, STATE_REMOVED, \
    STATE_MISSING, STATE_NONEXIST, STATE_MAX, \
    CONFLICT_BASE, CONFLICT_LOCAL, CONFLICT_REMOTE, \
    CONFLICT_MERGED, CONFLICT_OTHER, CONFLICT_THIS


    def value_paths(self, it):
        return [self.value_path(it, i) for i in range(self.ntree)]

    def value_path(self, it, pane):
        path = self.get_value(it, self.column_index(COL_PATH, pane))
        if path is not None:
            path = path.decode('utf8')
        return path

    def column_index(self, col, pane):
        return self.ntree * col + pane

    def add_entries(self, parent, names):
        child = self.append(parent)
        for pane, path in enumerate(names):
            self.set_value(child, self.column_index(COL_PATH, pane), path)
        return child

    def add_empty(self, parent, text="empty folder"):
        it = self.append(parent)
        for pane in range(self.ntree):
            self.set_value(it, self.column_index(COL_PATH, pane), None)
            self.set_state(it, pane, STATE_EMPTY, text)

    def add_error(self, parent, msg, pane):
        it = self.append(parent)
        for i in range(self.ntree):
            self.set_value(it, self.column_index(COL_STATE, i),
                           str(STATE_ERROR))

        self.set_state(it, pane, STATE_ERROR, msg)