Mercurial > evolve
comparison hgext3rd/topic/topicmap.py @ 6790:38a845d432e9 stable
topic: make sure filtername is not None
This is similar to 4188a0570ba1 in core.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 16 Mar 2024 18:27:18 -0300 |
parents | cd8e1a697124 |
children | b88cd2f549a8 68f7ba35ea83 |
comparison
equal
deleted
inserted
replaced
6789:cd8e1a697124 | 6790:38a845d432e9 |
---|---|
35 | 35 |
36 def gettopicrepo(repo): | 36 def gettopicrepo(repo): |
37 if not common.hastopicext(repo): | 37 if not common.hastopicext(repo): |
38 return repo | 38 return repo |
39 filtername = topicfilter(repo.filtername) | 39 filtername = topicfilter(repo.filtername) |
40 if filtername == repo.filtername: | 40 if filtername is None or filtername == repo.filtername: |
41 return repo | 41 return repo |
42 return repo.filtered(filtername) | 42 return repo.filtered(filtername) |
43 | 43 |
44 def _setuptopicfilter(ui): | 44 def _setuptopicfilter(ui): |
45 """extend the filter related mapping with topic related one""" | 45 """extend the filter related mapping with topic related one""" |
46 funcmap = repoview.filtertable | 46 funcmap = repoview.filtertable |
47 # hg <= 4.9 (caebe5e7f4bd) | 47 # hg <= 4.9 (caebe5e7f4bd) |
48 partialmap = branchmap.subsettable | 48 partialmap = branchmap.subsettable |
49 | 49 |
50 # filter level not affected by topic that we should not override | |
51 | |
52 for plainname in list(funcmap): | 50 for plainname in list(funcmap): |
53 newfilter = topicfilter(plainname) | 51 newfilter = topicfilter(plainname) |
54 if newfilter == plainname: | 52 if newfilter == plainname: |
53 # filter level not affected by topic that we should not override | |
55 continue | 54 continue |
56 | 55 |
57 def revsfunc(repo, name=plainname): | 56 def revsfunc(repo, name=plainname): |
58 return repoview.filterrevs(repo, name) | 57 return repoview.filterrevs(repo, name) |
59 | 58 |
91 extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply) | 90 extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply) |
92 compat.overridecommitstatus(commitstatus) | 91 compat.overridecommitstatus(commitstatus) |
93 | 92 |
94 def cgapply(orig, self, repo, *args, **kwargs): | 93 def cgapply(orig, self, repo, *args, **kwargs): |
95 """make sure a topicmap is used when applying a changegroup""" | 94 """make sure a topicmap is used when applying a changegroup""" |
96 other = repo.filtered(topicfilter(repo.filtername)) | 95 newfilter = topicfilter(repo.filtername) |
96 if newfilter is None: | |
97 other = repo | |
98 else: | |
99 other = repo.filtered(newfilter) | |
97 return orig(self, other, *args, **kwargs) | 100 return orig(self, other, *args, **kwargs) |
98 | 101 |
99 def commitstatus(orig, repo, node, branch, bheads=None, tip=None, **opts): | 102 def commitstatus(orig, repo, node, branch, bheads=None, tip=None, **opts): |
100 # wrap commit status use the topic branch heads | 103 # wrap commit status use the topic branch heads |
101 ctx = repo[node] | 104 ctx = repo[node] |