Skip to content

Commit

Permalink
Try to reduce open files for large directories (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
earwig committed Aug 18, 2016
1 parent a702056 commit f7a060a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gitup/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,20 @@ def _run_command(repo, command):

def _dispatch_multi(base, paths, callback, *args):
"""Apply the callback to all git repos in the list of paths."""
repos = []
valid = []
for path in paths:
try:
repo = Repo(path)
Repo(path)
except (exc.InvalidGitRepositoryError, exc.NoSuchPathError):
continue
repos.append(repo)
valid.append(path)

base = os.path.abspath(base)
suffix = "" if len(repos) == 1 else "s"
print(BOLD + base, "({0} repo{1}):".format(len(repos), suffix))
suffix = "" if len(valid) == 1 else "s"
print(BOLD + base, "({0} repo{1}):".format(len(valid), suffix))

for repo in sorted(repos, key=lambda r: os.path.split(r.working_dir)[1]):
callback(repo, *args)
for path in sorted(valid, key=os.path.basename):
callback(Repo(path), *args)

def _dispatch(path, callback, *args):
"""Apply a callback function on each valid repo in the given path.
Expand Down

0 comments on commit f7a060a

Please sign in to comment.