Mercurial > evolve
annotate hgext3rd/serverminitopic.py @ 5619:5673730db8d5 stable
evolve: clean merge state when content divergence resolution has no changes
This patch backs out b723805d7fe1, which only hid the problem.
Usually mergestate is cleared (or should be cleared) when creating a new
changeset, but sometimes there are situations when there's nothing to commit.
When solving content divergence resulted in no changes and no new changesets
were created, mergestate was left untouched. That's a problem because sometimes
mergestate contains files with conflicts that were already resolved by user,
and such mergestate only applies to the current wdir parent. Since evolve has
already dealt with the current wdir parent successfully when it reached this
code, this is a good place to clean the mergestate.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sat, 19 Sep 2020 17:49:31 +0200 |
parents | 3214dc282085 |
children | ad7c9c0b7a63 |
rev | line source |
---|---|
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
1 """enable a minimal verison of topic for server |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
2 |
4364
b74a31c69ad5
minitopic: add warning about extensions state and testing
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4187
diff
changeset
|
3 ! This extensions is not actively maintained |
b74a31c69ad5
minitopic: add warning about extensions state and testing
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4187
diff
changeset
|
4 ! We recommand using the main topic extension instead |
b74a31c69ad5
minitopic: add warning about extensions state and testing
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
4187
diff
changeset
|
5 |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 Non publishing repository will see topic as "branch:topic" in the branch field. |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
7 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
8 In addition to adding the extensions, the feature must be manually enabled in the config: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
9 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 [experimental] |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 server-mini-topic = yes |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
12 """ |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
13 import hashlib |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
14 import contextlib |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
15 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
16 from mercurial import ( |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
17 branchmap, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
18 context, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
19 encoding, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
20 extensions, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
21 node, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 registrar, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 util, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 ) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 |
5180
515d425c0a05
compat: drop 4.5 related compatibility around wireprotocol module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
5042
diff
changeset
|
26 from mercurial import wireprotov1server |
3679
b12c5d107187
minitopic: handle wireproto module change from b4d85bc122bd
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3651
diff
changeset
|
27 |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
28 if util.safehasattr(registrar, 'configitem'): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 configtable = {} |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 configitem = registrar.configitem(configtable) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
32 configitem(b'experimental', b'server-mini-topic', |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
33 default=False, |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
34 ) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 |
5428
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
36 # hg <= 5.4 (e2d17974a869) |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
37 def nonpublicphaseroots(repo): |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
38 if util.safehasattr(repo._phasecache, 'nonpublicphaseroots'): |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
39 return repo._phasecache.nonpublicphaseroots(repo) |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
40 return set().union( |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
41 *[roots for roots in repo._phasecache.phaseroots[1:] if roots] |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
42 ) |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
43 |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
44 def hasminitopic(repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
45 """true if minitopic is enabled on the repository |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
46 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
47 (The value is cached on the repository) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
48 """ |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
49 enabled = getattr(repo, '_hasminitopic', None) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
50 if enabled is None: |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
51 enabled = (repo.ui.configbool(b'experimental', b'server-mini-topic') |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
52 and not repo.publishing()) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
53 repo._hasminitopic = enabled |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
54 return enabled |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
55 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
56 ### make topic visible though "ctx.branch()" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
57 |
3651
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
58 def topicbranch(orig, self): |
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
59 branch = orig(self) |
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
60 if hasminitopic(self._repo) and self.phase(): |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
61 topic = self._changeset.extra.get(b'topic') |
3651
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
62 if topic is not None: |
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
63 topic = encoding.tolocal(topic) |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
64 branch = b'%s:%s' % (branch, topic) |
3651
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
65 return branch |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
66 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
67 ### avoid caching topic data in rev-branch-cache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
68 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
69 class revbranchcacheoverlay(object): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
70 """revbranch mixin that don't use the cache for non public changeset""" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
71 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
72 def _init__(self, *args, **kwargs): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
73 super(revbranchcacheoverlay, self).__init__(*args, **kwargs) |
4804
079dbf36e884
python3: add raw prefix in cases harder to analyze at the token level
Raphaël Gomès <rgomes@octobus.net>
parents:
4758
diff
changeset
|
74 if r'branchinfo' in vars(self): |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
75 del self.branchinfo |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
76 |
4187
49d442a2207f
topic: add the changelog argument to branchinfo()
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
3679
diff
changeset
|
77 def branchinfo(self, rev, changelog=None): |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
78 """return branch name and close flag for rev, using and updating |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
79 persistent cache.""" |
3511
768f752b5364
serverminitopic: fix wrong object being passed to phase
Sean Farley <sean@farley.io>
parents:
3207
diff
changeset
|
80 phase = self._repo._phasecache.phase(self._repo, rev) |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
81 if phase: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
82 ctx = self._repo[rev] |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
83 return ctx.branch(), ctx.closesbranch() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
84 return super(revbranchcacheoverlay, self).branchinfo(rev) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
85 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
86 def reposetup(ui, repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
87 """install a repo class with a special revbranchcache""" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
88 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
89 if hasminitopic(repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
90 repo = repo.unfiltered() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
91 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
92 class minitopicrepo(repo.__class__): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
93 """repository subclass that install the modified cache""" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
94 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
95 def revbranchcache(self): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
96 if self._revbranchcache is None: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 cache = super(minitopicrepo, self).revbranchcache() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 class topicawarerbc(revbranchcacheoverlay, cache.__class__): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
100 pass |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
101 cache.__class__ = topicawarerbc |
4804
079dbf36e884
python3: add raw prefix in cases harder to analyze at the token level
Raphaël Gomès <rgomes@octobus.net>
parents:
4758
diff
changeset
|
102 if r'branchinfo' in vars(cache): |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
103 del cache.branchinfo |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 self._revbranchcache = cache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 return self._revbranchcache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 repo.__class__ = minitopicrepo |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
108 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
109 ### topic aware branch head cache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
110 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
111 def _phaseshash(repo, maxrev): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
112 """uniq ID for a phase matching a set of rev""" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
113 revs = set() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
114 cl = repo.changelog |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
115 fr = cl.filteredrevs |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
116 nm = cl.nodemap |
5428
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
117 for n in nonpublicphaseroots(repo): |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
118 r = nm.get(n) |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
119 if r not in fr and r < maxrev: |
3214dc282085
serverminitopic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
120 revs.add(r) |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
121 key = node.nullid |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
122 revs = sorted(revs) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
123 if revs: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
124 s = hashlib.sha1() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
125 for rev in revs: |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
126 s.update(b'%d;' % rev) |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
127 key = s.digest() |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
128 return key |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
129 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
130 # needed to prevent reference used for 'super()' call using in branchmap.py to |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
131 # no go into cycle. (yes, URG) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
132 _oldbranchmap = branchmap.branchcache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
133 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
134 @contextlib.contextmanager |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
135 def oldbranchmap(): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
136 previous = branchmap.branchcache |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
137 try: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
138 branchmap.branchcache = _oldbranchmap |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
139 yield |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
140 finally: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
141 branchmap.branchcache = previous |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
142 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
143 _publiconly = set([ |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
144 b'base', |
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
145 b'immutable', |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
146 ]) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
147 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
148 def mighttopic(repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
149 return hasminitopic(repo) and repo.filtername not in _publiconly |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
150 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
151 class _topiccache(branchmap.branchcache): # combine me with branchmap.branchcache |
4394
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
152 @classmethod |
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
153 def fromfile(cls, repo): |
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
154 orig = super(_topiccache, cls).fromfile |
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
155 return wrapread(orig, repo) |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
156 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
157 def __init__(self, *args, **kwargs): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
158 # super() call may fail otherwise |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
159 with oldbranchmap(): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
160 super(_topiccache, self).__init__(*args, **kwargs) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
161 self.phaseshash = None |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
162 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
163 def copy(self): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
164 """return an deep copy of the branchcache object""" |
4521
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
165 if util.safehasattr(self, '_entries'): |
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
166 _entries = self._entries |
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
167 else: |
5193
a4d081923c81
compat: update hg-X.Y compat comments and test them
Anton Shestakov <av6@dwimlabs.net>
parents:
5180
diff
changeset
|
168 # hg <= 4.9 (624d6683c705+b137a6793c51) |
4521
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
169 _entries = self |
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
170 new = self.__class__(_entries, self.tipnode, self.tiprev, |
5303b9128714
serverminitopic: add compatibility for branchcache that now uses self._entries
Anton Shestakov <av6@dwimlabs.net>
parents:
4394
diff
changeset
|
171 self.filteredhash, self._closednodes) |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
172 new.phaseshash = self.phaseshash |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
173 return new |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
174 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
175 def validfor(self, repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
176 """Is the cache content valid regarding a repo |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
177 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
178 - False when cached tipnode is unknown or if we detect a strip. |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
179 - True when cache is up to date or a subset of current repo.""" |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
180 valid = super(_topiccache, self).validfor(repo) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
181 if not valid: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
182 return False |
3518
d938808e31bc
serverminitopic: attempt to fix assertion for repoview in branchmap
Sean Farley <sean@farley.io>
parents:
3511
diff
changeset
|
183 elif self.phaseshash is None: |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
184 # phasehash at None means this is a branchmap |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
185 # coming from a public only set |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
186 return True |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
187 else: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
188 try: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
189 valid = self.phaseshash == _phaseshash(repo, self.tiprev) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
190 return valid |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
191 except IndexError: |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
192 return False |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
193 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
194 def write(self, repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
195 # we expect (hope) mutable set to be small enough to be that computing |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
196 # it all the time will be fast enough |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
197 if not mighttopic(repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
198 super(_topiccache, self).write(repo) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
199 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
200 def update(self, repo, revgen): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
201 """Given a branchhead cache, self, that may have extra nodes or be |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
202 missing heads, and a generator of nodes that are strictly a superset of |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
203 heads missing, this function updates self to be correct. |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
204 """ |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
205 super(_topiccache, self).update(repo, revgen) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
206 if mighttopic(repo): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
207 self.phaseshash = _phaseshash(repo, self.tiprev) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
208 |
3207
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
209 def wrapread(orig, repo): |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
210 # Avoiding to write cache for filter where topic applies is a good step, |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
211 # but we need to also avoid reading it. Existing branchmap cache might |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
212 # exists before the turned the feature on. |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
213 if mighttopic(repo): |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
214 return None |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
215 return orig(repo) |
35c79686a635
serverminitopic: also avoid reading
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3206
diff
changeset
|
216 |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
217 # advertise topic capabilities |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
218 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
219 def wireprotocaps(orig, repo, proto): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
220 caps = orig(repo, proto) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
221 if hasminitopic(repo): |
4814
48b30ff742cb
python3: use format-source to run byteify-strings in .py files
Raphaël Gomès <rgomes@octobus.net>
parents:
4804
diff
changeset
|
222 caps.append(b'topics') |
3206
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
223 return caps |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
224 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
225 # wrap the necessary bit |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
226 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
227 def wrapclass(container, oldname, new): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
228 old = getattr(container, oldname) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
229 if not issubclass(old, new): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
230 targetclass = new |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
231 # check if someone else already wrapped the class and handle that |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
232 if not issubclass(new, old): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
233 class targetclass(new, old): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
234 pass |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
235 setattr(container, oldname, targetclass) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
236 current = getattr(container, oldname) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
237 assert issubclass(current, new), (current, new, targetclass) |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
238 |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
239 def uisetup(ui): |
3ccde4699cf0
topic: introduce a minimal extensions to enable topic on the server
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
240 wrapclass(branchmap, 'branchcache', _topiccache) |
4394
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
241 try: |
5193
a4d081923c81
compat: update hg-X.Y compat comments and test them
Anton Shestakov <av6@dwimlabs.net>
parents:
5180
diff
changeset
|
242 # hg <= 4.9 (3461814417f3) |
4394
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
243 extensions.wrapfunction(branchmap, 'read', wrapread) |
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
244 except AttributeError: |
5193
a4d081923c81
compat: update hg-X.Y compat comments and test them
Anton Shestakov <av6@dwimlabs.net>
parents:
5180
diff
changeset
|
245 # Mercurial 5.0; branchcache.fromfile now takes care of this |
4394
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
246 # which is alredy defined on _topiccache |
c6d1b0a6babe
topic: make topics compatible with branchmap refactor
Martijn Pieters <mj@octobus.net>
parents:
4364
diff
changeset
|
247 pass |
5180
515d425c0a05
compat: drop 4.5 related compatibility around wireprotocol module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
5042
diff
changeset
|
248 extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps) |
3651
fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Pulkit Goyal <7895pulkit@gmail.com>
parents:
3518
diff
changeset
|
249 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |