Show More
@@ -1,395 +1,398 b'' | |||
|
1 | $ "$TESTDIR/hghave" unix-permissions || exit 80 | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | > [extensions] |
|
5 | 3 | > convert= |
|
6 | 4 | > [convert] |
|
7 | 5 | > hg.saverev=False |
|
8 | 6 | > EOF |
|
9 | 7 | $ hg help convert |
|
10 | 8 | hg convert [OPTION]... SOURCE [DEST [REVMAP]] |
|
11 | 9 | |
|
12 | 10 | convert a foreign SCM repository to a Mercurial one. |
|
13 | 11 | |
|
14 | 12 | Accepted source formats [identifiers]: |
|
15 | 13 | |
|
16 | 14 | - Mercurial [hg] |
|
17 | 15 | - CVS [cvs] |
|
18 | 16 | - Darcs [darcs] |
|
19 | 17 | - git [git] |
|
20 | 18 | - Subversion [svn] |
|
21 | 19 | - Monotone [mtn] |
|
22 | 20 | - GNU Arch [gnuarch] |
|
23 | 21 | - Bazaar [bzr] |
|
24 | 22 | - Perforce [p4] |
|
25 | 23 | |
|
26 | 24 | Accepted destination formats [identifiers]: |
|
27 | 25 | |
|
28 | 26 | - Mercurial [hg] |
|
29 | 27 | - Subversion [svn] (history on branches is not preserved) |
|
30 | 28 | |
|
31 | 29 | If no revision is given, all revisions will be converted. Otherwise, |
|
32 | 30 | convert will only import up to the named revision (given in a format |
|
33 | 31 | understood by the source). |
|
34 | 32 | |
|
35 | 33 | If no destination directory name is specified, it defaults to the basename |
|
36 | 34 | of the source with "-hg" appended. If the destination repository doesn't |
|
37 | 35 | exist, it will be created. |
|
38 | 36 | |
|
39 | 37 | By default, all sources except Mercurial will use --branchsort. Mercurial |
|
40 | 38 | uses --sourcesort to preserve original revision numbers order. Sort modes |
|
41 | 39 | have the following effects: |
|
42 | 40 | |
|
43 | 41 | --branchsort convert from parent to child revision when possible, which |
|
44 | 42 | means branches are usually converted one after the other. |
|
45 | 43 | It generates more compact repositories. |
|
46 | 44 | --datesort sort revisions by date. Converted repositories have good- |
|
47 | 45 | looking changelogs but are often an order of magnitude |
|
48 | 46 | larger than the same ones generated by --branchsort. |
|
49 | 47 | --sourcesort try to preserve source revisions order, only supported by |
|
50 | 48 | Mercurial sources. |
|
51 | 49 | |
|
52 | 50 | If "REVMAP" isn't given, it will be put in a default location |
|
53 | 51 | ("<dest>/.hg/shamap" by default). The "REVMAP" is a simple text file that |
|
54 | 52 | maps each source commit ID to the destination ID for that revision, like |
|
55 | 53 | so: |
|
56 | 54 | |
|
57 | 55 | <source ID> <destination ID> |
|
58 | 56 | |
|
59 | 57 | If the file doesn't exist, it's automatically created. It's updated on |
|
60 | 58 | each commit copied, so "hg convert" can be interrupted and can be run |
|
61 | 59 | repeatedly to copy new commits. |
|
62 | 60 | |
|
63 | 61 | The authormap is a simple text file that maps each source commit author to |
|
64 | 62 | a destination commit author. It is handy for source SCMs that use unix |
|
65 | 63 | logins to identify authors (eg: CVS). One line per author mapping and the |
|
66 | 64 | line format is: |
|
67 | 65 | |
|
68 | 66 | source author = destination author |
|
69 | 67 | |
|
70 | 68 | Empty lines and lines starting with a "#" are ignored. |
|
71 | 69 | |
|
72 | 70 | The filemap is a file that allows filtering and remapping of files and |
|
73 | 71 | directories. Each line can contain one of the following directives: |
|
74 | 72 | |
|
75 | 73 | include path/to/file-or-dir |
|
76 | 74 | |
|
77 | 75 | exclude path/to/file-or-dir |
|
78 | 76 | |
|
79 | 77 | rename path/to/source path/to/destination |
|
80 | 78 | |
|
81 | 79 | Comment lines start with "#". A specified path matches if it equals the |
|
82 | 80 | full relative name of a file or one of its parent directories. The |
|
83 | 81 | "include" or "exclude" directive with the longest matching path applies, |
|
84 | 82 | so line order does not matter. |
|
85 | 83 | |
|
86 | 84 | The "include" directive causes a file, or all files under a directory, to |
|
87 | 85 | be included in the destination repository, and the exclusion of all other |
|
88 | 86 | files and directories not explicitly included. The "exclude" directive |
|
89 | 87 | causes files or directories to be omitted. The "rename" directive renames |
|
90 | 88 | a file or directory if it is converted. To rename from a subdirectory into |
|
91 | 89 | the root of the repository, use "." as the path to rename to. |
|
92 | 90 | |
|
93 | 91 | The splicemap is a file that allows insertion of synthetic history, |
|
94 | 92 | letting you specify the parents of a revision. This is useful if you want |
|
95 | 93 | to e.g. give a Subversion merge two parents, or graft two disconnected |
|
96 | 94 | series of history together. Each entry contains a key, followed by a |
|
97 | 95 | space, followed by one or two comma-separated values: |
|
98 | 96 | |
|
99 | 97 | key parent1, parent2 |
|
100 | 98 | |
|
101 | 99 | The key is the revision ID in the source revision control system whose |
|
102 | 100 | parents should be modified (same format as a key in .hg/shamap). The |
|
103 | 101 | values are the revision IDs (in either the source or destination revision |
|
104 | 102 | control system) that should be used as the new parents for that node. For |
|
105 | 103 | example, if you have merged "release-1.0" into "trunk", then you should |
|
106 | 104 | specify the revision on "trunk" as the first parent and the one on the |
|
107 | 105 | "release-1.0" branch as the second. |
|
108 | 106 | |
|
109 | 107 | The branchmap is a file that allows you to rename a branch when it is |
|
110 | 108 | being brought in from whatever external repository. When used in |
|
111 | 109 | conjunction with a splicemap, it allows for a powerful combination to help |
|
112 | 110 | fix even the most badly mismanaged repositories and turn them into nicely |
|
113 | 111 | structured Mercurial repositories. The branchmap contains lines of the |
|
114 | 112 | form: |
|
115 | 113 | |
|
116 | 114 | original_branch_name new_branch_name |
|
117 | 115 | |
|
118 | 116 | where "original_branch_name" is the name of the branch in the source |
|
119 | 117 | repository, and "new_branch_name" is the name of the branch is the |
|
120 | 118 | destination repository. No whitespace is allowed in the branch names. This |
|
121 | 119 | can be used to (for instance) move code in one repository from "default" |
|
122 | 120 | to a named branch. |
|
123 | 121 | |
|
124 | 122 | Mercurial Source |
|
125 | 123 | '''''''''''''''' |
|
126 | 124 | |
|
127 | 125 | The Mercurial source recognizes the following configuration options, which |
|
128 | 126 | you can set on the command line with "--config": |
|
129 | 127 | |
|
130 | 128 | convert.hg.ignoreerrors |
|
131 | 129 | ignore integrity errors when reading. Use it to fix |
|
132 | 130 | Mercurial repositories with missing revlogs, by converting |
|
133 | 131 | from and to Mercurial. Default is False. |
|
134 | 132 | convert.hg.saverev |
|
135 | 133 | store original revision ID in changeset (forces target IDs |
|
136 | 134 | to change). It takes a boolean argument and defaults to |
|
137 | 135 | False. |
|
138 | 136 | convert.hg.startrev |
|
139 | 137 | convert start revision and its descendants. It takes a hg |
|
140 | 138 | revision identifier and defaults to 0. |
|
141 | 139 | |
|
142 | 140 | CVS Source |
|
143 | 141 | '''''''''' |
|
144 | 142 | |
|
145 | 143 | CVS source will use a sandbox (i.e. a checked-out copy) from CVS to |
|
146 | 144 | indicate the starting point of what will be converted. Direct access to |
|
147 | 145 | the repository files is not needed, unless of course the repository is |
|
148 | 146 | ":local:". The conversion uses the top level directory in the sandbox to |
|
149 | 147 | find the CVS repository, and then uses CVS rlog commands to find files to |
|
150 | 148 | convert. This means that unless a filemap is given, all files under the |
|
151 | 149 | starting directory will be converted, and that any directory |
|
152 | 150 | reorganization in the CVS sandbox is ignored. |
|
153 | 151 | |
|
154 | 152 | The following options can be used with "--config": |
|
155 | 153 | |
|
156 | 154 | convert.cvsps.cache |
|
157 | 155 | Set to False to disable remote log caching, for testing and |
|
158 | 156 | debugging purposes. Default is True. |
|
159 | 157 | convert.cvsps.fuzz |
|
160 | 158 | Specify the maximum time (in seconds) that is allowed |
|
161 | 159 | between commits with identical user and log message in a |
|
162 | 160 | single changeset. When very large files were checked in as |
|
163 | 161 | part of a changeset then the default may not be long enough. |
|
164 | 162 | The default is 60. |
|
165 | 163 | convert.cvsps.mergeto |
|
166 | 164 | Specify a regular expression to which commit log messages |
|
167 | 165 | are matched. If a match occurs, then the conversion process |
|
168 | 166 | will insert a dummy revision merging the branch on which |
|
169 | 167 | this log message occurs to the branch indicated in the |
|
170 | 168 | regex. Default is "{{mergetobranch ([-\w]+)}}" |
|
171 | 169 | convert.cvsps.mergefrom |
|
172 | 170 | Specify a regular expression to which commit log messages |
|
173 | 171 | are matched. If a match occurs, then the conversion process |
|
174 | 172 | will add the most recent revision on the branch indicated in |
|
175 | 173 | the regex as the second parent of the changeset. Default is |
|
176 | 174 | "{{mergefrombranch ([-\w]+)}}" |
|
177 | 175 | hook.cvslog Specify a Python function to be called at the end of |
|
178 | 176 | gathering the CVS log. The function is passed a list with |
|
179 | 177 | the log entries, and can modify the entries in-place, or add |
|
180 | 178 | or delete them. |
|
181 | 179 | hook.cvschangesets |
|
182 | 180 | Specify a Python function to be called after the changesets |
|
183 | 181 | are calculated from the the CVS log. The function is passed |
|
184 | 182 | a list with the changeset entries, and can modify the |
|
185 | 183 | changesets in-place, or add or delete them. |
|
186 | 184 | |
|
187 | 185 | An additional "debugcvsps" Mercurial command allows the builtin changeset |
|
188 | 186 | merging code to be run without doing a conversion. Its parameters and |
|
189 | 187 | output are similar to that of cvsps 2.1. Please see the command help for |
|
190 | 188 | more details. |
|
191 | 189 | |
|
192 | 190 | Subversion Source |
|
193 | 191 | ''''''''''''''''' |
|
194 | 192 | |
|
195 | 193 | Subversion source detects classical trunk/branches/tags layouts. By |
|
196 | 194 | default, the supplied "svn://repo/path/" source URL is converted as a |
|
197 | 195 | single branch. If "svn://repo/path/trunk" exists it replaces the default |
|
198 | 196 | branch. If "svn://repo/path/branches" exists, its subdirectories are |
|
199 | 197 | listed as possible branches. If "svn://repo/path/tags" exists, it is |
|
200 | 198 | looked for tags referencing converted branches. Default "trunk", |
|
201 | 199 | "branches" and "tags" values can be overridden with following options. Set |
|
202 | 200 | them to paths relative to the source URL, or leave them blank to disable |
|
203 | 201 | auto detection. |
|
204 | 202 | |
|
205 | 203 | The following options can be set with "--config": |
|
206 | 204 | |
|
207 | 205 | convert.svn.branches |
|
208 | 206 | specify the directory containing branches. The default is |
|
209 | 207 | "branches". |
|
210 | 208 | convert.svn.tags |
|
211 | 209 | specify the directory containing tags. The default is |
|
212 | 210 | "tags". |
|
213 | 211 | convert.svn.trunk |
|
214 | 212 | specify the name of the trunk branch. The default is |
|
215 | 213 | "trunk". |
|
216 | 214 | |
|
217 | 215 | Source history can be retrieved starting at a specific revision, instead |
|
218 | 216 | of being integrally converted. Only single branch conversions are |
|
219 | 217 | supported. |
|
220 | 218 | |
|
221 | 219 | convert.svn.startrev |
|
222 | 220 | specify start Subversion revision number. The default is 0. |
|
223 | 221 | |
|
224 | 222 | Perforce Source |
|
225 | 223 | ''''''''''''''' |
|
226 | 224 | |
|
227 | 225 | The Perforce (P4) importer can be given a p4 depot path or a client |
|
228 | 226 | specification as source. It will convert all files in the source to a flat |
|
229 | 227 | Mercurial repository, ignoring labels, branches and integrations. Note |
|
230 | 228 | that when a depot path is given you then usually should specify a target |
|
231 | 229 | directory, because otherwise the target may be named "...-hg". |
|
232 | 230 | |
|
233 | 231 | It is possible to limit the amount of source history to be converted by |
|
234 | 232 | specifying an initial Perforce revision: |
|
235 | 233 | |
|
236 | 234 | convert.p4.startrev |
|
237 | 235 | specify initial Perforce revision (a Perforce changelist |
|
238 | 236 | number). |
|
239 | 237 | |
|
240 | 238 | Mercurial Destination |
|
241 | 239 | ''''''''''''''''''''' |
|
242 | 240 | |
|
243 | 241 | The following options are supported: |
|
244 | 242 | |
|
245 | 243 | convert.hg.clonebranches |
|
246 | 244 | dispatch source branches in separate clones. The default is |
|
247 | 245 | False. |
|
248 | 246 | convert.hg.tagsbranch |
|
249 | 247 | branch name for tag revisions, defaults to "default". |
|
250 | 248 | convert.hg.usebranchnames |
|
251 | 249 | preserve branch names. The default is True. |
|
252 | 250 | |
|
253 | 251 | options: |
|
254 | 252 | |
|
255 | 253 | -s --source-type TYPE source repository type |
|
256 | 254 | -d --dest-type TYPE destination repository type |
|
257 | 255 | -r --rev REV import up to target revision REV |
|
258 | 256 | -A --authormap FILE remap usernames using this file |
|
259 | 257 | --filemap FILE remap file names using contents of file |
|
260 | 258 | --splicemap FILE splice synthesized history into place |
|
261 | 259 | --branchmap FILE change branch names while converting |
|
262 | 260 | --branchsort try to sort changesets by branches |
|
263 | 261 | --datesort try to sort changesets by date |
|
264 | 262 | --sourcesort preserve source changesets order |
|
265 | 263 | |
|
266 | 264 | use "hg -v help convert" to show more info |
|
267 | 265 | $ hg init a |
|
268 | 266 | $ cd a |
|
269 | 267 | $ echo a > a |
|
270 | 268 | $ hg ci -d'0 0' -Ama |
|
271 | 269 | adding a |
|
272 | 270 | $ hg cp a b |
|
273 | 271 | $ hg ci -d'1 0' -mb |
|
274 | 272 | $ hg rm a |
|
275 | 273 | $ hg ci -d'2 0' -mc |
|
276 | 274 | $ hg mv b a |
|
277 | 275 | $ hg ci -d'3 0' -md |
|
278 | 276 | $ echo a >> a |
|
279 | 277 | $ hg ci -d'4 0' -me |
|
280 | 278 | $ cd .. |
|
281 | 279 | $ hg convert a 2>&1 | grep -v 'subversion python bindings could not be loaded' |
|
282 | 280 | assuming destination a-hg |
|
283 | 281 | initializing destination a-hg repository |
|
284 | 282 | scanning source... |
|
285 | 283 | sorting... |
|
286 | 284 | converting... |
|
287 | 285 | 4 a |
|
288 | 286 | 3 b |
|
289 | 287 | 2 c |
|
290 | 288 | 1 d |
|
291 | 289 | 0 e |
|
292 | 290 | $ hg --cwd a-hg pull ../a |
|
293 | 291 | pulling from ../a |
|
294 | 292 | searching for changes |
|
295 | 293 | no changes found |
|
296 | $ touch bogusfile | |
|
297 | 294 | |
|
298 | should fail | |
|
295 | conversion to existing file should fail | |
|
299 | 296 | |
|
297 | $ touch bogusfile | |
|
300 | 298 | $ hg convert a bogusfile |
|
301 | 299 | initializing destination bogusfile repository |
|
302 | 300 | abort: cannot create new bundle repository |
|
303 | 301 | [255] |
|
302 | ||
|
303 | #if unix-permissions | |
|
304 | ||
|
305 | conversion to dir without permissions should fail | |
|
306 | ||
|
304 | 307 | $ mkdir bogusdir |
|
305 | 308 | $ chmod 000 bogusdir |
|
306 | 309 | |
|
307 | should fail | |
|
308 | ||
|
309 | 310 | $ hg convert a bogusdir |
|
310 | 311 | abort: Permission denied: bogusdir |
|
311 | 312 | [255] |
|
312 | 313 | |
|
313 | should succeed | |
|
314 | user permissions should succeed | |
|
314 | 315 | |
|
315 | 316 | $ chmod 700 bogusdir |
|
316 | 317 | $ hg convert a bogusdir |
|
317 | 318 | initializing destination bogusdir repository |
|
318 | 319 | scanning source... |
|
319 | 320 | sorting... |
|
320 | 321 | converting... |
|
321 | 322 | 4 a |
|
322 | 323 | 3 b |
|
323 | 324 | 2 c |
|
324 | 325 | 1 d |
|
325 | 326 | 0 e |
|
326 | 327 | |
|
328 | #endif | |
|
329 | ||
|
327 | 330 | test pre and post conversion actions |
|
328 | 331 | |
|
329 | 332 | $ echo 'include b' > filemap |
|
330 | 333 | $ hg convert --debug --filemap filemap a partialb | \ |
|
331 | 334 | > grep 'run hg' |
|
332 | 335 | run hg source pre-conversion action |
|
333 | 336 | run hg sink pre-conversion action |
|
334 | 337 | run hg sink post-conversion action |
|
335 | 338 | run hg source post-conversion action |
|
336 | 339 | |
|
337 | 340 | converting empty dir should fail "nicely |
|
338 | 341 | |
|
339 | 342 | $ mkdir emptydir |
|
340 | 343 | |
|
341 | 344 | override $PATH to ensure p4 not visible; use $PYTHON in case we're |
|
342 | 345 | running from a devel copy, not a temp installation |
|
343 | 346 | |
|
344 | 347 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg convert emptydir |
|
345 | 348 | assuming destination emptydir-hg |
|
346 | 349 | initializing destination emptydir-hg repository |
|
347 | 350 | emptydir does not look like a CVS checkout |
|
348 | 351 | emptydir does not look like a Git repository |
|
349 | 352 | emptydir does not look like a Subversion repository |
|
350 | 353 | emptydir is not a local Mercurial repository |
|
351 | 354 | emptydir does not look like a darcs repository |
|
352 | 355 | emptydir does not look like a monotone repository |
|
353 | 356 | emptydir does not look like a GNU Arch repository |
|
354 | 357 | emptydir does not look like a Bazaar repository |
|
355 | 358 | cannot find required "p4" tool |
|
356 | 359 | abort: emptydir: missing or unsupported repository |
|
357 | 360 | [255] |
|
358 | 361 | |
|
359 | 362 | convert with imaginary source type |
|
360 | 363 | |
|
361 | 364 | $ hg convert --source-type foo a a-foo |
|
362 | 365 | initializing destination a-foo repository |
|
363 | 366 | abort: foo: invalid source repository type |
|
364 | 367 | [255] |
|
365 | 368 | |
|
366 | 369 | convert with imaginary sink type |
|
367 | 370 | |
|
368 | 371 | $ hg convert --dest-type foo a a-foo |
|
369 | 372 | abort: foo: invalid destination repository type |
|
370 | 373 | [255] |
|
371 | 374 | |
|
372 | 375 | testing: convert must not produce duplicate entries in fncache |
|
373 | 376 | |
|
374 | 377 | $ hg convert a b |
|
375 | 378 | initializing destination b repository |
|
376 | 379 | scanning source... |
|
377 | 380 | sorting... |
|
378 | 381 | converting... |
|
379 | 382 | 4 a |
|
380 | 383 | 3 b |
|
381 | 384 | 2 c |
|
382 | 385 | 1 d |
|
383 | 386 | 0 e |
|
384 | 387 | |
|
385 | 388 | contents of fncache file: |
|
386 | 389 | |
|
387 | 390 | $ cat b/.hg/store/fncache | sort |
|
388 | 391 | data/a.i |
|
389 | 392 | data/b.i |
|
390 | 393 | |
|
391 | 394 | test bogus URL |
|
392 | 395 | |
|
393 | 396 | $ hg convert -q bzr+ssh://foobar@selenic.com/baz baz |
|
394 | 397 | abort: bzr+ssh://foobar@selenic.com/baz: missing or unsupported repository |
|
395 | 398 | [255] |
@@ -1,525 +1,528 b'' | |||
|
1 | $ "$TESTDIR/hghave" unix-permissions || exit 80 | |
|
2 | ||
|
3 | 1 | Test EOL extension |
|
4 | 2 | |
|
5 | 3 | $ cat >> $HGRCPATH <<EOF |
|
6 | 4 | > [diff] |
|
7 | 5 | > git = True |
|
8 | 6 | > EOF |
|
9 | 7 | |
|
10 | 8 | Set up helpers |
|
11 | 9 | |
|
12 | 10 | $ cat > switch-eol.py <<EOF |
|
13 | 11 | > import sys |
|
14 | 12 | > try: |
|
15 | 13 | > import os, msvcrt |
|
16 | 14 | > msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) |
|
17 | 15 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
18 | 16 | > except ImportError: |
|
19 | 17 | > pass |
|
20 | 18 | > (old, new) = sys.argv[1] == 'LF' and ('\n', '\r\n') or ('\r\n', '\n') |
|
21 | 19 | > print "%% switching encoding from %r to %r" % (old, new) |
|
22 | 20 | > for path in sys.argv[2:]: |
|
23 | 21 | > data = file(path, 'rb').read() |
|
24 | 22 | > data = data.replace(old, new) |
|
25 | 23 | > file(path, 'wb').write(data) |
|
26 | 24 | > EOF |
|
27 | 25 | |
|
28 | 26 | $ seteol () { |
|
29 | 27 | > if [ $1 = "LF" ]; then |
|
30 | 28 | > EOL='\n' |
|
31 | 29 | > else |
|
32 | 30 | > EOL='\r\n' |
|
33 | 31 | > fi |
|
34 | 32 | > } |
|
35 | 33 | |
|
36 | 34 | $ makerepo () { |
|
37 | 35 | > seteol $1 |
|
38 | 36 | > echo "% setup $1 repository" |
|
39 | 37 | > hg init repo |
|
40 | 38 | > cd repo |
|
41 | 39 | > cat > .hgeol <<EOF |
|
42 | 40 | > [repository] |
|
43 | 41 | > native = $1 |
|
44 | 42 | > [patterns] |
|
45 | 43 | > mixed.txt = BIN |
|
46 | 44 | > **.txt = native |
|
47 | 45 | > EOF |
|
48 | 46 | > printf "first${EOL}second${EOL}third${EOL}" > a.txt |
|
49 | 47 | > hg commit --addremove -m 'checkin' |
|
50 | 48 | > echo |
|
51 | 49 | > cd .. |
|
52 | 50 | > } |
|
53 | 51 | |
|
54 | 52 | $ dotest () { |
|
55 | 53 | > seteol $1 |
|
56 | 54 | > echo "% hg clone repo repo-$1" |
|
57 | 55 | > hg clone --noupdate repo repo-$1 |
|
58 | 56 | > cd repo-$1 |
|
59 | 57 | > cat > .hg/hgrc <<EOF |
|
60 | 58 | > [extensions] |
|
61 | 59 | > eol = |
|
62 | 60 | > [eol] |
|
63 | 61 | > native = $1 |
|
64 | 62 | > EOF |
|
65 | 63 | > hg update |
|
66 | 64 | > echo '% a.txt' |
|
67 | 65 | > cat a.txt |
|
68 | 66 | > echo '% hg cat a.txt' |
|
69 | 67 | > hg cat a.txt |
|
70 | 68 | > printf "fourth${EOL}" >> a.txt |
|
71 | 69 | > echo '% a.txt' |
|
72 | 70 | > cat a.txt |
|
73 | 71 | > hg diff |
|
74 | 72 | > python ../switch-eol.py $1 a.txt |
|
75 | 73 | > echo '% hg diff only reports a single changed line:' |
|
76 | 74 | > hg diff |
|
77 | 75 | > echo "% reverting back to $1 format" |
|
78 | 76 | > hg revert a.txt |
|
79 | 77 | > cat a.txt |
|
80 | 78 | > printf "first\r\nsecond\n" > mixed.txt |
|
81 | 79 | > hg add mixed.txt |
|
82 | 80 | > echo "% hg commit of inconsistent .txt file marked as binary (should work)" |
|
83 | 81 | > hg commit -m 'binary file' |
|
84 | 82 | > echo "% hg commit of inconsistent .txt file marked as native (should fail)" |
|
85 | 83 | > printf "first\nsecond\r\nthird\nfourth\r\n" > a.txt |
|
86 | 84 | > hg commit -m 'inconsistent file' |
|
87 | 85 | > echo "% hg commit --config eol.only-consistent=False (should work)" |
|
88 | 86 | > hg commit --config eol.only-consistent=False -m 'inconsistent file' |
|
89 | 87 | > echo "% hg commit of binary .txt file marked as native (binary files always okay)" |
|
90 | 88 | > printf "first${EOL}\0${EOL}third${EOL}" > a.txt |
|
91 | 89 | > hg commit -m 'binary file' |
|
92 | 90 | > cd .. |
|
93 | 91 | > rm -r repo-$1 |
|
94 | 92 | > } |
|
95 | 93 | |
|
96 | 94 | $ makemixedrepo () { |
|
97 | 95 | > echo |
|
98 | 96 | > echo "# setup $1 repository" |
|
99 | 97 | > hg init mixed |
|
100 | 98 | > cd mixed |
|
101 | 99 | > printf "foo\r\nbar\r\nbaz\r\n" > win.txt |
|
102 | 100 | > printf "foo\nbar\nbaz\n" > unix.txt |
|
103 | 101 | > #printf "foo\r\nbar\nbaz\r\n" > mixed.txt |
|
104 | 102 | > hg commit --addremove -m 'created mixed files' |
|
105 | 103 | > echo "# setting repository-native EOLs to $1" |
|
106 | 104 | > cat > .hgeol <<EOF |
|
107 | 105 | > [repository] |
|
108 | 106 | > native = $1 |
|
109 | 107 | > [patterns] |
|
110 | 108 | > **.txt = native |
|
111 | 109 | > EOF |
|
112 | 110 | > hg commit --addremove -m 'added .hgeol' |
|
113 | 111 | > cd .. |
|
114 | 112 | > } |
|
115 | 113 | |
|
116 | 114 | $ testmixed () { |
|
117 | 115 | > echo |
|
118 | 116 | > echo "% hg clone mixed mixed-$1" |
|
119 | 117 | > hg clone mixed mixed-$1 |
|
120 | 118 | > cd mixed-$1 |
|
121 | 119 | > echo '% hg status (eol extension not yet activated)' |
|
122 | 120 | > hg status |
|
123 | 121 | > cat > .hg/hgrc <<EOF |
|
124 | 122 | > [extensions] |
|
125 | 123 | > eol = |
|
126 | 124 | > [eol] |
|
127 | 125 | > native = $1 |
|
128 | 126 | > EOF |
|
129 | 127 | > echo '% hg status (eol activated)' |
|
130 | 128 | > hg status |
|
131 | 129 | > echo '% hg commit' |
|
132 | 130 | > hg commit -m 'synchronized EOLs' |
|
133 | 131 | > echo '% hg status' |
|
134 | 132 | > hg status |
|
135 | 133 | > cd .. |
|
136 | 134 | > rm -r mixed-$1 |
|
137 | 135 | > } |
|
138 | 136 | |
|
139 | 137 | Basic tests |
|
140 | 138 | |
|
141 | 139 | $ makerepo LF |
|
142 | 140 | % setup LF repository |
|
143 | 141 | adding .hgeol |
|
144 | 142 | adding a.txt |
|
145 | 143 | |
|
146 | 144 | $ dotest LF |
|
147 | 145 | % hg clone repo repo-LF |
|
148 | 146 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
149 | 147 | % a.txt |
|
150 | 148 | first |
|
151 | 149 | second |
|
152 | 150 | third |
|
153 | 151 | % hg cat a.txt |
|
154 | 152 | first |
|
155 | 153 | second |
|
156 | 154 | third |
|
157 | 155 | % a.txt |
|
158 | 156 | first |
|
159 | 157 | second |
|
160 | 158 | third |
|
161 | 159 | fourth |
|
162 | 160 | diff --git a/a.txt b/a.txt |
|
163 | 161 | --- a/a.txt |
|
164 | 162 | +++ b/a.txt |
|
165 | 163 | @@ -1,3 +1,4 @@ |
|
166 | 164 | first |
|
167 | 165 | second |
|
168 | 166 | third |
|
169 | 167 | +fourth |
|
170 | 168 | % switching encoding from '\n' to '\r\n' |
|
171 | 169 | % hg diff only reports a single changed line: |
|
172 | 170 | diff --git a/a.txt b/a.txt |
|
173 | 171 | --- a/a.txt |
|
174 | 172 | +++ b/a.txt |
|
175 | 173 | @@ -1,3 +1,4 @@ |
|
176 | 174 | first |
|
177 | 175 | second |
|
178 | 176 | third |
|
179 | 177 | +fourth |
|
180 | 178 | % reverting back to LF format |
|
181 | 179 | first |
|
182 | 180 | second |
|
183 | 181 | third |
|
184 | 182 | % hg commit of inconsistent .txt file marked as binary (should work) |
|
185 | 183 | % hg commit of inconsistent .txt file marked as native (should fail) |
|
186 | 184 | abort: inconsistent newline style in a.txt |
|
187 | 185 | |
|
188 | 186 | % hg commit --config eol.only-consistent=False (should work) |
|
189 | 187 | % hg commit of binary .txt file marked as native (binary files always okay) |
|
190 | 188 | $ dotest CRLF |
|
191 | 189 | % hg clone repo repo-CRLF |
|
192 | 190 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
193 | 191 | % a.txt |
|
194 | 192 | first\r (esc) |
|
195 | 193 | second\r (esc) |
|
196 | 194 | third\r (esc) |
|
197 | 195 | % hg cat a.txt |
|
198 | 196 | first |
|
199 | 197 | second |
|
200 | 198 | third |
|
201 | 199 | % a.txt |
|
202 | 200 | first\r (esc) |
|
203 | 201 | second\r (esc) |
|
204 | 202 | third\r (esc) |
|
205 | 203 | fourth\r (esc) |
|
206 | 204 | diff --git a/a.txt b/a.txt |
|
207 | 205 | --- a/a.txt |
|
208 | 206 | +++ b/a.txt |
|
209 | 207 | @@ -1,3 +1,4 @@ |
|
210 | 208 | first |
|
211 | 209 | second |
|
212 | 210 | third |
|
213 | 211 | +fourth |
|
214 | 212 | % switching encoding from '\r\n' to '\n' |
|
215 | 213 | % hg diff only reports a single changed line: |
|
216 | 214 | diff --git a/a.txt b/a.txt |
|
217 | 215 | --- a/a.txt |
|
218 | 216 | +++ b/a.txt |
|
219 | 217 | @@ -1,3 +1,4 @@ |
|
220 | 218 | first |
|
221 | 219 | second |
|
222 | 220 | third |
|
223 | 221 | +fourth |
|
224 | 222 | % reverting back to CRLF format |
|
225 | 223 | first\r (esc) |
|
226 | 224 | second\r (esc) |
|
227 | 225 | third\r (esc) |
|
228 | 226 | % hg commit of inconsistent .txt file marked as binary (should work) |
|
229 | 227 | % hg commit of inconsistent .txt file marked as native (should fail) |
|
230 | 228 | abort: inconsistent newline style in a.txt |
|
231 | 229 | |
|
232 | 230 | % hg commit --config eol.only-consistent=False (should work) |
|
233 | 231 | % hg commit of binary .txt file marked as native (binary files always okay) |
|
234 | 232 | $ rm -r repo |
|
235 | 233 | $ makerepo CRLF |
|
236 | 234 | % setup CRLF repository |
|
237 | 235 | adding .hgeol |
|
238 | 236 | adding a.txt |
|
239 | 237 | |
|
240 | 238 | $ dotest LF |
|
241 | 239 | % hg clone repo repo-LF |
|
242 | 240 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
243 | 241 | % a.txt |
|
244 | 242 | first |
|
245 | 243 | second |
|
246 | 244 | third |
|
247 | 245 | % hg cat a.txt |
|
248 | 246 | first\r (esc) |
|
249 | 247 | second\r (esc) |
|
250 | 248 | third\r (esc) |
|
251 | 249 | % a.txt |
|
252 | 250 | first |
|
253 | 251 | second |
|
254 | 252 | third |
|
255 | 253 | fourth |
|
256 | 254 | diff --git a/a.txt b/a.txt |
|
257 | 255 | --- a/a.txt |
|
258 | 256 | +++ b/a.txt |
|
259 | 257 | @@ -1,3 +1,4 @@ |
|
260 | 258 | first\r (esc) |
|
261 | 259 | second\r (esc) |
|
262 | 260 | third\r (esc) |
|
263 | 261 | +fourth\r (esc) |
|
264 | 262 | % switching encoding from '\n' to '\r\n' |
|
265 | 263 | % hg diff only reports a single changed line: |
|
266 | 264 | diff --git a/a.txt b/a.txt |
|
267 | 265 | --- a/a.txt |
|
268 | 266 | +++ b/a.txt |
|
269 | 267 | @@ -1,3 +1,4 @@ |
|
270 | 268 | first\r (esc) |
|
271 | 269 | second\r (esc) |
|
272 | 270 | third\r (esc) |
|
273 | 271 | +fourth\r (esc) |
|
274 | 272 | % reverting back to LF format |
|
275 | 273 | first |
|
276 | 274 | second |
|
277 | 275 | third |
|
278 | 276 | % hg commit of inconsistent .txt file marked as binary (should work) |
|
279 | 277 | % hg commit of inconsistent .txt file marked as native (should fail) |
|
280 | 278 | abort: inconsistent newline style in a.txt |
|
281 | 279 | |
|
282 | 280 | % hg commit --config eol.only-consistent=False (should work) |
|
283 | 281 | % hg commit of binary .txt file marked as native (binary files always okay) |
|
284 | 282 | $ dotest CRLF |
|
285 | 283 | % hg clone repo repo-CRLF |
|
286 | 284 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
287 | 285 | % a.txt |
|
288 | 286 | first\r (esc) |
|
289 | 287 | second\r (esc) |
|
290 | 288 | third\r (esc) |
|
291 | 289 | % hg cat a.txt |
|
292 | 290 | first\r (esc) |
|
293 | 291 | second\r (esc) |
|
294 | 292 | third\r (esc) |
|
295 | 293 | % a.txt |
|
296 | 294 | first\r (esc) |
|
297 | 295 | second\r (esc) |
|
298 | 296 | third\r (esc) |
|
299 | 297 | fourth\r (esc) |
|
300 | 298 | diff --git a/a.txt b/a.txt |
|
301 | 299 | --- a/a.txt |
|
302 | 300 | +++ b/a.txt |
|
303 | 301 | @@ -1,3 +1,4 @@ |
|
304 | 302 | first\r (esc) |
|
305 | 303 | second\r (esc) |
|
306 | 304 | third\r (esc) |
|
307 | 305 | +fourth\r (esc) |
|
308 | 306 | % switching encoding from '\r\n' to '\n' |
|
309 | 307 | % hg diff only reports a single changed line: |
|
310 | 308 | diff --git a/a.txt b/a.txt |
|
311 | 309 | --- a/a.txt |
|
312 | 310 | +++ b/a.txt |
|
313 | 311 | @@ -1,3 +1,4 @@ |
|
314 | 312 | first\r (esc) |
|
315 | 313 | second\r (esc) |
|
316 | 314 | third\r (esc) |
|
317 | 315 | +fourth\r (esc) |
|
318 | 316 | % reverting back to CRLF format |
|
319 | 317 | first\r (esc) |
|
320 | 318 | second\r (esc) |
|
321 | 319 | third\r (esc) |
|
322 | 320 | % hg commit of inconsistent .txt file marked as binary (should work) |
|
323 | 321 | % hg commit of inconsistent .txt file marked as native (should fail) |
|
324 | 322 | abort: inconsistent newline style in a.txt |
|
325 | 323 | |
|
326 | 324 | % hg commit --config eol.only-consistent=False (should work) |
|
327 | 325 | % hg commit of binary .txt file marked as native (binary files always okay) |
|
328 | 326 | $ rm -r repo |
|
329 | 327 | |
|
330 | 328 | Mixed tests |
|
331 | 329 | |
|
332 | 330 | $ makemixedrepo LF |
|
333 | 331 | |
|
334 | 332 | # setup LF repository |
|
335 | 333 | adding unix.txt |
|
336 | 334 | adding win.txt |
|
337 | 335 | # setting repository-native EOLs to LF |
|
338 | 336 | adding .hgeol |
|
339 | 337 | $ testmixed LF |
|
340 | 338 | |
|
341 | 339 | % hg clone mixed mixed-LF |
|
342 | 340 | updating to branch default |
|
343 | 341 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
344 | 342 | % hg status (eol extension not yet activated) |
|
345 | 343 | % hg status (eol activated) |
|
346 | 344 | M win.txt |
|
347 | 345 | % hg commit |
|
348 | 346 | % hg status |
|
349 | 347 | $ testmixed CRLF |
|
350 | 348 | |
|
351 | 349 | % hg clone mixed mixed-CRLF |
|
352 | 350 | updating to branch default |
|
353 | 351 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
354 | 352 | % hg status (eol extension not yet activated) |
|
355 | 353 | % hg status (eol activated) |
|
356 | 354 | M win.txt |
|
357 | 355 | % hg commit |
|
358 | 356 | % hg status |
|
359 | 357 | $ rm -r mixed |
|
360 | 358 | $ makemixedrepo CRLF |
|
361 | 359 | |
|
362 | 360 | # setup CRLF repository |
|
363 | 361 | adding unix.txt |
|
364 | 362 | adding win.txt |
|
365 | 363 | # setting repository-native EOLs to CRLF |
|
366 | 364 | adding .hgeol |
|
367 | 365 | $ testmixed LF |
|
368 | 366 | |
|
369 | 367 | % hg clone mixed mixed-LF |
|
370 | 368 | updating to branch default |
|
371 | 369 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
372 | 370 | % hg status (eol extension not yet activated) |
|
373 | 371 | % hg status (eol activated) |
|
374 | 372 | M unix.txt |
|
375 | 373 | % hg commit |
|
376 | 374 | % hg status |
|
377 | 375 | $ testmixed CRLF |
|
378 | 376 | |
|
379 | 377 | % hg clone mixed mixed-CRLF |
|
380 | 378 | updating to branch default |
|
381 | 379 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 380 | % hg status (eol extension not yet activated) |
|
383 | 381 | % hg status (eol activated) |
|
384 | 382 | M unix.txt |
|
385 | 383 | % hg commit |
|
386 | 384 | % hg status |
|
387 | 385 | $ rm -r mixed |
|
388 | 386 | |
|
387 | $ echo '[extensions]' >> $HGRCPATH | |
|
388 | $ echo 'eol =' >> $HGRCPATH | |
|
389 | ||
|
390 | #if unix-permissions | |
|
391 | ||
|
389 | 392 | Test issue2569 -- eol extension takes write lock on reading: |
|
390 | 393 | |
|
391 | $ echo '[extensions]' >> $HGRCPATH | |
|
392 | $ echo 'eol =' >> $HGRCPATH | |
|
393 | 394 | $ hg init repo |
|
394 | 395 | $ cd repo |
|
395 | 396 | $ touch .hgeol |
|
396 | 397 | $ hg status |
|
397 | 398 | ? .hgeol |
|
398 | 399 | $ chmod -R -w .hg |
|
399 | 400 | $ sleep 1 |
|
400 | 401 | $ touch .hgeol |
|
401 | 402 | $ hg status --traceback |
|
402 | 403 | ? .hgeol |
|
403 | 404 | $ chmod -R u+w .hg |
|
404 | 405 | $ cd .. |
|
405 | 406 | |
|
407 | #endif | |
|
408 | ||
|
406 | 409 | Test cleverencode: and cleverdecode: aliases for win32text extension |
|
407 | 410 | |
|
408 | 411 | $ echo '[encode]' >> $HGRCPATH |
|
409 | 412 | $ echo '**.txt = cleverencode:' >> $HGRCPATH |
|
410 | 413 | $ echo '[decode]' >> $HGRCPATH |
|
411 | 414 | $ echo '**.txt = cleverdecode:' >> $HGRCPATH |
|
412 | 415 | |
|
413 | 416 | $ hg init win32compat |
|
414 | 417 | $ cd win32compat |
|
415 | 418 | $ printf "foo\r\nbar\r\nbaz\r\n" > win.txt |
|
416 | 419 | $ printf "foo\nbar\nbaz\n" > unix.txt |
|
417 | 420 | $ hg add |
|
418 | 421 | adding unix.txt |
|
419 | 422 | adding win.txt |
|
420 | 423 | $ hg commit -m checkin |
|
421 | 424 | |
|
422 | 425 | Check that both files have LF line-endings in the repository: |
|
423 | 426 | |
|
424 | 427 | $ hg cat win.txt |
|
425 | 428 | foo |
|
426 | 429 | bar |
|
427 | 430 | baz |
|
428 | 431 | $ hg cat unix.txt |
|
429 | 432 | foo |
|
430 | 433 | bar |
|
431 | 434 | baz |
|
432 | 435 | |
|
433 | 436 | Test handling of a broken .hgeol file: |
|
434 | 437 | |
|
435 | 438 | $ touch .hgeol |
|
436 | 439 | $ hg add .hgeol |
|
437 | 440 | $ hg commit -m 'clean version' |
|
438 | 441 | $ echo "bad" > .hgeol |
|
439 | 442 | $ hg status |
|
440 | 443 | warning: ignoring .hgeol file due to parse error at .hgeol:1: bad |
|
441 | 444 | M .hgeol |
|
442 | 445 | $ hg revert .hgeol |
|
443 | 446 | warning: ignoring .hgeol file due to parse error at .hgeol:1: bad |
|
444 | 447 | $ hg status |
|
445 | 448 | ? .hgeol.orig |
|
446 | 449 | |
|
447 | 450 | Test eol.only-consistent can be specified in .hgeol |
|
448 | 451 | |
|
449 | 452 | $ cd $TESTTMP |
|
450 | 453 | $ hg init only-consistent |
|
451 | 454 | $ cd only-consistent |
|
452 | 455 | $ printf "first\nsecond\r\n" > a.txt |
|
453 | 456 | $ hg add a.txt |
|
454 | 457 | $ cat > .hgeol << EOF |
|
455 | 458 | > [eol] |
|
456 | 459 | > only-consistent = True |
|
457 | 460 | > EOF |
|
458 | 461 | $ hg commit -m 'inconsistent' |
|
459 | 462 | abort: inconsistent newline style in a.txt |
|
460 | 463 | |
|
461 | 464 | [255] |
|
462 | 465 | $ cat > .hgeol << EOF |
|
463 | 466 | > [eol] |
|
464 | 467 | > only-consistent = False |
|
465 | 468 | > EOF |
|
466 | 469 | $ hg commit -m 'consistent' |
|
467 | 470 | |
|
468 | 471 | |
|
469 | 472 | Test trailing newline |
|
470 | 473 | |
|
471 | 474 | $ cat >> $HGRCPATH <<EOF |
|
472 | 475 | > [extensions] |
|
473 | 476 | > eol= |
|
474 | 477 | > EOF |
|
475 | 478 | |
|
476 | 479 | setup repository |
|
477 | 480 | |
|
478 | 481 | $ cd $TESTTMP |
|
479 | 482 | $ hg init trailing |
|
480 | 483 | $ cd trailing |
|
481 | 484 | $ cat > .hgeol <<EOF |
|
482 | 485 | > [patterns] |
|
483 | 486 | > **.txt = native |
|
484 | 487 | > [eol] |
|
485 | 488 | > fix-trailing-newline = False |
|
486 | 489 | > EOF |
|
487 | 490 | |
|
488 | 491 | add text without trailing newline |
|
489 | 492 | |
|
490 | 493 | $ printf "first\nsecond" > a.txt |
|
491 | 494 | $ hg commit --addremove -m 'checking in' |
|
492 | 495 | adding .hgeol |
|
493 | 496 | adding a.txt |
|
494 | 497 | $ rm a.txt |
|
495 | 498 | $ hg update -C -q |
|
496 | 499 | $ cat a.txt |
|
497 | 500 | first |
|
498 | 501 | second (no-eol) |
|
499 | 502 | |
|
500 | 503 | $ cat > .hgeol <<EOF |
|
501 | 504 | > [patterns] |
|
502 | 505 | > **.txt = native |
|
503 | 506 | > [eol] |
|
504 | 507 | > fix-trailing-newline = True |
|
505 | 508 | > EOF |
|
506 | 509 | $ printf "third\nfourth" > a.txt |
|
507 | 510 | $ hg commit -m 'checking in with newline fix' |
|
508 | 511 | $ rm a.txt |
|
509 | 512 | $ hg update -C -q |
|
510 | 513 | $ cat a.txt |
|
511 | 514 | third |
|
512 | 515 | fourth |
|
513 | 516 | |
|
514 | 517 | append a line without trailing newline |
|
515 | 518 | |
|
516 | 519 | $ printf "fifth" >> a.txt |
|
517 | 520 | $ hg commit -m 'adding another line line' |
|
518 | 521 | $ rm a.txt |
|
519 | 522 | $ hg update -C -q |
|
520 | 523 | $ cat a.txt |
|
521 | 524 | third |
|
522 | 525 | fourth |
|
523 | 526 | fifth |
|
524 | 527 | |
|
525 | 528 | $ cd .. |
@@ -1,123 +1,125 b'' | |||
|
1 | $ "$TESTDIR/hghave" unix-permissions || exit 80 | |
|
2 | ||
|
3 | 1 | Create user cache directory |
|
4 | 2 | |
|
5 | 3 | $ USERCACHE=`pwd`/cache; export USERCACHE |
|
6 | 4 | $ cat <<EOF >> ${HGRCPATH} |
|
7 | 5 | > [extensions] |
|
8 | 6 | > hgext.largefiles= |
|
9 | 7 | > [largefiles] |
|
10 | 8 | > usercache=${USERCACHE} |
|
11 | 9 | > EOF |
|
12 | 10 | $ mkdir -p ${USERCACHE} |
|
13 | 11 | |
|
14 | 12 | Create source repo, and commit adding largefile. |
|
15 | 13 | |
|
16 | 14 | $ hg init src |
|
17 | 15 | $ cd src |
|
18 | 16 | $ echo large > large |
|
19 | 17 | $ hg add --large large |
|
20 | 18 | $ hg commit -m 'add largefile' |
|
21 | 19 | $ cd .. |
|
22 | 20 | |
|
23 | 21 | Discard all cached largefiles in USERCACHE |
|
24 | 22 | |
|
25 | 23 | $ rm -rf ${USERCACHE} |
|
26 | 24 | |
|
27 | 25 | Create mirror repo, and pull from source without largefile: |
|
28 | 26 | "pull" is used instead of "clone" for suppression of (1) updating to |
|
29 | 27 | tip (= cahcing largefile from source repo), and (2) recording source |
|
30 | 28 | repo as "default" path in .hg/hgrc. |
|
31 | 29 | |
|
32 | 30 | $ hg init mirror |
|
33 | 31 | $ cd mirror |
|
34 | 32 | $ hg pull ../src |
|
35 | 33 | pulling from ../src |
|
36 | 34 | requesting all changes |
|
37 | 35 | adding changesets |
|
38 | 36 | adding manifests |
|
39 | 37 | adding file changes |
|
40 | 38 | added 1 changesets with 1 changes to 1 files |
|
41 | 39 | (run 'hg update' to get a working copy) |
|
42 | 40 | caching new largefiles |
|
43 | 41 | 0 largefiles cached |
|
44 | 42 | |
|
45 | 43 | Update working directory to "tip", which requires largefile("large"), |
|
46 | 44 | but there is no cache file for it. So, hg must treat it as |
|
47 | 45 | "missing"(!) file. |
|
48 | 46 | |
|
49 | 47 | $ hg update |
|
50 | 48 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
51 | 49 | getting changed largefiles |
|
52 | 50 | large: can't get file locally |
|
53 | 51 | (no default or default-push path set in hgrc) |
|
54 | 52 | 0 largefiles updated, 0 removed |
|
55 | 53 | $ hg status |
|
56 | 54 | ! large |
|
57 | 55 | |
|
58 | 56 | Update working directory to null: this cleanup .hg/largefiles/dirstate |
|
59 | 57 | |
|
60 | 58 | $ hg update null |
|
61 | 59 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
62 | 60 | getting changed largefiles |
|
63 | 61 | 0 largefiles updated, 0 removed |
|
64 | 62 | |
|
65 | 63 | Update working directory to tip, again. |
|
66 | 64 | |
|
67 | 65 | $ hg update |
|
68 | 66 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 | 67 | getting changed largefiles |
|
70 | 68 | large: can't get file locally |
|
71 | 69 | (no default or default-push path set in hgrc) |
|
72 | 70 | 0 largefiles updated, 0 removed |
|
73 | 71 | $ hg status |
|
74 | 72 | ! large |
|
73 | $ cd .. | |
|
74 | ||
|
75 | #if unix-permissions | |
|
75 | 76 | |
|
76 | 77 | Portable way to print file permissions: |
|
77 | 78 | |
|
78 | $ cd .. | |
|
79 | 79 | $ cat > ls-l.py <<EOF |
|
80 | 80 | > #!/usr/bin/env python |
|
81 | 81 | > import sys, os |
|
82 | 82 | > path = sys.argv[1] |
|
83 | 83 | > print '%03o' % (os.lstat(path).st_mode & 0777) |
|
84 | 84 | > EOF |
|
85 | 85 | $ chmod +x ls-l.py |
|
86 | 86 | |
|
87 | 87 | Test that files in .hg/largefiles inherit mode from .hg/store, not |
|
88 | 88 | from file in working copy: |
|
89 | 89 | |
|
90 | 90 | $ cd src |
|
91 | 91 | $ chmod 750 .hg/store |
|
92 | 92 | $ chmod 660 large |
|
93 | 93 | $ echo change >> large |
|
94 | 94 | $ hg commit -m change |
|
95 | 95 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
96 | 96 | 640 |
|
97 | 97 | |
|
98 | 98 | Test permission of with files in .hg/largefiles created by update: |
|
99 | 99 | |
|
100 | 100 | $ cd ../mirror |
|
101 | 101 | $ rm -r "$USERCACHE" .hg/largefiles # avoid links |
|
102 | 102 | $ chmod 750 .hg/store |
|
103 | 103 | $ hg pull ../src --update -q |
|
104 | 104 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
105 | 105 | 640 |
|
106 | 106 | |
|
107 | 107 | Test permission of files created by push: |
|
108 | 108 | |
|
109 | 109 | $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \ |
|
110 | 110 | > --config "web.allow_push=*" --config web.push_ssl=no |
|
111 | 111 | $ cat hg.pid >> $DAEMON_PIDS |
|
112 | 112 | |
|
113 | 113 | $ echo change >> large |
|
114 | 114 | $ hg commit -m change |
|
115 | 115 | |
|
116 | 116 | $ rm -r "$USERCACHE" |
|
117 | 117 | |
|
118 | 118 | $ hg push -q http://localhost:$HGPORT/ |
|
119 | 119 | |
|
120 | 120 | $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9 |
|
121 | 121 | 640 |
|
122 | 122 | |
|
123 | 123 | $ cd .. |
|
124 | ||
|
125 | #endif |
@@ -1,1217 +1,1221 b'' | |||
|
1 |
$ "$TESTDIR/hghave" |
|
|
1 | $ "$TESTDIR/hghave" serve || exit 80 | |
|
2 | 2 | $ USERCACHE=`pwd`/cache; export USERCACHE |
|
3 | 3 | $ mkdir -p ${USERCACHE} |
|
4 | 4 | $ cat >> $HGRCPATH <<EOF |
|
5 | 5 | > [extensions] |
|
6 | 6 | > largefiles= |
|
7 | 7 | > purge= |
|
8 | 8 | > rebase= |
|
9 | 9 | > transplant= |
|
10 | 10 | > [phases] |
|
11 | 11 | > publish=False |
|
12 | 12 | > [largefiles] |
|
13 | 13 | > minsize=2 |
|
14 | 14 | > patterns=glob:**.dat |
|
15 | 15 | > usercache=${USERCACHE} |
|
16 | 16 | > [hooks] |
|
17 | 17 | > precommit=echo "Invoking status precommit hook"; hg status |
|
18 | 18 | > EOF |
|
19 | 19 | |
|
20 | 20 | Create the repo with a couple of revisions of both large and normal |
|
21 | 21 | files, testing that status correctly shows largefiles and that summary output |
|
22 | 22 | is correct. |
|
23 | 23 | |
|
24 | 24 | $ hg init a |
|
25 | 25 | $ cd a |
|
26 | 26 | $ mkdir sub |
|
27 | 27 | $ echo normal1 > normal1 |
|
28 | 28 | $ echo normal2 > sub/normal2 |
|
29 | 29 | $ echo large1 > large1 |
|
30 | 30 | $ echo large2 > sub/large2 |
|
31 | 31 | $ hg add normal1 sub/normal2 |
|
32 | 32 | $ hg add --large large1 sub/large2 |
|
33 | 33 | $ hg commit -m "add files" |
|
34 | 34 | Invoking status precommit hook |
|
35 | 35 | A large1 |
|
36 | 36 | A normal1 |
|
37 | 37 | A sub/large2 |
|
38 | 38 | A sub/normal2 |
|
39 | 39 | $ echo normal11 > normal1 |
|
40 | 40 | $ echo normal22 > sub/normal2 |
|
41 | 41 | $ echo large11 > large1 |
|
42 | 42 | $ echo large22 > sub/large2 |
|
43 | 43 | $ hg commit -m "edit files" |
|
44 | 44 | Invoking status precommit hook |
|
45 | 45 | M large1 |
|
46 | 46 | M normal1 |
|
47 | 47 | M sub/large2 |
|
48 | 48 | M sub/normal2 |
|
49 | 49 | $ hg sum --large |
|
50 | 50 | parent: 1:ce8896473775 tip |
|
51 | 51 | edit files |
|
52 | 52 | branch: default |
|
53 | 53 | commit: (clean) |
|
54 | 54 | update: (current) |
|
55 | 55 | largefiles: No remote repo |
|
56 | 56 | |
|
57 | 57 | Commit preserved largefile contents. |
|
58 | 58 | |
|
59 | 59 | $ cat normal1 |
|
60 | 60 | normal11 |
|
61 | 61 | $ cat large1 |
|
62 | 62 | large11 |
|
63 | 63 | $ cat sub/normal2 |
|
64 | 64 | normal22 |
|
65 | 65 | $ cat sub/large2 |
|
66 | 66 | large22 |
|
67 | 67 | |
|
68 | 68 | Test status, subdir and unknown files |
|
69 | 69 | |
|
70 | 70 | $ echo unknown > sub/unknown |
|
71 | 71 | $ hg st --all |
|
72 | 72 | ? sub/unknown |
|
73 | 73 | C large1 |
|
74 | 74 | C normal1 |
|
75 | 75 | C sub/large2 |
|
76 | 76 | C sub/normal2 |
|
77 | 77 | $ hg st --all sub |
|
78 | 78 | ? sub/unknown |
|
79 | 79 | C sub/large2 |
|
80 | 80 | C sub/normal2 |
|
81 | 81 | $ rm sub/unknown |
|
82 | 82 | |
|
83 | 83 | Remove both largefiles and normal files. |
|
84 | 84 | |
|
85 | 85 | $ hg remove normal1 large1 |
|
86 | 86 | $ hg status large1 |
|
87 | 87 | R large1 |
|
88 | 88 | $ hg commit -m "remove files" |
|
89 | 89 | Invoking status precommit hook |
|
90 | 90 | R large1 |
|
91 | 91 | R normal1 |
|
92 | 92 | $ ls |
|
93 | 93 | sub |
|
94 | 94 | $ echo "testlargefile" > large1-test |
|
95 | 95 | $ hg add --large large1-test |
|
96 | 96 | $ hg st |
|
97 | 97 | A large1-test |
|
98 | 98 | $ hg rm large1-test |
|
99 | 99 | not removing large1-test: file has been marked for add (use forget to undo) |
|
100 | 100 | $ hg st |
|
101 | 101 | A large1-test |
|
102 | 102 | $ hg forget large1-test |
|
103 | 103 | $ hg st |
|
104 | 104 | ? large1-test |
|
105 | 105 | $ rm large1-test |
|
106 | 106 | |
|
107 | 107 | Copy both largefiles and normal files (testing that status output is correct). |
|
108 | 108 | |
|
109 | 109 | $ hg cp sub/normal2 normal1 |
|
110 | 110 | $ hg cp sub/large2 large1 |
|
111 | 111 | $ hg commit -m "copy files" |
|
112 | 112 | Invoking status precommit hook |
|
113 | 113 | A large1 |
|
114 | 114 | A normal1 |
|
115 | 115 | $ cat normal1 |
|
116 | 116 | normal22 |
|
117 | 117 | $ cat large1 |
|
118 | 118 | large22 |
|
119 | 119 | |
|
120 | 120 | Test moving largefiles and verify that normal files are also unaffected. |
|
121 | 121 | |
|
122 | 122 | $ hg mv normal1 normal3 |
|
123 | 123 | $ hg mv large1 large3 |
|
124 | 124 | $ hg mv sub/normal2 sub/normal4 |
|
125 | 125 | $ hg mv sub/large2 sub/large4 |
|
126 | 126 | $ hg commit -m "move files" |
|
127 | 127 | Invoking status precommit hook |
|
128 | 128 | A large3 |
|
129 | 129 | A normal3 |
|
130 | 130 | A sub/large4 |
|
131 | 131 | A sub/normal4 |
|
132 | 132 | R large1 |
|
133 | 133 | R normal1 |
|
134 | 134 | R sub/large2 |
|
135 | 135 | R sub/normal2 |
|
136 | 136 | $ cat normal3 |
|
137 | 137 | normal22 |
|
138 | 138 | $ cat large3 |
|
139 | 139 | large22 |
|
140 | 140 | $ cat sub/normal4 |
|
141 | 141 | normal22 |
|
142 | 142 | $ cat sub/large4 |
|
143 | 143 | large22 |
|
144 | 144 | |
|
145 | 145 | Test display of largefiles in hgweb |
|
146 | 146 | |
|
147 | 147 | $ hg serve -d -p $HGPORT --pid-file ../hg.pid |
|
148 | 148 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
149 | 149 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/tip/?style=raw' |
|
150 | 150 | 200 Script output follows |
|
151 | 151 | |
|
152 | 152 | |
|
153 | 153 | drwxr-xr-x sub |
|
154 | 154 | -rw-r--r-- 41 large3 |
|
155 | 155 | -rw-r--r-- 9 normal3 |
|
156 | 156 | |
|
157 | 157 | |
|
158 | 158 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/tip/sub/?style=raw' |
|
159 | 159 | 200 Script output follows |
|
160 | 160 | |
|
161 | 161 | |
|
162 | 162 | -rw-r--r-- 41 large4 |
|
163 | 163 | -rw-r--r-- 9 normal4 |
|
164 | 164 | |
|
165 | 165 | |
|
166 | 166 | $ "$TESTDIR/killdaemons.py" |
|
167 | 167 | |
|
168 | 168 | Test archiving the various revisions. These hit corner cases known with |
|
169 | 169 | archiving. |
|
170 | 170 | |
|
171 | 171 | $ hg archive -r 0 ../archive0 |
|
172 | 172 | $ hg archive -r 1 ../archive1 |
|
173 | 173 | $ hg archive -r 2 ../archive2 |
|
174 | 174 | $ hg archive -r 3 ../archive3 |
|
175 | 175 | $ hg archive -r 4 ../archive4 |
|
176 | 176 | $ cd ../archive0 |
|
177 | 177 | $ cat normal1 |
|
178 | 178 | normal1 |
|
179 | 179 | $ cat large1 |
|
180 | 180 | large1 |
|
181 | 181 | $ cat sub/normal2 |
|
182 | 182 | normal2 |
|
183 | 183 | $ cat sub/large2 |
|
184 | 184 | large2 |
|
185 | 185 | $ cd ../archive1 |
|
186 | 186 | $ cat normal1 |
|
187 | 187 | normal11 |
|
188 | 188 | $ cat large1 |
|
189 | 189 | large11 |
|
190 | 190 | $ cat sub/normal2 |
|
191 | 191 | normal22 |
|
192 | 192 | $ cat sub/large2 |
|
193 | 193 | large22 |
|
194 | 194 | $ cd ../archive2 |
|
195 | 195 | $ ls |
|
196 | 196 | sub |
|
197 | 197 | $ cat sub/normal2 |
|
198 | 198 | normal22 |
|
199 | 199 | $ cat sub/large2 |
|
200 | 200 | large22 |
|
201 | 201 | $ cd ../archive3 |
|
202 | 202 | $ cat normal1 |
|
203 | 203 | normal22 |
|
204 | 204 | $ cat large1 |
|
205 | 205 | large22 |
|
206 | 206 | $ cat sub/normal2 |
|
207 | 207 | normal22 |
|
208 | 208 | $ cat sub/large2 |
|
209 | 209 | large22 |
|
210 | 210 | $ cd ../archive4 |
|
211 | 211 | $ cat normal3 |
|
212 | 212 | normal22 |
|
213 | 213 | $ cat large3 |
|
214 | 214 | large22 |
|
215 | 215 | $ cat sub/normal4 |
|
216 | 216 | normal22 |
|
217 | 217 | $ cat sub/large4 |
|
218 | 218 | large22 |
|
219 | 219 | |
|
220 | 220 | Commit corner case: specify files to commit. |
|
221 | 221 | |
|
222 | 222 | $ cd ../a |
|
223 | 223 | $ echo normal3 > normal3 |
|
224 | 224 | $ echo large3 > large3 |
|
225 | 225 | $ echo normal4 > sub/normal4 |
|
226 | 226 | $ echo large4 > sub/large4 |
|
227 | 227 | $ hg commit normal3 large3 sub/normal4 sub/large4 -m "edit files again" |
|
228 | 228 | Invoking status precommit hook |
|
229 | 229 | M large3 |
|
230 | 230 | M normal3 |
|
231 | 231 | M sub/large4 |
|
232 | 232 | M sub/normal4 |
|
233 | 233 | $ cat normal3 |
|
234 | 234 | normal3 |
|
235 | 235 | $ cat large3 |
|
236 | 236 | large3 |
|
237 | 237 | $ cat sub/normal4 |
|
238 | 238 | normal4 |
|
239 | 239 | $ cat sub/large4 |
|
240 | 240 | large4 |
|
241 | 241 | |
|
242 | 242 | One more commit corner case: commit from a subdirectory. |
|
243 | 243 | |
|
244 | 244 | $ cd ../a |
|
245 | 245 | $ echo normal33 > normal3 |
|
246 | 246 | $ echo large33 > large3 |
|
247 | 247 | $ echo normal44 > sub/normal4 |
|
248 | 248 | $ echo large44 > sub/large4 |
|
249 | 249 | $ cd sub |
|
250 | 250 | $ hg commit -m "edit files yet again" |
|
251 | 251 | Invoking status precommit hook |
|
252 | 252 | M large3 |
|
253 | 253 | M normal3 |
|
254 | 254 | M sub/large4 |
|
255 | 255 | M sub/normal4 |
|
256 | 256 | $ cat ../normal3 |
|
257 | 257 | normal33 |
|
258 | 258 | $ cat ../large3 |
|
259 | 259 | large33 |
|
260 | 260 | $ cat normal4 |
|
261 | 261 | normal44 |
|
262 | 262 | $ cat large4 |
|
263 | 263 | large44 |
|
264 | 264 | |
|
265 | 265 | Committing standins is not allowed. |
|
266 | 266 | |
|
267 | 267 | $ cd .. |
|
268 | 268 | $ echo large3 > large3 |
|
269 | 269 | $ hg commit .hglf/large3 -m "try to commit standin" |
|
270 | 270 | abort: file ".hglf/large3" is a largefile standin |
|
271 | 271 | (commit the largefile itself instead) |
|
272 | 272 | [255] |
|
273 | 273 | |
|
274 | 274 | Corner cases for adding largefiles. |
|
275 | 275 | |
|
276 | 276 | $ echo large5 > large5 |
|
277 | 277 | $ hg add --large large5 |
|
278 | 278 | $ hg add --large large5 |
|
279 | 279 | large5 already a largefile |
|
280 | 280 | $ mkdir sub2 |
|
281 | 281 | $ echo large6 > sub2/large6 |
|
282 | 282 | $ echo large7 > sub2/large7 |
|
283 | 283 | $ hg add --large sub2 |
|
284 | 284 | adding sub2/large6 as a largefile (glob) |
|
285 | 285 | adding sub2/large7 as a largefile (glob) |
|
286 | 286 | $ hg st |
|
287 | 287 | M large3 |
|
288 | 288 | A large5 |
|
289 | 289 | A sub2/large6 |
|
290 | 290 | A sub2/large7 |
|
291 | 291 | |
|
292 | 292 | Test "hg status" with combination of 'file pattern' and 'directory |
|
293 | 293 | pattern' for largefiles: |
|
294 | 294 | |
|
295 | 295 | $ hg status sub2/large6 sub2 |
|
296 | 296 | A sub2/large6 |
|
297 | 297 | A sub2/large7 |
|
298 | 298 | |
|
299 | 299 | Config settings (pattern **.dat, minsize 2 MB) are respected. |
|
300 | 300 | |
|
301 | 301 | $ echo testdata > test.dat |
|
302 | 302 | $ dd bs=1k count=2k if=/dev/zero of=reallylarge > /dev/null 2> /dev/null |
|
303 | 303 | $ hg add |
|
304 | 304 | adding reallylarge as a largefile |
|
305 | 305 | adding test.dat as a largefile |
|
306 | 306 | |
|
307 | 307 | Test that minsize and --lfsize handle float values; |
|
308 | 308 | also tests that --lfsize overrides largefiles.minsize. |
|
309 | 309 | (0.250 MB = 256 kB = 262144 B) |
|
310 | 310 | |
|
311 | 311 | $ dd if=/dev/zero of=ratherlarge bs=1024 count=256 > /dev/null 2> /dev/null |
|
312 | 312 | $ dd if=/dev/zero of=medium bs=1024 count=128 > /dev/null 2> /dev/null |
|
313 | 313 | $ hg --config largefiles.minsize=.25 add |
|
314 | 314 | adding ratherlarge as a largefile |
|
315 | 315 | adding medium |
|
316 | 316 | $ hg forget medium |
|
317 | 317 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
318 | 318 | adding medium as a largefile |
|
319 | 319 | $ dd if=/dev/zero of=notlarge bs=1024 count=127 > /dev/null 2> /dev/null |
|
320 | 320 | $ hg --config largefiles.minsize=.25 add --lfsize=.125 |
|
321 | 321 | adding notlarge |
|
322 | 322 | $ hg forget notlarge |
|
323 | 323 | |
|
324 | 324 | Test forget on largefiles. |
|
325 | 325 | |
|
326 | 326 | $ hg forget large3 large5 test.dat reallylarge ratherlarge medium |
|
327 | 327 | $ hg commit -m "add/edit more largefiles" |
|
328 | 328 | Invoking status precommit hook |
|
329 | 329 | A sub2/large6 |
|
330 | 330 | A sub2/large7 |
|
331 | 331 | R large3 |
|
332 | 332 | ? large5 |
|
333 | 333 | ? medium |
|
334 | 334 | ? notlarge |
|
335 | 335 | ? ratherlarge |
|
336 | 336 | ? reallylarge |
|
337 | 337 | ? test.dat |
|
338 | 338 | $ hg st |
|
339 | 339 | ? large3 |
|
340 | 340 | ? large5 |
|
341 | 341 | ? medium |
|
342 | 342 | ? notlarge |
|
343 | 343 | ? ratherlarge |
|
344 | 344 | ? reallylarge |
|
345 | 345 | ? test.dat |
|
346 | 346 | |
|
347 | 347 | Purge with largefiles: verify that largefiles are still in the working |
|
348 | 348 | dir after a purge. |
|
349 | 349 | |
|
350 | 350 | $ hg purge --all |
|
351 | 351 | $ cat sub/large4 |
|
352 | 352 | large44 |
|
353 | 353 | $ cat sub2/large6 |
|
354 | 354 | large6 |
|
355 | 355 | $ cat sub2/large7 |
|
356 | 356 | large7 |
|
357 | 357 | |
|
358 | 358 | Test addremove: verify that files that should be added as largfiles are added as |
|
359 | 359 | such and that already-existing largfiles are not added as normal files by |
|
360 | 360 | accident. |
|
361 | 361 | |
|
362 | 362 | $ rm normal3 |
|
363 | 363 | $ rm sub/large4 |
|
364 | 364 | $ echo "testing addremove with patterns" > testaddremove.dat |
|
365 | 365 | $ echo "normaladdremove" > normaladdremove |
|
366 | 366 | $ hg addremove |
|
367 | 367 | removing sub/large4 |
|
368 | 368 | adding testaddremove.dat as a largefile |
|
369 | 369 | removing normal3 |
|
370 | 370 | adding normaladdremove |
|
371 | 371 | |
|
372 | 372 | Clone a largefiles repo. |
|
373 | 373 | |
|
374 | 374 | $ hg clone . ../b |
|
375 | 375 | updating to branch default |
|
376 | 376 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
377 | 377 | getting changed largefiles |
|
378 | 378 | 3 largefiles updated, 0 removed |
|
379 | 379 | $ cd ../b |
|
380 | 380 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
381 | 381 | 7:daea875e9014 add/edit more largefiles |
|
382 | 382 | 6:4355d653f84f edit files yet again |
|
383 | 383 | 5:9d5af5072dbd edit files again |
|
384 | 384 | 4:74c02385b94c move files |
|
385 | 385 | 3:9e8fbc4bce62 copy files |
|
386 | 386 | 2:51a0ae4d5864 remove files |
|
387 | 387 | 1:ce8896473775 edit files |
|
388 | 388 | 0:30d30fe6a5be add files |
|
389 | 389 | $ cat normal3 |
|
390 | 390 | normal33 |
|
391 | 391 | $ cat sub/normal4 |
|
392 | 392 | normal44 |
|
393 | 393 | $ cat sub/large4 |
|
394 | 394 | large44 |
|
395 | 395 | $ cat sub2/large6 |
|
396 | 396 | large6 |
|
397 | 397 | $ cat sub2/large7 |
|
398 | 398 | large7 |
|
399 | 399 | $ cd .. |
|
400 | 400 | $ hg clone a -r 3 c |
|
401 | 401 | adding changesets |
|
402 | 402 | adding manifests |
|
403 | 403 | adding file changes |
|
404 | 404 | added 4 changesets with 10 changes to 4 files |
|
405 | 405 | updating to branch default |
|
406 | 406 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
407 | 407 | getting changed largefiles |
|
408 | 408 | 2 largefiles updated, 0 removed |
|
409 | 409 | $ cd c |
|
410 | 410 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
411 | 411 | 3:9e8fbc4bce62 copy files |
|
412 | 412 | 2:51a0ae4d5864 remove files |
|
413 | 413 | 1:ce8896473775 edit files |
|
414 | 414 | 0:30d30fe6a5be add files |
|
415 | 415 | $ cat normal1 |
|
416 | 416 | normal22 |
|
417 | 417 | $ cat large1 |
|
418 | 418 | large22 |
|
419 | 419 | $ cat sub/normal2 |
|
420 | 420 | normal22 |
|
421 | 421 | $ cat sub/large2 |
|
422 | 422 | large22 |
|
423 | 423 | |
|
424 | 424 | Old revisions of a clone have correct largefiles content (this also |
|
425 | 425 | tests update). |
|
426 | 426 | |
|
427 | 427 | $ hg update -r 1 |
|
428 | 428 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
429 | 429 | getting changed largefiles |
|
430 | 430 | 1 largefiles updated, 0 removed |
|
431 | 431 | $ cat large1 |
|
432 | 432 | large11 |
|
433 | 433 | $ cat sub/large2 |
|
434 | 434 | large22 |
|
435 | 435 | $ cd .. |
|
436 | 436 | |
|
437 | 437 | Test cloning with --all-largefiles flag |
|
438 | 438 | |
|
439 | 439 | $ rm -Rf ${USERCACHE}/* |
|
440 | 440 | $ hg clone --all-largefiles a a-backup |
|
441 | 441 | updating to branch default |
|
442 | 442 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
443 | 443 | getting changed largefiles |
|
444 | 444 | 3 largefiles updated, 0 removed |
|
445 | 445 | 8 additional largefiles cached |
|
446 | 446 | |
|
447 | 447 | $ hg clone --all-largefiles a ssh://localhost/a |
|
448 | 448 | abort: --all-largefiles is incompatible with non-local destination ssh://localhost/a |
|
449 | 449 | [255] |
|
450 | 450 | |
|
451 | 451 | Test pulling with --all-largefiles flag |
|
452 | 452 | |
|
453 | 453 | $ rm -Rf a-backup |
|
454 | 454 | $ hg clone -r 1 a a-backup |
|
455 | 455 | adding changesets |
|
456 | 456 | adding manifests |
|
457 | 457 | adding file changes |
|
458 | 458 | added 2 changesets with 8 changes to 4 files |
|
459 | 459 | updating to branch default |
|
460 | 460 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
461 | 461 | getting changed largefiles |
|
462 | 462 | 2 largefiles updated, 0 removed |
|
463 | 463 | $ rm -Rf ${USERCACHE}/* |
|
464 | 464 | $ cd a-backup |
|
465 | 465 | $ hg pull --all-largefiles |
|
466 | 466 | pulling from $TESTTMP/a |
|
467 | 467 | searching for changes |
|
468 | 468 | adding changesets |
|
469 | 469 | adding manifests |
|
470 | 470 | adding file changes |
|
471 | 471 | added 6 changesets with 16 changes to 8 files |
|
472 | 472 | (run 'hg update' to get a working copy) |
|
473 | 473 | caching new largefiles |
|
474 | 474 | 3 largefiles cached |
|
475 | 475 | 3 additional largefiles cached |
|
476 | 476 | $ cd .. |
|
477 | 477 | |
|
478 | 478 | Rebasing between two repositories does not revert largefiles to old |
|
479 | 479 | revisions (this was a very bad bug that took a lot of work to fix). |
|
480 | 480 | |
|
481 | 481 | $ hg clone a d |
|
482 | 482 | updating to branch default |
|
483 | 483 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
484 | 484 | getting changed largefiles |
|
485 | 485 | 3 largefiles updated, 0 removed |
|
486 | 486 | $ cd b |
|
487 | 487 | $ echo large4-modified > sub/large4 |
|
488 | 488 | $ echo normal3-modified > normal3 |
|
489 | 489 | $ hg commit -m "modify normal file and largefile in repo b" |
|
490 | 490 | Invoking status precommit hook |
|
491 | 491 | M normal3 |
|
492 | 492 | M sub/large4 |
|
493 | 493 | $ cd ../d |
|
494 | 494 | $ echo large6-modified > sub2/large6 |
|
495 | 495 | $ echo normal4-modified > sub/normal4 |
|
496 | 496 | $ hg commit -m "modify normal file largefile in repo d" |
|
497 | 497 | Invoking status precommit hook |
|
498 | 498 | M sub/normal4 |
|
499 | 499 | M sub2/large6 |
|
500 | 500 | $ cd .. |
|
501 | 501 | $ hg clone d e |
|
502 | 502 | updating to branch default |
|
503 | 503 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
504 | 504 | getting changed largefiles |
|
505 | 505 | 3 largefiles updated, 0 removed |
|
506 | 506 | $ cd d |
|
507 | 507 | $ hg pull --rebase ../b |
|
508 | 508 | pulling from ../b |
|
509 | 509 | searching for changes |
|
510 | 510 | adding changesets |
|
511 | 511 | adding manifests |
|
512 | 512 | adding file changes |
|
513 | 513 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
514 | 514 | Invoking status precommit hook |
|
515 | 515 | M sub/normal4 |
|
516 | 516 | M sub2/large6 |
|
517 | 517 | saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
518 | 518 | nothing to rebase |
|
519 | 519 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
520 | 520 | 9:598410d3eb9a modify normal file largefile in repo d |
|
521 | 521 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
522 | 522 | 7:daea875e9014 add/edit more largefiles |
|
523 | 523 | 6:4355d653f84f edit files yet again |
|
524 | 524 | 5:9d5af5072dbd edit files again |
|
525 | 525 | 4:74c02385b94c move files |
|
526 | 526 | 3:9e8fbc4bce62 copy files |
|
527 | 527 | 2:51a0ae4d5864 remove files |
|
528 | 528 | 1:ce8896473775 edit files |
|
529 | 529 | 0:30d30fe6a5be add files |
|
530 | 530 | $ cat normal3 |
|
531 | 531 | normal3-modified |
|
532 | 532 | $ cat sub/normal4 |
|
533 | 533 | normal4-modified |
|
534 | 534 | $ cat sub/large4 |
|
535 | 535 | large4-modified |
|
536 | 536 | $ cat sub2/large6 |
|
537 | 537 | large6-modified |
|
538 | 538 | $ cat sub2/large7 |
|
539 | 539 | large7 |
|
540 | 540 | $ cd ../e |
|
541 | 541 | $ hg pull ../b |
|
542 | 542 | pulling from ../b |
|
543 | 543 | searching for changes |
|
544 | 544 | adding changesets |
|
545 | 545 | adding manifests |
|
546 | 546 | adding file changes |
|
547 | 547 | added 1 changesets with 2 changes to 2 files (+1 heads) |
|
548 | 548 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
549 | 549 | caching new largefiles |
|
550 | 550 | 0 largefiles cached |
|
551 | 551 | $ hg rebase |
|
552 | 552 | Invoking status precommit hook |
|
553 | 553 | M sub/normal4 |
|
554 | 554 | M sub2/large6 |
|
555 | 555 | saved backup bundle to $TESTTMP/e/.hg/strip-backup/f574fb32bb45-backup.hg (glob) |
|
556 | 556 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
557 | 557 | 9:598410d3eb9a modify normal file largefile in repo d |
|
558 | 558 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
559 | 559 | 7:daea875e9014 add/edit more largefiles |
|
560 | 560 | 6:4355d653f84f edit files yet again |
|
561 | 561 | 5:9d5af5072dbd edit files again |
|
562 | 562 | 4:74c02385b94c move files |
|
563 | 563 | 3:9e8fbc4bce62 copy files |
|
564 | 564 | 2:51a0ae4d5864 remove files |
|
565 | 565 | 1:ce8896473775 edit files |
|
566 | 566 | 0:30d30fe6a5be add files |
|
567 | 567 | $ cat normal3 |
|
568 | 568 | normal3-modified |
|
569 | 569 | $ cat sub/normal4 |
|
570 | 570 | normal4-modified |
|
571 | 571 | $ cat sub/large4 |
|
572 | 572 | large4-modified |
|
573 | 573 | $ cat sub2/large6 |
|
574 | 574 | large6-modified |
|
575 | 575 | $ cat sub2/large7 |
|
576 | 576 | large7 |
|
577 | 577 | |
|
578 | 578 | Rollback on largefiles. |
|
579 | 579 | |
|
580 | 580 | $ echo large4-modified-again > sub/large4 |
|
581 | 581 | $ hg commit -m "Modify large4 again" |
|
582 | 582 | Invoking status precommit hook |
|
583 | 583 | M sub/large4 |
|
584 | 584 | $ hg rollback |
|
585 | 585 | repository tip rolled back to revision 9 (undo commit) |
|
586 | 586 | working directory now based on revision 9 |
|
587 | 587 | $ hg st |
|
588 | 588 | M sub/large4 |
|
589 | 589 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
590 | 590 | 9:598410d3eb9a modify normal file largefile in repo d |
|
591 | 591 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
592 | 592 | 7:daea875e9014 add/edit more largefiles |
|
593 | 593 | 6:4355d653f84f edit files yet again |
|
594 | 594 | 5:9d5af5072dbd edit files again |
|
595 | 595 | 4:74c02385b94c move files |
|
596 | 596 | 3:9e8fbc4bce62 copy files |
|
597 | 597 | 2:51a0ae4d5864 remove files |
|
598 | 598 | 1:ce8896473775 edit files |
|
599 | 599 | 0:30d30fe6a5be add files |
|
600 | 600 | $ cat sub/large4 |
|
601 | 601 | large4-modified-again |
|
602 | 602 | |
|
603 | 603 | "update --check" refuses to update with uncommitted changes. |
|
604 | 604 | $ hg update --check 8 |
|
605 | 605 | abort: uncommitted local changes |
|
606 | 606 | [255] |
|
607 | 607 | |
|
608 | 608 | "update --clean" leaves correct largefiles in working copy. |
|
609 | 609 | |
|
610 | 610 | $ hg update --clean |
|
611 | 611 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
612 | 612 | getting changed largefiles |
|
613 | 613 | 1 largefiles updated, 0 removed |
|
614 | 614 | $ cat normal3 |
|
615 | 615 | normal3-modified |
|
616 | 616 | $ cat sub/normal4 |
|
617 | 617 | normal4-modified |
|
618 | 618 | $ cat sub/large4 |
|
619 | 619 | large4-modified |
|
620 | 620 | $ cat sub2/large6 |
|
621 | 621 | large6-modified |
|
622 | 622 | $ cat sub2/large7 |
|
623 | 623 | large7 |
|
624 | 624 | |
|
625 | 625 | Now "update check" is happy. |
|
626 | 626 | $ hg update --check 8 |
|
627 | 627 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
628 | 628 | getting changed largefiles |
|
629 | 629 | 1 largefiles updated, 0 removed |
|
630 | 630 | $ hg update --check |
|
631 | 631 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
632 | 632 | getting changed largefiles |
|
633 | 633 | 1 largefiles updated, 0 removed |
|
634 | 634 | |
|
635 | 635 | Test removing empty largefiles directories on update |
|
636 | 636 | $ test -d sub2 && echo "sub2 exists" |
|
637 | 637 | sub2 exists |
|
638 | 638 | $ hg update -q null |
|
639 | 639 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
640 | 640 | [1] |
|
641 | 641 | $ hg update -q |
|
642 | 642 | |
|
643 | 643 | Test hg remove removes empty largefiles directories |
|
644 | 644 | $ test -d sub2 && echo "sub2 exists" |
|
645 | 645 | sub2 exists |
|
646 | 646 | $ hg remove sub2/* |
|
647 | 647 | $ test -d sub2 && echo "error: sub2 should not exist anymore" |
|
648 | 648 | [1] |
|
649 | 649 | $ hg revert sub2/large6 sub2/large7 |
|
650 | 650 | |
|
651 | 651 | "revert" works on largefiles (and normal files too). |
|
652 | 652 | $ echo hack3 >> normal3 |
|
653 | 653 | $ echo hack4 >> sub/normal4 |
|
654 | 654 | $ echo hack4 >> sub/large4 |
|
655 | 655 | $ rm sub2/large6 |
|
656 | 656 | $ hg revert sub2/large6 |
|
657 | 657 | $ hg rm sub2/large6 |
|
658 | 658 | $ echo new >> sub2/large8 |
|
659 | 659 | $ hg add --large sub2/large8 |
|
660 | 660 | # XXX we don't really want to report that we're reverting the standin; |
|
661 | 661 | # that's just an implementation detail. But I don't see an obvious fix. ;-( |
|
662 | 662 | $ hg revert sub |
|
663 | 663 | reverting .hglf/sub/large4 (glob) |
|
664 | 664 | reverting sub/normal4 (glob) |
|
665 | 665 | $ hg status |
|
666 | 666 | M normal3 |
|
667 | 667 | A sub2/large8 |
|
668 | 668 | R sub2/large6 |
|
669 | 669 | ? sub/large4.orig |
|
670 | 670 | ? sub/normal4.orig |
|
671 | 671 | $ cat sub/normal4 |
|
672 | 672 | normal4-modified |
|
673 | 673 | $ cat sub/large4 |
|
674 | 674 | large4-modified |
|
675 | 675 | $ hg revert -a --no-backup |
|
676 | 676 | undeleting .hglf/sub2/large6 (glob) |
|
677 | 677 | forgetting .hglf/sub2/large8 (glob) |
|
678 | 678 | reverting normal3 |
|
679 | 679 | $ hg status |
|
680 | 680 | ? sub/large4.orig |
|
681 | 681 | ? sub/normal4.orig |
|
682 | 682 | ? sub2/large8 |
|
683 | 683 | $ cat normal3 |
|
684 | 684 | normal3-modified |
|
685 | 685 | $ cat sub2/large6 |
|
686 | 686 | large6-modified |
|
687 | 687 | $ rm sub/*.orig sub2/large8 |
|
688 | 688 | |
|
689 | 689 | revert some files to an older revision |
|
690 | 690 | $ hg revert --no-backup -r 8 sub2 |
|
691 | 691 | reverting .hglf/sub2/large6 (glob) |
|
692 | 692 | $ cat sub2/large6 |
|
693 | 693 | large6 |
|
694 | 694 | $ hg revert --no-backup sub2 |
|
695 | 695 | reverting .hglf/sub2/large6 (glob) |
|
696 | 696 | $ hg status |
|
697 | 697 | |
|
698 | 698 | "verify --large" actually verifies largefiles |
|
699 | 699 | |
|
700 | 700 | $ hg verify --large |
|
701 | 701 | checking changesets |
|
702 | 702 | checking manifests |
|
703 | 703 | crosschecking files in changesets and manifests |
|
704 | 704 | checking files |
|
705 | 705 | 10 files, 10 changesets, 28 total revisions |
|
706 | 706 | searching 1 changesets for largefiles |
|
707 | 707 | verified existence of 3 revisions of 3 largefiles |
|
708 | 708 | |
|
709 | 709 | Merging does not revert to old versions of largefiles and also check |
|
710 | 710 | that merging after having pulled from a non-default remote works |
|
711 | 711 | correctly. |
|
712 | 712 | |
|
713 | 713 | $ cd .. |
|
714 | 714 | $ hg clone -r 7 e temp |
|
715 | 715 | adding changesets |
|
716 | 716 | adding manifests |
|
717 | 717 | adding file changes |
|
718 | 718 | added 8 changesets with 24 changes to 10 files |
|
719 | 719 | updating to branch default |
|
720 | 720 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
721 | 721 | getting changed largefiles |
|
722 | 722 | 3 largefiles updated, 0 removed |
|
723 | 723 | $ hg clone temp f |
|
724 | 724 | updating to branch default |
|
725 | 725 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
726 | 726 | getting changed largefiles |
|
727 | 727 | 3 largefiles updated, 0 removed |
|
728 | 728 | # Delete the largefiles in the largefiles system cache so that we have an |
|
729 | 729 | # opportunity to test that caching after a pull works. |
|
730 | 730 | $ rm ${USERCACHE}/* |
|
731 | 731 | $ cd f |
|
732 | 732 | $ echo "large4-merge-test" > sub/large4 |
|
733 | 733 | $ hg commit -m "Modify large4 to test merge" |
|
734 | 734 | Invoking status precommit hook |
|
735 | 735 | M sub/large4 |
|
736 | 736 | $ hg pull ../e |
|
737 | 737 | pulling from ../e |
|
738 | 738 | searching for changes |
|
739 | 739 | adding changesets |
|
740 | 740 | adding manifests |
|
741 | 741 | adding file changes |
|
742 | 742 | added 2 changesets with 4 changes to 4 files (+1 heads) |
|
743 | 743 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
744 | 744 | caching new largefiles |
|
745 | 745 | 2 largefiles cached |
|
746 | 746 | $ hg merge |
|
747 | 747 | merging sub/large4 |
|
748 | 748 | largefile sub/large4 has a merge conflict |
|
749 | 749 | keep (l)ocal or take (o)ther? l |
|
750 | 750 | 3 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
751 | 751 | (branch merge, don't forget to commit) |
|
752 | 752 | getting changed largefiles |
|
753 | 753 | 1 largefiles updated, 0 removed |
|
754 | 754 | $ hg commit -m "Merge repos e and f" |
|
755 | 755 | Invoking status precommit hook |
|
756 | 756 | M normal3 |
|
757 | 757 | M sub/normal4 |
|
758 | 758 | M sub2/large6 |
|
759 | 759 | $ cat normal3 |
|
760 | 760 | normal3-modified |
|
761 | 761 | $ cat sub/normal4 |
|
762 | 762 | normal4-modified |
|
763 | 763 | $ cat sub/large4 |
|
764 | 764 | large4-merge-test |
|
765 | 765 | $ cat sub2/large6 |
|
766 | 766 | large6-modified |
|
767 | 767 | $ cat sub2/large7 |
|
768 | 768 | large7 |
|
769 | 769 | |
|
770 | 770 | Test status after merging with a branch that introduces a new largefile: |
|
771 | 771 | |
|
772 | 772 | $ echo large > large |
|
773 | 773 | $ hg add --large large |
|
774 | 774 | $ hg commit -m 'add largefile' |
|
775 | 775 | Invoking status precommit hook |
|
776 | 776 | A large |
|
777 | 777 | $ hg update -q ".^" |
|
778 | 778 | $ echo change >> normal3 |
|
779 | 779 | $ hg commit -m 'some change' |
|
780 | 780 | Invoking status precommit hook |
|
781 | 781 | M normal3 |
|
782 | 782 | created new head |
|
783 | 783 | $ hg merge |
|
784 | 784 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
785 | 785 | (branch merge, don't forget to commit) |
|
786 | 786 | getting changed largefiles |
|
787 | 787 | 1 largefiles updated, 0 removed |
|
788 | 788 | $ hg status |
|
789 | 789 | M large |
|
790 | 790 | |
|
791 | 791 | Test that a normal file and a largefile with the same name and path cannot |
|
792 | 792 | coexist. |
|
793 | 793 | |
|
794 | 794 | $ rm sub2/large7 |
|
795 | 795 | $ echo "largeasnormal" > sub2/large7 |
|
796 | 796 | $ hg add sub2/large7 |
|
797 | 797 | sub2/large7 already a largefile |
|
798 | 798 | |
|
799 | 799 | Test that transplanting a largefile change works correctly. |
|
800 | 800 | |
|
801 | 801 | $ cd .. |
|
802 | 802 | $ hg clone -r 8 d g |
|
803 | 803 | adding changesets |
|
804 | 804 | adding manifests |
|
805 | 805 | adding file changes |
|
806 | 806 | added 9 changesets with 26 changes to 10 files |
|
807 | 807 | updating to branch default |
|
808 | 808 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
809 | 809 | getting changed largefiles |
|
810 | 810 | 3 largefiles updated, 0 removed |
|
811 | 811 | $ cd g |
|
812 | 812 | $ hg transplant -s ../d 598410d3eb9a |
|
813 | 813 | searching for changes |
|
814 | 814 | searching for changes |
|
815 | 815 | adding changesets |
|
816 | 816 | adding manifests |
|
817 | 817 | adding file changes |
|
818 | 818 | added 1 changesets with 2 changes to 2 files |
|
819 | 819 | getting changed largefiles |
|
820 | 820 | 1 largefiles updated, 0 removed |
|
821 | 821 | $ hg log --template '{rev}:{node|short} {desc|firstline}\n' |
|
822 | 822 | 9:598410d3eb9a modify normal file largefile in repo d |
|
823 | 823 | 8:a381d2c8c80e modify normal file and largefile in repo b |
|
824 | 824 | 7:daea875e9014 add/edit more largefiles |
|
825 | 825 | 6:4355d653f84f edit files yet again |
|
826 | 826 | 5:9d5af5072dbd edit files again |
|
827 | 827 | 4:74c02385b94c move files |
|
828 | 828 | 3:9e8fbc4bce62 copy files |
|
829 | 829 | 2:51a0ae4d5864 remove files |
|
830 | 830 | 1:ce8896473775 edit files |
|
831 | 831 | 0:30d30fe6a5be add files |
|
832 | 832 | $ cat normal3 |
|
833 | 833 | normal3-modified |
|
834 | 834 | $ cat sub/normal4 |
|
835 | 835 | normal4-modified |
|
836 | 836 | $ cat sub/large4 |
|
837 | 837 | large4-modified |
|
838 | 838 | $ cat sub2/large6 |
|
839 | 839 | large6-modified |
|
840 | 840 | $ cat sub2/large7 |
|
841 | 841 | large7 |
|
842 | 842 | |
|
843 | 843 | Cat a largefile |
|
844 | 844 | $ hg cat normal3 |
|
845 | 845 | normal3-modified |
|
846 | 846 | $ hg cat sub/large4 |
|
847 | 847 | large4-modified |
|
848 | 848 | $ rm ${USERCACHE}/* |
|
849 | 849 | $ hg cat -r a381d2c8c80e -o cat.out sub/large4 |
|
850 | 850 | $ cat cat.out |
|
851 | 851 | large4-modified |
|
852 | 852 | $ rm cat.out |
|
853 | 853 | $ hg cat -r a381d2c8c80e normal3 |
|
854 | 854 | normal3-modified |
|
855 | 855 | |
|
856 | 856 | Test that renaming a largefile results in correct output for status |
|
857 | 857 | |
|
858 | 858 | $ hg rename sub/large4 large4-renamed |
|
859 | 859 | $ hg commit -m "test rename output" |
|
860 | 860 | Invoking status precommit hook |
|
861 | 861 | A large4-renamed |
|
862 | 862 | R sub/large4 |
|
863 | 863 | $ cat large4-renamed |
|
864 | 864 | large4-modified |
|
865 | 865 | $ cd sub2 |
|
866 | 866 | $ hg rename large6 large6-renamed |
|
867 | 867 | $ hg st |
|
868 | 868 | A sub2/large6-renamed |
|
869 | 869 | R sub2/large6 |
|
870 | 870 | $ cd .. |
|
871 | 871 | |
|
872 | 872 | Test --normal flag |
|
873 | 873 | |
|
874 | 874 | $ dd if=/dev/zero bs=2k count=11k > new-largefile 2> /dev/null |
|
875 | 875 | $ hg add --normal --large new-largefile |
|
876 | 876 | abort: --normal cannot be used with --large |
|
877 | 877 | [255] |
|
878 | 878 | $ hg add --normal new-largefile |
|
879 | 879 | new-largefile: up to 69 MB of RAM may be required to manage this file |
|
880 | 880 | (use 'hg revert new-largefile' to cancel the pending addition) |
|
881 | 881 | $ cd .. |
|
882 | 882 | |
|
883 | 883 | vanilla clients not locked out from largefiles servers on vanilla repos |
|
884 | 884 | $ mkdir r1 |
|
885 | 885 | $ cd r1 |
|
886 | 886 | $ hg init |
|
887 | 887 | $ echo c1 > f1 |
|
888 | 888 | $ hg add f1 |
|
889 | 889 | $ hg commit -m "m1" |
|
890 | 890 | Invoking status precommit hook |
|
891 | 891 | A f1 |
|
892 | 892 | $ cd .. |
|
893 | 893 | $ hg serve -R r1 -d -p $HGPORT --pid-file hg.pid |
|
894 | 894 | $ cat hg.pid >> $DAEMON_PIDS |
|
895 | 895 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT r2 |
|
896 | 896 | requesting all changes |
|
897 | 897 | adding changesets |
|
898 | 898 | adding manifests |
|
899 | 899 | adding file changes |
|
900 | 900 | added 1 changesets with 1 changes to 1 files |
|
901 | 901 | updating to branch default |
|
902 | 902 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
903 | 903 | |
|
904 | 904 | largefiles clients still work with vanilla servers |
|
905 | 905 | $ hg --config extensions.largefiles=! serve -R r1 -d -p $HGPORT1 --pid-file hg.pid |
|
906 | 906 | $ cat hg.pid >> $DAEMON_PIDS |
|
907 | 907 | $ hg clone http://localhost:$HGPORT1 r3 |
|
908 | 908 | requesting all changes |
|
909 | 909 | adding changesets |
|
910 | 910 | adding manifests |
|
911 | 911 | adding file changes |
|
912 | 912 | added 1 changesets with 1 changes to 1 files |
|
913 | 913 | updating to branch default |
|
914 | 914 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
915 | 915 | |
|
916 | 916 | vanilla clients locked out from largefiles http repos |
|
917 | 917 | $ mkdir r4 |
|
918 | 918 | $ cd r4 |
|
919 | 919 | $ hg init |
|
920 | 920 | $ echo c1 > f1 |
|
921 | 921 | $ hg add --large f1 |
|
922 | 922 | $ hg commit -m "m1" |
|
923 | 923 | Invoking status precommit hook |
|
924 | 924 | A f1 |
|
925 | 925 | $ cd .. |
|
926 | 926 | $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid |
|
927 | 927 | $ cat hg.pid >> $DAEMON_PIDS |
|
928 | 928 | $ hg --config extensions.largefiles=! clone http://localhost:$HGPORT2 r5 |
|
929 | 929 | abort: remote error: |
|
930 | 930 | |
|
931 | 931 | This repository uses the largefiles extension. |
|
932 | 932 | |
|
933 | 933 | Please enable it in your Mercurial config file. |
|
934 | 934 | [255] |
|
935 | 935 | |
|
936 | 936 | used all HGPORTs, kill all daemons |
|
937 | 937 | $ "$TESTDIR/killdaemons.py" |
|
938 | 938 | |
|
939 | 939 | vanilla clients locked out from largefiles ssh repos |
|
940 | 940 | $ hg --config extensions.largefiles=! clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/r4 r5 |
|
941 | 941 | abort: remote error: |
|
942 | 942 | |
|
943 | 943 | This repository uses the largefiles extension. |
|
944 | 944 | |
|
945 | 945 | Please enable it in your Mercurial config file. |
|
946 | 946 | [255] |
|
947 | 947 | |
|
948 | 948 | largefiles clients refuse to push largefiles repos to vanilla servers |
|
949 | 949 | $ mkdir r6 |
|
950 | 950 | $ cd r6 |
|
951 | 951 | $ hg init |
|
952 | 952 | $ echo c1 > f1 |
|
953 | 953 | $ hg add f1 |
|
954 | 954 | $ hg commit -m "m1" |
|
955 | 955 | Invoking status precommit hook |
|
956 | 956 | A f1 |
|
957 | 957 | $ cat >> .hg/hgrc <<! |
|
958 | 958 | > [web] |
|
959 | 959 | > push_ssl = false |
|
960 | 960 | > allow_push = * |
|
961 | 961 | > ! |
|
962 | 962 | $ cd .. |
|
963 | 963 | $ hg clone r6 r7 |
|
964 | 964 | updating to branch default |
|
965 | 965 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
966 | 966 | $ cd r7 |
|
967 | 967 | $ echo c2 > f2 |
|
968 | 968 | $ hg add --large f2 |
|
969 | 969 | $ hg commit -m "m2" |
|
970 | 970 | Invoking status precommit hook |
|
971 | 971 | A f2 |
|
972 | 972 | $ hg --config extensions.largefiles=! -R ../r6 serve -d -p $HGPORT --pid-file ../hg.pid |
|
973 | 973 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
974 | 974 | $ hg push http://localhost:$HGPORT |
|
975 | 975 | pushing to http://localhost:$HGPORT/ |
|
976 | 976 | searching for changes |
|
977 | 977 | abort: http://localhost:$HGPORT/ does not appear to be a largefile store |
|
978 | 978 | [255] |
|
979 | 979 | $ cd .. |
|
980 | 980 | |
|
981 | 981 | putlfile errors are shown (issue3123) |
|
982 | 982 | Corrupt the cached largefile in r7 |
|
983 | 983 | $ echo corruption > $USERCACHE/4cdac4d8b084d0b599525cf732437fb337d422a8 |
|
984 | 984 | $ hg init empty |
|
985 | 985 | $ hg serve -R empty -d -p $HGPORT1 --pid-file hg.pid \ |
|
986 | 986 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
987 | 987 | $ cat hg.pid >> $DAEMON_PIDS |
|
988 | 988 | $ hg push -R r7 http://localhost:$HGPORT1 |
|
989 | 989 | pushing to http://localhost:$HGPORT1/ |
|
990 | 990 | searching for changes |
|
991 | 991 | remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash |
|
992 | 992 | abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ |
|
993 | 993 | [255] |
|
994 | 994 | $ rm -rf empty |
|
995 | 995 | |
|
996 | 996 | Push a largefiles repository to a served empty repository |
|
997 | 997 | $ hg init r8 |
|
998 | 998 | $ echo c3 > r8/f1 |
|
999 | 999 | $ hg add --large r8/f1 -R r8 |
|
1000 | 1000 | $ hg commit -m "m1" -R r8 |
|
1001 | 1001 | Invoking status precommit hook |
|
1002 | 1002 | A f1 |
|
1003 | 1003 | $ hg init empty |
|
1004 | 1004 | $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \ |
|
1005 | 1005 | > --config 'web.allow_push=*' --config web.push_ssl=False |
|
1006 | 1006 | $ cat hg.pid >> $DAEMON_PIDS |
|
1007 | 1007 | $ rm ${USERCACHE}/* |
|
1008 | 1008 | $ hg push -R r8 http://localhost:$HGPORT2 |
|
1009 | 1009 | pushing to http://localhost:$HGPORT2/ |
|
1010 | 1010 | searching for changes |
|
1011 | 1011 | searching for changes |
|
1012 | 1012 | remote: adding changesets |
|
1013 | 1013 | remote: adding manifests |
|
1014 | 1014 | remote: adding file changes |
|
1015 | 1015 | remote: added 1 changesets with 1 changes to 1 files |
|
1016 | 1016 | $ rm -rf empty |
|
1017 | 1017 | |
|
1018 | 1018 | used all HGPORTs, kill all daemons |
|
1019 | 1019 | $ "$TESTDIR/killdaemons.py" |
|
1020 | 1020 | |
|
1021 | #if unix-permissions | |
|
1022 | ||
|
1021 | 1023 | Clone a local repository owned by another user |
|
1022 | 1024 | We have to simulate that here by setting $HOME and removing write permissions |
|
1023 | 1025 | $ ORIGHOME="$HOME" |
|
1024 | 1026 | $ mkdir alice |
|
1025 | 1027 | $ HOME="`pwd`/alice" |
|
1026 | 1028 | $ cd alice |
|
1027 | 1029 | $ hg init pubrepo |
|
1028 | 1030 | $ cd pubrepo |
|
1029 | 1031 | $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null |
|
1030 | 1032 | $ hg add --large a-large-file |
|
1031 | 1033 | $ hg commit -m "Add a large file" |
|
1032 | 1034 | Invoking status precommit hook |
|
1033 | 1035 | A a-large-file |
|
1034 | 1036 | $ cd .. |
|
1035 | 1037 | $ chmod -R a-w pubrepo |
|
1036 | 1038 | $ cd .. |
|
1037 | 1039 | $ mkdir bob |
|
1038 | 1040 | $ HOME="`pwd`/bob" |
|
1039 | 1041 | $ cd bob |
|
1040 | 1042 | $ hg clone --pull ../alice/pubrepo pubrepo |
|
1041 | 1043 | requesting all changes |
|
1042 | 1044 | adding changesets |
|
1043 | 1045 | adding manifests |
|
1044 | 1046 | adding file changes |
|
1045 | 1047 | added 1 changesets with 1 changes to 1 files |
|
1046 | 1048 | updating to branch default |
|
1047 | 1049 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1048 | 1050 | getting changed largefiles |
|
1049 | 1051 | 1 largefiles updated, 0 removed |
|
1050 | 1052 | $ cd .. |
|
1051 | 1053 | $ chmod -R u+w alice/pubrepo |
|
1052 | 1054 | $ HOME="$ORIGHOME" |
|
1053 | 1055 | |
|
1056 | #endif | |
|
1057 | ||
|
1054 | 1058 | #if symlink |
|
1055 | 1059 | |
|
1056 | 1060 | Symlink to a large largefile should behave the same as a symlink to a normal file |
|
1057 | 1061 | $ hg init largesymlink |
|
1058 | 1062 | $ cd largesymlink |
|
1059 | 1063 | $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null |
|
1060 | 1064 | $ hg add --large largefile |
|
1061 | 1065 | $ hg commit -m "commit a large file" |
|
1062 | 1066 | Invoking status precommit hook |
|
1063 | 1067 | A largefile |
|
1064 | 1068 | $ ln -s largefile largelink |
|
1065 | 1069 | $ hg add largelink |
|
1066 | 1070 | $ hg commit -m "commit a large symlink" |
|
1067 | 1071 | Invoking status precommit hook |
|
1068 | 1072 | A largelink |
|
1069 | 1073 | $ rm -f largelink |
|
1070 | 1074 | $ hg up >/dev/null |
|
1071 | 1075 | $ test -f largelink |
|
1072 | 1076 | [1] |
|
1073 | 1077 | $ test -L largelink |
|
1074 | 1078 | [1] |
|
1075 | 1079 | $ rm -f largelink # make next part of the test independent of the previous |
|
1076 | 1080 | $ hg up -C >/dev/null |
|
1077 | 1081 | $ test -f largelink |
|
1078 | 1082 | $ test -L largelink |
|
1079 | 1083 | $ cd .. |
|
1080 | 1084 | |
|
1081 | 1085 | #endif |
|
1082 | 1086 | |
|
1083 | 1087 | test for pattern matching on 'hg status': |
|
1084 | 1088 | to boost performance, largefiles checks whether specified patterns are |
|
1085 | 1089 | related to largefiles in working directory (NOT to STANDIN) or not. |
|
1086 | 1090 | |
|
1087 | 1091 | $ hg init statusmatch |
|
1088 | 1092 | $ cd statusmatch |
|
1089 | 1093 | |
|
1090 | 1094 | $ mkdir -p a/b/c/d |
|
1091 | 1095 | $ echo normal > a/b/c/d/e.normal.txt |
|
1092 | 1096 | $ hg add a/b/c/d/e.normal.txt |
|
1093 | 1097 | $ echo large > a/b/c/d/e.large.txt |
|
1094 | 1098 | $ hg add --large a/b/c/d/e.large.txt |
|
1095 | 1099 | $ mkdir -p a/b/c/x |
|
1096 | 1100 | $ echo normal > a/b/c/x/y.normal.txt |
|
1097 | 1101 | $ hg add a/b/c/x/y.normal.txt |
|
1098 | 1102 | $ hg commit -m 'add files' |
|
1099 | 1103 | Invoking status precommit hook |
|
1100 | 1104 | A a/b/c/d/e.large.txt |
|
1101 | 1105 | A a/b/c/d/e.normal.txt |
|
1102 | 1106 | A a/b/c/x/y.normal.txt |
|
1103 | 1107 | |
|
1104 | 1108 | (1) no pattern: no performance boost |
|
1105 | 1109 | $ hg status -A |
|
1106 | 1110 | C a/b/c/d/e.large.txt |
|
1107 | 1111 | C a/b/c/d/e.normal.txt |
|
1108 | 1112 | C a/b/c/x/y.normal.txt |
|
1109 | 1113 | |
|
1110 | 1114 | (2) pattern not related to largefiles: performance boost |
|
1111 | 1115 | $ hg status -A a/b/c/x |
|
1112 | 1116 | C a/b/c/x/y.normal.txt |
|
1113 | 1117 | |
|
1114 | 1118 | (3) pattern related to largefiles: no performance boost |
|
1115 | 1119 | $ hg status -A a/b/c/d |
|
1116 | 1120 | C a/b/c/d/e.large.txt |
|
1117 | 1121 | C a/b/c/d/e.normal.txt |
|
1118 | 1122 | |
|
1119 | 1123 | (4) pattern related to STANDIN (not to largefiles): performance boost |
|
1120 | 1124 | $ hg status -A .hglf/a |
|
1121 | 1125 | C .hglf/a/b/c/d/e.large.txt |
|
1122 | 1126 | |
|
1123 | 1127 | (5) mixed case: no performance boost |
|
1124 | 1128 | $ hg status -A a/b/c/x a/b/c/d |
|
1125 | 1129 | C a/b/c/d/e.large.txt |
|
1126 | 1130 | C a/b/c/d/e.normal.txt |
|
1127 | 1131 | C a/b/c/x/y.normal.txt |
|
1128 | 1132 | |
|
1129 | 1133 | verify that largefiles doesn't break filesets |
|
1130 | 1134 | |
|
1131 | 1135 | $ hg log --rev . --exclude "set:binary()" |
|
1132 | 1136 | changeset: 0:41bd42f10efa |
|
1133 | 1137 | tag: tip |
|
1134 | 1138 | user: test |
|
1135 | 1139 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1136 | 1140 | summary: add files |
|
1137 | 1141 | |
|
1138 | 1142 | verify that large files in subrepos handled properly |
|
1139 | 1143 | $ hg init subrepo |
|
1140 | 1144 | $ echo "subrepo = subrepo" > .hgsub |
|
1141 | 1145 | $ hg add .hgsub |
|
1142 | 1146 | $ hg ci -m "add subrepo" |
|
1143 | 1147 | Invoking status precommit hook |
|
1144 | 1148 | A .hgsub |
|
1145 | 1149 | ? .hgsubstate |
|
1146 | 1150 | $ echo "rev 1" > subrepo/large.txt |
|
1147 | 1151 | $ hg -R subrepo add --large subrepo/large.txt |
|
1148 | 1152 | $ hg sum |
|
1149 | 1153 | parent: 1:8ee150ea2e9c tip |
|
1150 | 1154 | add subrepo |
|
1151 | 1155 | branch: default |
|
1152 | 1156 | commit: 1 subrepos |
|
1153 | 1157 | update: (current) |
|
1154 | 1158 | $ hg st |
|
1155 | 1159 | $ hg st -S |
|
1156 | 1160 | A subrepo/large.txt |
|
1157 | 1161 | $ hg ci -S -m "commit top repo" |
|
1158 | 1162 | committing subrepository subrepo |
|
1159 | 1163 | Invoking status precommit hook |
|
1160 | 1164 | A large.txt |
|
1161 | 1165 | Invoking status precommit hook |
|
1162 | 1166 | M .hgsubstate |
|
1163 | 1167 | # No differences |
|
1164 | 1168 | $ hg st -S |
|
1165 | 1169 | $ hg sum |
|
1166 | 1170 | parent: 2:ce4cd0c527a6 tip |
|
1167 | 1171 | commit top repo |
|
1168 | 1172 | branch: default |
|
1169 | 1173 | commit: (clean) |
|
1170 | 1174 | update: (current) |
|
1171 | 1175 | $ echo "rev 2" > subrepo/large.txt |
|
1172 | 1176 | $ hg st -S |
|
1173 | 1177 | M subrepo/large.txt |
|
1174 | 1178 | $ hg sum |
|
1175 | 1179 | parent: 2:ce4cd0c527a6 tip |
|
1176 | 1180 | commit top repo |
|
1177 | 1181 | branch: default |
|
1178 | 1182 | commit: 1 subrepos |
|
1179 | 1183 | update: (current) |
|
1180 | 1184 | $ hg ci -m "this commit should fail without -S" |
|
1181 | 1185 | abort: uncommitted changes in subrepo subrepo |
|
1182 | 1186 | (use --subrepos for recursive commit) |
|
1183 | 1187 | [255] |
|
1184 | 1188 | |
|
1185 | 1189 | Add a normal file to the subrepo, then test archiving |
|
1186 | 1190 | |
|
1187 | 1191 | $ echo 'normal file' > subrepo/normal.txt |
|
1188 | 1192 | $ hg -R subrepo add subrepo/normal.txt |
|
1189 | 1193 | |
|
1190 | 1194 | Lock in subrepo, otherwise the change isn't archived |
|
1191 | 1195 | |
|
1192 | 1196 | $ hg ci -S -m "add normal file to top level" |
|
1193 | 1197 | committing subrepository subrepo |
|
1194 | 1198 | Invoking status precommit hook |
|
1195 | 1199 | M large.txt |
|
1196 | 1200 | A normal.txt |
|
1197 | 1201 | Invoking status precommit hook |
|
1198 | 1202 | M .hgsubstate |
|
1199 | 1203 | $ hg archive -S lf_subrepo_archive |
|
1200 | 1204 | $ find lf_subrepo_archive | sort |
|
1201 | 1205 | lf_subrepo_archive |
|
1202 | 1206 | lf_subrepo_archive/.hg_archival.txt |
|
1203 | 1207 | lf_subrepo_archive/.hgsub |
|
1204 | 1208 | lf_subrepo_archive/.hgsubstate |
|
1205 | 1209 | lf_subrepo_archive/a |
|
1206 | 1210 | lf_subrepo_archive/a/b |
|
1207 | 1211 | lf_subrepo_archive/a/b/c |
|
1208 | 1212 | lf_subrepo_archive/a/b/c/d |
|
1209 | 1213 | lf_subrepo_archive/a/b/c/d/e.large.txt |
|
1210 | 1214 | lf_subrepo_archive/a/b/c/d/e.normal.txt |
|
1211 | 1215 | lf_subrepo_archive/a/b/c/x |
|
1212 | 1216 | lf_subrepo_archive/a/b/c/x/y.normal.txt |
|
1213 | 1217 | lf_subrepo_archive/subrepo |
|
1214 | 1218 | lf_subrepo_archive/subrepo/large.txt |
|
1215 | 1219 | lf_subrepo_archive/subrepo/normal.txt |
|
1216 | 1220 | |
|
1217 | 1221 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now