##// END OF EJS Templates
largefiles: test lfconvert with rename, remove, and merge
Greg Ward -
r15342:b2e00d67 stable
parent child Browse files
Show More
@@ -1,114 +1,205 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > largefiles =
4 4 > share =
5 > graphlog =
5 6 > [largefiles]
6 7 > minsize = 0.5
7 8 > patterns = **.dat
8 9 > EOF
9 10
10 11 "lfconvert" works
11 12 $ hg init bigfile-repo
12 13 $ cd bigfile-repo
13 14 $ cat >> .hg/hgrc <<EOF
14 15 > [extensions]
15 16 > largefiles = !
16 17 > EOF
17 18 $ mkdir sub
18 19 $ dd if=/dev/zero bs=1k count=256 > large 2> /dev/null
19 20 $ echo normal > normal1
20 21 $ echo alsonormal > sub/normal2
21 22 $ dd if=/dev/zero bs=1k count=10 > sub/maybelarge.dat 2> /dev/null
22 23 $ hg addremove
23 24 adding large
24 25 adding normal1
25 26 adding sub/maybelarge.dat
26 27 adding sub/normal2
27 28 $ hg commit -m"add large, normal1" large normal1
28 29 $ hg commit -m"add sub/*" sub
29 30 $ [ -d .hg/largefiles ] && echo fail || echo pass
30 31 pass
31 32 $ cd ..
32 33 $ hg lfconvert --size 0.2 bigfile-repo largefiles-repo
33 34 initializing destination largefiles-repo
34 35
35 36 "lfconvert" converts content correctly
36 37 $ cd largefiles-repo
37 38 $ hg up
38 39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 40 getting changed largefiles
40 41 2 largefiles updated, 0 removed
41 42 $ hg locate
42 43 .hglf/large
43 44 .hglf/sub/maybelarge.dat
44 45 normal1
45 46 sub/normal2
46 47 $ cat normal1
47 48 normal
48 49 $ cat sub/normal2
49 50 alsonormal
50 51 $ sha1sum large sub/maybelarge.dat
51 52 2e000fa7e85759c7f4c254d4d9c33ef481e459a7 large
52 53 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c sub/maybelarge.dat
53 54
54 55 "lfconvert" adds 'largefiles' to .hg/requires.
55 56 $ cat .hg/requires
56 57 largefiles
57 58 revlogv1
58 59 fncache
59 60 store
60 61 dotencode
61 62
62 63 "lfconvert" includes a newline at the end of the standin files.
63 64 $ cat .hglf/large .hglf/sub/maybelarge.dat
64 65 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
65 66 34e163be8e43c5631d8b92e9c43ab0bf0fa62b9c
66 67
67 68 add another largefile to the new largefiles repo
68 69 $ dd if=/dev/zero bs=1k count=1k > anotherlarge 2> /dev/null
69 70 $ hg add --lfsize=1 anotherlarge
70 71 $ hg commit -m "add anotherlarge (should be a largefile)"
71 72 $ cat .hglf/large .hglf/anotherlarge
72 73 2e000fa7e85759c7f4c254d4d9c33ef481e459a7
73 74 3b71f43ff30f4b15b5cd85dd9e95ebc7e84eb5a3
74 75 $ cd ..
75 76
77 add some changesets to rename/remove/merge
78 $ cd bigfile-repo
79 $ hg mv -q sub stuff
80 $ hg commit -m"rename sub/ to stuff/"
81 $ hg update -q 1
82 $ echo blah >> normal3
83 $ echo blah >> sub/normal2
84 $ echo blah >> sub/maybelarge.dat
85 $ sha1sum sub/maybelarge.dat
86 76236b6a2c6102826c61af4297dd738fb3b1de38 sub/maybelarge.dat
87 $ hg commit -A -m"add normal3, modify sub/*"
88 adding normal3
89 created new head
90 $ hg rm large normal3
91 $ hg commit -q -m"remove large, normal3"
92 $ hg merge
93 merging sub/maybelarge.dat and stuff/maybelarge.dat to stuff/maybelarge.dat
94 warning: $TESTTMP/bigfile-repo/stuff/maybelarge.dat looks like a binary file.
95 merging stuff/maybelarge.dat failed!
96 merging sub/normal2 and stuff/normal2 to stuff/normal2
97 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
99 [1]
100 $ hg cat -r . sub/maybelarge.dat > stuff/maybelarge.dat
101 $ hg resolve -m stuff/maybelarge.dat
102 $ hg commit -m"merge"
103 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
104 @ 5:4884f215abda merge
105 |\
106 | o 4:7285f817b77e remove large, normal3
107 | |
108 | o 3:67e3892e3534 add normal3, modify sub/*
109 | |
110 o | 2:c96c8beb5d56 rename sub/ to stuff/
111 |/
112 o 1:020c65d24e11 add sub/*
113 |
114 o 0:117b8328f97a add large, normal1
115
116 $ cd ..
117
118 lfconvert with rename, merge, and remove
119 $ hg lfconvert --size 0.2 bigfile-repo largefiles2-repo
120 initializing destination largefiles2-repo
121 $ cd largefiles2-repo
122 $ hg glog --template "{rev}:{node|short} {desc|firstline}\n"
123 o 5:8e05f5f2b77e merge
124 |\
125 | o 4:a5a02de7a8e4 remove large, normal3
126 | |
127 | o 3:55759520c76f add normal3, modify sub/*
128 | |
129 o | 2:261ad3f3f037 rename sub/ to stuff/
130 |/
131 o 1:334e5237836d add sub/*
132 |
133 o 0:d4892ec57ce2 add large, normal1
134
135 $ hg locate -r 2
136 .hglf/large
137 .hglf/stuff/maybelarge.dat
138 normal1
139 stuff/normal2
140 $ hg locate -r 3
141 .hglf/large
142 .hglf/sub/maybelarge.dat
143 normal1
144 normal3
145 sub/normal2
146 $ hg locate -r 4
147 .hglf/sub/maybelarge.dat
148 normal1
149 sub/normal2
150 $ hg locate -r 5
151 .hglf/stuff/maybelarge.dat
152 normal1
153 stuff/normal2
154 $ hg update
155 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 getting changed largefiles
157 1 largefiles updated, 0 removed
158 $ cat stuff/normal2
159 alsonormal
160 blah
161 $ sha1sum stuff/maybelarge.dat
162 76236b6a2c6102826c61af4297dd738fb3b1de38 stuff/maybelarge.dat
163 $ cat .hglf/stuff/maybelarge.dat
164 76236b6a2c6102826c61af4297dd738fb3b1de38
165 $ cd ..
166
76 167 "lfconvert" error cases
77 168 $ hg lfconvert http://localhost/foo foo
78 169 abort: http://localhost/foo is not a local Mercurial repo
79 170 [255]
80 171 $ hg lfconvert foo ssh://localhost/foo
81 172 abort: ssh://localhost/foo is not a local Mercurial repo
82 173 [255]
83 174 $ hg lfconvert nosuchrepo foo
84 175 abort: repository nosuchrepo not found!
85 176 [255]
86 177 $ hg share -q -U bigfile-repo shared
87 178 $ echo -n bogus > shared/.hg/sharedpath
88 179 $ hg lfconvert shared foo
89 180 abort: .hg/sharedpath points to nonexistent directory $TESTTMP/bogus!
90 181 [255]
91 182 $ hg lfconvert bigfile-repo largefiles-repo
92 183 initializing destination largefiles-repo
93 184 abort: repository largefiles-repo already exists!
94 185 [255]
95 186
96 187 Convert back to a normal (non-largefiles) repo
97 188 $ cd largefiles-repo
98 189 $ hg lfconvert --to-normal . ../normal-repo
99 190 initializing destination ../normal-repo
100 191 $ cd ../normal-repo
101 192 $ cat >> .hg/hgrc <<EOF
102 193 > [extensions]
103 194 > largefiles = !
104 195 > EOF
105 196 $ hg update
106 197 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 198 $ hg locate
108 199 anotherlarge
109 200 large
110 201 normal1
111 202 sub/maybelarge.dat
112 203 sub/normal2
113 204 $ [ -d .hg/largefiles ] && echo fail || echo pass
114 205 pass
General Comments 0
You need to be logged in to leave comments. Login now