Comments
Patch
@@ -86,19 +86,24 @@
def _makestore(orig, requirements, storebasepath, vfstype):
- # Check for presence of pygit2 only here. The assumption is that we'll
- # run this code iff we'll later need pygit2.
- if gitutil.get_pygit2() is None:
- raise error.Abort(
- _(
- b'the git extension requires the Python '
- b'pygit2 library to be installed'
+ reqsf = os.path.join(storebasepath, b'requirements')
+ reqs = set()
+ if os.path.exists(reqsf):
+ with open(reqsf, 'rb') as f:
+ reqs = {l.strip() for l in f}
+ if b'git' in reqs and os.path.exists(
+ os.path.join(storebasepath, b'..', b'.git')
+ ):
+ # Check for presence of pygit2 only here. The assumption is that we'll
+ # run this code iff we'll later need pygit2.
+ if gitutil.get_pygit2() is None:
+ raise error.Abort(
+ _(
+ b'the git extension requires the Python '
+ b'pygit2 library to be installed'
+ )
)
- )
- if os.path.exists(
- os.path.join(storebasepath, b'this-is-git')
- ) and os.path.exists(os.path.join(storebasepath, b'..', b'.git')):
return gitstore(storebasepath, vfstype)
return orig(requirements, storebasepath, vfstype)
@@ -128,8 +133,6 @@
os.path.join(path, b'.git', b'info', b'exclude'), 'ab'
) as exclude:
exclude.write(b'\n.hg\n')
- with open(os.path.join(dothg, b'this-is-git'), 'wb') as f:
- pass
with open(os.path.join(dothg, b'requirements'), 'wb') as f:
f.write(b'git\n')