Skip to content
Snippets Groups Projects
Commit 8421cbebc783 authored by Christian Ebert's avatar Christian Ebert
Browse files

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.
parent bc5148d0a446
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
Run kwdemo outside a repo
$ hg -q --config extensions.keyword= --config keywordmaps.Foo="{author|user}" kwdemo
[extensions]
keyword =
[keyword]
demo.txt =
[keywordset]
svn = False
[keywordmaps]
Foo = {author|user}
$Foo: test $
$ cat <<EOF >> $HGRCPATH
> [extensions]
> keyword =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment