Просмотр исходного кода

info: Use the non-formatting printer for headtext

If "repo init" was run in a path containing "%", "repo info" would fail
printing the path with

    File ".repo/repo/color.py", line 173, in f
      return fmt % args
    TypeError: not enough arguments for format string

as the "%" in the path name is interpreted as the start of a formatting
specifier. Avoid that by using the non-formatting printer for headtext
which does not require any formatting so there is no need to try to
expand "%" sequences.

Change-Id: Ie193b912191fe7cdabdce5c97bb100f0714f6e76
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Sebastian Schuberth 6 лет назад
Родитель
Сommit
266f74c888
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      subcmds/info.py

+ 1 - 1
subcmds/info.py

@@ -45,7 +45,7 @@ class Info(PagedCommand):
   def Execute(self, opt, args):
   def Execute(self, opt, args):
     self.out = _Coloring(self.manifest.globalConfig)
     self.out = _Coloring(self.manifest.globalConfig)
     self.heading = self.out.printer('heading', attr = 'bold')
     self.heading = self.out.printer('heading', attr = 'bold')
-    self.headtext = self.out.printer('headtext', fg = 'yellow')
+    self.headtext = self.out.nofmt_printer('headtext', fg = 'yellow')
     self.redtext = self.out.printer('redtext', fg = 'red')
     self.redtext = self.out.printer('redtext', fg = 'red')
     self.sha = self.out.printer("sha", fg = 'yellow')
     self.sha = self.out.printer("sha", fg = 'yellow')
     self.text = self.out.nofmt_printer('text')
     self.text = self.out.nofmt_printer('text')