diff options
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 7acb6e5b..113e7a67 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -102,9 +102,13 @@ def _SafeCheckoutOrder(checkouts: List[Project]) -> List[List[Project]]: | |||
102 | 102 | ||
103 | # depth_stack contains a current stack of parent paths. | 103 | # depth_stack contains a current stack of parent paths. |
104 | depth_stack = [] | 104 | depth_stack = [] |
105 | # checkouts are iterated in asc order by relpath. That way, it can easily be | 105 | # Checkouts are iterated in the hierarchical order. That way, it can easily |
106 | # determined if the previous checkout is parent of the current checkout. | 106 | # be determined if the previous checkout is parent of the current checkout. |
107 | for checkout in sorted(checkouts, key=lambda x: x.relpath): | 107 | # We are splitting by the path separator so the final result is |
108 | # hierarchical, and not just lexicographical. For example, if the projects | ||
109 | # are: foo, foo/bar, foo-bar, lexicographical order produces foo, foo-bar | ||
110 | # and foo/bar, which doesn't work. | ||
111 | for checkout in sorted(checkouts, key=lambda x: x.relpath.split("/")): | ||
108 | checkout_path = Path(checkout.relpath) | 112 | checkout_path = Path(checkout.relpath) |
109 | while depth_stack: | 113 | while depth_stack: |
110 | try: | 114 | try: |