filter-repo: avoid relaying progress or checkpoint directives

We don't expect to ever get progress or checkpoint directives in normal
operation, but the --stdin flag makes it a possibility.  In such a case,
the progress directives could actually break our parsing since
git-fast-import will just print it to its stdout, which is what we read
from to find new commit names so we can do commit message hash updating.
So, pass these along to a progress_callback, but don't dump them by
default.  Also, it is not clear checkpoint directives make sense given
that we'll be filtering and only getting a subset of history (and I'm
dubious on checkpoint's utility in general anyway as fast-import is
relatively quick), so pass these along to a callback but don't use them
by default.

Signed-off-by: Elijah Newren <newren@gmail.com>
pull/13/head
Elijah Newren 5 years ago
parent 8a8a15b998
commit 3f0bfc2925

@ -1554,9 +1554,11 @@ class FastExportFilter(object):
if self._everything_callback:
self._everything_callback('progress', progress)
# Now print the resulting progress message
if not progress.dumped:
progress.dump(self._output)
# NOTE: By default, we do NOT print the progress message; git
# fast-import would write it to fast_import_pipes which could mess with
# our parsing of output from the 'ls' and 'get-mark' directives we send
# to fast-import. If users want these messages, they need to process
# and handle them in the appropriate callback above.
def _parse_checkpoint(self):
"""
@ -1580,9 +1582,11 @@ class FastExportFilter(object):
if self._everything_callback:
self._everything_callback('checkpoint', checkpoint)
# Now print the resulting checkpoint
if not checkpoint.dumped:
checkpoint.dump(self._output)
# NOTE: By default, we do NOT print the checkpoint message; although it
# we would only realistically get them with --stdin, the fact that we
# are filtering makes me think the checkpointing is less likely to be
# reasonable. In fact, I don't think it's necessary in general. If
# users do want it, they should process it in the checkpoint_callback.
def _parse_literal_command(self):
"""

Loading…
Cancel
Save