hanw / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

repo info fail with error "TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'" #154

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version:

  1.20

Environment:

  Linux, Fedora 19 x86_64, Python 2.7.5

What steps will reproduce the problem?

  (I don't know)

What is the expected output? What do you see instead?

  Expected output:

    $ repo info
    Manifest branch: master
    Manifest merge branch: project-name
    Manifest groups: all,-notdefault
    ----------------------------
    Project: dir/name
    Mount path: dir/name
    Current revision: refs/tags/a_tag
    Local Branches: 0
    ...

  Actual output:

    $ repo info
    Manifest branch: Traceback (most recent call last):
      File "project/.repo/repo/main.py", line 418, in <module>
        _Main(sys.argv[1:])
      File "project/.repo/repo/main.py", line 394, in _Main
        result = repo._Run(argv) or 0
      File "project/.repo/repo/main.py", line 142, in _Run
        result = cmd.Execute(copts, cargs)
      File "project/.repo/repo/subcmds/info.py", line 62, in Execute
        self.headtext(self.manifest.default.revisionExpr)
      File "project/.repo/repo/color.py", line 126, in f
        s._out.write(c(fmt, *args))
      File "project/.repo/repo/color.py", line 140, in f
        output = fmt % args
     TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

Original issue reported on code.google.com by yann@droneaud.fr on 19 Nov 2013 at 5:34

GoogleCodeExporter commented 9 years ago
I've found the problem in the manifest file: the default element is lacking a 
revision attribute. I was able to workaround the bug in git-repo by adding the 
missing attribute to my manifest file:

-  <default remote="server"/>  
+  <default revision="master" remote="server" />

But in the end, there's either a bug in git-repo code or in documentation,
since the associated DTD doesn't seems to require revision attribute:

    <!ELEMENT default (EMPTY)>
    <!ATTLIST default remote      IDREF #IMPLIED>
    <!ATTLIST default revision    CDATA #IMPLIED>
    <!ATTLIST default dest-branch CDATA #IMPLIED>
    <!ATTLIST default sync-j      CDATA #IMPLIED>
    <!ATTLIST default sync-c      CDATA #IMPLIED>
    <!ATTLIST default sync-s      CDATA #IMPLIED>

Original comment by yann@droneaud.fr on 20 Nov 2013 at 9:45