comparison hgext3rd/topic/destination.py @ 1911:442a7cb8404e

histedit: restrict default edited set to current topic when possible If we have an active topic, we restrict the edit within that topic.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 17 Mar 2016 09:14:57 -0700
parents 93cf0ddb5234
children 692a1aa1350c
comparison
equal deleted inserted replaced
1910:24986e5a537c 1911:442a7cb8404e
53 node = revs.last() 53 node = revs.last()
54 if bookmarks.isactivewdirparent(repo): 54 if bookmarks.isactivewdirparent(repo):
55 movemark = repo['.'].node() 55 movemark = repo['.'].node()
56 return node, movemark, None 56 return node, movemark, None
57 57
58 def desthistedit(orig, ui, repo):
59 if not (ui.config('histedit', 'defaultrev', None) is None
60 and repo.currenttopic):
61 return orig(ui, repo)
62 revs = repo.revs('::. and stack()')
63 if revs:
64 return revs.min()
65 return None
66
58 def setupdest(): 67 def setupdest():
59 if util.safehasattr(destutil, '_destmergebranch'): 68 if util.safehasattr(destutil, '_destmergebranch'):
60 extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch) 69 extensions.wrapfunction(destutil, '_destmergebranch', _destmergebranch)
61 rebase = extensions.find('rebase') 70 rebase = extensions.find('rebase')
62 if (util.safehasattr(rebase, '_destrebase') 71 if (util.safehasattr(rebase, '_destrebase')
65 extensions.wrapfunction(rebase, '_destrebase', _destmergebranch) 74 extensions.wrapfunction(rebase, '_destrebase', _destmergebranch)
66 if util.safehasattr(destutil, 'destupdatesteps'): 75 if util.safehasattr(destutil, 'destupdatesteps'):
67 bridx = destutil.destupdatesteps.index('branch') 76 bridx = destutil.destupdatesteps.index('branch')
68 destutil.destupdatesteps.insert(bridx, 'topic') 77 destutil.destupdatesteps.insert(bridx, 'topic')
69 destutil.destupdatestepmap['topic'] = _destupdatetopic 78 destutil.destupdatestepmap['topic'] = _destupdatetopic
79 if util.safehasattr(destutil, 'desthistedit'):
80 extensions.wrapfunction(destutil, 'desthistedit', desthistedit)
70 81
71 def ngtip(repo, branch, all=False): 82 def ngtip(repo, branch, all=False):
72 """tip new generation""" 83 """tip new generation"""
73 ## search for untopiced heads of branch 84 ## search for untopiced heads of branch
74 # could be heads((::branch(x) - topic())) 85 # could be heads((::branch(x) - topic()))