annotate tests/test-fncache.t @ 26998:4414d500604f

localrepo: put bookmark move following commit in one transaction Before this patch, making a commit on a local repo could move a bookmark and both operations would not be grouped as one transaction. This patch makes both operations part of one transaction. This is necessary to switch to the new api to save bookmarks repo._bookmarks.recordchange if we don't want to change the current behavior of rollback. Dirstate change happening after the commit is done is now part of the transaction mentioned above. This leads to a change in the expected output of several tests. The change to test-fncache happens because both lock are now released in the same finally clause. The lock release is made explicitly buggy in this test. Previously releasing lock would crash triggering release of wlock that crashes too. Now lock release crash does not directly result in the release of wlock. Instead wlock is released at garbage collection time and the error raised at that time "confuses" python.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 18 Nov 2015 01:36:58 -0800
parents 56b2bcea2529
children 8a829fc84bb3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
1 Init repo1:
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
2
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
3 $ hg init repo1
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
4 $ cd repo1
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
5 $ echo "some text" > a
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
6 $ hg add
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
7 adding a
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
8 $ hg ci -m first
13389
3efc99ac2ac4 tests: sort fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 12316
diff changeset
9 $ cat .hg/store/fncache | sort
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
10 data/a.i
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
11
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
12 Testing a.i/b:
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
13
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
14 $ mkdir a.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
15 $ echo "some other text" > a.i/b
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
16 $ hg add
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 14266
diff changeset
17 adding a.i/b (glob)
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
18 $ hg ci -m second
13389
3efc99ac2ac4 tests: sort fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 12316
diff changeset
19 $ cat .hg/store/fncache | sort
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
20 data/a.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
21 data/a.i.hg/b.i
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
22
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
23 Testing a.i.hg/c:
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
24
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
25 $ mkdir a.i.hg
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
26 $ echo "yet another text" > a.i.hg/c
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
27 $ hg add
15447
9910f60a37ee tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents: 14266
diff changeset
28 adding a.i.hg/c (glob)
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
29 $ hg ci -m third
13389
3efc99ac2ac4 tests: sort fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 12316
diff changeset
30 $ cat .hg/store/fncache | sort
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
31 data/a.i
13389
3efc99ac2ac4 tests: sort fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 12316
diff changeset
32 data/a.i.hg.hg/c.i
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
33 data/a.i.hg/b.i
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
34
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
35 Testing verify:
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
36
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
37 $ hg verify
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
38 checking changesets
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
39 checking manifests
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
40 crosschecking files in changesets and manifests
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
41 checking files
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
42 3 files, 3 changesets, 3 total revisions
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
43
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
44 $ rm .hg/store/fncache
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
45
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
46 $ hg verify
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
47 checking changesets
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
48 checking manifests
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
49 crosschecking files in changesets and manifests
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
50 checking files
25627
9573d8f346f1 verify: clarify misleading fncache message
Matt Mackall <mpm@selenic.com>
parents: 23904
diff changeset
51 warning: revlog 'data/a.i' not in fncache!
9573d8f346f1 verify: clarify misleading fncache message
Matt Mackall <mpm@selenic.com>
parents: 23904
diff changeset
52 warning: revlog 'data/a.i.hg/c.i' not in fncache!
9573d8f346f1 verify: clarify misleading fncache message
Matt Mackall <mpm@selenic.com>
parents: 23904
diff changeset
53 warning: revlog 'data/a.i/b.i' not in fncache!
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
54 3 files, 3 changesets, 3 total revisions
25627
9573d8f346f1 verify: clarify misleading fncache message
Matt Mackall <mpm@selenic.com>
parents: 23904
diff changeset
55 3 warnings encountered!
25653
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
56 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
57
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
58 Follow the hint to make sure it works
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
59
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
60 $ hg debugrebuildfncache
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
61 adding data/a.i
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
62 adding data/a.i.hg/c.i
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
63 adding data/a.i/b.i
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
64 3 items added, 0 removed from fncache
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
65
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
66 $ hg verify
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
67 checking changesets
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
68 checking manifests
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
69 crosschecking files in changesets and manifests
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
70 checking files
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
71 3 files, 3 changesets, 3 total revisions
9d1e04f5dca7 verify: print hint to run debugrebuildfncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25652
diff changeset
72
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
73 $ cd ..
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
74
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
75 Non store repo:
7290
a3871028aacf add test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents:
diff changeset
76
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
77 $ hg --config format.usestore=False init foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
78 $ cd foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
79 $ mkdir tst.d
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
80 $ echo foo > tst.d/foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
81 $ hg ci -Amfoo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
82 adding tst.d/foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
83 $ find .hg | sort
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
84 .hg
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
85 .hg/00changelog.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
86 .hg/00manifest.i
15886
a5917346c72e localrepo: update branchcache in a more reliable way
Mads Kiilerich <mads@kiilerich.com>
parents: 15483
diff changeset
87 .hg/cache
20185
7d4219512823 branchmap: cache open/closed branch head information
Brodie Rao <brodie@sf.io>
parents: 18382
diff changeset
88 .hg/cache/branch2-served
23786
7d63398fbfd1 branchmap: use revbranchcache when updating branch map
Mads Kiilerich <madski@unity3d.com>
parents: 23512
diff changeset
89 .hg/cache/rbc-names-v1
7d63398fbfd1 branchmap: use revbranchcache when updating branch map
Mads Kiilerich <madski@unity3d.com>
parents: 23512
diff changeset
90 .hg/cache/rbc-revs-v1
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
91 .hg/data
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
92 .hg/data/tst.d.hg
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
93 .hg/data/tst.d.hg/foo.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
94 .hg/dirstate
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
95 .hg/last-message.txt
15483
9ae766f2f452 phases: set new commit in 1-phase
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 15455
diff changeset
96 .hg/phaseroots
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
97 .hg/requires
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
98 .hg/undo
26998
4414d500604f localrepo: put bookmark move following commit in one transaction
Laurent Charignon <lcharignon@fb.com>
parents: 26587
diff changeset
99 .hg/undo.backup.dirstate
23904
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23786
diff changeset
100 .hg/undo.backupfiles
14266
89e7d35e0ef0 fix bookmarks rollback behavior
Alexander Solovyov <alexander@solovyov.net>
parents: 13389
diff changeset
101 .hg/undo.bookmarks
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
102 .hg/undo.branch
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
103 .hg/undo.desc
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
104 .hg/undo.dirstate
15455
c6f87bdab2a1 phases: add rollback support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 15447
diff changeset
105 .hg/undo.phaseroots
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
106 $ cd ..
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
107
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
108 Non fncache repo:
8633
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
109
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
110 $ hg --config format.usefncache=False init bar
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
111 $ cd bar
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
112 $ mkdir tst.d
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
113 $ echo foo > tst.d/Foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
114 $ hg ci -Amfoo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
115 adding tst.d/Foo
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
116 $ find .hg | sort
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
117 .hg
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
118 .hg/00changelog.i
15886
a5917346c72e localrepo: update branchcache in a more reliable way
Mads Kiilerich <mads@kiilerich.com>
parents: 15483
diff changeset
119 .hg/cache
20185
7d4219512823 branchmap: cache open/closed branch head information
Brodie Rao <brodie@sf.io>
parents: 18382
diff changeset
120 .hg/cache/branch2-served
23786
7d63398fbfd1 branchmap: use revbranchcache when updating branch map
Mads Kiilerich <madski@unity3d.com>
parents: 23512
diff changeset
121 .hg/cache/rbc-names-v1
7d63398fbfd1 branchmap: use revbranchcache when updating branch map
Mads Kiilerich <madski@unity3d.com>
parents: 23512
diff changeset
122 .hg/cache/rbc-revs-v1
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
123 .hg/dirstate
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
124 .hg/last-message.txt
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
125 .hg/requires
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
126 .hg/store
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
127 .hg/store/00changelog.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
128 .hg/store/00manifest.i
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
129 .hg/store/data
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
130 .hg/store/data/tst.d.hg
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
131 .hg/store/data/tst.d.hg/_foo.i
15483
9ae766f2f452 phases: set new commit in 1-phase
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 15455
diff changeset
132 .hg/store/phaseroots
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
133 .hg/store/undo
23904
d251da5e0e84 transaction: include backup file in the "undo" transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23786
diff changeset
134 .hg/store/undo.backupfiles
15455
c6f87bdab2a1 phases: add rollback support
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 15447
diff changeset
135 .hg/store/undo.phaseroots
26998
4414d500604f localrepo: put bookmark move following commit in one transaction
Laurent Charignon <lcharignon@fb.com>
parents: 26587
diff changeset
136 .hg/undo.backup.dirstate
14266
89e7d35e0ef0 fix bookmarks rollback behavior
Alexander Solovyov <alexander@solovyov.net>
parents: 13389
diff changeset
137 .hg/undo.bookmarks
11865
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
138 .hg/undo.branch
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
139 .hg/undo.desc
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
140 .hg/undo.dirstate
400aa8f28f6b tests: unify test-fncache
Adrian Buehlmann <adrian@cadifra.com>
parents: 8721
diff changeset
141 $ cd ..
8633
c31fe74a6633 store encoding: .i/.d encoding for non-store repo (broken by 810387f59696)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 8167
diff changeset
142
17710
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
143 Encoding of reserved / long paths in the store
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
144
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
145 $ hg init r2
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
146 $ cd r2
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
147 $ cat <<EOF > .hg/hgrc
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
148 > [ui]
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
149 > portablefilenames = ignore
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
150 > EOF
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
151
17748
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
152 $ hg import -q --bypass - <<EOF
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
153 > # HG changeset patch
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
154 > # User test
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
155 > # Date 0 0
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
156 > # Node ID 1c7a2f7cb77be1a0def34e4c7cabc562ad98fbd7
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
157 > # Parent 0000000000000000000000000000000000000000
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
158 > 1
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
159 >
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
160 > diff --git a/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
161 > new file mode 100644
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
162 > --- /dev/null
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
163 > +++ b/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
164 > @@ -0,0 +1,1 @@
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
165 > +foo
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
166 > diff --git a/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
167 > new file mode 100644
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
168 > --- /dev/null
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
169 > +++ b/AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH/LOREMIPSUM.TXT
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
170 > @@ -0,0 +1,1 @@
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
171 > +foo
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
172 > diff --git a/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
173 > new file mode 100644
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
174 > --- /dev/null
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
175 > +++ b/Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother/AndThenAnExtremelyLongFileName.txt
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
176 > @@ -0,0 +1,1 @@
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
177 > +foo
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
178 > diff --git a/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
179 > new file mode 100644
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
180 > --- /dev/null
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
181 > +++ b/bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL/normal.c
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
182 > @@ -0,0 +1,1 @@
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
183 > +foo
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
184 > diff --git a/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
185 > new file mode 100644
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
186 > --- /dev/null
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
187 > +++ b/enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
188 > @@ -0,0 +1,1 @@
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
189 > +foo
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
190 > EOF
49f759636aaf test-fncache: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 17710
diff changeset
191
17710
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
192 $ find .hg/store -name *.i | sort
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
193 .hg/store/00changelog.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
194 .hg/store/00manifest.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
195 .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
196 .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
197 .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
198 .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
199 .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
200
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
201 $ cd ..
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
202
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
203 Aborting lock does not prevent fncache writes
17710
95d29533e2ee test-fncache: test reserved / long paths
Adrian Buehlmann <adrian@cadifra.com>
parents: 15886
diff changeset
204
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
205 $ cat > exceptionext.py <<EOF
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
206 > import os
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
207 > from mercurial import commands, error
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
208 > from mercurial.extensions import wrapfunction
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
209 >
26497
ca778cbe94f3 test-fncache: use args/kwargs for lock wrapper
Siddharth Agarwal <sid0@fb.com>
parents: 26475
diff changeset
210 > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs):
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
211 > def releasewrap():
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
212 > raise error.Abort("forced lock failure")
26497
ca778cbe94f3 test-fncache: use args/kwargs for lock wrapper
Siddharth Agarwal <sid0@fb.com>
parents: 26475
diff changeset
213 > return orig(vfs, lockname, wait, releasewrap, *args, **kwargs)
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
214 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
215 > def reposetup(ui, repo):
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
216 > wrapfunction(repo, '_lock', lockexception)
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
217 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
218 > cmdtable = {}
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
219 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
220 > EOF
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
221 $ extpath=`pwd`/exceptionext.py
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
222 $ hg init fncachetxn
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
223 $ cd fncachetxn
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
224 $ printf "[extensions]\nexceptionext=$extpath\n" >> .hg/hgrc
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
225 $ touch y
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
226 $ hg ci -qAm y
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
227 abort: forced lock failure
26998
4414d500604f localrepo: put bookmark move following commit in one transaction
Laurent Charignon <lcharignon@fb.com>
parents: 26587
diff changeset
228 Exception mercurial.error.Abort: Abort('forced lock failure',) in <bound method lock.__del__ of <mercurial.lock.lock object at *>> ignored (glob)
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
229 [255]
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
230 $ cat .hg/store/fncache
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
231 data/y.i
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
232
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
233 Aborting transaction prevents fncache change
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
234
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
235 $ cat > ../exceptionext.py <<EOF
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
236 > import os
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
237 > from mercurial import commands, error, localrepo
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
238 > from mercurial.extensions import wrapfunction
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
239 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
240 > def wrapper(orig, self, *args, **kwargs):
23510
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
241 > tr = orig(self, *args, **kwargs)
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
242 > def fail(tr):
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
243 > raise error.Abort("forced transaction failure")
23510
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
244 > # zzz prefix to ensure it sorted after store.write
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
245 > tr.addfinalize('zzz-forcefails', fail)
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
246 > return tr
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
247 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
248 > def uisetup(ui):
23510
065c0334846f fncache: drop dedicated 'onclose' function in favor of 'tr.addfinalize'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23063
diff changeset
249 > wrapfunction(localrepo.localrepository, 'transaction', wrapper)
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
250 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
251 > cmdtable = {}
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
252 >
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
253 > EOF
21760
a7f5967ff644 tests: ignore missing file with PYTHONDONTWRITEBYTECODE (issue4239)
Matt Mackall <mpm@selenic.com>
parents: 20883
diff changeset
254 $ rm -f "${extpath}c"
20883
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
255 $ touch z
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
256 $ hg ci -qAm z
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
257 transaction abort!
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
258 rollback completed
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
259 abort: forced transaction failure
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
260 [255]
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
261 $ cat .hg/store/fncache
cd443c7589cc fncache: move fncache writing to be in a transaction
Durham Goode <durham@fb.com>
parents: 20185
diff changeset
262 data/y.i
23063
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
263
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
264 Aborted transactions can be recovered later
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
265
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
266 $ cat > ../exceptionext.py <<EOF
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
267 > import os
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
268 > from mercurial import commands, error, transaction, localrepo
23063
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
269 > from mercurial.extensions import wrapfunction
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
270 >
23512
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
271 > def trwrapper(orig, self, *args, **kwargs):
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
272 > tr = orig(self, *args, **kwargs)
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
273 > def fail(tr):
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
274 > raise error.Abort("forced transaction failure")
23512
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
275 > # zzz prefix to ensure it sorted after store.write
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
276 > tr.addfinalize('zzz-forcefails', fail)
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
277 > return tr
23063
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
278 >
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
279 > def abortwrapper(orig, self, *args, **kwargs):
26587
56b2bcea2529 error: get Abort from 'error' instead of 'util'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 26497
diff changeset
280 > raise error.Abort("forced transaction failure")
23063
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
281 >
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
282 > def uisetup(ui):
23512
0ff6b65afeb0 transaction: remove the redundant 'onclose' mechanism
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23510
diff changeset
283 > wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
23063
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
284 > wrapfunction(transaction.transaction, '_abort', abortwrapper)
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
285 >
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
286 > cmdtable = {}
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
287 >
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
288 > EOF
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
289 $ rm -f "${extpath}c"
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
290 $ hg up -q 1
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
291 $ touch z
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
292 $ hg ci -qAm z 2>/dev/null
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
293 [255]
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
294 $ cat .hg/store/fncache | sort
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
295 data/y.i
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
296 data/z.i
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
297 $ hg recover
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
298 rolling back interrupted transaction
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
299 checking changesets
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
300 checking manifests
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
301 crosschecking files in changesets and manifests
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
302 checking files
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
303 1 files, 1 changesets, 1 total revisions
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
304 $ cat .hg/store/fncache
cd86a6707159 transactions: fix hg recover with fncache backups
Durham Goode <durham@fb.com>
parents: 21760
diff changeset
305 data/y.i
25652
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
306
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
307 $ cd ..
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
308
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
309 debugrebuildfncache does nothing unless repo has fncache requirement
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
310
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
311 $ hg --config format.usefncache=false init nofncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
312 $ cd nofncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
313 $ hg debugrebuildfncache
25874
3e84f40232c7 repair: fix typo in warning message
Wagner Bruna <wbruna@yahoo.com>
parents: 25653
diff changeset
314 (not rebuilding fncache because repository does not support fncache)
25652
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
315
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
316 $ cd ..
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
317
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
318 debugrebuildfncache works on empty repository
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
319
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
320 $ hg init empty
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
321 $ cd empty
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
322 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
323 fncache already up to date
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
324 $ cd ..
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
325
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
326 debugrebuildfncache on an up to date repository no-ops
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
327
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
328 $ hg init repo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
329 $ cd repo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
330 $ echo initial > foo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
331 $ echo initial > .bar
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
332 $ hg commit -A -m initial
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
333 adding .bar
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
334 adding foo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
335
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
336 $ cat .hg/store/fncache | sort
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
337 data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
338 data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
339
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
340 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
341 fncache already up to date
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
342
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
343 debugrebuildfncache restores deleted fncache file
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
344
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
345 $ rm -f .hg/store/fncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
346 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
347 adding data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
348 adding data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
349 2 items added, 0 removed from fncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
350
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
351 $ cat .hg/store/fncache | sort
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
352 data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
353 data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
354
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
355 Rebuild after rebuild should no-op
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
356
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
357 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
358 fncache already up to date
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
359
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
360 A single missing file should get restored, an extra file should be removed
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
361
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
362 $ cat > .hg/store/fncache << EOF
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
363 > data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
364 > data/bad-entry.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
365 > EOF
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
366
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
367 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
368 removing data/bad-entry.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
369 adding data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
370 1 items added, 1 removed from fncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
371
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
372 $ cat .hg/store/fncache | sort
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
373 data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
374 data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
375
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
376 $ cd ..
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
377
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
378 Try a simple variation without dotencode to ensure fncache is ignorant of encoding
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
379
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
380 $ hg --config format.dotencode=false init nodotencode
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
381 $ cd nodotencode
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
382 $ echo initial > foo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
383 $ echo initial > .bar
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
384 $ hg commit -A -m initial
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
385 adding .bar
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
386 adding foo
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
387
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
388 $ cat .hg/store/fncache | sort
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
389 data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
390 data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
391
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
392 $ rm .hg/store/fncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
393 $ hg debugrebuildfncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
394 adding data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
395 adding data/foo.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
396 2 items added, 0 removed from fncache
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
397
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
398 $ cat .hg/store/fncache | sort
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
399 data/.bar.i
2882d6886919 repair: add functionality to rebuild fncache
Gregory Szorc <gregory.szorc@gmail.com>
parents: 25627
diff changeset
400 data/foo.i