##// END OF EJS Templates
annotate: increase refcount of each revisions correctly (issue3841)...
FUJIWARA Katsunori -
r18993:0fd0612d default
parent child Browse files
Show More
@@ -689,7 +689,8 b' class filectx(object):'
689 needed = {base: 1}
689 needed = {base: 1}
690 while visit:
690 while visit:
691 f = visit[-1]
691 f = visit[-1]
692 if f not in pcache:
692 pcached = f in pcache
693 if not pcached:
693 pcache[f] = parents(f)
694 pcache[f] = parents(f)
694
695
695 ready = True
696 ready = True
@@ -698,6 +699,7 b' class filectx(object):'
698 if p not in hist:
699 if p not in hist:
699 ready = False
700 ready = False
700 visit.append(p)
701 visit.append(p)
702 if not pcached:
701 needed[p] = needed.get(p, 0) + 1
703 needed[p] = needed.get(p, 0) + 1
702 if ready:
704 if ready:
703 visit.pop()
705 visit.pop()
@@ -267,6 +267,114 b" annotate file without '\\n' on last line"
267 [0-9]+: a (re)
267 [0-9]+: a (re)
268 [0-9]+: b (re)
268 [0-9]+: b (re)
269
269
270 Issue3841: check annotation of the file of which filelog includes
271 merging between the revision and its ancestor
272
273 to reproduce the situation with recent Mercurial, this script uses (1)
274 "hg debugsetparents" to merge without ancestor check by "hg merge",
275 and (2) the extension to allow filelog merging between the revision
276 and its ancestor by overriding "repo._filecommit".
277
278 $ cat > ../legacyrepo.py <<EOF
279 > from mercurial import node, util
280 > def reposetup(ui, repo):
281 > class legacyrepo(repo.__class__):
282 > def _filecommit(self, fctx, manifest1, manifest2,
283 > linkrev, tr, changelist):
284 > fname = fctx.path()
285 > text = fctx.data()
286 > flog = self.file(fname)
287 > fparent1 = manifest1.get(fname, node.nullid)
288 > fparent2 = manifest2.get(fname, node.nullid)
289 > meta = {}
290 > copy = fctx.renamed()
291 > if copy and copy[0] != fname:
292 > raise util.Abort('copying is not supported')
293 > if fparent2 != node.nullid:
294 > changelist.append(fname)
295 > return flog.add(text, meta, tr, linkrev,
296 > fparent1, fparent2)
297 > raise util.Abort('only merging is supported')
298 > repo.__class__ = legacyrepo
299 > EOF
300
301 $ cat > baz <<EOF
302 > 1
303 > 2
304 > 3
305 > 4
306 > 5
307 > EOF
308 $ hg add baz
309 $ hg commit -m "baz:0"
310
311 $ cat > baz <<EOF
312 > 1 baz:1
313 > 2
314 > 3
315 > 4
316 > 5
317 > EOF
318 $ hg commit -m "baz:1"
319
320 $ cat > baz <<EOF
321 > 1 baz:1
322 > 2 baz:2
323 > 3
324 > 4
325 > 5
326 > EOF
327 $ hg debugsetparents 17 17
328 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
329 $ hg debugindexdot .hg/store/data/baz.i
330 digraph G {
331 -1 -> 0
332 0 -> 1
333 1 -> 2
334 1 -> 2
335 }
336 $ hg annotate baz
337 17: 1 baz:1
338 18: 2 baz:2
339 16: 3
340 16: 4
341 16: 5
342
343 $ cat > baz <<EOF
344 > 1 baz:1
345 > 2 baz:2
346 > 3 baz:3
347 > 4
348 > 5
349 > EOF
350 $ hg commit -m "baz:3"
351
352 $ cat > baz <<EOF
353 > 1 baz:1
354 > 2 baz:2
355 > 3 baz:3
356 > 4 baz:4
357 > 5
358 > EOF
359 $ hg debugsetparents 19 18
360 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
361 $ hg debugindexdot .hg/store/data/baz.i
362 digraph G {
363 -1 -> 0
364 0 -> 1
365 1 -> 2
366 1 -> 2
367 2 -> 3
368 3 -> 4
369 2 -> 4
370 }
371 $ hg annotate baz
372 17: 1 baz:1
373 18: 2 baz:2
374 19: 3 baz:3
375 20: 4 baz:4
376 16: 5
377
270 Test annotate with whitespace options
378 Test annotate with whitespace options
271
379
272 $ cd ..
380 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now