mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: aid debugging with a string representation of several classes
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
6ca3d7c1c7
commit
4f149daacc
@ -16,6 +16,7 @@ import collections
|
||||
import fnmatch
|
||||
import os
|
||||
import re
|
||||
import StringIO
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
@ -237,6 +238,18 @@ class _GitElement(object):
|
||||
"""
|
||||
raise SystemExit("Unimplemented function: %s.dump()" % type(self).__name__)
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Convert GitElement to string; used for debugging
|
||||
"""
|
||||
old_dumped = self.dumped
|
||||
writeme = StringIO.StringIO()
|
||||
self.dump(writeme)
|
||||
output_lines = writeme.getvalue().splitlines()
|
||||
writeme.close()
|
||||
self.dumped = old_dumped
|
||||
return "{}:\n {}".format(type(self).__name__, "\n ".join(output_lines))
|
||||
|
||||
def skip(self, new_id=None):
|
||||
"""
|
||||
Ensures this element will not be written to output
|
||||
|
Loading…
Reference in New Issue
Block a user