Skip to content

Commit

Permalink
Improve compatibility with PyPy3.6 on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed Mar 16, 2021
1 parent 088f903 commit acd41ce
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions southwark/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,30 @@ class DiskRefsContainer(dulwich.refs.DiskRefsContainer):
def _from_container(cls, container: dulwich.refs.DiskRefsContainer):
return cls(container.path, container.worktree_path, container._logger) # type: ignore

def allkeys(self):
allkeys = set()

if os.path.exists(self.refpath(b"HEAD")):
allkeys.add(b"HEAD")

path = self.refpath(b"")
refspath = self.refpath(b"refs")

for root, unused_dirs, files in os.walk(refspath.decode("UTF-8")):
dir = root[len(path):] # noqa: A001 # pylint: disable=redefined-builtin

if os.path.sep != '/':
dir = dir.replace(os.path.sep, '/') # noqa: A001 # pylint: disable=redefined-builtin

for filename in files:
refname = '/'.join([dir, filename])

if dulwich.refs.check_ref_format(refname.encode("UTF-8")):
allkeys.add(refname.encode("UTF-8"))

allkeys.update(self.get_packed_refs())
return allkeys

def subkeys(self, base):
subkeys = set()

Expand Down

0 comments on commit acd41ce

Please sign in to comment.