Submitter | Boris Feld |
---|---|
Date | Oct. 9, 2017, 6:40 p.m. |
Message ID | <1943f74e8e4cb6bd1d44.1507574452@FB> |
Download | mbox | patch |
Permalink | /patch/24675/ |
State | Superseded |
Headers | show |
Comments
On Tue, Oct 10, 2017 at 12:10 AM, Boris Feld <boris.feld@octobus.net> wrote: > # HG changeset patch > # User Boris Feld <boris.feld@octobus.net> > # Date 1507209918 -7200 > # Thu Oct 05 15:25:18 2017 +0200 > # Node ID 1943f74e8e4cb6bd1d44910898fffcaec7a56ca1 > # Parent 14824410b05da8d360ddd65c1f8727cc3bafb111 > # EXP-Topic obsfatekeyword > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1943f74e8e4c > log: add obsfate by default in changeset printer > > Having an obsfate by default in log will be useful for users to understand why > they have obsolete and unstable changesets. Obsfate will only be shown for > obsolete changesets, which only happens if people opt-in to experimental feature. > > But when obsolete changeset are visible, it is very useful to understand where > they are. Having it in log could be sufficient for most people, so they don't > have to learn a new command (like obslog which is itself useful in case of > divergences). > > For example, when pulling and working directory parent become obsolete: > > $ hg pull > ... > working directory parent is obsolete! (f936c1697205) I think you should mention that this message comes from evolve. > > Obsfate would comes handy: > > $ hg log -G > o changeset: 2:6f91013c5136 > | tag: tip > | parent: 0:4ef7b558f3ec > | user: Boris Feld <boris.feld@octobus.net> > | date: Mon Oct 09 16:00:27 2017 +0200 > | summary: A > | > | @ changeset: 1:f936c1697205 > |/ user: Boris Feld <boris.feld@octobus.net> > | date: Mon Oct 09 16:00:27 2017 +0200 > | obsolete: reworded as 6f91013c5136 ^^^^^^---> obsolete or obsfate? Can you change the above example as it shows a section named obsolete and your patch says add obsfate. I realized after checking that above obsolete thing is output from 'evolve extension'. > | summary: -A > > And once we update, obsfate is not shown anymore: I don't understand what you wanted to convey here. The obsfate is not shown because the hidden changeset is not shown. I think I can still see the obsfate of that changeset by `hg log --hidden`.
On Tue, 2017-10-10 at 03:00 +0530, Pulkit Goyal wrote: > On Tue, Oct 10, 2017 at 12:10 AM, Boris Feld <boris.feld@octobus.net> > wrote: > > # HG changeset patch > > # User Boris Feld <boris.feld@octobus.net> > > # Date 1507209918 -7200 > > # Thu Oct 05 15:25:18 2017 +0200 > > # Node ID 1943f74e8e4cb6bd1d44910898fffcaec7a56ca1 > > # Parent 14824410b05da8d360ddd65c1f8727cc3bafb111 > > # EXP-Topic obsfatekeyword > > # Available At https://bitbucket.org/octobus/mercurial-devel/ > > # hg pull https://bitbucket.org/octobus/mercurial-deve > > l/ -r 1943f74e8e4c > > log: add obsfate by default in changeset printer > > > > Having an obsfate by default in log will be useful for users to > > understand why > > they have obsolete and unstable changesets. Obsfate will only be > > shown for > > obsolete changesets, which only happens if people opt-in to > > experimental feature. > > > > But when obsolete changeset are visible, it is very useful to > > understand where > > they are. Having it in log could be sufficient for most people, so > > they don't > > have to learn a new command (like obslog which is itself useful in > > case of > > divergences). > > > > For example, when pulling and working directory parent become > > obsolete: > > > > $ hg pull > > ... > > working directory parent is obsolete! (f936c1697205) > > I think you should mention that this message comes from evolve. Ha yes, I thought it was coming from core. > > > > > Obsfate would comes handy: > > > > $ hg log -G > > o changeset: 2:6f91013c5136 > > | tag: tip > > | parent: 0:4ef7b558f3ec > > | user: Boris Feld <boris.feld@octobus.net> > > | date: Mon Oct 09 16:00:27 2017 +0200 > > | summary: A > > | > > | @ changeset: 1:f936c1697205 > > |/ user: Boris Feld <boris.feld@octobus.net> > > | date: Mon Oct 09 16:00:27 2017 +0200 > > | obsolete: reworded as 6f91013c5136 > > ^^^^^^---> obsolete or obsfate? > > Can you change the above example as it shows a section named obsolete > and your patch says add obsfate. I realized after checking that above > obsolete thing is output from 'evolve extension'. Yes, I got confused by almost the same output format. Will update and send a V2. > > > | summary: -A > > > > And once we update, obsfate is not shown anymore: > > I don't understand what you wanted to convey here. The obsfate is not > shown because the hidden changeset is not shown. I think I can still > see the obsfate of that changeset by `hg log --hidden`. I wanted to show that in most cases, having obsfate in default changeset printer would not add extra information because it's not everyday that you should see an obsolete changeset in your log without using --hidden.
Patch
diff -r 14824410b05d -r 1943f74e8e4c mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Oct 09 15:34:26 2017 +0200 +++ b/mercurial/cmdutil.py Thu Oct 05 15:25:18 2017 +0200 @@ -1684,6 +1684,9 @@ self.ui.write(_("instability: %s\n") % ', '.join(instabilities), label='log.instability') + elif ctx.obsolete(): + self.showobsfate(ctx) + self._exthook(ctx) if self.ui.debugflag: @@ -1732,6 +1735,14 @@ self.showpatch(ctx, matchfn) + def showobsfate(self, ctx): + obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui) + + if obsfate: + for obsfateline in obsfate: + self.ui.write(_("obsfate: %s\n") % obsfateline, + label='log.obsfate') + def _exthook(self, ctx): '''empty method used by extension as a hook point ''' diff -r 14824410b05d -r 1943f74e8e4c tests/test-commandserver.t --- a/tests/test-commandserver.t Mon Oct 09 15:34:26 2017 +0200 +++ b/tests/test-commandserver.t Thu Oct 05 15:25:18 2017 +0200 @@ -535,6 +535,7 @@ tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 + obsfate: pruned summary: . changeset: 0:eff892de26ec diff -r 14824410b05d -r 1943f74e8e4c tests/test-obsmarker-template.t --- a/tests/test-obsmarker-template.t Mon Oct 09 15:34:26 2017 +0200 +++ b/tests/test-obsmarker-template.t Thu Oct 05 15:25:18 2017 +0200 @@ -58,11 +58,13 @@ |/ parent: 0:ea207398892e | user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 3:d004c8f274b9 by test2 | summary: A1 | | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:a468dc9b3633 | summary: A0 | o changeset: 0:ea207398892e @@ -103,6 +105,26 @@ |/ Obsfate: rewritten using amend as 3:d004c8f274b9 by test, test2 o ea207398892e + + $ hg log -G --config ui.logtemplate= + o changeset: 3:d004c8f274b9 + | tag: tip + | parent: 0:ea207398892e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: A2 + | + | @ changeset: 1:471f378eab4c + |/ user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 3:d004c8f274b9 by test2 + | summary: A0 + | + o changeset: 0:ea207398892e + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: ROOT + $ hg up 'desc(A1)' --hidden 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -294,6 +316,7 @@ | x changeset: 1:471597cad322 |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a | summary: A0 | o changeset: 0:ea207398892e @@ -469,11 +492,13 @@ | x changeset: 2:0dec01379d3b | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 + | | obsfate: rewritten as 3:eb5a0daa2192 | | summary: B0 | | | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten as 3:eb5a0daa2192 | summary: A0 | o changeset: 0:ea207398892e @@ -640,6 +665,7 @@ | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:fdf9bde5129a | summary: A0 | o changeset: 0:ea207398892e @@ -669,6 +695,8 @@ | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:fdf9bde5129a + | obsfate: rewritten using amend as 3:65b757b745b9 | summary: A0 | o changeset: 0:ea207398892e @@ -690,6 +718,7 @@ |/ parent: 0:ea207398892e | user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 4:019fadeab383 | summary: A2 | | o changeset: 2:fdf9bde5129a @@ -702,6 +731,8 @@ | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:fdf9bde5129a + | obsfate: rewritten using amend as 3:65b757b745b9 | summary: A0 | o changeset: 0:ea207398892e @@ -880,6 +911,7 @@ | x changeset: 2:0dec01379d3b |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 3:b7ea6d14e664 | summary: B0 | o changeset: 1:471f378eab4c @@ -918,16 +950,19 @@ | | parent: 1:471f378eab4c | | user: test | | date: Thu Jan 01 00:00:00 1970 +0000 + | | obsfate: rewritten as 4:eb5a0daa2192 | | summary: B1 | | | | x changeset: 2:0dec01379d3b | |/ user: test | | date: Thu Jan 01 00:00:00 1970 +0000 + | | obsfate: rewritten using amend as 3:b7ea6d14e664 | | summary: B0 | | | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten as 4:eb5a0daa2192 | summary: A0 | o changeset: 0:ea207398892e @@ -1166,11 +1201,13 @@ |/ parent: 0:ea207398892e | user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 3:7a230b46bf61 | summary: A1 | | x changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:fdf9bde5129a | summary: A0 | o changeset: 0:ea207398892e @@ -1200,6 +1237,7 @@ | @ changeset: 1:471f378eab4c |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 2:7a230b46bf61 | summary: A0 | o changeset: 0:ea207398892e @@ -1607,6 +1645,8 @@ | x changeset: 6:4a004186e638 |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: rewritten using amend as 8:b18bc8331526 + | obsfate: rewritten using amend as 9:0b997eb7ceee | summary: Add A,B,C | o changeset: 5:dd800401bd8c @@ -2050,6 +2090,7 @@ | tag: tip | user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: pruned | summary: A2 | o changeset: 2:617adc3a144c @@ -2061,6 +2102,7 @@ | x changeset: 1:471597cad322 |/ user: test | date: Thu Jan 01 00:00:00 1970 +0000 + | obsfate: split as 2:617adc3a144c, 3:0d0ef4bdf70e | summary: A0 | o changeset: 0:ea207398892e diff -r 14824410b05d -r 1943f74e8e4c tests/test-obsolete.t --- a/tests/test-obsolete.t Mon Oct 09 15:34:26 2017 +0200 +++ b/tests/test-obsolete.t Thu Oct 05 15:25:18 2017 +0200 @@ -972,6 +972,7 @@ [log.parent changeset.draft|parent: 3:6f9641995072] [log.user|user: test] [log.date|date: Thu Jan 01 00:00:00 1970 +0000] + [log.obsfate|obsfate: pruned] [log.summary|summary: add obsolete_e]