##// END OF EJS Templates
copies: add a devel debug mode to trace what copy tracing does...
Boris Feld -
r40093:25b28682 default
parent child Browse files
Show More
@@ -377,6 +377,9 b" coreconfigitem('devel', 'user.obsmarker'"
377 coreconfigitem('devel', 'warn-config-unknown',
377 coreconfigitem('devel', 'warn-config-unknown',
378 default=None,
378 default=None,
379 )
379 )
380 coreconfigitem('devel', 'debug.copies',
381 default=False,
382 )
380 coreconfigitem('devel', 'debug.extensions',
383 coreconfigitem('devel', 'debug.extensions',
381 default=False,
384 default=False,
382 )
385 )
@@ -163,9 +163,17 b' def _committedforwardcopies(a, b, match)'
163 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
163 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
164 # files might have to be traced back to the fctx parent of the last
164 # files might have to be traced back to the fctx parent of the last
165 # one-side-only changeset, but not further back than that
165 # one-side-only changeset, but not further back than that
166 limit = _findlimit(a._repo, a.rev(), b.rev())
166 repo = a._repo
167 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
168 dbg = repo.ui.debug
169 if debug:
170 dbg('debug.copies: looking into rename from %s to %s\n'
171 % (a, b))
172 limit = _findlimit(repo, a.rev(), b.rev())
167 if limit is None:
173 if limit is None:
168 limit = -1
174 limit = -1
175 if debug:
176 dbg('debug.copies: search limit: %d\n' % limit)
169 am = a.manifest()
177 am = a.manifest()
170
178
171 # find where new files came from
179 # find where new files came from
@@ -186,11 +194,20 b' def _committedforwardcopies(a, b, match)'
186 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
194 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
187
195
188 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
196 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
197
198 if debug:
199 dbg('debug.copies: missing file to search: %d\n' % len(missing))
200
189 for f in missing:
201 for f in missing:
202 if debug:
203 dbg('debug.copies: tracing file: %s\n' % f)
190 fctx = b[f]
204 fctx = b[f]
191 fctx._ancestrycontext = ancestrycontext
205 fctx._ancestrycontext = ancestrycontext
206
192 ofctx = _tracefile(fctx, am, limit)
207 ofctx = _tracefile(fctx, am, limit)
193 if ofctx:
208 if ofctx:
209 if debug:
210 dbg('debug.copies: rename of: %s\n' % ofctx._path)
194 cm[f] = ofctx.path()
211 cm[f] = ofctx.path()
195 return cm
212 return cm
196
213
@@ -226,13 +243,24 b' def _backwardrenames(a, b):'
226
243
227 def pathcopies(x, y, match=None):
244 def pathcopies(x, y, match=None):
228 """find {dst@y: src@x} copy mapping for directed compare"""
245 """find {dst@y: src@x} copy mapping for directed compare"""
246 repo = x._repo
247 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
248 if debug:
249 repo.ui.debug('debug.copies: searching copies from %s to %s\n'
250 % (x, y))
229 if x == y or not x or not y:
251 if x == y or not x or not y:
230 return {}
252 return {}
231 a = y.ancestor(x)
253 a = y.ancestor(x)
232 if a == x:
254 if a == x:
255 if debug:
256 repo.ui.debug('debug.copies: search mode: forward\n')
233 return _forwardcopies(x, y, match=match)
257 return _forwardcopies(x, y, match=match)
234 if a == y:
258 if a == y:
259 if debug:
260 repo.ui.debug('debug.copies: search mode: backward\n')
235 return _backwardrenames(x, y)
261 return _backwardrenames(x, y)
262 if debug:
263 repo.ui.debug('debug.copies: search mode: combined\n')
236 return _chain(x, y, _backwardrenames(x, a),
264 return _chain(x, y, _backwardrenames(x, a),
237 _forwardcopies(a, y, match=match))
265 _forwardcopies(a, y, match=match))
238
266
@@ -1666,4 +1666,18 b' accessing the parent of 4 (renamed) shou'
1666 @@ -0,0 +1,1 @@
1666 @@ -0,0 +1,1 @@
1667 +change
1667 +change
1668
1668
1669 Check debug output for copy tracing
1670
1671 $ hg status --copies --rev 'desc(dev)' --rev . --config devel.debug.copies=yes --debug
1672 debug.copies: searching copies from a51f36ab1704 to 7935fd48a8f9
1673 debug.copies: search mode: forward
1674 debug.copies: looking into rename from a51f36ab1704 to 7935fd48a8f9
1675 debug.copies: search limit: 2
1676 debug.copies: missing file to search: 1
1677 debug.copies: tracing file: renamed
1678 debug.copies: rename of: f
1679 A renamed
1680 f
1681 R f
1682
1669 $ cd ..
1683 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now