[Bug 4470] New: memctx raises AttributeError when inspecting removed files

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Tue Dec 9 16:02:25 UTC 2014


http://bz.selenic.com/show_bug.cgi?id=4470

          Priority: normal
            Bug ID: 4470
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: memctx raises AttributeError when inspecting removed
                    files
          Severity: bug
    Classification: Unclassified
                OS: Linux
          Reporter: jordigh at octave.org
          Hardware: PC
            Status: UNCONFIRMED
           Version: 3.2.1
         Component: Mercurial
           Product: Mercurial

Here is the repro:

    #!/bin/bash

    cat << EOF > /tmp/lolomghgrc
    [ui]
    username = omg wtf lol
    interactive = True

    [extensions]
    record=

    [committemplate]
    changeset = {desc}\n\n
        HG: {extramsg}
        HG: user: {author}\n{ifeq(p2rev, "-1", "",
       "HG: branch merge\n")
       }HG: branch '{branch}'\n{if(currentbookmark,
       "HG: bookmark '{currentbookmark}'\n")  }{subrepos %
       "HG: subrepo {subrepo}\n"              }
       {splitlines(diff()) % 'HG: {line}\n'}
    EOF

    export HGRCPATH=/tmp/lolomghgrc
    hg init lol
    cd lol
    echo a > a
    echo b > b
    hg addr
    hg ci -m 'init'
    hg rm b
    hg ci -m 'rm b'
    echo a >> a
    echo -e "y\nA" | hg record --amend
    unset HGRCPATH
    cd ..

This results in the following incorrect error message:

    transaction abort!
    rollback completed
    abort: template filter 'splitlines' is not compatible with keyword '[]'

The problem is actually that in the following line of memctx:

    man[f] = revlog.hash(self[f].data(), p1node, p2node)

    (mercurial/context.py:1643 at rev 406dfc63a1ad: 
    
http://inversethought.com/hg/mercurial-crew/file/406dfc63a1ad/mercurial/context.py#l1635
)

self[f] will be None if f is a removed file. This exception then gets
swallowed by the templater who concludes the problem is with the
combination of splitlines() and `diff`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list