annotate tests/test-journal-share.t @ 30189:4999c12c526b stable

largefiles: test coverage of fatal interruption of update Test using existing changesets in a clean working directory, revealing problems with files that don't show up as modified or do show up as removed when they just not have been written yet.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 16 Oct 2016 02:26:38 +0200
parents 0103b673d6ca
children 9843e3d9f4b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29503
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
1 Journal extension test: tests the share extension support
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
3 $ cat >> testmocks.py << EOF
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
4 > # mock out util.getuser() and util.makedate() to supply testable values
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
5 > import os
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
6 > from mercurial import util
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
7 > def mockgetuser():
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
8 > return 'foobar'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
9 >
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
10 > def mockmakedate():
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
11 > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
12 > try:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
13 > with open(filename, 'rb') as timef:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
14 > time = float(timef.read()) + 1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
15 > except IOError:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
16 > time = 0.0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
17 > with open(filename, 'wb') as timef:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
18 > timef.write(str(time))
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
19 > return (time, 0)
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
20 >
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
21 > util.getuser = mockgetuser
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
22 > util.makedate = mockmakedate
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
23 > EOF
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
24
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
25 $ cat >> $HGRCPATH << EOF
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
26 > [extensions]
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
27 > journal=
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
28 > share=
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
29 > testmocks=`pwd`/testmocks.py
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
30 > [remotenames]
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
31 > rename.default=remote
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
32 > EOF
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
33
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
34 $ hg init repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
35 $ cd repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
36 $ hg bookmark bm
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
37 $ touch file0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
38 $ hg commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
39 adding file0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
40 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
41 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
42 5640b525682e . commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
43 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
44
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
45 A shared working copy initially receives the same bookmarks and working copy
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
46
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
47 $ cd ..
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
48 $ hg share repo shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
49 updating working directory
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
51 $ cd shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
52 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
53 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
54 5640b525682e . share repo shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
55
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
56 unless you explicitly share bookmarks
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
57
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
58 $ cd ..
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
59 $ hg share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
60 updating working directory
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
61 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
62 $ cd shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
63 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
64 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
65 5640b525682e . share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
66 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
67
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
68 Moving the bookmark in the original repository is only shown in the repository
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
69 that shares bookmarks
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
70
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
71 $ cd ../repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
72 $ touch file1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
73 $ hg commit -Am "file1 added"
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
74 adding file1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
75 $ cd ../shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
76 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
77 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
78 5640b525682e . share repo shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
79 $ cd ../shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
80 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
81 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
82 6432d239ac5d bm commit -Am 'file1 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
83 5640b525682e . share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
84 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
85
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
86 But working copy changes are always 'local'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
87
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
88 $ cd ../repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
89 $ hg up 0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
90 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
91 (leaving bookmark bm)
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
92 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
93 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
94 5640b525682e . up 0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
95 6432d239ac5d . commit -Am 'file1 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
96 6432d239ac5d bm commit -Am 'file1 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
97 5640b525682e . commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
98 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
99 $ cd ../shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
100 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
101 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
102 6432d239ac5d bm commit -Am 'file1 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
103 5640b525682e . share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
104 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
105 $ hg up tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
107 $ hg up 0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
108 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
109 $ hg journal
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
110 previous locations of '.':
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
111 5640b525682e up 0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
112 6432d239ac5d up tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
113 5640b525682e share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
114
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
115 Unsharing works as expected; the journal remains consistent
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
116
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
117 $ cd ../shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
118 $ hg unshare
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
119 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
120 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
121 5640b525682e . share repo shared1
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
122 $ cd ../shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
123 $ hg unshare
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
124 $ hg journal --all
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
125 previous locations of the working copy and bookmarks:
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
126 5640b525682e . up 0
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
127 6432d239ac5d . up tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
128 6432d239ac5d bm commit -Am 'file1 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
129 5640b525682e . share --bookmarks repo shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
130 5640b525682e bm commit -Am 'file0 added'
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
131
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
132 New journal entries in the source repo no longer show up in the other working copies
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
133
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
134 $ cd ../repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
135 $ hg bookmark newbm -r tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
136 $ hg journal newbm
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
137 previous locations of 'newbm':
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
138 6432d239ac5d bookmark newbm -r tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
139 $ cd ../shared2
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
140 $ hg journal newbm
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
141 previous locations of 'newbm':
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
142 no recorded locations
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
143
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
144 This applies for both directions
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
145
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
146 $ hg bookmark shared2bm -r tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
147 $ hg journal shared2bm
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
148 previous locations of 'shared2bm':
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
149 6432d239ac5d bookmark shared2bm -r tip
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
150 $ cd ../repo
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
151 $ hg journal shared2bm
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
152 previous locations of 'shared2bm':
0103b673d6ca journal: add share extension support
Martijn Pieters <mjpieters@fb.com>
parents:
diff changeset
153 no recorded locations