Issue #8 resolved

Exception while pulling changesets

Vsevolod Parfenov
created an issue

{{{ File "checkfiles.py", line 326, in check_hook cf = CheckFiles(ui, repo, None) File "checkfiles.py", line 97, in init self.files = ctx.files() AttributeError: 'NoneType' object has no attribute 'files' }}}

This is because calls: {{{ 314: def check_hook(ui, repo, hooktype, node, **kwargs): ... 326: cf = CheckFiles(ui, repo, None)

74: class CheckFiles(object): 75: def init(self, ui, repo, ctx, opts = {}): ... 97: self.files = ctx.files() }}}

ctx in None when calling CheckFiles constructor.

May be line 326 should be cf = CheckFiles(ui, repo, repo[None]) ?

Comments (6)

  1. Anonymous

    Patch?

    diff -r ec506db156e4 checkfiles.py
    --- a/checkfiles.py     Sat Jan 15 15:59:32 2011 +0100
    +++ b/checkfiles.py     Sun Mar 13 19:07:57 2011 +0200
    @@ -94,7 +94,10 @@
                 self.files = modified + added + clean # we can't get filecontext for unknown files
                 self.check_diffs = False
             else:
    -            self.files = ctx.files()
    +            if ctx:
    +                self.files = ctx.files()
    +            else:
    +                self.files = []
    
             if self.checked_exts == '""':
                 self.ui.debug('checkfiles: checked extensions: (all text files)\n')
    @@ -106,8 +109,6 @@
             self.ui.debug('checkfiles: check diffs only: %r\n' % self.check_diffs)
             self.ui.debug('checkfiles: use spaces: %r\n' % self.use_spaces)
    
    -        self.ui.debug('checkfiles: considering files:\n  %s\n' % '\n  '.join(self.files))
    -
         def is_relevant(self, file):
             if file in self.ignored_files:
                 self.ui.debug('checkfiles: ignoring %s (explicit ignore)\n' % file)
    @@ -144,6 +145,8 @@
             return True
    
         def check(self):
    +        self.ui.debug('checkfiles: considering files:\n  %s\n' % '\n  '.join(self.files))
    +
             if self.use_spaces:
                 indicator = '^' * self.tab_size
             else:
    @@ -328,6 +331,7 @@
    
             for rev in cmdutil.revrange(repo, ['%s::' % node]):
                 cf.ctx = repo.changectx(rev)
    +            cf.files = cf.ctx.files();
                 fail = cf.check() or fail
    
             return fail
    
  2. Log in to comment