comparison tests/test-log.t @ 44728:59ad165f6cdb

templatekw: fix shownames() to check if namespace exists in repo (issue6301) Namespace registration is dynamic, but the corresponding template keyword is registered statically.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 16 Apr 2020 22:30:11 +0900
parents 34a46d48d24e
children 46856c2cc4f2
comparison
equal deleted inserted replaced
44727:694d40416d62 44728:59ad165f6cdb
2271 > """A small extension to test adding arbitrary names to a repo""" 2271 > """A small extension to test adding arbitrary names to a repo"""
2272 > from __future__ import absolute_import 2272 > from __future__ import absolute_import
2273 > from mercurial import namespaces 2273 > from mercurial import namespaces
2274 > 2274 >
2275 > def reposetup(ui, repo): 2275 > def reposetup(ui, repo):
2276 > if not repo.local():
2277 > return
2276 > foo = {b'foo': repo[0].node()} 2278 > foo = {b'foo': repo[0].node()}
2277 > names = lambda r: foo.keys() 2279 > names = lambda r: foo.keys()
2278 > namemap = lambda r, name: foo.get(name) 2280 > namemap = lambda r, name: foo.get(name)
2279 > nodemap = lambda r, node: [name for name, n in foo.items() 2281 > nodemap = lambda r, node: [name for name, n in foo.items()
2280 > if n == node] 2282 > if n == node]
2325 (line 1\nline2\n{shortest(node}\nline4\nline5 2327 (line 1\nline2\n{shortest(node}\nline4\nline5
2326 ^ here) 2328 ^ here)
2327 [255] 2329 [255]
2328 2330
2329 $ cd .. 2331 $ cd ..
2332
2333 New namespace is registered per repo instance, but the template keyword
2334 is global. So we shouldn't expect the namespace always exists. Using
2335 ssh:// makes sure a bundle repository is created from scratch. (issue6301)
2336
2337 $ hg clone -e "'$PYTHON' '$TESTDIR/dummyssh'" \
2338 > -qr0 "ssh://user@dummy/`pwd`/a" a-clone
2339 $ hg incoming --config extensions.names=names.py -R a-clone \
2340 > -e "'$PYTHON' '$TESTDIR/dummyssh'" -T '{bars}\n' -l1
2341 comparing with ssh://user@dummy/$TESTTMP/a
2342 searching for changes
2343
2330 2344
2331 hg log -f dir across branches 2345 hg log -f dir across branches
2332 2346
2333 $ hg init acrossbranches 2347 $ hg init acrossbranches
2334 $ cd acrossbranches 2348 $ cd acrossbranches