David Schleimer avatar David Schleimer committed 31917a6

stupid: only check branch mappings for discovered files once

For whatever reason, we were processing the list of discovered files
for new branches every time we discovered a new file. This pulls the
process-discovered-files loop out of the discover-files loop, and
should reduce the running time from
O(num_paths_discovered * num_files_discovered) to
O(num_paths_discovered + num_files_discovered)

Comments (0)

Files changed (1)

hgsubversion/stupid.py

                                          for x in listdir(p, revnum)
                                          if x[1] == 'f'])
 
-        if not actually_files:
+    for path in actually_files:
+        if meta.get_path_tag(path):
             continue
-
-        for path in actually_files:
-            if meta.get_path_tag(path):
-                continue
-            fpath, branch, bpath = meta.split_branch_path(path, existing=False)
-            if bpath is None:
-                continue
-            branches[branch] = bpath
+        fpath, branch, bpath = meta.split_branch_path(path, existing=False)
+        if bpath is None:
+            continue
+        branches[branch] = bpath
 
     return branches
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.