Show More
@@ -34,7 +34,6 b' from mercurial import (' | |||
|
34 | 34 | dirstateguard, |
|
35 | 35 | error, |
|
36 | 36 | extensions, |
|
37 | formatter, | |
|
38 | 37 | merge as mergemod, |
|
39 | 38 | mergestate as mergestatemod, |
|
40 | 39 | mergeutil, |
@@ -52,7 +51,6 b' from mercurial import (' | |||
|
52 | 51 | scmutil, |
|
53 | 52 | smartset, |
|
54 | 53 | state as statemod, |
|
55 | templatekw, | |
|
56 | 54 | util, |
|
57 | 55 | ) |
|
58 | 56 | |
@@ -153,7 +151,9 b' def _ctxdesc(ctx):' | |||
|
153 | 151 | labels_spec, |
|
154 | 152 | labels_spec, |
|
155 | 153 | ) |
|
156 | return cmdutil.rendertemplate(ctx, spec) | |
|
154 | return cmdutil.format_changeset_summary( | |
|
155 | ctx.repo().ui, ctx, command=b'rebase', default_spec=spec | |
|
156 | ) | |
|
157 | 157 | |
|
158 | 158 | |
|
159 | 159 | class rebaseruntime(object): |
@@ -1210,6 +1210,24 b' def rendertemplate(ctx, tmpl, props=None' | |||
|
1210 | 1210 | return t.renderdefault(mapping) |
|
1211 | 1211 | |
|
1212 | 1212 | |
|
1213 | def format_changeset_summary(ui, ctx, command=None, default_spec=None): | |
|
1214 | """Format a changeset summary (one line).""" | |
|
1215 | spec = None | |
|
1216 | if command: | |
|
1217 | spec = ui.config( | |
|
1218 | b'command-templates', b'oneline-summary.%s' % command, None | |
|
1219 | ) | |
|
1220 | if not spec: | |
|
1221 | spec = ui.config(b'command-templates', b'oneline-summary') | |
|
1222 | if not spec: | |
|
1223 | spec = default_spec | |
|
1224 | if not spec: | |
|
1225 | # TODO: Pick a default we can agree on. This isn't used yet. | |
|
1226 | raise error.ProgrammingError(b"no default one-line summary defined yet") | |
|
1227 | text = rendertemplate(ctx, spec) | |
|
1228 | return text.split(b'\n')[0] | |
|
1229 | ||
|
1230 | ||
|
1213 | 1231 | def _buildfntemplate(pat, total=None, seqno=None, revwidth=None, pathname=None): |
|
1214 | 1232 | r"""Convert old-style filename format string to template string |
|
1215 | 1233 |
@@ -251,6 +251,15 b' coreconfigitem(' | |||
|
251 | 251 | default=None, |
|
252 | 252 | alias=[(b'ui', b'pre-merge-tool-output-template')], |
|
253 | 253 | ) |
|
254 | coreconfigitem( | |
|
255 | b'command-templates', b'oneline-summary', default=None, | |
|
256 | ) | |
|
257 | coreconfigitem( | |
|
258 | b'command-templates', | |
|
259 | b'oneline-summary.*', | |
|
260 | default=dynamicdefault, | |
|
261 | generic=True, | |
|
262 | ) | |
|
254 | 263 | _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.') |
|
255 | 264 | coreconfigitem( |
|
256 | 265 | b'commands', b'commit.post-status', default=False, |
@@ -82,3 +82,21 b' Getting the JSON output for nodechanges' | |||
|
82 | 82 | o 0:18d04c59bb5d Added a |
|
83 | 83 | |
|
84 | 84 | |
|
85 | Respects command-templates.oneline-summary | |
|
86 | ||
|
87 | $ hg rebase -r 7 -d 8 -n --config command-templates.oneline-summary='rev: {rev}' | |
|
88 | starting dry-run rebase; repository will not be changed | |
|
89 | rebasing rev: 7 | |
|
90 | note: not rebasing rev: 7, its destination already has all its changes | |
|
91 | dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase | |
|
92 | ||
|
93 | ||
|
94 | command-templates.oneline-summary.rebase overrides | |
|
95 | ||
|
96 | $ hg rebase -r 7 -d 8 -n \ | |
|
97 | > --config command-templates.oneline-summary='global: {rev}' \ | |
|
98 | > --config command-templates.oneline-summary.rebase='override: {rev}' | |
|
99 | starting dry-run rebase; repository will not be changed | |
|
100 | rebasing override: 7 | |
|
101 | note: not rebasing override: 7, its destination already has all its changes | |
|
102 | dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase |
General Comments 0
You need to be logged in to leave comments.
Login now