Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 6423:b71d6235fa01 mercurial-5.9
test-compat: merge mercurial-6.0 into mercurial-5.9
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 24 Feb 2023 19:44:10 +0400 |
parents | faea18a26188 50c4ed02ac6d |
children | 96749dc32fa1 |
comparison
equal
deleted
inserted
replaced
6392:faea18a26188 | 6423:b71d6235fa01 |
---|---|
231 # default color to help log output and thg | 231 # default color to help log output and thg |
232 # (first pick I could think off, update as needed | 232 # (first pick I could think off, update as needed |
233 b'log.topic': b'green_background', | 233 b'log.topic': b'green_background', |
234 } | 234 } |
235 | 235 |
236 __version__ = b'1.0.0.dev' | 236 __version__ = b'1.0.0.dev0' |
237 | 237 |
238 testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3' | 238 testedwith = b'4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3' |
239 minimumhgversion = b'4.8' | 239 minimumhgversion = b'4.8' |
240 buglink = b'https://bz.mercurial-scm.org/' | 240 buglink = b'https://bz.mercurial-scm.org/' |
241 | 241 |
468 extensions.wrapcommand(commands.table, b'summary', wrap_summary) | 468 extensions.wrapcommand(commands.table, b'summary', wrap_summary) |
469 | 469 |
470 try: | 470 try: |
471 evolve = extensions.find(b'evolve') | 471 evolve = extensions.find(b'evolve') |
472 extensions.wrapfunction(evolve.rewriteutil, "presplitupdate", | 472 extensions.wrapfunction(evolve.rewriteutil, "presplitupdate", |
473 presplitupdatetopic) | 473 wrappresplitupdate) |
474 except (KeyError, AttributeError): | 474 except (KeyError, AttributeError): |
475 pass | 475 pass |
476 | 476 |
477 cmdutil.summaryhooks.add(b'topic', summaryhook) | 477 cmdutil.summaryhooks.add(b'topic', summaryhook) |
478 | 478 |
784 | 784 |
785 templatekeyword = registrar.templatekeyword() | 785 templatekeyword = registrar.templatekeyword() |
786 | 786 |
787 @templatekeyword(b'topic', requires={b'ctx'}) | 787 @templatekeyword(b'topic', requires={b'ctx'}) |
788 def topickw(context, mapping): | 788 def topickw(context, mapping): |
789 """:topic: String. The topic of the changeset""" | 789 """String. The topic of the changeset""" |
790 ctx = context.resource(mapping, b'ctx') | 790 ctx = context.resource(mapping, b'ctx') |
791 return ctx.topic() | 791 return ctx.topic() |
792 | 792 |
793 @templatekeyword(b'topicidx', requires={b'ctx'}) | 793 @templatekeyword(b'topicidx', requires={b'ctx'}) |
794 def topicidxkw(context, mapping): | 794 def topicidxkw(context, mapping): |
795 """:topicidx: Integer. Index of the changeset as a stack alias""" | 795 """Integer. Index of the changeset as a stack alias""" |
796 ctx = context.resource(mapping, b'ctx') | 796 ctx = context.resource(mapping, b'ctx') |
797 return ctx.topicidx() | 797 return ctx.topicidx() |
798 | 798 |
799 @templatekeyword(b'topic_namespace', requires={b'ctx'}) | 799 @templatekeyword(b'topic_namespace', requires={b'ctx'}) |
800 def topicnamespacekw(context, mapping): | 800 def topicnamespacekw(context, mapping): |
801 """:topic_namespace: String. The topic namespace of the changeset""" | 801 """String. The topic namespace of the changeset""" |
802 ctx = context.resource(mapping, b'ctx') | 802 ctx = context.resource(mapping, b'ctx') |
803 return ctx.topic_namespace() | 803 return ctx.topic_namespace() |
804 | 804 |
805 @templatekeyword(b'fqbn', requires={b'ctx'}) | 805 @templatekeyword(b'fqbn', requires={b'ctx'}) |
806 def fqbnkw(context, mapping): | 806 def fqbnkw(context, mapping): |
807 """:fqbn: String. The branch//namespace/topic of the changeset""" | 807 """String. The branch//namespace/topic of the changeset""" |
808 ctx = context.resource(mapping, b'ctx') | 808 ctx = context.resource(mapping, b'ctx') |
809 return ctx.fqbn() | 809 return ctx.fqbn() |
810 | 810 |
811 def wrapinit(orig, self, repo, *args, **kwargs): | 811 def wrapinit(orig, self, repo, *args, **kwargs): |
812 orig(self, repo, *args, **kwargs) | 812 orig(self, repo, *args, **kwargs) |
1602 cmdutil.extrapreimportmap[b'topic'] = _importtopic | 1602 cmdutil.extrapreimportmap[b'topic'] = _importtopic |
1603 patch.patchheadermap.append((b'EXP-Topic', b'topic')) | 1603 patch.patchheadermap.append((b'EXP-Topic', b'topic')) |
1604 | 1604 |
1605 ## preserve topic during split | 1605 ## preserve topic during split |
1606 | 1606 |
1607 def presplitupdatetopic(original, repo, ui, prev, ctx): | 1607 def wrappresplitupdate(original, repo, ui, prev, ctx): |
1608 # Save topic of revision | 1608 # Save topic of revision |
1609 tns = None | |
1609 topic = None | 1610 topic = None |
1611 if util.safehasattr(ctx, 'topic_namespace'): | |
1612 tns = ctx.topic_namespace() | |
1610 if util.safehasattr(ctx, 'topic'): | 1613 if util.safehasattr(ctx, 'topic'): |
1611 topic = ctx.topic() | 1614 topic = ctx.topic() |
1612 | 1615 |
1613 # Update the working directory | 1616 # Update the working directory |
1614 original(repo, ui, prev, ctx) | 1617 original(repo, ui, prev, ctx) |
1615 | 1618 |
1616 # Restore the topic if need | 1619 # Restore the topic if need |
1620 if tns: | |
1621 _changecurrenttns(repo, tns) | |
1617 if topic: | 1622 if topic: |
1618 _changecurrenttopic(repo, topic) | 1623 _changecurrenttopic(repo, topic) |
1619 | 1624 |
1620 def _changecurrenttns(repo, tns): | 1625 def _changecurrenttns(repo, tns): |
1621 if tns: | 1626 if tns: |