Line-wrap projects.yaml but strip trailing spaces
This restores ruamel's new line-wrapping behavior, but corrects the trailing spaces that it leaves by stripping them in our customized output routine. Change-Id: I795994657abb3d706c2a0725c5955e15e5c067ba
This commit is contained in:
2126
gerrit/projects.yaml
2126
gerrit/projects.yaml
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
|
||||
import ruamel.yaml
|
||||
|
||||
|
||||
@@ -29,9 +27,6 @@ class YAML(object):
|
||||
self.yaml.allow_duplicate_keys = True
|
||||
self.yaml.representer.add_representer(type(None), none_representer)
|
||||
self.yaml.indent(mapping=2, sequence=4, offset=2)
|
||||
# Ruamel does weird things with linewrapping like adding extra
|
||||
# whitespace at the end of lines. Just avoid wrapping entirely.
|
||||
self.yaml.width = sys.maxsize
|
||||
|
||||
def load(self, stream):
|
||||
return self.yaml.load(stream)
|
||||
@@ -41,9 +36,9 @@ class YAML(object):
|
||||
newlines = []
|
||||
for line in x.split('\n'):
|
||||
if '#' in line:
|
||||
newlines.append(line)
|
||||
newlines.append(line.rstrip())
|
||||
else:
|
||||
newlines.append(line[2:])
|
||||
newlines.append(line[2:].rstrip())
|
||||
return '\n'.join(newlines)
|
||||
|
||||
def dump(self, data, *args, **kwargs):
|
||||
|
Reference in New Issue
Block a user