Show More
@@ -440,7 +440,8 b' class changesetformatter(changesetprinte' | |||||
440 | fm.context(ctx=ctx) |
|
440 | fm.context(ctx=ctx) | |
441 | fm.data(rev=scmutil.intrev(ctx), node=fm.hexfunc(scmutil.binnode(ctx))) |
|
441 | fm.data(rev=scmutil.intrev(ctx), node=fm.hexfunc(scmutil.binnode(ctx))) | |
442 |
|
442 | |||
443 | if self.ui.quiet: |
|
443 | datahint = fm.datahint() | |
|
444 | if self.ui.quiet and not datahint: | |||
444 | return |
|
445 | return | |
445 |
|
446 | |||
446 | fm.data( |
|
447 | fm.data( | |
@@ -456,12 +457,17 b' class changesetformatter(changesetprinte' | |||||
456 | ), |
|
457 | ), | |
457 | ) |
|
458 | ) | |
458 |
|
459 | |||
459 | if self.ui.debugflag: |
|
460 | if self.ui.debugflag or b'manifest' in datahint: | |
460 | fm.data( |
|
461 | fm.data(manifest=fm.hexfunc(ctx.manifestnode() or wdirid)) | |
461 | manifest=fm.hexfunc(ctx.manifestnode() or wdirid), |
|
462 | if self.ui.debugflag or b'extra' in datahint: | |
462 |
|
|
463 | fm.data(extra=fm.formatdict(ctx.extra())) | |
463 | ) |
|
|||
464 |
|
464 | |||
|
465 | if ( | |||
|
466 | self.ui.debugflag | |||
|
467 | or b'modified' in datahint | |||
|
468 | or b'added' in datahint | |||
|
469 | or b'removed' in datahint | |||
|
470 | ): | |||
465 | files = ctx.p1().status(ctx) |
|
471 | files = ctx.p1().status(ctx) | |
466 | fm.data( |
|
472 | fm.data( | |
467 | modified=fm.formatlist(files[0], name=b'file'), |
|
473 | modified=fm.formatlist(files[0], name=b'file'), | |
@@ -469,18 +475,19 b' class changesetformatter(changesetprinte' | |||||
469 | removed=fm.formatlist(files[2], name=b'file'), |
|
475 | removed=fm.formatlist(files[2], name=b'file'), | |
470 | ) |
|
476 | ) | |
471 |
|
477 | |||
472 |
elif self.ui.verbose |
|
478 | verbose = not self.ui.debugflag and self.ui.verbose | |
|
479 | if verbose or b'files' in datahint: | |||
473 | fm.data(files=fm.formatlist(ctx.files(), name=b'file')) |
|
480 | fm.data(files=fm.formatlist(ctx.files(), name=b'file')) | |
474 | if copies: |
|
481 | if verbose and copies or b'copies' in datahint: | |
475 |
|
|
482 | fm.data( | |
476 |
|
|
483 | copies=fm.formatdict(copies or {}, key=b'name', value=b'source') | |
477 |
|
|
484 | ) | |
478 |
|
485 | |||
479 | if self._includestat: |
|
486 | if self._includestat or b'diffstat' in datahint: | |
480 | self.ui.pushbuffer() |
|
487 | self.ui.pushbuffer() | |
481 | self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True) |
|
488 | self._differ.showdiff(self.ui, ctx, self._diffopts, stat=True) | |
482 | fm.data(diffstat=self.ui.popbuffer()) |
|
489 | fm.data(diffstat=self.ui.popbuffer()) | |
483 | if self._includediff: |
|
490 | if self._includediff or b'diff' in datahint: | |
484 | self.ui.pushbuffer() |
|
491 | self.ui.pushbuffer() | |
485 | self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False) |
|
492 | self._differ.showdiff(self.ui, ctx, self._diffopts, stat=False) | |
486 | fm.data(diff=self.ui.popbuffer()) |
|
493 | fm.data(diff=self.ui.popbuffer()) |
@@ -1119,6 +1119,60 b' honor --git but not format-breaking diff' | |||||
1119 | {"parents": ["0000000000000000000000000000000000000000"], "rev": 7} |
|
1119 | {"parents": ["0000000000000000000000000000000000000000"], "rev": 7} | |
1120 | ] |
|
1120 | ] | |
1121 |
|
1121 | |||
|
1122 | $ hg log -qr. -T'json(rev, parents)' | |||
|
1123 | [ | |||
|
1124 | {"parents": ["29114dbae42b9f078cf2714dbe3a86bba8ec7453"], "rev": 8} | |||
|
1125 | ] | |||
|
1126 | ||||
|
1127 | $ hg log -r. -T'json(diff)' | |||
|
1128 | [ | |||
|
1129 | {"diff": "diff -r 29114dbae42b -r 95c24699272e fourth\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/fourth\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+second\ndiff -r 29114dbae42b -r 95c24699272e second\n--- a/second\tMon Jan 12 13:46:40 1970 +0000\n+++ /dev/null\tThu Jan 01 00:00:00 1970 +0000\n@@ -1,1 +0,0 @@\n-second\ndiff -r 29114dbae42b -r 95c24699272e third\n--- /dev/null\tThu Jan 01 00:00:00 1970 +0000\n+++ b/third\tWed Jan 01 10:01:00 2020 +0000\n@@ -0,0 +1,1 @@\n+third\n"} | |||
|
1130 | ] | |||
|
1131 | ||||
|
1132 | $ hg log -r. -T'json(diffstat)' | |||
|
1133 | [ | |||
|
1134 | {"diffstat": " fourth | 1 +\n second | 1 -\n third | 1 +\n 3 files changed, 2 insertions(+), 1 deletions(-)\n"} | |||
|
1135 | ] | |||
|
1136 | ||||
|
1137 | $ hg log -r. -T'json(manifest)' | |||
|
1138 | [ | |||
|
1139 | {"manifest": "94961b75a2da554b4df6fb599e5bfc7d48de0c64"} | |||
|
1140 | ] | |||
|
1141 | ||||
|
1142 | $ hg log -r. -T'json(extra)' | |||
|
1143 | [ | |||
|
1144 | {"extra": {"branch": "default"}} | |||
|
1145 | ] | |||
|
1146 | ||||
|
1147 | $ hg log -r3 -T'json(modified)' | |||
|
1148 | [ | |||
|
1149 | {"modified": ["c"]} | |||
|
1150 | ] | |||
|
1151 | ||||
|
1152 | $ hg log -r. -T'json(added)' | |||
|
1153 | [ | |||
|
1154 | {"added": ["fourth", "third"]} | |||
|
1155 | ] | |||
|
1156 | ||||
|
1157 | $ hg log -r. -T'json(removed)' | |||
|
1158 | [ | |||
|
1159 | {"removed": ["second"]} | |||
|
1160 | ] | |||
|
1161 | ||||
|
1162 | $ hg log -r. -T'json(files)' | |||
|
1163 | [ | |||
|
1164 | {"files": ["fourth", "second", "third"]} | |||
|
1165 | ] | |||
|
1166 | ||||
|
1167 | --copies is the exception. copies dict is built only when --copies switch | |||
|
1168 | is on: | |||
|
1169 | ||||
|
1170 | $ hg log -r'.^:' -T'json(copies)' --copies | |||
|
1171 | [ | |||
|
1172 | {"copies": {}}, | |||
|
1173 | {"copies": {"fourth": "second"}} | |||
|
1174 | ] | |||
|
1175 | ||||
1122 | $ hg log -r. -T'json()' |
|
1176 | $ hg log -r. -T'json()' | |
1123 | [ |
|
1177 | [ | |
1124 | {} |
|
1178 | {} |
General Comments 0
You need to be logged in to leave comments.
Login now