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