Mercurial > hg
annotate tests/test-pull-pull-corruption2.t @ 16101:20ad8f0512a2 stable
mq: restore _branchtags() fast path (issue3223)
Since a5917346c72e, mq saves the nodeid of the first applied patch to
cache/branchheads, which breaks the optimized cache handling introduced in
fbf8320f25c8. The problem is the revision being committed is appended to
mqrepo.applied after the commit succeeds, which means mqrepo._branchtags()
performs a regular update and write the first applied patch to the branch
cache.
One solution is to set a context variable _committingpatch on the mqrepo while
it is committing a patch and to take it in account when deciding to fast-path
mqrepo._branchtags(). Not really elegant but it works.
The changes to test-mq-caches.t reverse changes introduced by a5917346c72e. The
cache should not have been updated with mq records.
The changes to test-keyword.t are indirectly caused by a5917346c72e.
Reported and analyzed by Yuya Nishihara <yuya@tcha.org>
Notes:
- qpush still makes a slow path _branchtags() call when checking heads. Maybe
this can be optimized.
- be careful when merging this patch in default as secretcommit() was renamed
newcommit() right after the end of the code freeze.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Tue, 07 Feb 2012 18:47:16 +0100 |
parents | 2f8740c639e4 |
children |
rev | line source |
---|---|
12482
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
1 Corrupt an hg repo with two pulls. |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
2 create one repo with a long history |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
3 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
4 $ hg init source1 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
5 $ cd source1 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
6 $ touch foo |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
7 $ hg add foo |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
8 $ for i in 1 2 3 4 5 6 7 8 9 10; do |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
9 > echo $i >> foo |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
10 > hg ci -m $i |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
11 > done |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
12 $ cd .. |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
13 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
14 create a third repo to pull both other repos into it |
2000
6f6e210b38cf
add benoit's test for issue148.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff
changeset
|
15 |
12482
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
16 $ hg init version2 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
17 $ hg -R version2 pull source1 & |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
18 $ sleep 1 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
19 pulling from source1 |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
20 requesting all changes |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
21 adding changesets |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
22 adding manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
23 adding file changes |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
24 added 10 changesets with 10 changes to 1 files |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
25 (run 'hg update' to get a working copy) |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
26 $ hg clone --pull -U version2 corrupted |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
27 requesting all changes |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
28 adding changesets |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
29 adding manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
30 adding file changes |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
31 added 10 changesets with 10 changes to 1 files |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
32 $ wait |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
33 $ hg -R corrupted verify |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
34 checking changesets |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
35 checking manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
36 crosschecking files in changesets and manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
37 checking files |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
38 1 files, 10 changesets, 10 total revisions |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
39 $ hg -R version2 verify |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
40 checking changesets |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
41 checking manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
42 crosschecking files in changesets and manifests |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
43 checking files |
2f8740c639e4
tests: unify test-pull-pull-corruption2
Matt Mackall <mpm@selenic.com>
parents:
2530
diff
changeset
|
44 1 files, 10 changesets, 10 total revisions |