30
     ˆ¾�þB gí¤z8Æ/çÅƒh¹ÄÂÁ      30
  3   	ˆl–Ãa¾”*i?u8 Y¸î41hßŽþFEœpy§I+¬€ÏÆ‚¢ÅÃÂ  ¬    	# Directory for PostgreSQL sockets, lockfiles and stats tempfiles
d /run/postgresql 2775 postgres postgres - -
# Log directory
d /var/log/postgresql 1775 root postgres - -
  8   ˆl–ß=¿J
hŠm@Šãn\i¥1hß�þYh2¬ã #c�Ò3üÿÇ„,´ÏÆÅÄÃ 4    # gnuarch.py - GNU Arch support for the convert extension
#
#  Copyright 2008, 2009 Aleix Conchillo Flaque <aleix@member.fsf.org>
#  and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import os
import shutil
import stat
import tempfile

from mercurial.i18n import _
from mercurial import (
    encoding,
    error,
    mail,
    pycompat,
    util,
)
from mercurial.utils import (
    dateutil,
    procutil,
)
from . import common


class gnuarch_source(common.converter_source, common.commandline):
    class gnuarch_rev:
        def __init__(self, rev):
            self.rev = rev
            self.summary = b''
            self.date = None
            self.author = b''
            self.continuationof = None
            self.add_files = []
            self.mod_files = []
            self.del_files = []
            self.ren_files = {}
            self.ren_dirs = {}

    def __init__(self, ui, repotype, path, revs=None):
        super(gnuarch_source, self).__init__(ui, repotype, path, revs=revs)

        if not os.path.exists(os.path.join(path, b'{arch}')):
            raise common.NoRepo(
                _(b"%s does not look like a GNU Arch repository") % path
            )

        # Could use checktool, but we want to check for baz or tla.
        self.execmd = None
        if procutil.findexe(b'baz'):
            self.execmd = b'baz'
        else:
            if procutil.findexe(b'tla'):
                self.execmd = b'tla'
            else:
                raise error.Abort(_(b'cannot find a GNU Arch tool') +
                                  _(b' (try installing the %s package)') % b'tla')

        common.commandline.__init__(self, ui, self.execmd)

        self.path = os.path.realpath(path)
        self.tmppath = None

        self.treeversion = None
        self.lastrev = None
        self.changes = {}
        self.parents = {}
        self.tags = {}
        self.encoding = encoding.encoding
        self.archives = []

    def before(self):
        # Get registered archives
        self.archives = [
            i.rstrip(b'\n') for i in self.runlines0(b'archives', b'-n')
        ]

        if self.execmd == b'tla':
            output = self.run0(b'tree-version', self.path)
        else:
            output = self.run0(b'tree-version', b'-d', self.path)
        self.treeversion = output.strip()

        # Get name of temporary directory
        version = self.treeversion.split(b'/')
        self.tmppath = os.path.join(
            pycompat.fsencode(tempfile.gettempdir()), b'hg-%s' % version[1]
        )

        # Generate parents dictionary
        self.parents[None] = []
        treeversion = self.treeversion
        child = None
        while treeversion:
            self.ui.status(_(b'analyzing tree version %s...\n') % treeversion)

            archive = treeversion.split(b'/')[0]
            if archive not in self.archives:
                self.ui.status(
                    _(
                        b'tree analysis stopped because it points to '
                        b'an unregistered archive %s...\n'
                    )
                    % archive
                )
                break

            # Get the complete list of revisions for that tree version
            output, status = self.runlines(
                b'revisions', b'-r', b'-f', treeversion
            )
            self.checkexit(
                status, b'failed retrieving revisions for %s' % treeversion
            )

            # No new iteration unless a revision has a continuation-of header
            treeversion = None

            for l in output:
                rev = l.strip