Mercurial > hg
diff hgext/keyword.py @ 29634:8421cbebc783 stable
keyword: avoid traceback when kwdemo is run outside a repo
f0564402d059 causes a fatal AttributeError if kwdemo is run outside a repo
because in the temporary repo creation repo is None and therefore cannot have a
baseui attribute.
In this case fall back to using ui.
Add test case.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Wed, 27 Jul 2016 13:57:51 +0100 |
parents | 844f72885fb9 |
children | d5883fd055c6 |
line wrap: on
line diff
--- a/hgext/keyword.py Wed Jul 27 08:38:54 2016 +0000 +++ b/hgext/keyword.py Wed Jul 27 13:57:51 2016 +0100 @@ -412,7 +412,11 @@ fn = 'demo.txt' tmpdir = tempfile.mkdtemp('', 'kwdemo.') ui.note(_('creating temporary repository at %s\n') % tmpdir) - repo = localrepo.localrepository(repo.baseui, tmpdir, True) + if repo is None: + baseui = ui + else: + baseui = repo.baseui + repo = localrepo.localrepository(baseui, tmpdir, True) ui.setconfig('keyword', fn, '', 'keyword') svn = ui.configbool('keywordset', 'svn') # explicitly set keywordset for demo output