Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a progress bar to the file command #9

Closed
simonw opened this issue Nov 12, 2021 · 2 comments
Closed

Add a progress bar to the file command #9

simonw opened this issue Nov 12, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 12, 2021

Can use the Click one. The total number of commits is available using repo.active_branch.commit.count().

@simonw simonw added the enhancement New feature or request label Nov 12, 2021
@simonw simonw closed this as completed in 0253657 Nov 12, 2021
@simonw
Copy link
Owner Author

simonw commented Nov 12, 2021

progress

@simonw
Copy link
Owner Author

simonw commented Nov 12, 2021

I didn't use repo.active_branch.commit.count() because it turns out I already read all of the commits into a list here, plus I wanted to be able to take previously processed commits that get skipped into account.

repo = git.Repo(repo_path, odbt=git.GitDB)
commits = reversed(list(repo.iter_commits(ref, paths=[relative_path])))
progress_bar = None
if skip_commits:
# Filter down to just the ones we haven't seen
new_commits = [
commit for commit in commits if commit.hexsha not in skip_commits
]
commits = new_commits
if show_progress:
progress_bar = click.progressbar(commits, show_pos=True, show_percent=True)

simonw added a commit that referenced this issue Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant