فهرست منبع

Change to slash separator to fix a bug on Windows in owners.py

Some of the owners.py code does not change file path to use the slash
separator, causing owners check to crash on Windows. This CL fixes it.

Change-Id: I6e06a235dbb563ea45691f19b03d826b23184b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2626090
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Mandy Chen <mandy.chen@microsoft.com>
Mandy Chen 4 سال پیش
والد
کامیت
c13ea848e6
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      owners.py

+ 6 - 1
owners.py

@@ -513,7 +513,12 @@ class Database(object):
     return owners
     return owners
 
 
   def _covering_set_of_owners_for(self, files, author):
   def _covering_set_of_owners_for(self, files, author):
-    dirs_remaining = set(self.enclosing_dir_with_owners(f) for f in files)
+    dirs_remaining = set()
+    for f in files:
+      dir_path = self.enclosing_dir_with_owners(f)
+      # Always use slashes as separators.
+      dirs_remaining.add(dir_path.replace(os.sep, '/'))
+
     all_possible_owners = self.all_possible_owners(dirs_remaining, author)
     all_possible_owners = self.all_possible_owners(dirs_remaining, author)
     suggested_owners = set()
     suggested_owners = set()
     while dirs_remaining and all_possible_owners:
     while dirs_remaining and all_possible_owners: