浏览代码

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
 
   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)
     suggested_owners = set()
     while dirs_remaining and all_possible_owners: