# HG changeset patch # User Pierre-Yves David # Date 1458231297 25200 # Node ID 442a7cb8404e4aab09f167381dfecc6e99383b07 # Parent 24986e5a537c7b94fbb7b01d973b79ebdb37ebb9 histedit: restrict default edited set to current topic when possible If we have an active topic, we restrict the edit within that topic. diff -r 24986e5a537c -r 442a7cb8404e hgext3rd/topic/destination.py --- a/hgext3rd/topic/destination.py Thu Mar 17 09:13:12 2016 -0700 +++ b/hgext3rd/topic/destination.py Thu Mar 17 09:14:57 2016 -0700 @@ -55,6 +55,15 @@ movemark = repo['.'].node() return node, movemark, None +def desthistedit(orig, ui, repo): + if not (ui.config('histedit', 'defaultrev', None) is None + and repo.currenttopic): + return orig(ui, repo) + revs = repo.revs('::. and stack()') + if revs: + return revs.min() + return None + def setupdest(): if util.safehasattr(destutil, '_destmergebranch'): extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch) @@ -67,6 +76,8 @@ bridx = destutil.destupdatesteps.index('branch') destutil.destupdatesteps.insert(bridx, 'topic') destutil.destupdatestepmap['topic'] = _destupdatetopic + if util.safehasattr(destutil, 'desthistedit'): + extensions.wrapfunction(destutil, 'desthistedit', desthistedit) def ngtip(repo, branch, all=False): """tip new generation""" diff -r 24986e5a537c -r 442a7cb8404e tests/test-topic-dest.t --- a/tests/test-topic-dest.t Thu Mar 17 09:13:12 2016 -0700 +++ b/tests/test-topic-dest.t Thu Mar 17 09:14:57 2016 -0700 @@ -5,6 +5,7 @@ $ cat <> .hg/hgrc > [extensions] > rebase= + > histedit= > [phases] > publish=false > EOF @@ -479,3 +480,17 @@ | o 0 () c_alpha + +Default destination for histedit +================================ + +By default hisetdit should edit with the current topic only +(even when based on other draft + + $ hg phase 'desc(c_zeta)' + 11: draft + $ HGEDITOR=cat hg histedit | grep pick + pick e44744d9ad73 12 babar + pick 38eea8439aee 14 arthur + pick 411315c48bdc 15 pompadour + # p, pick = use commit