| Index: infra/libs/git2/git2.py
|
| diff --git a/infra/services/gnumbd/support/git.py b/infra/libs/git2/git2.py
|
| similarity index 94%
|
| rename from infra/services/gnumbd/support/git.py
|
| rename to infra/libs/git2/git2.py
|
| index b337ac20c4a65e682839ac350a1f56d5783eb255..3dfdafae7097fc1f07595a759f243b540c023407 100644
|
| --- a/infra/services/gnumbd/support/git.py
|
| +++ b/infra/libs/git2/git2.py
|
| @@ -10,28 +10,14 @@ import sys
|
| import tempfile
|
| import urlparse
|
|
|
| -from infra.services.gnumbd.support.util import (
|
| - cached_property, CalledProcessError)
|
| +from infra.libs.decorators import cached_property
|
|
|
| -from infra.services.gnumbd.support.data import CommitData
|
| +from infra.libs.git2.util import CalledProcessError
|
| +from infra.libs.git2.util import INVALID
|
| +from infra.libs.git2.data import CommitData
|
|
|
| -LOGGER = logging.getLogger(__name__)
|
| -
|
| -
|
| -class _Invalid(object):
|
| - def __call__(self, *_args, **_kwargs):
|
| - return self
|
| -
|
| - def __getattr__(self, _key):
|
| - return self
|
|
|
| - def __eq__(self, _other):
|
| - return False
|
| -
|
| - def __ne__(self, _other): # pylint: disable=R0201
|
| - return True
|
| -
|
| -INVALID = _Invalid()
|
| +LOGGER = logging.getLogger(__name__)
|
|
|
|
|
| class Repo(object):
|
| @@ -50,6 +36,10 @@ class Repo(object):
|
| self._commit_cache = collections.OrderedDict()
|
| self._log = LOGGER.getChild('Repo')
|
|
|
| + def __getitem__(self, ref):
|
| + """Get a Ref attached to this Repo."""
|
| + return Ref(self, ref)
|
| +
|
| def reify(self):
|
| """Ensures the local mirror of this Repo exists."""
|
| assert self.repos_dir is not None
|
|
|