##// END OF EJS Templates
fastannotate: rip out specialized support for remotefilelog...
Augie Fackler -
r39246:303dae01 default
parent child Browse files
Show More
@@ -53,19 +53,11 b' annotate cache greatly. Run "debugbuildl'
53 serverbuildondemand = True
53 serverbuildondemand = True
54
54
55 # update local annotate cache from remote on demand
55 # update local annotate cache from remote on demand
56 # (default: True for remotefilelog repo, False otherwise)
56 client = False
57 client = True
58
57
59 # path to use when connecting to the remote server (default: default)
58 # path to use when connecting to the remote server (default: default)
60 remotepath = default
59 remotepath = default
61
60
62 # share sshpeer with remotefilelog. this would allow fastannotate to peek
63 # into remotefilelog internals, and steal its sshpeer, or in the reversed
64 # direction: donate its sshpeer to remotefilelog. disable this if
65 # fastannotate and remotefilelog should not share a sshpeer when their
66 # endpoints are different and incompatible. (default: True)
67 clientsharepeer = True
68
69 # minimal length of the history of a file required to fetch linelog from
61 # minimal length of the history of a file required to fetch linelog from
70 # the server. (default: 10)
62 # the server. (default: 10)
71 clientfetchthreshold = 10
63 clientfetchthreshold = 10
@@ -108,12 +100,8 b' annotate cache greatly. Run "debugbuildl'
108 #
100 #
109 # * rename the config knob for updating the local cache from a remote server
101 # * rename the config knob for updating the local cache from a remote server
110 #
102 #
111 # * remove the remotefilelog-peer-sharing functionality
112 #
113 # * move various global-setup bits to extsetup() or reposetup()
103 # * move various global-setup bits to extsetup() or reposetup()
114 #
104 #
115 # * assume repo.requirements will always exist
116 #
117 # * move `flock` based locking to a common area
105 # * move `flock` based locking to a common area
118 #
106 #
119 # * revise wireprotocol for sharing annotate files
107 # * revise wireprotocol for sharing annotate files
@@ -154,7 +142,7 b' configitem = registrar.configitem(config'
154 configitem('fastannotate', 'modes', default=['fastannotate'])
142 configitem('fastannotate', 'modes', default=['fastannotate'])
155 configitem('fastannotate', 'server', default=False)
143 configitem('fastannotate', 'server', default=False)
156 configitem('fastannotate', 'useflock', default=True)
144 configitem('fastannotate', 'useflock', default=True)
157 configitem('fastannotate', 'client')
145 configitem('fastannotate', 'client', default=False)
158 configitem('fastannotate', 'unfilteredrepo', default=True)
146 configitem('fastannotate', 'unfilteredrepo', default=True)
159 configitem('fastannotate', 'defaultformat', default=['number'])
147 configitem('fastannotate', 'defaultformat', default=['number'])
160 configitem('fastannotate', 'perfhack', default=False)
148 configitem('fastannotate', 'perfhack', default=False)
@@ -162,7 +150,6 b" configitem('fastannotate', 'mainbranch')"
162 configitem('fastannotate', 'forcetext', default=True)
150 configitem('fastannotate', 'forcetext', default=True)
163 configitem('fastannotate', 'forcefollow', default=True)
151 configitem('fastannotate', 'forcefollow', default=True)
164 configitem('fastannotate', 'clientfetchthreshold', default=10)
152 configitem('fastannotate', 'clientfetchthreshold', default=10)
165 configitem('fastannotate', 'clientsharepeer', default=True)
166 configitem('fastannotate', 'serverbuildondemand', default=True)
153 configitem('fastannotate', 'serverbuildondemand', default=True)
167 configitem('fastannotate', 'remotepath', default='default')
154 configitem('fastannotate', 'remotepath', default='default')
168
155
@@ -188,7 +175,6 b' def uisetup(ui):'
188 elif name == 'fctx':
175 elif name == 'fctx':
189 from . import support
176 from . import support
190 support.replacefctxannotate()
177 support.replacefctxannotate()
191 support.replaceremotefctxannotate()
192 commands.wrapdefault()
178 commands.wrapdefault()
193 else:
179 else:
194 raise hgerror.Abort(_('fastannotate: invalid mode: %s') % name)
180 raise hgerror.Abort(_('fastannotate: invalid mode: %s') % name)
@@ -203,9 +189,5 b' def uisetup(ui):'
203 localrepo.localrepository._wlockfreeprefix.add('fastannotate/')
189 localrepo.localrepository._wlockfreeprefix.add('fastannotate/')
204
190
205 def reposetup(ui, repo):
191 def reposetup(ui, repo):
206 client = ui.configbool('fastannotate', 'client', default=None)
192 if ui.configbool('fastannotate', 'client'):
207 if client is None:
208 if util.safehasattr(repo, 'requirements'):
209 client = 'remotefilelog' in repo.requirements
210 if client:
211 protocol.clientreposetup(ui, repo)
193 protocol.clientreposetup(ui, repo)
@@ -134,33 +134,14 b' def peersetup(ui, peer):'
134 def annotatepeer(repo):
134 def annotatepeer(repo):
135 ui = repo.ui
135 ui = repo.ui
136
136
137 # fileservice belongs to remotefilelog
137 remotepath = ui.expandpath(
138 fileservice = getattr(repo, 'fileservice', None)
138 ui.config('fastannotate', 'remotepath', 'default'))
139 sharepeer = ui.configbool('fastannotate', 'clientsharepeer', True)
139 peer = hg.peer(ui, {}, remotepath)
140
141 if sharepeer and fileservice:
142 ui.debug('fastannotate: using remotefilelog connection pool\n')
143 conn = repo.connectionpool.get(repo.fallbackpath)
144 peer = conn.peer
145 stolen = True
146 else:
147 remotepath = ui.expandpath(
148 ui.config('fastannotate', 'remotepath', 'default'))
149 peer = hg.peer(ui, {}, remotepath)
150 stolen = False
151
140
152 try:
141 try:
153 # Note: fastannotate requests should never trigger a remotefilelog
154 # "getfiles" request, because "getfiles" puts the stream into a state
155 # that does not exit. See "clientfetch": it does "getannotate" before
156 # any hg stuff that could potentially trigger a "getfiles".
157 yield peer
142 yield peer
158 finally:
143 finally:
159 if not stolen:
144 peer.close()
160 for i in ['close', 'cleanup']:
161 getattr(peer, i, lambda: None)()
162 else:
163 conn.__exit__(None, None, None)
164
145
165 def clientfetch(repo, paths, lastnodemap=None, peer=None):
146 def clientfetch(repo, paths, lastnodemap=None, peer=None):
166 """download annotate cache from the server for paths"""
147 """download annotate cache from the server for paths"""
@@ -209,16 +190,10 b' def _filterfetchpaths(repo, paths):'
209
190
210 master = repo.ui.config('fastannotate', 'mainbranch') or 'default'
191 master = repo.ui.config('fastannotate', 'mainbranch') or 'default'
211
192
212 if 'remotefilelog' in repo.requirements:
213 ctx = scmutil.revsingle(repo, master)
214 f = lambda path: len(ctx[path].ancestormap())
215 else:
216 f = lambda path: len(repo.file(path))
217
218 result = []
193 result = []
219 for path in paths:
194 for path in paths:
220 try:
195 try:
221 if f(path) >= threshold:
196 if len(repo.file(path)) >= threshold:
222 result.append(path)
197 result.append(path)
223 except Exception: # file not found etc.
198 except Exception: # file not found etc.
224 result.append(path)
199 result.append(path)
@@ -120,12 +120,3 b' def replacehgwebannotate():'
120
120
121 def replacefctxannotate():
121 def replacefctxannotate():
122 extensions.wrapfunction(hgcontext.basefilectx, 'annotate', _fctxannotate)
122 extensions.wrapfunction(hgcontext.basefilectx, 'annotate', _fctxannotate)
123
124 def replaceremotefctxannotate():
125 try:
126 r = extensions.find('remotefilelog')
127 except KeyError:
128 return
129 else:
130 extensions.wrapfunction(r.remotefilectx.remotefilectx, 'annotate',
131 _remotefctxannotate)
General Comments 0
You need to be logged in to leave comments. Login now