00000039
  4   !ˆl–ßi~”ªn-j�vãM\dJbÑ¿ŽþDÔ‹6WÆFDØÆ ùÕ589ÔÂÒ M    !€}q (X	   locale_idqX   ig_NGqX   territoriesq}qX	   languagesq}qX   variantsq}qX   scriptsq	}q
X   list_patternsq}qX	   week_dataq}qX   zone_formatsq}qX
   time_zonesq}qX
   meta_zonesq}qX   number_symbolsq}qX   decimal_formatsq}qX   scientific_formatsq}qX   percent_formatsq}qX   currency_formatsq}qX   currency_unit_patternsq}q X   currency_namesq!}q"X   currency_names_pluralq#}q$X   currency_symbolsq%}q&X   unit_patternsq'}q(X   compound_unit_patternsq)}q*X   unit_display_namesq+}q,X   date_fieldsq-}q.X   measurement_systemsq/}q0u.  6   #ˆl–Ü4ý( ©”u( 	•íÀà™S�ÿ�þBD³rˆ�†A„% ?ŸÖƒh-9ÕÁÃÓ 2    ## Copyright (C) 2006-2007 by Jelmer Vernooij
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""Map Tree."""

def map_file_ids(repository, old_parents, new_parents):
    """Try to determine the equivalent file ids in two sets of parents.

    :param repository: Repository to use
    :param old_parents: List of revision ids of old parents
    :param new_parents: List of revision ids of new parents
    """
    assert len(old_parents) == len(new_parents)
    ret = {}
    for (oldp, newp) in zip(old_parents, new_parents):
        oldtree = repository.revision_tree(oldp)
        newtree = repository.revision_tree(newp)
        for path, ie in oldtree.iter_entries_by_dir():
            file_id = newtree.path2id(path)
            if file_id is not None:
                ret[ie.file_id] = file_id
    return ret


class MapTree:
    """Wrapper around a tree that translates file ids.
    """

    def __init__(self, oldtree, fileid_map):
        """Create a new MapTree.

        :param oldtree: Old tree to map to.
        :param fileid_map: Map with old -> new file ids.
        """
        self.oldtree = oldtree
        self.map = fileid_map

    def old_id(self, file_id):
        """Look up the original file id of a file.

        :param file_id: New file id
        :return: Old file id if mapped, otherwise new file id
        """
        for x in self.map:
            if self.map[x] == file_id:
                return x
        return file_id

    def new_id(self, file_id):
        """Look up the new file id of a file.

        :param file_id: Old file id
        :return: New file id
        """
        try:
            return self.map[file_id]
        except KeyError:
            return file_id

    def get_file_sha1(self, path, file_id=None):
        "See Tree.get_file_sha1()."""
        return self.oldtree.get_file_sha1(path)

    def get_file_with_stat(self, path, file_id=None):
        "See Tree.get_file_with_stat()."""
        if getattr(self.oldtree, "get_file_with_stat", None) is not None:
            return self.oldtree.get_file_with_stat(path=path)
        else:
            return self.get_file(path), None

    def get_file(self, path, file_id=None):
        "See Tree.get_file()."""
        return self.oldtree.get_file(path)

    def is_executable(self, path, file_id=None):
        "See Tree.is_executable()."""
        return self.oldtree.is_executable(path)

    def has_filename(self, filename):
        "See Tree.has_filename()."""
        return self.oldtree.has_filename(filename)

    def path_content_summary(self, path):
        "See Tree.path_content_summary()."""
        return self.oldtree.path_content_summary(path)

    def map_ie(self, ie):
     