##// END OF EJS Templates
config: add a new [command-templates] section for templates defined by hg...
Martin von Zweigbergk -
r46350:ed84a4d4 default
parent child Browse files
Show More
@@ -4566,7 +4566,7 b' def log(ui, repo, *pats, **opts):'
4566 4566
4567 4567 See :hg:`help templates` for more about pre-packaged styles and
4568 4568 specifying custom templates. The default template used by the log
4569 command can be customized via the ``ui.logtemplate`` configuration
4569 command can be customized via the ``command-templates.log`` configuration
4570 4570 setting.
4571 4571
4572 4572 Returns 0 on success.
@@ -223,6 +223,9 b' coreconfigitem('
223 223 coreconfigitem(
224 224 b'color', b'pagermode', default=dynamicdefault,
225 225 )
226 coreconfigitem(
227 b'command-templates', b'log', default=None, alias=[(b'ui', b'logtemplate')],
228 )
226 229 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
227 230 coreconfigitem(
228 231 b'commands', b'commit.post-status', default=False,
@@ -1306,9 +1309,6 b' coreconfigitem('
1306 1309 b'ui', b'logblockedtimes', default=False,
1307 1310 )
1308 1311 coreconfigitem(
1309 b'ui', b'logtemplate', default=None,
1310 )
1311 coreconfigitem(
1312 1312 b'ui', b'merge', default=None,
1313 1313 )
1314 1314 coreconfigitem(
@@ -2363,7 +2363,7 b' User interface controls.'
2363 2363 (default: 10000000)
2364 2364
2365 2365 ``logtemplate``
2366 Template string for commands that print changesets.
2366 (DEPRECATED) Use ``command-templates.log`` instead.
2367 2367
2368 2368 ``merge``
2369 2369 The conflict resolution program to use during a manual merge.
@@ -2561,6 +2561,15 b' User interface controls.'
2561 2561 Increase the amount of output printed. (default: False)
2562 2562
2563 2563
2564 ``command-templates``
2565 ---------------------
2566
2567 Templates used for customizing the output of commands.
2568
2569 ``log``
2570 Template string for commands that print changesets.
2571
2572
2564 2573 ``web``
2565 2574 -------
2566 2575
@@ -623,7 +623,7 b' def _lookuptemplate(ui, tmpl, style):'
623 623
624 624 # ui settings
625 625 if not tmpl and not style: # template are stronger than style
626 tmpl = ui.config(b'ui', b'logtemplate')
626 tmpl = ui.config(b'command-templates', b'log')
627 627 if tmpl:
628 628 return formatter.literal_templatespec(templater.unquotestring(tmpl))
629 629 else:
@@ -656,7 +656,7 b' def changesetdisplayer(ui, repo, opts, d'
656 656 Display format will be the first non-empty hit of:
657 657 1. option 'template'
658 658 2. option 'style'
659 3. [ui] setting 'logtemplate'
659 3. [command-templates] setting 'log'
660 660 4. [ui] setting 'style'
661 661 If all of these values are either the unset or the empty string,
662 662 regular display via changesetprinter() is done.
@@ -507,6 +507,8 b' class ui(object):'
507 507 del cfg[b'defaults'][k]
508 508 for k, v in cfg.items(b'commands'):
509 509 del cfg[b'commands'][k]
510 for k, v in cfg.items(b'command-templates'):
511 del cfg[b'command-templates'][k]
510 512 # Don't remove aliases from the configuration if in the exceptionlist
511 513 if self.plain(b'alias'):
512 514 for k, v in cfg.items(b'alias'):
@@ -403,10 +403,10 b' Test update-timestamp config option|'
403 403 $ hg init $TESTTMP/repo5
404 404 $ cd $TESTTMP/repo5
405 405 $ cat <<'EOF' >> .hg/hgrc
406 > [ui]
407 > logtemplate = 'user: {user}
408 > date: {date|date}
409 > summary: {desc|firstline}\n'
406 > [command-templates]
407 > log = 'user: {user}
408 > date: {date|date}
409 > summary: {desc|firstline}\n'
410 410 > EOF
411 411
412 412 $ echo a>a
@@ -10,8 +10,8 b''
10 10 #require serve
11 11
12 12 $ cat << EOF >> $HGRCPATH
13 > [ui]
14 > logtemplate={rev}:{node|short} {desc|firstline}
13 > [command-templates]
14 > log={rev}:{node|short} {desc|firstline}
15 15 > [phases]
16 16 > publish=False
17 17 > [experimental]
@@ -30,7 +30,8 b' enable obsolescence'
30 30 > bundle2-output-capture=True
31 31 > [ui]
32 32 > ssh="$PYTHON" "$TESTDIR/dummyssh"
33 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
33 > [command-templates]
34 > log={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
34 35 > [web]
35 36 > push_ssl = false
36 37 > allow_push = *
@@ -235,7 +235,8 b' Create an extension to test bundle2 API'
235 235 > evolution.createmarkers=True
236 236 > [ui]
237 237 > ssh="$PYTHON" "$TESTDIR/dummyssh"
238 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
238 > [command-templates]
239 > log={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
239 240 > [web]
240 241 > push_ssl = false
241 242 > allow_push = *
@@ -34,8 +34,8 b' Create an extension to test bundle2 with'
34 34 > EOF
35 35
36 36 $ cat >> $HGRCPATH << EOF
37 > [ui]
38 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
37 > [command-templates]
38 > log={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
39 39 > EOF
40 40
41 41 Start with a simple repository with a single commit
@@ -96,7 +96,8 b' Start a simple HTTP server to serve bund'
96 96 $ cat >> $HGRCPATH << EOF
97 97 > [ui]
98 98 > ssh="$PYTHON" "$TESTDIR/dummyssh"
99 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
99 > [command-templates]
100 > log={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
100 101 > EOF
101 102
102 103 $ hg init repo
@@ -982,8 +982,8 b' cases.'
982 982 $ cd repo3
983 983
984 984 $ cat <<EOF >> $HGRCPATH
985 > [ui]
986 > logtemplate = {rev} {desc|firstline} ({files})\n
985 > [command-templates]
986 > log = {rev} {desc|firstline} ({files})\n
987 987 >
988 988 > [extensions]
989 989 > failafterfinalize = $TESTTMP/failafterfinalize.py
@@ -17,8 +17,8 b' use git diff to see rename'
17 17 $ cat << EOF >> $HGRCPATH
18 18 > [diff]
19 19 > git=yes
20 > [ui]
21 > logtemplate={rev} {desc}\n
20 > [command-templates]
21 > log={rev} {desc}\n
22 22 > EOF
23 23
24 24 #if compatibility
@@ -1,6 +1,6 b''
1 1 $ cat >> $HGRCPATH << EOF
2 > [ui]
3 > logtemplate="{rev}:{node|short} ({phase}) [{tags} {bookmarks}] {desc|firstline}\n"
2 > [command-templates]
3 > log="{rev}:{node|short} ({phase}) [{tags} {bookmarks}] {desc|firstline}\n"
4 4 > [extensions]
5 5 > dirstateparanoidcheck = $TESTDIR/../contrib/dirstatenonnormalcheck.py
6 6 > [experimental]
@@ -3084,8 +3084,8 b' Multiple roots (issue5440):'
3084 3084 $ hg init multiroots
3085 3085 $ cd multiroots
3086 3086 $ cat <<EOF > .hg/hgrc
3087 > [ui]
3088 > logtemplate = '{rev} {desc}\n\n'
3087 > [command-templates]
3088 > log = '{rev} {desc}\n\n'
3089 3089 > EOF
3090 3090
3091 3091 $ touch foo
@@ -1,8 +1,8 b''
1 1 This test file aims at test topological iteration and the various configuration it can has.
2 2
3 3 $ cat >> $HGRCPATH << EOF
4 > [ui]
5 > logtemplate={rev}\n
4 > [command-templates]
5 > log={rev}\n
6 6 > EOF
7 7
8 8 On this simple example, all topological branch are displayed in turn until we
@@ -3420,8 +3420,8 b' Multiple roots (issue5440):'
3420 3420 $ hg init multiroots
3421 3421 $ cd multiroots
3422 3422 $ cat <<EOF > .hg/hgrc
3423 > [ui]
3424 > logtemplate = '{rev} {desc}\n\n'
3423 > [command-templates]
3424 > log = '{rev} {desc}\n\n'
3425 3425 > EOF
3426 3426
3427 3427 $ touch foo
@@ -851,8 +851,8 b' unmodified changes.'
851 851 $ cd follow
852 852
853 853 $ cat <<'EOF' >> .hg/hgrc
854 > [ui]
855 > logtemplate = '{rev}: {join(files % "{status} {path}", ", ")}\n'
854 > [command-templates]
855 > log = '{rev}: {join(files % "{status} {path}", ", ")}\n'
856 856 > EOF
857 857
858 858 $ for f in add0 add0-mod1 add0-rm1 add0-mod2 add0-rm2 add0-mod3 add0-mod4 add0-rm4; do
@@ -293,8 +293,8 b' Check that histedit respect immutability'
293 293 -------------------------------------------
294 294
295 295 $ cat >> $HGRCPATH << EOF
296 > [ui]
297 > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
296 > [command-templates]
297 > log = {rev}:{node|short} ({phase}) {desc|firstline}\n
298 298 > EOF
299 299
300 300 $ hg ph -pv '.^'
@@ -450,6 +450,16 b' log -vf dir/b'
450 450 a
451 451
452 452
453 Respects ui.logtemplate and command-templates.log configs (the latter takes
454 precedence)
455
456 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n"
457 foo 0
458 $ hg log -r 0 --config command-templates.log="bar {rev}\n"
459 bar 0
460 $ hg log -r 0 --config ui.logtemplate="foo {rev}\n" \
461 > --config command-templates.log="bar {rev}\n"
462 bar 0
453 463
454 464
455 465 -f and multiple filelog heads
@@ -1122,8 +1132,8 b' log --follow --patch FILE in repository '
1122 1132 $ hg init follow-dup
1123 1133 $ cd follow-dup
1124 1134 $ cat <<EOF >> .hg/hgrc
1125 > [ui]
1126 > logtemplate = '=== {rev}: {desc}\n'
1135 > [command-templates]
1136 > log = '=== {rev}: {desc}\n'
1127 1137 > [diff]
1128 1138 > nodates = True
1129 1139 > EOF
@@ -122,7 +122,7 b' Predecessors template should show curren'
122 122 o ea207398892e
123 123
124 124
125 $ hg log -G --config ui.logtemplate=
125 $ hg log -G --config command-templates.log=
126 126 o changeset: 3:d004c8f274b9
127 127 | tag: tip
128 128 | parent: 0:ea207398892e
@@ -9,9 +9,9 b' Config setup'
9 9 ------------
10 10
11 11 $ cat >> $HGRCPATH <<EOF
12 > [ui]
12 > [command-templates]
13 13 > # simpler log output
14 > logtemplate = "{node|short}: {desc}\n"
14 > log = "{node|short}: {desc}\n"
15 15 >
16 16 > [experimental]
17 17 > # enable evolution
@@ -3,8 +3,8 b' Check that obsolete properly strip heads'
3 3 > [phases]
4 4 > # public changeset are not obsolete
5 5 > publish=false
6 > [ui]
7 > logtemplate='{node|short} ({phase}) {desc|firstline}\n'
6 > [command-templates]
7 > log='{node|short} ({phase}) {desc|firstline}\n'
8 8 > [experimental]
9 9 > evolution.createmarkers=True
10 10 > EOF
@@ -16,8 +16,8 b' to happen in the local case but can easi'
16 16 > evolution = all
17 17 > [phases]
18 18 > publish = False
19 > [ui]
20 > logtemplate= {rev}:{node|short} {desc}{if(obsfate, " [{join(obsfate, "; ")}]")}\n
19 > [command-templates]
20 > log = {rev}:{node|short} {desc}{if(obsfate, " [{join(obsfate, "; ")}]")}\n
21 21 > EOF
22 22
23 23 Check distributed chain building
@@ -5,8 +5,8 b' Test rebase with obsolete'
5 5 Enable obsolete
6 6
7 7 $ cat >> $HGRCPATH << EOF
8 > [ui]
9 > logtemplate= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
8 > [command-templates]
9 > log= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')}
10 10 > [experimental]
11 11 > evolution.createmarkers=True
12 12 > evolution.allowunstable=True
@@ -1,7 +1,7 b''
1 1
2 2 $ cat >> $HGRCPATH << EOF
3 > [ui]
4 > logtemplate="{rev}:{node|short} {desc} [{tags}]\n"
3 > [command-templates]
4 > log="{rev}:{node|short} {desc} [{tags}]\n"
5 5 > EOF
6 6
7 7 $ hg init legacy-lookup
@@ -48,8 +48,9 b' Second branch starting at nullrev:'
48 48
49 49 Make sure user/global hgrc does not affect tests
50 50
51 $ echo '[command-templates]' > .hg/hgrc
52 $ echo 'log =' >> .hg/hgrc
51 53 $ echo '[ui]' > .hg/hgrc
52 $ echo 'logtemplate =' >> .hg/hgrc
53 54 $ echo 'style =' >> .hg/hgrc
54 55
55 56 Add some simple styles to settings
@@ -3,8 +3,8 b' Tests discovery against servers without '
3 3 $ CAP="getbundle bundle2"
4 4 $ . "$TESTDIR/notcapable"
5 5 $ cat >> $HGRCPATH <<EOF
6 > [ui]
7 > logtemplate="{rev} {node|short}: {desc} {branches}\n"
6 > [command-templates]
7 > log="{rev} {node|short}: {desc} {branches}\n"
8 8 > EOF
9 9
10 10 Setup HTTP server control:
@@ -14,9 +14,9 b' cat >> $HGRCPATH <<EOF'
14 14 push_ssl = false
15 15 allow_push = *
16 16
17 [ui]
17 [command-templates]
18 18 # simpler log output
19 logtemplate ="{node|short} ({phase}): {desc}\n"
19 log ="{node|short} ({phase}): {desc}\n"
20 20
21 21 [phases]
22 22 # non publishing server
@@ -1,9 +1,9 b''
1 1 # setup config and various utility to test new heads checks on push
2 2
3 3 cat >> $HGRCPATH <<EOF
4 [ui]
4 [command-templates]
5 5 # simpler log output
6 logtemplate ="{node|short} ({phase}): {desc}\n"
6 log ="{node|short} ({phase}): {desc}\n"
7 7
8 8 [phases]
9 9 # non publishing server
General Comments 0
You need to be logged in to leave comments. Login now