Exemple #1
0
# MA  02110-1301, USA.

"""Tests for the index."""


from cStringIO import (
    StringIO,
    )
import os
import shutil
import stat
import struct
import tempfile
from fs import fs

fs.hook(shutil)
fs.hook(tempfile)
open = fs.hooked_builtin_open

from dulwich.index import (
    Index,
    cleanup_mode,
    commit_tree,
    read_index,
    write_cache_time,
    write_index,
    )
from dulwich.object_store import (
    MemoryObjectStore,
    )
from dulwich.objects import (
Exemple #2
0
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA  02110-1301, USA.

"""Tests for the smart protocol server."""

from cStringIO import StringIO
import os
import tempfile
from fs import fs

fs.hook(tempfile)

from dulwich.errors import (
    GitProtocolError,
    NotGitRepository,
    UnexpectedCommandError,
    )
from dulwich.repo import (
    MemoryRepo,
    Repo,
    )
from dulwich.server import (
    Backend,
    DictBackend,
    FileSystemBackend,
    Handler,
Exemple #3
0
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA  02110-1301, USA.

"""Tests for Dulwich packs."""


from cStringIO import StringIO
import os
import shutil
import tempfile
import zlib
from fs import fs

fs.hook(os.path)
fs.hook(shutil)
fs.hook(tempfile)
open = fs.hooked_builtin_open

from dulwich.errors import (
    ChecksumMismatch,
    )
from dulwich.file import (
    GitFile,
    )
from dulwich.objects import (
    hex_to_sha,
    sha_to_hex,
    Tree,
    )
Exemple #4
0
# 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., 51 Franklin Street, Fifth Floor, Boston,
# MA  02110-1301, USA.

"""Safe access to git files."""

import errno
import os
import tempfile
from fs import fs

fs.hook(os)
fs.hook(os.path)
fs.hook(tempfile)

def ensure_dir_exists(dirname):
    """Ensure a directory exists, creating if necessary."""
    try:
        os.makedirs(dirname)
    except OSError, e:
        if e.errno != errno.EEXIST:
            raise


def fancy_rename(oldname, newname):
    """Rename file with temporary backup file to rollback if rename fails"""
    if not os.path.exists(newname):
Exemple #5
0
    import mmap
except ImportError:
    has_mmap = False
else:
    has_mmap = True
import os
import struct
try:
    from struct import unpack_from
except ImportError:
    from dulwich._compat import unpack_from
import sys
import zlib
from fs import fs

fs.hook(os.path)

from dulwich.errors import (
    ApplyDeltaError,
    ChecksumMismatch,
    )
from dulwich.file import GitFile
from dulwich.lru_cache import (
    LRUSizeCache,
    )
from dulwich._compat import (
    make_sha,
    SEEK_END,
    )
from dulwich.objects import (
    ShaFile,