Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #54 from ministryofjustice/upgrade_pygit2_compatib…
Browse files Browse the repository at this point in the history
…ility_to_0.23

Upgrade pygit2 compatibility to 0.23
  • Loading branch information
KrisSaxton committed Nov 3, 2015
2 parents b2bdfe1 + 03262ff commit 3a70161
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions shaker/libs/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,26 @@ def open_repository(url,
% (url, target_directory))
repo = pygit2.Repository(target_directory)
else:
repo = pygit2.clone_repository(url,
target_directory,
credentials=credentials)
# Try to use pygit2 0.22 cloning
try:
shaker.libs.logger.Logger().debug("open_repository: "
"Trying to open repository "
"using pygit2 0.22 format")
repo = pygit2.clone_repository(url,
target_directory,
credentials=credentials)
except TypeError as e:
shaker.libs.logger.Logger().debug("open_repository: "
"Failed to detect pygit2 0.22")
shaker.libs.logger.Logger().debug("open_repository: "
"Trying to open repository "
"using pygit2 0.23 format")
# Try to use pygit2 0.23 cloning
callbacks = pygit2.RemoteCallbacks(credentials)
repo = pygit2.clone_repository(url,
target_directory,
callbacks=callbacks)

shaker.libs.logger.Logger().debug(":open_repository: "
"Cloning url '%s' into local repository '%s'"
% (url, target_directory))
Expand Down

0 comments on commit 3a70161

Please sign in to comment.