コード例 #1
0
def has_xdiff():
    try:
        from mercurial import policy
        bdiff = policy.importmod('bdiff')
        return bdiff.xdiffblocks(b'', b'') == [(0, 0, 0, 0)]
    except (ImportError, AttributeError):
        return False
コード例 #2
0
ファイル: basepack.py プロジェクト: davidshepherd7/dotfiles
from __future__ import absolute_import

import errno, hashlib, mmap, os, struct, time

from collections import defaultdict
from mercurial import policy, pycompat, util
from mercurial.i18n import _
from mercurial import vfs as vfsmod

from . import shallowutil

osutil = policy.importmod(r'osutil')

# The pack version supported by this implementation. This will need to be
# rev'd whenever the byte format changes. Ex: changing the fanout prefix,
# changing any of the int sizes, changing the delta algorithm, etc.
PACKVERSIONSIZE = 1
INDEXVERSIONSIZE = 2

FANOUTSTART = INDEXVERSIONSIZE

# Constant that indicates a fanout table entry hasn't been filled in. (This does
# not get serialized)
EMPTYFANOUT = -1

# The fanout prefix is the number of bytes that can be addressed by the fanout
# table. Example: a fanout prefix of 1 means we use the first byte of a hash to
# look in the fanout table (which will be 2^8 entries long).
SMALLFANOUTPREFIX = 1
LARGEFANOUTPREFIX = 2
コード例 #3
0
)

# TRACKING hg46
# wireproto -> wireprotov1server
wireproto = import_module('mercurial.wireprotov1server')
if not wireproto:
    wireproto = import_module('mercurial.wireproto')

with demandimport.deactivated():
    from kafka import SimpleClient
    import kafka.common as kafkacommon
    # kafka.codec does module sniffing via imports. Import it explicitly
    # to force it to import now.
    import kafka.codec as kafkacodec

base85 = policy.importmod('base85')

testedwith = '4.3 4.4 4.5 4.6 4.7 4.8 4.9'

cmdtable = {}

command = registrar.command(cmdtable)

# Register `hg mozrepohash` with the command registrar
command('mozrepohash', [
    ('', 'no-raw', False, 'skip hashing raw files'),
] + cmdutil.formatteropts)(commoncommands.mozrepohash)

configtable = {}
configitem = registrar.configitem(configtable)
コード例 #4
0
ファイル: repack.py プロジェクト: dothq/mozillabuild
    scmutil,
    util,
    vfs,
)
from mercurial.utils import procutil
from . import (
    constants,
    contentstore,
    datapack,
    extutil,
    historypack,
    metadatastore,
    shallowutil,
)

osutil = policy.importmod(r'osutil')


class RepackAlreadyRunning(error.Abort):
    pass


def backgroundrepack(repo, incremental=True, packsonly=False):
    cmd = [procutil.hgexecutable(), '-R', repo.origroot, 'repack']
    msg = _("(running background repack)\n")
    if incremental:
        cmd.append('--incremental')
        msg = _("(running background incremental repack)\n")
    if packsonly:
        cmd.append('--packsonly')
    repo.ui.warn(msg)
コード例 #5
0
ファイル: test-parseindex2.py プロジェクト: pombredanne/hg
import struct
import subprocess
import sys
import unittest

from mercurial.node import (
    nullid,
    nullrev,
)
from mercurial import (
    node as nodemod,
    policy,
    pycompat,
)

parsers = policy.importmod(r'parsers')

# original python implementation
def gettype(q):
    return int(q & 0xFFFF)

def offset_type(offset, type):
    return int(int(offset) << 16 | type)

indexformatng = ">Qiiiiii20s12x"

def py_parseindex(data, inline) :
    s = 64
    cache = None
    index = []
    nodemap = {nullid: nullrev}