Handle Windows compatibility

Some of the library functions we call for file path handling require the
calling code to handle the differences in path separators for Windows.
This adds special handling where this was found, though it is possible
there are some other code paths that have not been identified yet.

Story: 2006549
Task: 36632

Change-Id: I0d74222f711724f3aaccc226a9ec4b5f31cf283e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2019-10-08 11:51:21 -05:00
parent 8d94d16714
commit 6d35f48c64
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
1 changed files with 7 additions and 0 deletions

View File

@ -89,6 +89,9 @@ def _changes_in_subdir(repo, walk_entry, subdir):
commit = walk_entry.commit
store = repo.object_store
if os.path.sep == '\\':
subdir = subdir.replace('\\', '/')
parents = walk_entry._get_parents(commit)
if not parents:
@ -484,6 +487,10 @@ class RenoRepo(repo.Repo):
commit = self[sha]
tree = self[commit.tree]
try:
if os.path.sep == '\\':
# Dulwich doesn't handle Windows paths, we need to take care of
# it ourselves
filename = filename.replace('\\', '/')
mode, blob_sha = tree.lookup_path(self.get_object,
filename.encode('utf-8'))
except KeyError: