comparison hgext3rd/topic/__init__.py @ 6245:a54db3e55c88

topic: switch to namespace when updating to a commit, similar to topic
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 23 May 2022 14:02:54 +0400
parents 91d9a279b84a
children 213db29a19e9
comparison
equal deleted inserted replaced
6244:945d27da146c 6245:a54db3e55c88
1466 # The mergeupdatewrap function makes the destination's topic as the 1466 # The mergeupdatewrap function makes the destination's topic as the
1467 # current topic. This is right for merge but wrong for rebase. We check 1467 # current topic. This is right for merge but wrong for rebase. We check
1468 # if rebase is running and update the currenttopic to topic of new 1468 # if rebase is running and update the currenttopic to topic of new
1469 # rebased commit. We have explicitly stored in config if rebase is 1469 # rebased commit. We have explicitly stored in config if rebase is
1470 # running. 1470 # running.
1471 otns = repo.currenttns
1471 ot = repo.currenttopic 1472 ot = repo.currenttopic
1472 if repo.ui.hasconfig(b'experimental', b'topicrebase'): 1473 if repo.ui.hasconfig(b'experimental', b'topicrebase'):
1473 isrebase = True 1474 isrebase = True
1474 if repo.ui.configbool(b'_internal', b'keep-topic'): 1475 if repo.ui.configbool(b'_internal', b'keep-topic'):
1475 ist0 = True 1476 ist0 = True
1476 if ((not partial and not branchmerge) or isrebase) and not ist0: 1477 if ((not partial and not branchmerge) or isrebase) and not ist0:
1478 tns = b'default'
1477 t = b'' 1479 t = b''
1478 pctx = repo[node] 1480 pctx = repo[node]
1479 if pctx.phase() > phases.public: 1481 if pctx.phase() > phases.public:
1482 tns = pctx.topic_namespace()
1480 t = pctx.topic() 1483 t = pctx.topic()
1484 repo.vfs.write(b'topic-namespace', tns)
1485 if tns != b'default' and tns != otns:
1486 repo.ui.status(_(b"switching to topic-namespace %s\n") % tns)
1481 repo.vfs.write(b'topic', t) 1487 repo.vfs.write(b'topic', t)
1482 if t and t != ot: 1488 if t and t != ot:
1483 repo.ui.status(_(b"switching to topic %s\n") % t) 1489 repo.ui.status(_(b"switching to topic %s\n") % t)
1484 if ot and not t: 1490 if ot and not t:
1485 st = stack.stack(repo, topic=ot) 1491 st = stack.stack(repo, topic=ot)