def set_repos(self, source_repo, target_repo, fast_export_args = None): ############################################################################# """ Initialization """ # The location of the original repo self._source_repo = source_repo # The location of the filtered-clone repo self._target_repo = target_repo # Extra args that need to be passed along to git self._fast_export_args = fast_export_args if not self._fast_export_args: self._fast_export_args = ['--branches', '--tags'] # Total number of commits in source repo; used only for showing progress self._total_commits = get_commit_count(source_repo, self._fast_export_args) # If no commits to clone, we're done if self._total_commits == 0: sys.stderr.write("There are no commits to clone.\n") sys.exit(0)
def set_repos(self, source_repo, target_repo, fast_export_args=None): ############################################################################# """ Initialization """ # The location of the original repo self._source_repo = source_repo # The location of the filtered-clone repo self._target_repo = target_repo # Extra args that need to be passed along to git self._fast_export_args = fast_export_args if not self._fast_export_args: self._fast_export_args = ['--branches', '--tags'] # Total number of commits in source repo; used only for showing progress self._total_commits = get_commit_count(source_repo, self._fast_export_args) # If no commits to clone, we're done if self._total_commits == 0: sys.stderr.write("There are no commits to clone.\n") sys.exit(0)
import sys from git_fast_filter import Blob, Reset, FileChanges, Commit, FastExportFilter from git_fast_filter import get_commit_count, get_total_objects import re import datetime if len(sys.argv) != 3: raise SystemExit("Syntax:\n %s SOURCE_REPO TARGET_REPO") source_repo = sys.argv[1] target_repo = sys.argv[2] regexp = re.compile('^[^/]*/[^/]*/[^/]*\.bot.*') start = datetime.datetime.now() total_objects = get_total_objects(source_repo) # blobs + trees total_commits = get_commit_count(source_repo) object_count = 0 commit_count = 0 def print_progress(): global object_count, commit_count, total_objects, total_commits print "\rRewriting commits... %d/%d (%d objects)" \ % (commit_count, total_commits, object_count), def my_blob_callback(blob): global object_count object_count += 1 print_progress()
import sys from git_fast_filter import Blob, Reset, FileChanges, Commit, FastExportFilter from git_fast_filter import get_commit_count, get_total_objects import re import datetime if len(sys.argv) != 3: raise SystemExit("Syntax:\n %s SOURCE_REPO TARGET_REPO") source_repo = sys.argv[1] target_repo = sys.argv[2] regexp = re.compile('^[^/]*/[^/]*/[^/]*\.bot.*') start = datetime.datetime.now() total_objects = get_total_objects(source_repo) # blobs + trees total_commits = get_commit_count(source_repo) object_count = 0 commit_count = 0 def print_progress(): global object_count, commit_count, total_objects, total_commits print "\rRewriting commits... %d/%d (%d objects)" \ % (commit_count, total_commits, object_count), def my_blob_callback(blob): global object_count object_count += 1 print_progress() def my_commit_callback(commit): global commit_count