Skip to content

Commit

Permalink
Flake8 formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Ramillien committed Jan 25, 2024
1 parent 032b8a3 commit 5b1d2de
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions ghp_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,27 @@ def run_import(git, srcdir, **opts):


def squash_history(git, branch, message=None):
filter_test = '[ "$(git rev-parse refs/heads/%s)" != "$GIT_COMMIT" ]' % branch
filter_test = (
'[ "$(git rev-parse refs/heads/%s)" != "$GIT_COMMIT" ] '
% branch
)
if message:
filter_test += ' && [ $(git show -s --format=%%B "$GIT_COMMIT" | grep -c "%s") -gt 0 ]' % message
filter_script = 'if %s ; then skip_commit "$@"; else git commit-tree "$@"; fi' % filter_test
git.check_call('filter-branch', '--force', '--commit-filter', filter_script, 'refs/heads/%s' % branch,
env={ **os.environ , 'FILTER_BRANCH_SQUELCH_WARNING':'1' })
filter_test += (
'&& [ $(git show -s --format=%%B "$GIT_COMMIT" '
'| grep -c "%s") -gt 0 ]'
% message
)
filter_script = (
'if %s ; then skip_commit "$@"; else git commit-tree "$@"; fi'
% filter_test
)
git.check_call(
'filter-branch',
'--force',
'--commit-filter', filter_script,
'refs/heads/%s' % branch,
env={**os.environ, 'FILTER_BRANCH_SQUELCH_WARNING': '1'}
)


def options():
Expand Down

0 comments on commit 5b1d2de

Please sign in to comment.