--- a/hgext3rd/topic/__init__.py Tue Jun 27 23:28:58 2017 +0530
+++ b/hgext3rd/topic/__init__.py Thu Jun 29 02:31:55 2017 +0530
@@ -492,9 +492,17 @@
matcher = kwargs.get('matcher')
partial = not (matcher is None or matcher.always())
wlock = repo.wlock()
+ isrebase = False
try:
ret = orig(repo, node, branchmerge, force, *args, **kwargs)
- if not partial and not branchmerge:
+ # The mergeupdatewrap function makes the destination's topic as the
+ # current topic. This is right for merge but wrong for rebase. We check
+ # if rebase is running and update the currenttopic to topic of new
+ # rebased commit. We have explicitly stored in config if rebase is
+ # running.
+ if repo.ui.hasconfig('experimental', 'topicrebase'):
+ isrebase = True
+ if (not partial and not branchmerge) or isrebase:
ot = repo.currenttopic
t = ''
pctx = repo[node]
@@ -519,9 +527,18 @@
def newmakeextrafn(orig, copiers):
return orig(copiers + [savetopic])
+ def setrebaseconfig(orig, ui, repo, **opts):
+ repo.ui.setconfig('experimental', 'topicrebase', 'yes',
+ source='topic-extension')
+ return orig(ui, repo, **opts)
+
try:
rebase = extensions.find("rebase")
extensions.wrapfunction(rebase, '_makeextrafn', newmakeextrafn)
+ # This exists to store in the config that rebase is running so that we can
+ # update the topic according to rebase. This is a hack and should be removed
+ # when we have better options.
+ extensions.wrapcommand(rebase.cmdtable, 'rebase', setrebaseconfig)
except KeyError:
pass