# HG changeset patch # User Sushil khanchi # Date 1537525373 -19800 # Node ID 4eb3877540f1d38382750674d511395a56ea9e69 # Parent eea339cf4d30fa0c2cc97779e3d5d014384c6fa4 evovle: remove redundancy in evolve output Copying the discription of this redundancy issue given by Pierre Yves David: When running `hg evolve` to stabilize orphan changeset output about the currently stabilized changeset is issued. For example: $ hg evolve move:[3] a3 atop:[4] a2 working directory is now at 7c5649f73d11 This output can become quite repetitive when orphan are stabilized atop each other. For example: $ hg evolve --all move:[8] dansk 2! atop:[10] dansk! merging main-file-1 move:[9] dansk 3! atop:[11] dansk 2! In this case it would be smoother to issue: $ hg evolve --all move:[8] dansk 2! atop:[10] dansk! merging main-file-1 move:[9] dansk 3! Since we are moving "dansk 3!" atop the changeset we just stabilized. When adding this be careful that we still want to issue the "atop" message in various cases: 1. first changesets in a stack 2. when the orphan is not stabilized atop previous one 3. when using hg evolve --continue to resume an evolution So, I have made the changes which also respect above listed three points. And changes in tests/test-evovle*.t reflecting the changed behavior. diff -r eea339cf4d30 -r 4eb3877540f1 CHANGELOG --- a/CHANGELOG Tue Sep 18 02:14:10 2018 +0200 +++ b/CHANGELOG Fri Sep 21 15:52:53 2018 +0530 @@ -1,6 +1,11 @@ Changelog ========= +8.2.1 - in progress +------------------- + + * evolve: avoid redundant output when handling linear orphans + 8.2.1 -- 2018-09-14 ------------------- diff -r eea339cf4d30 -r 4eb3877540f1 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Tue Sep 18 02:14:10 2018 +0200 +++ b/hgext3rd/evolve/evolvecmd.py Fri Sep 21 15:52:53 2018 +0530 @@ -53,7 +53,7 @@ abortmessage = _("see `hg help evolve.interrupted`\n") def _solveone(ui, repo, ctx, evolvestate, dryrun, confirm, - progresscb, category): + progresscb, category, lastsolved=None): """Resolve the troubles affecting one revision returns a tuple (bool, newnode) where, @@ -68,8 +68,8 @@ lock = repo.lock() tr = repo.transaction("evolve") if 'orphan' == category: - result = _solveunstable(ui, repo, ctx, evolvestate, - dryrun, confirm, progresscb) + result = _solveunstable(ui, repo, ctx, evolvestate, dryrun, confirm, + progresscb, lastsolved=lastsolved) elif 'phasedivergent' == category: result = _solvephasedivergence(ui, repo, ctx, evolvestate, dryrun, confirm, progresscb) @@ -84,7 +84,7 @@ lockmod.release(tr, lock, wlock) def _solveunstable(ui, repo, orig, evolvestate, dryrun=False, confirm=False, - progresscb=None): + progresscb=None, lastsolved=None): """ Tries to stabilize the changeset orig which is orphan. returns a tuple (bool, newnode) where, @@ -158,8 +158,9 @@ if not ui.quiet or confirm: repo.ui.write(_('move:'), label='evolve.operation') displayer.show(orig) - repo.ui.write(_('atop:')) - displayer.show(target) + if lastsolved is None or target != repo[lastsolved]: + repo.ui.write(_('atop:')) + displayer.show(target) if confirm and ui.prompt('perform evolve? [Ny]', 'n') != 'y': raise error.Abort(_('evolve aborted by user')) if progresscb: @@ -1566,14 +1567,19 @@ 'command': 'evolve', 'orphanmerge': False, 'bookmarkchanges': [], 'temprevs': [], 'obsmarkers': []} evolvestate.addopts(stateopts) + # lastsolved: keep track of successor of last troubled cset we evolved + # to confirm that if atop msg should be suppressed to remove redundancy + lastsolved = None for rev in revs: curctx = repo[rev] progresscb() - ret = _solveone(ui, repo, curctx, evolvestate, dryrunopt, confirmopt, - progresscb, targetcat) + ret = _solveone(ui, repo, curctx, evolvestate, dryrunopt, + confirmopt, progresscb, targetcat, + lastsolved=lastsolved) seen += 1 if ret[0]: evolvestate['replacements'][curctx.node()] = ret[1] + lastsolved = ret[1] else: evolvestate['skippedrevs'].append(curctx.node()) @@ -1718,15 +1724,21 @@ category = evolvestate['category'] confirm = evolvestate['confirm'] unfi = repo.unfiltered() + # lastsolved: keep track of successor of last troubled cset we + # evolved to confirm that if atop msg should be suppressed to remove + # redundancy + lastsolved = None for rev in evolvestate['revs']: # XXX: prevent this lookup by storing nodes instead of revnums curctx = unfi[rev] if (curctx.node() not in evolvestate['replacements'] and curctx.node() not in evolvestate['skippedrevs']): newnode = _solveone(ui, repo, curctx, evolvestate, False, - confirm, progresscb, category) + confirm, progresscb, category, + lastsolved=lastsolved) if newnode[0]: evolvestate['replacements'][curctx.node()] = newnode[1] + lastsolved = newnode[1] else: evolvestate['skippedrevs'].append(curctx.node()) return diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-abort-orphan.t --- a/tests/test-evolve-abort-orphan.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-abort-orphan.t Fri Sep 21 15:52:53 2018 +0530 @@ -157,7 +157,6 @@ move:[2] added b atop:[7] added a move:[5] added c - atop:[8] added b merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` @@ -485,7 +484,6 @@ move:[2] added b atop:[4] added a move:[3] added c - atop:[5] added b merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-content-divergence.t --- a/tests/test-evolve-content-divergence.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-content-divergence.t Fri Sep 21 15:52:53 2018 +0530 @@ -378,7 +378,6 @@ move:[3] added c atop:[8] added b move:[4] added d - atop:[9] added c working directory is now at 4ae4427ee9f8 $ hg glog @ 10:4ae4427ee9f8 added d @@ -819,9 +818,7 @@ move:[2] added b atop:[6] watbar to a move:[3] added c - atop:[7] added b move:[4] added d - atop:[8] added c working directory is now at 15c781f93cac $ hg glog @ 9:15c781f93cac added d @@ -845,9 +842,7 @@ move:[2] added b atop:[5] watbar to a move:[3] added c - atop:[6] added b move:[4] added d - atop:[7] added c working directory is now at c72d2885eb51 $ hg glog @ 8:c72d2885eb51 added d diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-continue.t --- a/tests/test-evolve-continue.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-continue.t Fri Sep 21 15:52:53 2018 +0530 @@ -166,7 +166,6 @@ move:[5] added c atop:[10] added b move:[8] added d - atop:[11] added c working directory is now at 6642d2c9176e $ hg glog @@ -237,7 +236,6 @@ move:[12] added d atop:[16] added c move:[13] added f - atop:[17] added d merging f warning: conflicts while merging f! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` @@ -252,7 +250,6 @@ move:[14] added g atop:[18] added f move:[15] added h - atop:[19] added g merging h warning: conflicts while merging h! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-issue5832.t --- a/tests/test-evolve-issue5832.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-issue5832.t Fri Sep 21 15:52:53 2018 +0530 @@ -117,7 +117,6 @@ move:[2] added b atop:[5] added a move:[4] merge commit - atop:[8] added b ancestor '7235ef625ea3' split over multiple topological branches. choose an evolve destination: 0: [62fb70414f99] added c @@ -259,7 +258,6 @@ move:[2] added b atop:[6] added a move:[4] merge commit - atop:[9] added b ancestor 'cdf2ea1b9312' split over multiple topological branches. choose an evolve destination: 0: [62fb70414f99] added c diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-noupdate.t --- a/tests/test-evolve-noupdate.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-noupdate.t Fri Sep 21 15:52:53 2018 +0530 @@ -64,7 +64,6 @@ move:[3] added c atop:[5] added b move:[4] added d - atop:[6] added c $ hg glog o 7:b6b20b8eefdc added d @@ -108,9 +107,7 @@ move:[5] added b atop:[8] added a move:[6] added c - atop:[9] added b move:[7] added d - atop:[10] added c working directory is now at 12c720cb3782 $ hg glog diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-order.t --- a/tests/test-evolve-order.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-order.t Fri Sep 21 15:52:53 2018 +0530 @@ -62,7 +62,6 @@ move:[2] add _b atop:[4] add _a move:[3] add _c - atop:[5] add _b working directory is now at 52b8f9b04f83 evolve --rev reorders the rev to solve instability. Harder case, obsolescence @@ -106,9 +105,7 @@ move:[10] bprime atop:[11] asecond move:[6] add _c - atop:[12] bprime move:[7] add _d - atop:[13] add _c working directory is now at 739f18ac1d03 $ hg log -G @ 14:739f18ac1d03@default(draft) add _d @@ -214,7 +211,6 @@ move:[17] add c3_ atop:[28] add c2prime move:[18] add c4_ - atop:[30] add c3_ working directory is now at 35e7b797ace5 $ hg log -G -r "desc(_d)::" @ 31:35e7b797ace5@default(draft) add c4_ diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-orphan-merge.t --- a/tests/test-evolve-orphan-merge.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-orphan-merge.t Fri Sep 21 15:52:53 2018 +0530 @@ -350,7 +350,6 @@ move:[16] added m atop:[20] added l move:[19] merge commit - atop:[21] added m working directory is now at a446ad3e6700 $ hg glog diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-stop-orphan.t --- a/tests/test-evolve-stop-orphan.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-stop-orphan.t Fri Sep 21 15:52:53 2018 +0530 @@ -242,9 +242,7 @@ move:[1] added a atop:[7] added hgignore move:[2] added b - atop:[8] added a move:[5] added c - atop:[9] added b merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` @@ -357,7 +355,6 @@ move:[9] added b atop:[12] added a move:[10] added c - atop:[13] added b merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve-topic.t --- a/tests/test-evolve-topic.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve-topic.t Fri Sep 21 15:52:53 2018 +0530 @@ -127,7 +127,6 @@ move:[4] add eee atop:[10] add ddd move:[11] add fff - atop:[12] add eee working directory is now at 070c5573d8f9 $ hg log -G @ 13 - {foo} 070c5573d8f9 add fff (draft) @@ -164,11 +163,8 @@ move:[6] add ggg atop:[13] add fff move:[7] add hhh - atop:[14] add ggg move:[8] add iii - atop:[15] add hhh move:[9] add jjj - atop:[16] add iii working directory is now at 9bf430c106b7 $ hg log -G @ 17 - {bar} 9bf430c106b7 add jjj (draft) diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-evolve.t --- a/tests/test-evolve.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-evolve.t Fri Sep 21 15:52:53 2018 +0530 @@ -468,7 +468,6 @@ atop:[10] dansk! merging main-file-1 move:[9] dansk 3! - atop:[11] dansk 2! merging main-file-1 working directory is now at 96abb1319a47 $ hg log -G @@ -1291,7 +1290,6 @@ move:[20] add j2 atop:[23] add j1 move:[21] add j3 - atop:[24] add j2 working directory is now at 0d9203b74542 $ glog -r "0cf3707e8971::" @ 25:0d9203b74542@default(draft) add j3 @@ -1465,7 +1463,6 @@ move:[35] will be evolved safely atop:[37] amended move:[36] will cause conflict at evolve - atop:[38] will be evolved safely merging newfile warning: conflicts while merging newfile! (edit, then use 'hg resolve --mark') fix conflicts and see `hg help evolve.interrupted` diff -r eea339cf4d30 -r 4eb3877540f1 tests/test-split.t --- a/tests/test-split.t Tue Sep 18 02:14:10 2018 +0200 +++ b/tests/test-split.t Fri Sep 21 15:52:53 2018 +0530 @@ -151,7 +151,6 @@ move:[5] split1 atop:[7] _cprim move:[6] split2 - atop:[8] split1 working directory is now at * (glob) $ hg log -r "desc(_cprim)" -v -p changeset: 7:b434287e665c @@ -219,7 +218,6 @@ move:[8] split1 atop:[11] split4 move:[9] split2 - atop:[12] split1 working directory is now at d74c6715e706 $ hg log -G @ changeset: 13:d74c6715e706