def _ReadGit(self): """ Read configuration data from git. This internal method populates the GitConfig cache. """ c = {} d = self._do('--null', '--list') if d is None: return c if not is_python3(): d = d.decode('utf-8') for line in d.rstrip('\0').split('\0'): if '\n' in line: key, val = line.split('\n', 1) else: key = line val = None if key in c: c[key].append(val) else: c[key] = [val] return c
def setUp(self): """Load the wrapper module every time.""" wrapper._wrapper_module = None wrapper._gitc_manifest_dir = None # reset cache self.wrapper = wrapper.Wrapper() if not is_python3(): self.assertRegex = self.assertRegexpMatches
from __future__ import print_function import contextlib import os import re import shutil import tempfile import unittest from repo.pyversion import is_python3 from repo import wrapper from repo import platform_utils if is_python3(): from unittest import mock from io import StringIO else: import mock from StringIO import StringIO @contextlib.contextmanager def TemporaryDirectory(): """Create a new empty git checkout for testing.""" # TODO(vapier): Convert this to tempfile.TemporaryDirectory once we drop # Python 2 support entirely. try: tempdir = tempfile.mkdtemp(prefix='repo-tests') yield tempdir
People shouldn't run this directly; instead, they should use the `repo` wrapper which takes care of execing this entry point. """ from __future__ import print_function import getpass import netrc import optparse import os import shlex import sys import textwrap import time from repo.pyversion import is_python3 if is_python3(): import urllib.request else: import imp import urllib2 urllib = imp.new_module('urllib') urllib.request = urllib2 try: import kerberos except ImportError: kerberos = None from repo.color import SetDefaultColoring from repo import event_log from repo.trace import SetTrace