# 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
            path = self.get_path(it)
            if path[-1]:
                path = path[:-1] + (path[-1]-1,)
                it = self.get_iter(path)
                while 1:
                    nc = self.iter_n_children(it)
                    if nc:
                        it = self.iter_nth_child(it, nc-1)
                    else:
                        break
            else:
                up = self.iter_parent(it)
                if up:
                    it = up
                else:
                    raise StopIteration()
            yield it

    def _find_next_prev_diff(self, start_path):
        prev_path, next_path = None, None
        start_iter = self.get_iter(start_path)

        for it in self.inorder_search_up(start_iter):
            state = self.get_state(it, 0)
            if state not in (STATE_NORMAL, STATE_EMPTY):
                prev_path = self.get_path(it)
                break

        for it in self.inorder_search_down(start_iter):
            state = self.get_state(it, 0)

# 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

            path = self.get_path(it)
            if path[-1]:
                path = path[:-1] + (path[-1]-1,)
                it = self.get_iter(path)
                while 1:
                    nc = self.iter_n_children(it)
                    if nc:
                        it = self.iter_nth_child(it, nc-1)
                    else:
                        break
            else:
                up = self.iter_parent(it)
                if up:
                    it = up
                else:
                    raise StopIteration()
            yield it

    def _find_next_prev_diff(self, start_path):
        prev_path, next_path = None, None
        start_iter = self.get_iter(start_path)

        for it in self.inorder_search_up(start_iter):
            state = self.get_state(it, 0)
            if state not in (STATE_NORMAL, STATE_EMPTY):
                prev_path = self.get_path(it)
                break

        for it in self.inorder_search_down(start_iter):
            state = self.get_state(it, 0)

            if state not in (STATE_NORMAL, STATE_EMPTY):