mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: cleanups to gathering the commit count
Two things: * rename get_total_commits -> get_commit_count * accept rev-list arguments Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
d099d2628b
commit
a20bf1957f
@ -489,10 +489,15 @@ def FastImportInput(target_repo, extra_args = []):
|
||||
stdin = PIPE,
|
||||
cwd = target_repo)
|
||||
|
||||
def get_total_commits(repo):
|
||||
p1 = Popen(["git", "rev-list", "--all"], stdout = PIPE, cwd = repo)
|
||||
def get_commit_count(repo, args):
|
||||
if not args:
|
||||
args = ['--all']
|
||||
p1 = Popen(["git", "rev-list"] + args, stdout=PIPE, stderr=PIPE, cwd=repo)
|
||||
p2 = Popen(["wc", "-l"], stdin = p1.stdout, stdout = PIPE)
|
||||
return int(p2.communicate()[0])
|
||||
count = int(p2.communicate()[0])
|
||||
if p1.poll() != 0:
|
||||
raise SystemExit("%s does not appear to be a valid git repository" % repo)
|
||||
return count
|
||||
|
||||
def get_total_objects(repo):
|
||||
p1 = Popen(["git", "count-objects", "-v"], stdout = PIPE, cwd = repo)
|
||||
|
Loading…
Reference in New Issue
Block a user