Show More
@@ -1,85 +1,85 b'' | |||||
1 | # minifileset.py - a simple language to select files |
|
1 | # minifileset.py - a simple language to select files | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Facebook, Inc. |
|
3 | # Copyright 2017 Facebook, Inc. | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | from .i18n import _ |
|
10 | from .i18n import _ | |
11 | from . import ( |
|
11 | from . import ( | |
12 | error, |
|
12 | error, | |
13 | fileset, |
|
13 | fileset, | |
14 | ) |
|
14 | ) | |
15 |
|
15 | |||
16 | def _compile(tree): |
|
16 | def _compile(tree): | |
17 | if not tree: |
|
17 | if not tree: | |
18 | raise error.ParseError(_("missing argument")) |
|
18 | raise error.ParseError(_("missing argument")) | |
19 | op = tree[0] |
|
19 | op = tree[0] | |
20 | if op in {'symbol', 'string', 'kindpat'}: |
|
20 | if op in {'symbol', 'string', 'kindpat'}: | |
21 | name = fileset.getpattern(tree, {'path'}, _('invalid file pattern')) |
|
21 | name = fileset.getpattern(tree, {'path'}, _('invalid file pattern')) | |
22 | if name.startswith('**'): # file extension test, ex. "**.tar.gz" |
|
22 | if name.startswith('**'): # file extension test, ex. "**.tar.gz" | |
23 | ext = name[2:] |
|
23 | ext = name[2:] | |
24 | for c in ext: |
|
24 | for c in ext: | |
25 | if c in '*{}[]?/\\': |
|
25 | if c in '*{}[]?/\\': | |
26 | raise error.ParseError(_('reserved character: %s') % c) |
|
26 | raise error.ParseError(_('reserved character: %s') % c) | |
27 | return lambda n, s: n.endswith(ext) |
|
27 | return lambda n, s: n.endswith(ext) | |
28 | elif name.startswith('path:'): # directory or full path test |
|
28 | elif name.startswith('path:'): # directory or full path test | |
29 | p = name[5:] # prefix |
|
29 | p = name[5:] # prefix | |
30 | pl = len(p) |
|
30 | pl = len(p) | |
31 | f = lambda n, s: n.startswith(p) and (len(n) == pl or n[pl] == '/') |
|
31 | f = lambda n, s: n.startswith(p) and (len(n) == pl or n[pl] == '/') | |
32 | return f |
|
32 | return f | |
33 | raise error.ParseError(_("unsupported file pattern"), |
|
33 | raise error.ParseError(_("unsupported file pattern: %s") % name, | |
34 | hint=_('paths must be prefixed with "path:"')) |
|
34 | hint=_('paths must be prefixed with "path:"')) | |
35 | elif op == 'or': |
|
35 | elif op == 'or': | |
36 | func1 = _compile(tree[1]) |
|
36 | func1 = _compile(tree[1]) | |
37 | func2 = _compile(tree[2]) |
|
37 | func2 = _compile(tree[2]) | |
38 | return lambda n, s: func1(n, s) or func2(n, s) |
|
38 | return lambda n, s: func1(n, s) or func2(n, s) | |
39 | elif op == 'and': |
|
39 | elif op == 'and': | |
40 | func1 = _compile(tree[1]) |
|
40 | func1 = _compile(tree[1]) | |
41 | func2 = _compile(tree[2]) |
|
41 | func2 = _compile(tree[2]) | |
42 | return lambda n, s: func1(n, s) and func2(n, s) |
|
42 | return lambda n, s: func1(n, s) and func2(n, s) | |
43 | elif op == 'not': |
|
43 | elif op == 'not': | |
44 | return lambda n, s: not _compile(tree[1])(n, s) |
|
44 | return lambda n, s: not _compile(tree[1])(n, s) | |
45 | elif op == 'group': |
|
45 | elif op == 'group': | |
46 | return _compile(tree[1]) |
|
46 | return _compile(tree[1]) | |
47 | elif op == 'func': |
|
47 | elif op == 'func': | |
48 | symbols = { |
|
48 | symbols = { | |
49 | 'all': lambda n, s: True, |
|
49 | 'all': lambda n, s: True, | |
50 | 'none': lambda n, s: False, |
|
50 | 'none': lambda n, s: False, | |
51 | 'size': lambda n, s: fileset.sizematcher(tree[2])(s), |
|
51 | 'size': lambda n, s: fileset.sizematcher(tree[2])(s), | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | name = fileset.getsymbol(tree[1]) |
|
54 | name = fileset.getsymbol(tree[1]) | |
55 | if name in symbols: |
|
55 | if name in symbols: | |
56 | return symbols[name] |
|
56 | return symbols[name] | |
57 |
|
57 | |||
58 | raise error.UnknownIdentifier(name, symbols.keys()) |
|
58 | raise error.UnknownIdentifier(name, symbols.keys()) | |
59 | elif op == 'minus': # equivalent to 'x and not y' |
|
59 | elif op == 'minus': # equivalent to 'x and not y' | |
60 | func1 = _compile(tree[1]) |
|
60 | func1 = _compile(tree[1]) | |
61 | func2 = _compile(tree[2]) |
|
61 | func2 = _compile(tree[2]) | |
62 | return lambda n, s: func1(n, s) and not func2(n, s) |
|
62 | return lambda n, s: func1(n, s) and not func2(n, s) | |
63 | elif op == 'negate': |
|
63 | elif op == 'negate': | |
64 | raise error.ParseError(_("can't use negate operator in this context")) |
|
64 | raise error.ParseError(_("can't use negate operator in this context")) | |
65 | elif op == 'list': |
|
65 | elif op == 'list': | |
66 | raise error.ParseError(_("can't use a list in this context"), |
|
66 | raise error.ParseError(_("can't use a list in this context"), | |
67 | hint=_('see hg help "filesets.x or y"')) |
|
67 | hint=_('see hg help "filesets.x or y"')) | |
68 | raise error.ProgrammingError('illegal tree: %r' % (tree,)) |
|
68 | raise error.ProgrammingError('illegal tree: %r' % (tree,)) | |
69 |
|
69 | |||
70 | def compile(text): |
|
70 | def compile(text): | |
71 | """generate a function (path, size) -> bool from filter specification. |
|
71 | """generate a function (path, size) -> bool from filter specification. | |
72 |
|
72 | |||
73 | "text" could contain the operators defined by the fileset language for |
|
73 | "text" could contain the operators defined by the fileset language for | |
74 | common logic operations, and parenthesis for grouping. The supported path |
|
74 | common logic operations, and parenthesis for grouping. The supported path | |
75 | tests are '**.extname' for file extension test, and '"path:dir/subdir"' |
|
75 | tests are '**.extname' for file extension test, and '"path:dir/subdir"' | |
76 | for prefix test. The ``size()`` predicate is borrowed from filesets to test |
|
76 | for prefix test. The ``size()`` predicate is borrowed from filesets to test | |
77 | file size. The predicates ``all()`` and ``none()`` are also supported. |
|
77 | file size. The predicates ``all()`` and ``none()`` are also supported. | |
78 |
|
78 | |||
79 | '(**.php & size(">10MB")) | **.zip | (path:bin & !path:bin/README)' for |
|
79 | '(**.php & size(">10MB")) | **.zip | (path:bin & !path:bin/README)' for | |
80 | example, will catch all php files whose size is greater than 10 MB, all |
|
80 | example, will catch all php files whose size is greater than 10 MB, all | |
81 | files whose name ends with ".zip", and all files under "bin" in the repo |
|
81 | files whose name ends with ".zip", and all files under "bin" in the repo | |
82 | root except for "bin/README". |
|
82 | root except for "bin/README". | |
83 | """ |
|
83 | """ | |
84 | tree = fileset.parse(text) |
|
84 | tree = fileset.parse(text) | |
85 | return _compile(tree) |
|
85 | return _compile(tree) |
@@ -1,1064 +1,1068 b'' | |||||
1 | # Initial setup |
|
1 | # Initial setup | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH << EOF |
|
3 | $ cat >> $HGRCPATH << EOF | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > lfs= |
|
5 | > lfs= | |
6 | > [lfs] |
|
6 | > [lfs] | |
7 | > # Test deprecated config |
|
7 | > # Test deprecated config | |
8 | > threshold=1000B |
|
8 | > threshold=1000B | |
9 | > EOF |
|
9 | > EOF | |
10 |
|
10 | |||
11 | $ LONG=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC | |
12 |
|
12 | |||
13 | # Prepare server and enable extension |
|
13 | # Prepare server and enable extension | |
14 | $ hg init server |
|
14 | $ hg init server | |
15 | $ hg clone -q server client |
|
15 | $ hg clone -q server client | |
16 | $ cd client |
|
16 | $ cd client | |
17 |
|
17 | |||
18 | # Commit small file |
|
18 | # Commit small file | |
19 | $ echo s > smallfile |
|
19 | $ echo s > smallfile | |
20 | $ echo '**.py = LF' > .hgeol |
|
20 | $ echo '**.py = LF' > .hgeol | |
|
21 | $ hg --config lfs.track='"size(\">1000B\")"' commit -Aqm "add small file" | |||
|
22 | hg: parse error: unsupported file pattern: size(">1000B") | |||
|
23 | (paths must be prefixed with "path:") | |||
|
24 | [255] | |||
21 | $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file" |
|
25 | $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file" | |
22 |
|
26 | |||
23 | # Commit large file |
|
27 | # Commit large file | |
24 | $ echo $LONG > largefile |
|
28 | $ echo $LONG > largefile | |
25 | $ grep lfs .hg/requires |
|
29 | $ grep lfs .hg/requires | |
26 | [1] |
|
30 | [1] | |
27 | $ hg commit --traceback -Aqm "add large file" |
|
31 | $ hg commit --traceback -Aqm "add large file" | |
28 | $ grep lfs .hg/requires |
|
32 | $ grep lfs .hg/requires | |
29 | lfs |
|
33 | lfs | |
30 |
|
34 | |||
31 | # Ensure metadata is stored |
|
35 | # Ensure metadata is stored | |
32 | $ hg debugdata largefile 0 |
|
36 | $ hg debugdata largefile 0 | |
33 | version https://git-lfs.github.com/spec/v1 |
|
37 | version https://git-lfs.github.com/spec/v1 | |
34 | oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b |
|
38 | oid sha256:f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b | |
35 | size 1501 |
|
39 | size 1501 | |
36 | x-is-binary 0 |
|
40 | x-is-binary 0 | |
37 |
|
41 | |||
38 | # Check the blobstore is populated |
|
42 | # Check the blobstore is populated | |
39 | $ find .hg/store/lfs/objects | sort |
|
43 | $ find .hg/store/lfs/objects | sort | |
40 | .hg/store/lfs/objects |
|
44 | .hg/store/lfs/objects | |
41 | .hg/store/lfs/objects/f1 |
|
45 | .hg/store/lfs/objects/f1 | |
42 | .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b |
|
46 | .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b | |
43 |
|
47 | |||
44 | # Check the blob stored contains the actual contents of the file |
|
48 | # Check the blob stored contains the actual contents of the file | |
45 | $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b |
|
49 | $ cat .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b | |
46 | AAAAAAAAAAAAAAAAA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ing to $TESTTMP/server |
|
55 | pushing to $TESTTMP/server | |
52 | searching for changes |
|
56 | searching for changes | |
53 | abort: lfs.url needs to be configured |
|
57 | abort: lfs.url needs to be configured | |
54 | [255] |
|
58 | [255] | |
55 |
|
59 | |||
56 | $ cat >> $HGRCPATH << EOF |
|
60 | $ cat >> $HGRCPATH << EOF | |
57 | > [lfs] |
|
61 | > [lfs] | |
58 | > url=file:$TESTTMP/dummy-remote/ |
|
62 | > url=file:$TESTTMP/dummy-remote/ | |
59 | > EOF |
|
63 | > EOF | |
60 |
|
64 | |||
61 | Push to a local non-lfs repo with the extension enabled will add the |
|
65 | Push to a local non-lfs repo with the extension enabled will add the | |
62 | lfs requirement |
|
66 | lfs requirement | |
63 |
|
67 | |||
64 | $ grep lfs $TESTTMP/server/.hg/requires |
|
68 | $ grep lfs $TESTTMP/server/.hg/requires | |
65 | [1] |
|
69 | [1] | |
66 | $ hg push -v | egrep -v '^(uncompressed| )' |
|
70 | $ hg push -v | egrep -v '^(uncompressed| )' | |
67 | pushing to $TESTTMP/server |
|
71 | pushing to $TESTTMP/server | |
68 | searching for changes |
|
72 | searching for changes | |
69 | lfs: found f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b in the local lfs store |
|
73 | lfs: found f11e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b in the local lfs store | |
70 | 2 changesets found |
|
74 | 2 changesets found | |
71 | adding changesets |
|
75 | adding changesets | |
72 | adding manifests |
|
76 | adding manifests | |
73 | adding file changes |
|
77 | adding file changes | |
74 | added 2 changesets with 3 changes to 3 files |
|
78 | added 2 changesets with 3 changes to 3 files | |
75 | calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs |
|
79 | calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs | |
76 | $ grep lfs $TESTTMP/server/.hg/requires |
|
80 | $ grep lfs $TESTTMP/server/.hg/requires | |
77 | lfs |
|
81 | lfs | |
78 |
|
82 | |||
79 | # Unknown URL scheme |
|
83 | # Unknown URL scheme | |
80 |
|
84 | |||
81 | $ hg push --config lfs.url=ftp://foobar |
|
85 | $ hg push --config lfs.url=ftp://foobar | |
82 | abort: lfs: unknown url scheme: ftp |
|
86 | abort: lfs: unknown url scheme: ftp | |
83 | [255] |
|
87 | [255] | |
84 |
|
88 | |||
85 | $ cd ../ |
|
89 | $ cd ../ | |
86 |
|
90 | |||
87 | # Initialize new client (not cloning) and setup extension |
|
91 | # Initialize new client (not cloning) and setup extension | |
88 | $ hg init client2 |
|
92 | $ hg init client2 | |
89 | $ cd client2 |
|
93 | $ cd client2 | |
90 | $ cat >> .hg/hgrc <<EOF |
|
94 | $ cat >> .hg/hgrc <<EOF | |
91 | > [paths] |
|
95 | > [paths] | |
92 | > default = $TESTTMP/server |
|
96 | > default = $TESTTMP/server | |
93 | > EOF |
|
97 | > EOF | |
94 |
|
98 | |||
95 | # Pull from server |
|
99 | # Pull from server | |
96 |
|
100 | |||
97 | Pulling a local lfs repo into a local non-lfs repo with the extension |
|
101 | Pulling a local lfs repo into a local non-lfs repo with the extension | |
98 | enabled adds the lfs requirement |
|
102 | enabled adds the lfs requirement | |
99 |
|
103 | |||
100 | $ grep lfs .hg/requires $TESTTMP/server/.hg/requires |
|
104 | $ grep lfs .hg/requires $TESTTMP/server/.hg/requires | |
101 | $TESTTMP/server/.hg/requires:lfs |
|
105 | $TESTTMP/server/.hg/requires:lfs | |
102 | $ hg pull default |
|
106 | $ hg pull default | |
103 | pulling from $TESTTMP/server |
|
107 | pulling from $TESTTMP/server | |
104 | requesting all changes |
|
108 | requesting all changes | |
105 | adding changesets |
|
109 | adding changesets | |
106 | adding manifests |
|
110 | adding manifests | |
107 | adding file changes |
|
111 | adding file changes | |
108 | added 2 changesets with 3 changes to 3 files |
|
112 | added 2 changesets with 3 changes to 3 files | |
109 | new changesets 0ead593177f7:b88141481348 |
|
113 | new changesets 0ead593177f7:b88141481348 | |
110 | (run 'hg update' to get a working copy) |
|
114 | (run 'hg update' to get a working copy) | |
111 | $ grep lfs .hg/requires $TESTTMP/server/.hg/requires |
|
115 | $ grep lfs .hg/requires $TESTTMP/server/.hg/requires | |
112 | .hg/requires:lfs |
|
116 | .hg/requires:lfs | |
113 | $TESTTMP/server/.hg/requires:lfs |
|
117 | $TESTTMP/server/.hg/requires:lfs | |
114 |
|
118 | |||
115 | # Check the blobstore is not yet populated |
|
119 | # Check the blobstore is not yet populated | |
116 | $ [ -d .hg/store/lfs/objects ] |
|
120 | $ [ -d .hg/store/lfs/objects ] | |
117 | [1] |
|
121 | [1] | |
118 |
|
122 | |||
119 | # Update to the last revision containing the large file |
|
123 | # Update to the last revision containing the large file | |
120 | $ hg update |
|
124 | $ hg update | |
121 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
125 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
122 |
|
126 | |||
123 | # Check the blobstore has been populated on update |
|
127 | # Check the blobstore has been populated on update | |
124 | $ find .hg/store/lfs/objects | sort |
|
128 | $ find .hg/store/lfs/objects | sort | |
125 | .hg/store/lfs/objects |
|
129 | .hg/store/lfs/objects | |
126 | .hg/store/lfs/objects/f1 |
|
130 | .hg/store/lfs/objects/f1 | |
127 | .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b |
|
131 | .hg/store/lfs/objects/f1/1e77c257047a398492d8d6cb9f6acf3aa7c4384bb23080b43546053e183e4b | |
128 |
|
132 | |||
129 | # Check the contents of the file are fetched from blobstore when requested |
|
133 | # Check the contents of the file are fetched from blobstore when requested | |
130 | $ hg cat -r . largefile |
|
134 | $ hg cat -r . largefile | |
131 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC | |
132 |
|
136 | |||
133 | # Check the file has been copied in the working copy |
|
137 | # Check the file has been copied in the working copy | |
134 | $ cat largefile |
|
138 | $ cat largefile | |
135 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC | |
136 |
|
140 | |||
137 | $ cd .. |
|
141 | $ cd .. | |
138 |
|
142 | |||
139 | # Check rename, and switch between large and small files |
|
143 | # Check rename, and switch between large and small files | |
140 |
|
144 | |||
141 | $ hg init repo3 |
|
145 | $ hg init repo3 | |
142 | $ cd repo3 |
|
146 | $ cd repo3 | |
143 | $ cat >> .hg/hgrc << EOF |
|
147 | $ cat >> .hg/hgrc << EOF | |
144 | > [lfs] |
|
148 | > [lfs] | |
145 | > track=size(">10B") |
|
149 | > track=size(">10B") | |
146 | > EOF |
|
150 | > EOF | |
147 |
|
151 | |||
148 | $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large |
|
152 | $ echo LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS > large | |
149 | $ echo SHORTER > small |
|
153 | $ echo SHORTER > small | |
150 | $ hg add . -q |
|
154 | $ hg add . -q | |
151 | $ hg commit -m 'commit with lfs content' |
|
155 | $ hg commit -m 'commit with lfs content' | |
152 |
|
156 | |||
153 | $ hg mv large l |
|
157 | $ hg mv large l | |
154 | $ hg mv small s |
|
158 | $ hg mv small s | |
155 | $ hg commit -m 'renames' |
|
159 | $ hg commit -m 'renames' | |
156 |
|
160 | |||
157 | $ echo SHORT > l |
|
161 | $ echo SHORT > l | |
158 | $ echo BECOME-LARGER-FROM-SHORTER > s |
|
162 | $ echo BECOME-LARGER-FROM-SHORTER > s | |
159 | $ hg commit -m 'large to small, small to large' |
|
163 | $ hg commit -m 'large to small, small to large' | |
160 |
|
164 | |||
161 | $ echo 1 >> l |
|
165 | $ echo 1 >> l | |
162 | $ echo 2 >> s |
|
166 | $ echo 2 >> s | |
163 | $ hg commit -m 'random modifications' |
|
167 | $ hg commit -m 'random modifications' | |
164 |
|
168 | |||
165 | $ echo RESTORE-TO-BE-LARGE > l |
|
169 | $ echo RESTORE-TO-BE-LARGE > l | |
166 | $ echo SHORTER > s |
|
170 | $ echo SHORTER > s | |
167 | $ hg commit -m 'switch large and small again' |
|
171 | $ hg commit -m 'switch large and small again' | |
168 |
|
172 | |||
169 | # Test lfs_files template |
|
173 | # Test lfs_files template | |
170 |
|
174 | |||
171 | $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n' |
|
175 | $ hg log -r 'all()' -T '{rev} {join(lfs_files, ", ")}\n' | |
172 | 0 large |
|
176 | 0 large | |
173 | 1 l |
|
177 | 1 l | |
174 | 2 s |
|
178 | 2 s | |
175 | 3 s |
|
179 | 3 s | |
176 | 4 l |
|
180 | 4 l | |
177 |
|
181 | |||
178 | # Push and pull the above repo |
|
182 | # Push and pull the above repo | |
179 |
|
183 | |||
180 | $ hg --cwd .. init repo4 |
|
184 | $ hg --cwd .. init repo4 | |
181 | $ hg push ../repo4 |
|
185 | $ hg push ../repo4 | |
182 | pushing to ../repo4 |
|
186 | pushing to ../repo4 | |
183 | searching for changes |
|
187 | searching for changes | |
184 | adding changesets |
|
188 | adding changesets | |
185 | adding manifests |
|
189 | adding manifests | |
186 | adding file changes |
|
190 | adding file changes | |
187 | added 5 changesets with 10 changes to 4 files |
|
191 | added 5 changesets with 10 changes to 4 files | |
188 |
|
192 | |||
189 | $ hg --cwd .. init repo5 |
|
193 | $ hg --cwd .. init repo5 | |
190 | $ hg --cwd ../repo5 pull ../repo3 |
|
194 | $ hg --cwd ../repo5 pull ../repo3 | |
191 | pulling from ../repo3 |
|
195 | pulling from ../repo3 | |
192 | requesting all changes |
|
196 | requesting all changes | |
193 | adding changesets |
|
197 | adding changesets | |
194 | adding manifests |
|
198 | adding manifests | |
195 | adding file changes |
|
199 | adding file changes | |
196 | added 5 changesets with 10 changes to 4 files |
|
200 | added 5 changesets with 10 changes to 4 files | |
197 | new changesets fd47a419c4f7:5adf850972b9 |
|
201 | new changesets fd47a419c4f7:5adf850972b9 | |
198 | (run 'hg update' to get a working copy) |
|
202 | (run 'hg update' to get a working copy) | |
199 |
|
203 | |||
200 | $ cd .. |
|
204 | $ cd .. | |
201 |
|
205 | |||
202 | # Test clone |
|
206 | # Test clone | |
203 |
|
207 | |||
204 | $ hg init repo6 |
|
208 | $ hg init repo6 | |
205 | $ cd repo6 |
|
209 | $ cd repo6 | |
206 | $ cat >> .hg/hgrc << EOF |
|
210 | $ cat >> .hg/hgrc << EOF | |
207 | > [lfs] |
|
211 | > [lfs] | |
208 | > track=size(">30B") |
|
212 | > track=size(">30B") | |
209 | > EOF |
|
213 | > EOF | |
210 |
|
214 | |||
211 | $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large |
|
215 | $ echo LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES > large | |
212 | $ echo SMALL > small |
|
216 | $ echo SMALL > small | |
213 | $ hg commit -Aqm 'create a lfs file' large small |
|
217 | $ hg commit -Aqm 'create a lfs file' large small | |
214 | $ hg debuglfsupload -r 'all()' -v |
|
218 | $ hg debuglfsupload -r 'all()' -v | |
215 | lfs: found 8e92251415339ae9b148c8da89ed5ec665905166a1ab11b09dca8fad83344738 in the local lfs store |
|
219 | lfs: found 8e92251415339ae9b148c8da89ed5ec665905166a1ab11b09dca8fad83344738 in the local lfs store | |
216 |
|
220 | |||
217 | $ cd .. |
|
221 | $ cd .. | |
218 |
|
222 | |||
219 | $ hg clone repo6 repo7 |
|
223 | $ hg clone repo6 repo7 | |
220 | updating to branch default |
|
224 | updating to branch default | |
221 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
225 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
222 | $ cd repo7 |
|
226 | $ cd repo7 | |
223 | $ hg config extensions --debug | grep lfs |
|
227 | $ hg config extensions --debug | grep lfs | |
224 | $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob) |
|
228 | $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob) | |
225 | $ cat large |
|
229 | $ cat large | |
226 | LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES |
|
230 | LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES | |
227 | $ cat small |
|
231 | $ cat small | |
228 | SMALL |
|
232 | SMALL | |
229 |
|
233 | |||
230 | $ cd .. |
|
234 | $ cd .. | |
231 |
|
235 | |||
232 | $ hg --config extensions.share= share repo7 sharedrepo |
|
236 | $ hg --config extensions.share= share repo7 sharedrepo | |
233 | updating working directory |
|
237 | updating working directory | |
234 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
238 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
235 | $ hg -R sharedrepo config extensions --debug | grep lfs |
|
239 | $ hg -R sharedrepo config extensions --debug | grep lfs | |
236 | $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob) |
|
240 | $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob) | |
237 |
|
241 | |||
238 | # Test rename and status |
|
242 | # Test rename and status | |
239 |
|
243 | |||
240 | $ hg init repo8 |
|
244 | $ hg init repo8 | |
241 | $ cd repo8 |
|
245 | $ cd repo8 | |
242 | $ cat >> .hg/hgrc << EOF |
|
246 | $ cat >> .hg/hgrc << EOF | |
243 | > [lfs] |
|
247 | > [lfs] | |
244 | > track=size(">10B") |
|
248 | > track=size(">10B") | |
245 | > EOF |
|
249 | > EOF | |
246 |
|
250 | |||
247 | $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1 |
|
251 | $ echo THIS-IS-LFS-BECAUSE-10-BYTES > a1 | |
248 | $ echo SMALL > a2 |
|
252 | $ echo SMALL > a2 | |
249 | $ hg commit -m a -A a1 a2 |
|
253 | $ hg commit -m a -A a1 a2 | |
250 | $ hg status |
|
254 | $ hg status | |
251 | $ hg mv a1 b1 |
|
255 | $ hg mv a1 b1 | |
252 | $ hg mv a2 a1 |
|
256 | $ hg mv a2 a1 | |
253 | $ hg mv b1 a2 |
|
257 | $ hg mv b1 a2 | |
254 | $ hg commit -m b |
|
258 | $ hg commit -m b | |
255 | $ hg status |
|
259 | $ hg status | |
256 | >>> with open('a2', 'wb') as f: |
|
260 | >>> with open('a2', 'wb') as f: | |
257 | ... f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA') |
|
261 | ... f.write(b'\1\nSTART-WITH-HG-FILELOG-METADATA') | |
258 | >>> with open('a1', 'wb') as f: |
|
262 | >>> with open('a1', 'wb') as f: | |
259 | ... f.write(b'\1\nMETA\n') |
|
263 | ... f.write(b'\1\nMETA\n') | |
260 | $ hg commit -m meta |
|
264 | $ hg commit -m meta | |
261 | $ hg status |
|
265 | $ hg status | |
262 | $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n' |
|
266 | $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n' | |
263 | 2: | | |
|
267 | 2: | | | |
264 | 1: a1 (a2)a2 (a1) | | |
|
268 | 1: a1 (a2)a2 (a1) | | | |
265 | 0: | | a1 a2 |
|
269 | 0: | | a1 a2 | |
266 |
|
270 | |||
267 | $ for n in a1 a2; do |
|
271 | $ for n in a1 a2; do | |
268 | > for r in 0 1 2; do |
|
272 | > for r in 0 1 2; do | |
269 | > printf '\n%s @ %s\n' $n $r |
|
273 | > printf '\n%s @ %s\n' $n $r | |
270 | > hg debugdata $n $r |
|
274 | > hg debugdata $n $r | |
271 | > done |
|
275 | > done | |
272 | > done |
|
276 | > done | |
273 |
|
277 | |||
274 | a1 @ 0 |
|
278 | a1 @ 0 | |
275 | version https://git-lfs.github.com/spec/v1 |
|
279 | version https://git-lfs.github.com/spec/v1 | |
276 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
280 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
277 | size 29 |
|
281 | size 29 | |
278 | x-is-binary 0 |
|
282 | x-is-binary 0 | |
279 |
|
283 | |||
280 | a1 @ 1 |
|
284 | a1 @ 1 | |
281 | \x01 (esc) |
|
285 | \x01 (esc) | |
282 | copy: a2 |
|
286 | copy: a2 | |
283 | copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9 |
|
287 | copyrev: 50470ad23cf937b1f4b9f80bfe54df38e65b50d9 | |
284 | \x01 (esc) |
|
288 | \x01 (esc) | |
285 | SMALL |
|
289 | SMALL | |
286 |
|
290 | |||
287 | a1 @ 2 |
|
291 | a1 @ 2 | |
288 | \x01 (esc) |
|
292 | \x01 (esc) | |
289 | \x01 (esc) |
|
293 | \x01 (esc) | |
290 | \x01 (esc) |
|
294 | \x01 (esc) | |
291 | META |
|
295 | META | |
292 |
|
296 | |||
293 | a2 @ 0 |
|
297 | a2 @ 0 | |
294 | SMALL |
|
298 | SMALL | |
295 |
|
299 | |||
296 | a2 @ 1 |
|
300 | a2 @ 1 | |
297 | version https://git-lfs.github.com/spec/v1 |
|
301 | version https://git-lfs.github.com/spec/v1 | |
298 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
302 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
299 | size 29 |
|
303 | size 29 | |
300 | x-hg-copy a1 |
|
304 | x-hg-copy a1 | |
301 | x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4 |
|
305 | x-hg-copyrev be23af27908a582af43e5cda209a5a9b319de8d4 | |
302 | x-is-binary 0 |
|
306 | x-is-binary 0 | |
303 |
|
307 | |||
304 | a2 @ 2 |
|
308 | a2 @ 2 | |
305 | version https://git-lfs.github.com/spec/v1 |
|
309 | version https://git-lfs.github.com/spec/v1 | |
306 | oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943 |
|
310 | oid sha256:876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943 | |
307 | size 32 |
|
311 | size 32 | |
308 | x-is-binary 0 |
|
312 | x-is-binary 0 | |
309 |
|
313 | |||
310 | # Verify commit hashes include rename metadata |
|
314 | # Verify commit hashes include rename metadata | |
311 |
|
315 | |||
312 | $ hg log -T '{rev}:{node|short} {desc}\n' |
|
316 | $ hg log -T '{rev}:{node|short} {desc}\n' | |
313 | 2:0fae949de7fa meta |
|
317 | 2:0fae949de7fa meta | |
314 | 1:9cd6bdffdac0 b |
|
318 | 1:9cd6bdffdac0 b | |
315 | 0:7f96794915f7 a |
|
319 | 0:7f96794915f7 a | |
316 |
|
320 | |||
317 | $ cd .. |
|
321 | $ cd .. | |
318 |
|
322 | |||
319 | # Test bundle |
|
323 | # Test bundle | |
320 |
|
324 | |||
321 | $ hg init repo9 |
|
325 | $ hg init repo9 | |
322 | $ cd repo9 |
|
326 | $ cd repo9 | |
323 | $ cat >> .hg/hgrc << EOF |
|
327 | $ cat >> .hg/hgrc << EOF | |
324 | > [lfs] |
|
328 | > [lfs] | |
325 | > track=size(">10B") |
|
329 | > track=size(">10B") | |
326 | > [diff] |
|
330 | > [diff] | |
327 | > git=1 |
|
331 | > git=1 | |
328 | > EOF |
|
332 | > EOF | |
329 |
|
333 | |||
330 | $ for i in 0 single two three 4; do |
|
334 | $ for i in 0 single two three 4; do | |
331 | > echo 'THIS-IS-LFS-'$i > a |
|
335 | > echo 'THIS-IS-LFS-'$i > a | |
332 | > hg commit -m a-$i -A a |
|
336 | > hg commit -m a-$i -A a | |
333 | > done |
|
337 | > done | |
334 |
|
338 | |||
335 | $ hg update 2 -q |
|
339 | $ hg update 2 -q | |
336 | $ echo 'THIS-IS-LFS-2-CHILD' > a |
|
340 | $ echo 'THIS-IS-LFS-2-CHILD' > a | |
337 | $ hg commit -m branching -q |
|
341 | $ hg commit -m branching -q | |
338 |
|
342 | |||
339 | $ hg bundle --base 1 bundle.hg -v |
|
343 | $ hg bundle --base 1 bundle.hg -v | |
340 | lfs: found 5ab7a3739a5feec94a562d070a14f36dba7cad17e5484a4a89eea8e5f3166888 in the local lfs store |
|
344 | lfs: found 5ab7a3739a5feec94a562d070a14f36dba7cad17e5484a4a89eea8e5f3166888 in the local lfs store | |
341 | lfs: found a9c7d1cd6ce2b9bbdf46ed9a862845228717b921c089d0d42e3bcaed29eb612e in the local lfs store |
|
345 | lfs: found a9c7d1cd6ce2b9bbdf46ed9a862845228717b921c089d0d42e3bcaed29eb612e in the local lfs store | |
342 | lfs: found f693890c49c409ec33673b71e53f297681f76c1166daf33b2ad7ebf8b1d3237e in the local lfs store |
|
346 | lfs: found f693890c49c409ec33673b71e53f297681f76c1166daf33b2ad7ebf8b1d3237e in the local lfs store | |
343 | lfs: found fda198fea753eb66a252e9856915e1f5cddbe41723bd4b695ece2604ad3c9f75 in the local lfs store |
|
347 | lfs: found fda198fea753eb66a252e9856915e1f5cddbe41723bd4b695ece2604ad3c9f75 in the local lfs store | |
344 | 4 changesets found |
|
348 | 4 changesets found | |
345 | uncompressed size of bundle content: |
|
349 | uncompressed size of bundle content: | |
346 | * (changelog) (glob) |
|
350 | * (changelog) (glob) | |
347 | * (manifests) (glob) |
|
351 | * (manifests) (glob) | |
348 | * a (glob) |
|
352 | * a (glob) | |
349 | $ hg --config extensions.strip= strip -r 2 --no-backup --force -q |
|
353 | $ hg --config extensions.strip= strip -r 2 --no-backup --force -q | |
350 | $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a |
|
354 | $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a | |
351 | 5 branching |
|
355 | 5 branching | |
352 | diff --git a/a b/a |
|
356 | diff --git a/a b/a | |
353 | --- a/a |
|
357 | --- a/a | |
354 | +++ b/a |
|
358 | +++ b/a | |
355 | @@ -1,1 +1,1 @@ |
|
359 | @@ -1,1 +1,1 @@ | |
356 | -THIS-IS-LFS-two |
|
360 | -THIS-IS-LFS-two | |
357 | +THIS-IS-LFS-2-CHILD |
|
361 | +THIS-IS-LFS-2-CHILD | |
358 |
|
362 | |||
359 | 4 a-4 |
|
363 | 4 a-4 | |
360 | diff --git a/a b/a |
|
364 | diff --git a/a b/a | |
361 | --- a/a |
|
365 | --- a/a | |
362 | +++ b/a |
|
366 | +++ b/a | |
363 | @@ -1,1 +1,1 @@ |
|
367 | @@ -1,1 +1,1 @@ | |
364 | -THIS-IS-LFS-three |
|
368 | -THIS-IS-LFS-three | |
365 | +THIS-IS-LFS-4 |
|
369 | +THIS-IS-LFS-4 | |
366 |
|
370 | |||
367 | 3 a-three |
|
371 | 3 a-three | |
368 | diff --git a/a b/a |
|
372 | diff --git a/a b/a | |
369 | --- a/a |
|
373 | --- a/a | |
370 | +++ b/a |
|
374 | +++ b/a | |
371 | @@ -1,1 +1,1 @@ |
|
375 | @@ -1,1 +1,1 @@ | |
372 | -THIS-IS-LFS-two |
|
376 | -THIS-IS-LFS-two | |
373 | +THIS-IS-LFS-three |
|
377 | +THIS-IS-LFS-three | |
374 |
|
378 | |||
375 | 2 a-two |
|
379 | 2 a-two | |
376 | diff --git a/a b/a |
|
380 | diff --git a/a b/a | |
377 | --- a/a |
|
381 | --- a/a | |
378 | +++ b/a |
|
382 | +++ b/a | |
379 | @@ -1,1 +1,1 @@ |
|
383 | @@ -1,1 +1,1 @@ | |
380 | -THIS-IS-LFS-single |
|
384 | -THIS-IS-LFS-single | |
381 | +THIS-IS-LFS-two |
|
385 | +THIS-IS-LFS-two | |
382 |
|
386 | |||
383 | 1 a-single |
|
387 | 1 a-single | |
384 | diff --git a/a b/a |
|
388 | diff --git a/a b/a | |
385 | --- a/a |
|
389 | --- a/a | |
386 | +++ b/a |
|
390 | +++ b/a | |
387 | @@ -1,1 +1,1 @@ |
|
391 | @@ -1,1 +1,1 @@ | |
388 | -THIS-IS-LFS-0 |
|
392 | -THIS-IS-LFS-0 | |
389 | +THIS-IS-LFS-single |
|
393 | +THIS-IS-LFS-single | |
390 |
|
394 | |||
391 | 0 a-0 |
|
395 | 0 a-0 | |
392 | diff --git a/a b/a |
|
396 | diff --git a/a b/a | |
393 | new file mode 100644 |
|
397 | new file mode 100644 | |
394 | --- /dev/null |
|
398 | --- /dev/null | |
395 | +++ b/a |
|
399 | +++ b/a | |
396 | @@ -0,0 +1,1 @@ |
|
400 | @@ -0,0 +1,1 @@ | |
397 | +THIS-IS-LFS-0 |
|
401 | +THIS-IS-LFS-0 | |
398 |
|
402 | |||
399 | $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q |
|
403 | $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q | |
400 | $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a |
|
404 | $ hg -R bundle-again.hg log -p -T '{rev} {desc}\n' a | |
401 | 5 branching |
|
405 | 5 branching | |
402 | diff --git a/a b/a |
|
406 | diff --git a/a b/a | |
403 | --- a/a |
|
407 | --- a/a | |
404 | +++ b/a |
|
408 | +++ b/a | |
405 | @@ -1,1 +1,1 @@ |
|
409 | @@ -1,1 +1,1 @@ | |
406 | -THIS-IS-LFS-two |
|
410 | -THIS-IS-LFS-two | |
407 | +THIS-IS-LFS-2-CHILD |
|
411 | +THIS-IS-LFS-2-CHILD | |
408 |
|
412 | |||
409 | 4 a-4 |
|
413 | 4 a-4 | |
410 | diff --git a/a b/a |
|
414 | diff --git a/a b/a | |
411 | --- a/a |
|
415 | --- a/a | |
412 | +++ b/a |
|
416 | +++ b/a | |
413 | @@ -1,1 +1,1 @@ |
|
417 | @@ -1,1 +1,1 @@ | |
414 | -THIS-IS-LFS-three |
|
418 | -THIS-IS-LFS-three | |
415 | +THIS-IS-LFS-4 |
|
419 | +THIS-IS-LFS-4 | |
416 |
|
420 | |||
417 | 3 a-three |
|
421 | 3 a-three | |
418 | diff --git a/a b/a |
|
422 | diff --git a/a b/a | |
419 | --- a/a |
|
423 | --- a/a | |
420 | +++ b/a |
|
424 | +++ b/a | |
421 | @@ -1,1 +1,1 @@ |
|
425 | @@ -1,1 +1,1 @@ | |
422 | -THIS-IS-LFS-two |
|
426 | -THIS-IS-LFS-two | |
423 | +THIS-IS-LFS-three |
|
427 | +THIS-IS-LFS-three | |
424 |
|
428 | |||
425 | 2 a-two |
|
429 | 2 a-two | |
426 | diff --git a/a b/a |
|
430 | diff --git a/a b/a | |
427 | --- a/a |
|
431 | --- a/a | |
428 | +++ b/a |
|
432 | +++ b/a | |
429 | @@ -1,1 +1,1 @@ |
|
433 | @@ -1,1 +1,1 @@ | |
430 | -THIS-IS-LFS-single |
|
434 | -THIS-IS-LFS-single | |
431 | +THIS-IS-LFS-two |
|
435 | +THIS-IS-LFS-two | |
432 |
|
436 | |||
433 | 1 a-single |
|
437 | 1 a-single | |
434 | diff --git a/a b/a |
|
438 | diff --git a/a b/a | |
435 | --- a/a |
|
439 | --- a/a | |
436 | +++ b/a |
|
440 | +++ b/a | |
437 | @@ -1,1 +1,1 @@ |
|
441 | @@ -1,1 +1,1 @@ | |
438 | -THIS-IS-LFS-0 |
|
442 | -THIS-IS-LFS-0 | |
439 | +THIS-IS-LFS-single |
|
443 | +THIS-IS-LFS-single | |
440 |
|
444 | |||
441 | 0 a-0 |
|
445 | 0 a-0 | |
442 | diff --git a/a b/a |
|
446 | diff --git a/a b/a | |
443 | new file mode 100644 |
|
447 | new file mode 100644 | |
444 | --- /dev/null |
|
448 | --- /dev/null | |
445 | +++ b/a |
|
449 | +++ b/a | |
446 | @@ -0,0 +1,1 @@ |
|
450 | @@ -0,0 +1,1 @@ | |
447 | +THIS-IS-LFS-0 |
|
451 | +THIS-IS-LFS-0 | |
448 |
|
452 | |||
449 | $ cd .. |
|
453 | $ cd .. | |
450 |
|
454 | |||
451 | # Test isbinary |
|
455 | # Test isbinary | |
452 |
|
456 | |||
453 | $ hg init repo10 |
|
457 | $ hg init repo10 | |
454 | $ cd repo10 |
|
458 | $ cd repo10 | |
455 | $ cat >> .hg/hgrc << EOF |
|
459 | $ cat >> .hg/hgrc << EOF | |
456 | > [extensions] |
|
460 | > [extensions] | |
457 | > lfs= |
|
461 | > lfs= | |
458 | > [lfs] |
|
462 | > [lfs] | |
459 | > track=all() |
|
463 | > track=all() | |
460 | > EOF |
|
464 | > EOF | |
461 | $ $PYTHON <<'EOF' |
|
465 | $ $PYTHON <<'EOF' | |
462 | > def write(path, content): |
|
466 | > def write(path, content): | |
463 | > with open(path, 'wb') as f: |
|
467 | > with open(path, 'wb') as f: | |
464 | > f.write(content) |
|
468 | > f.write(content) | |
465 | > write('a', b'\0\0') |
|
469 | > write('a', b'\0\0') | |
466 | > write('b', b'\1\n') |
|
470 | > write('b', b'\1\n') | |
467 | > write('c', b'\1\n\0') |
|
471 | > write('c', b'\1\n\0') | |
468 | > write('d', b'xx') |
|
472 | > write('d', b'xx') | |
469 | > EOF |
|
473 | > EOF | |
470 | $ hg add a b c d |
|
474 | $ hg add a b c d | |
471 | $ hg diff --stat |
|
475 | $ hg diff --stat | |
472 | a | Bin |
|
476 | a | Bin | |
473 | b | 1 + |
|
477 | b | 1 + | |
474 | c | Bin |
|
478 | c | Bin | |
475 | d | 1 + |
|
479 | d | 1 + | |
476 | 4 files changed, 2 insertions(+), 0 deletions(-) |
|
480 | 4 files changed, 2 insertions(+), 0 deletions(-) | |
477 | $ hg commit -m binarytest |
|
481 | $ hg commit -m binarytest | |
478 | $ cat > $TESTTMP/dumpbinary.py << EOF |
|
482 | $ cat > $TESTTMP/dumpbinary.py << EOF | |
479 | > def reposetup(ui, repo): |
|
483 | > def reposetup(ui, repo): | |
480 | > for n in 'abcd': |
|
484 | > for n in 'abcd': | |
481 | > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary())) |
|
485 | > ui.write(('%s: binary=%s\n') % (n, repo['.'][n].isbinary())) | |
482 | > EOF |
|
486 | > EOF | |
483 | $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace |
|
487 | $ hg --config extensions.dumpbinary=$TESTTMP/dumpbinary.py id --trace | |
484 | a: binary=True |
|
488 | a: binary=True | |
485 | b: binary=False |
|
489 | b: binary=False | |
486 | c: binary=True |
|
490 | c: binary=True | |
487 | d: binary=False |
|
491 | d: binary=False | |
488 | b55353847f02 tip |
|
492 | b55353847f02 tip | |
489 |
|
493 | |||
490 | $ cd .. |
|
494 | $ cd .. | |
491 |
|
495 | |||
492 | # Test fctx.cmp fastpath - diff without LFS blobs |
|
496 | # Test fctx.cmp fastpath - diff without LFS blobs | |
493 |
|
497 | |||
494 | $ hg init repo12 |
|
498 | $ hg init repo12 | |
495 | $ cd repo12 |
|
499 | $ cd repo12 | |
496 | $ cat >> .hg/hgrc <<EOF |
|
500 | $ cat >> .hg/hgrc <<EOF | |
497 | > [lfs] |
|
501 | > [lfs] | |
498 | > threshold=1 |
|
502 | > threshold=1 | |
499 | > EOF |
|
503 | > EOF | |
500 | $ cat > ../patch.diff <<EOF |
|
504 | $ cat > ../patch.diff <<EOF | |
501 | > # HG changeset patch |
|
505 | > # HG changeset patch | |
502 | > 2 |
|
506 | > 2 | |
503 | > |
|
507 | > | |
504 | > diff --git a/a b/a |
|
508 | > diff --git a/a b/a | |
505 | > old mode 100644 |
|
509 | > old mode 100644 | |
506 | > new mode 100755 |
|
510 | > new mode 100755 | |
507 | > EOF |
|
511 | > EOF | |
508 |
|
512 | |||
509 | $ for i in 1 2 3; do |
|
513 | $ for i in 1 2 3; do | |
510 | > cp ../repo10/a a |
|
514 | > cp ../repo10/a a | |
511 | > if [ $i = 3 ]; then |
|
515 | > if [ $i = 3 ]; then | |
512 | > # make a content-only change |
|
516 | > # make a content-only change | |
513 | > hg import -q --bypass ../patch.diff |
|
517 | > hg import -q --bypass ../patch.diff | |
514 | > hg update -q |
|
518 | > hg update -q | |
515 | > rm ../patch.diff |
|
519 | > rm ../patch.diff | |
516 | > else |
|
520 | > else | |
517 | > echo $i >> a |
|
521 | > echo $i >> a | |
518 | > hg commit -m $i -A a |
|
522 | > hg commit -m $i -A a | |
519 | > fi |
|
523 | > fi | |
520 | > done |
|
524 | > done | |
521 | $ [ -d .hg/store/lfs/objects ] |
|
525 | $ [ -d .hg/store/lfs/objects ] | |
522 |
|
526 | |||
523 | $ cd .. |
|
527 | $ cd .. | |
524 |
|
528 | |||
525 | $ hg clone repo12 repo13 --noupdate |
|
529 | $ hg clone repo12 repo13 --noupdate | |
526 | $ cd repo13 |
|
530 | $ cd repo13 | |
527 | $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git |
|
531 | $ hg log --removed -p a -T '{desc}\n' --config diff.nobinary=1 --git | |
528 | 2 |
|
532 | 2 | |
529 | diff --git a/a b/a |
|
533 | diff --git a/a b/a | |
530 | old mode 100644 |
|
534 | old mode 100644 | |
531 | new mode 100755 |
|
535 | new mode 100755 | |
532 |
|
536 | |||
533 | 2 |
|
537 | 2 | |
534 | diff --git a/a b/a |
|
538 | diff --git a/a b/a | |
535 | Binary file a has changed |
|
539 | Binary file a has changed | |
536 |
|
540 | |||
537 | 1 |
|
541 | 1 | |
538 | diff --git a/a b/a |
|
542 | diff --git a/a b/a | |
539 | new file mode 100644 |
|
543 | new file mode 100644 | |
540 | Binary file a has changed |
|
544 | Binary file a has changed | |
541 |
|
545 | |||
542 | $ [ -d .hg/store/lfs/objects ] |
|
546 | $ [ -d .hg/store/lfs/objects ] | |
543 | [1] |
|
547 | [1] | |
544 |
|
548 | |||
545 | $ cd .. |
|
549 | $ cd .. | |
546 |
|
550 | |||
547 | # Test filter |
|
551 | # Test filter | |
548 |
|
552 | |||
549 | $ hg init repo11 |
|
553 | $ hg init repo11 | |
550 | $ cd repo11 |
|
554 | $ cd repo11 | |
551 | $ cat >> .hg/hgrc << EOF |
|
555 | $ cat >> .hg/hgrc << EOF | |
552 | > [lfs] |
|
556 | > [lfs] | |
553 | > track=(**.a & size(">5B")) | (**.b & !size(">5B")) |
|
557 | > track=(**.a & size(">5B")) | (**.b & !size(">5B")) | |
554 | > | (**.c & "path:d" & !"path:d/c.c") | size(">10B") |
|
558 | > | (**.c & "path:d" & !"path:d/c.c") | size(">10B") | |
555 | > EOF |
|
559 | > EOF | |
556 |
|
560 | |||
557 | $ mkdir a |
|
561 | $ mkdir a | |
558 | $ echo aaaaaa > a/1.a |
|
562 | $ echo aaaaaa > a/1.a | |
559 | $ echo a > a/2.a |
|
563 | $ echo a > a/2.a | |
560 | $ echo aaaaaa > 1.b |
|
564 | $ echo aaaaaa > 1.b | |
561 | $ echo a > 2.b |
|
565 | $ echo a > 2.b | |
562 | $ echo a > 1.c |
|
566 | $ echo a > 1.c | |
563 | $ mkdir d |
|
567 | $ mkdir d | |
564 | $ echo a > d/c.c |
|
568 | $ echo a > d/c.c | |
565 | $ echo a > d/d.c |
|
569 | $ echo a > d/d.c | |
566 | $ echo aaaaaaaaaaaa > x |
|
570 | $ echo aaaaaaaaaaaa > x | |
567 | $ hg add . -q |
|
571 | $ hg add . -q | |
568 | $ hg commit -m files |
|
572 | $ hg commit -m files | |
569 |
|
573 | |||
570 | $ for p in a/1.a a/2.a 1.b 2.b 1.c d/c.c d/d.c x; do |
|
574 | $ for p in a/1.a a/2.a 1.b 2.b 1.c d/c.c d/d.c x; do | |
571 | > if hg debugdata $p 0 2>&1 | grep git-lfs >/dev/null; then |
|
575 | > if hg debugdata $p 0 2>&1 | grep git-lfs >/dev/null; then | |
572 | > echo "${p}: is lfs" |
|
576 | > echo "${p}: is lfs" | |
573 | > else |
|
577 | > else | |
574 | > echo "${p}: not lfs" |
|
578 | > echo "${p}: not lfs" | |
575 | > fi |
|
579 | > fi | |
576 | > done |
|
580 | > done | |
577 | a/1.a: is lfs |
|
581 | a/1.a: is lfs | |
578 | a/2.a: not lfs |
|
582 | a/2.a: not lfs | |
579 | 1.b: not lfs |
|
583 | 1.b: not lfs | |
580 | 2.b: is lfs |
|
584 | 2.b: is lfs | |
581 | 1.c: not lfs |
|
585 | 1.c: not lfs | |
582 | d/c.c: not lfs |
|
586 | d/c.c: not lfs | |
583 | d/d.c: is lfs |
|
587 | d/d.c: is lfs | |
584 | x: is lfs |
|
588 | x: is lfs | |
585 |
|
589 | |||
586 | $ cd .. |
|
590 | $ cd .. | |
587 |
|
591 | |||
588 | # Verify the repos |
|
592 | # Verify the repos | |
589 |
|
593 | |||
590 | $ cat > $TESTTMP/dumpflog.py << EOF |
|
594 | $ cat > $TESTTMP/dumpflog.py << EOF | |
591 | > # print raw revision sizes, flags, and hashes for certain files |
|
595 | > # print raw revision sizes, flags, and hashes for certain files | |
592 | > import hashlib |
|
596 | > import hashlib | |
593 | > from mercurial import revlog |
|
597 | > from mercurial import revlog | |
594 | > from mercurial.node import short |
|
598 | > from mercurial.node import short | |
595 | > def hash(rawtext): |
|
599 | > def hash(rawtext): | |
596 | > h = hashlib.sha512() |
|
600 | > h = hashlib.sha512() | |
597 | > h.update(rawtext) |
|
601 | > h.update(rawtext) | |
598 | > return h.hexdigest()[:4] |
|
602 | > return h.hexdigest()[:4] | |
599 | > def reposetup(ui, repo): |
|
603 | > def reposetup(ui, repo): | |
600 | > # these 2 files are interesting |
|
604 | > # these 2 files are interesting | |
601 | > for name in ['l', 's']: |
|
605 | > for name in ['l', 's']: | |
602 | > fl = repo.file(name) |
|
606 | > fl = repo.file(name) | |
603 | > if len(fl) == 0: |
|
607 | > if len(fl) == 0: | |
604 | > continue |
|
608 | > continue | |
605 | > sizes = [revlog.revlog.rawsize(fl, i) for i in fl] |
|
609 | > sizes = [revlog.revlog.rawsize(fl, i) for i in fl] | |
606 | > texts = [fl.revision(i, raw=True) for i in fl] |
|
610 | > texts = [fl.revision(i, raw=True) for i in fl] | |
607 | > flags = [int(fl.flags(i)) for i in fl] |
|
611 | > flags = [int(fl.flags(i)) for i in fl] | |
608 | > hashes = [hash(t) for t in texts] |
|
612 | > hashes = [hash(t) for t in texts] | |
609 | > print(' %s: rawsizes=%r flags=%r hashes=%r' |
|
613 | > print(' %s: rawsizes=%r flags=%r hashes=%r' | |
610 | > % (name, sizes, flags, hashes)) |
|
614 | > % (name, sizes, flags, hashes)) | |
611 | > EOF |
|
615 | > EOF | |
612 |
|
616 | |||
613 | $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \ |
|
617 | $ for i in client client2 server repo3 repo4 repo5 repo6 repo7 repo8 repo9 \ | |
614 | > repo10; do |
|
618 | > repo10; do | |
615 | > echo 'repo:' $i |
|
619 | > echo 'repo:' $i | |
616 | > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q |
|
620 | > hg --cwd $i verify --config extensions.dumpflog=$TESTTMP/dumpflog.py -q | |
617 | > done |
|
621 | > done | |
618 | repo: client |
|
622 | repo: client | |
619 | repo: client2 |
|
623 | repo: client2 | |
620 | repo: server |
|
624 | repo: server | |
621 | repo: repo3 |
|
625 | repo: repo3 | |
622 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] |
|
626 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] | |
623 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] |
|
627 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] | |
624 | repo: repo4 |
|
628 | repo: repo4 | |
625 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] |
|
629 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] | |
626 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] |
|
630 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] | |
627 | repo: repo5 |
|
631 | repo: repo5 | |
628 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] |
|
632 | l: rawsizes=[211, 6, 8, 141] flags=[8192, 0, 0, 8192] hashes=['d2b8', '948c', 'cc88', '724d'] | |
629 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] |
|
633 | s: rawsizes=[74, 141, 141, 8] flags=[0, 8192, 8192, 0] hashes=['3c80', 'fce0', '874a', '826b'] | |
630 | repo: repo6 |
|
634 | repo: repo6 | |
631 | repo: repo7 |
|
635 | repo: repo7 | |
632 | repo: repo8 |
|
636 | repo: repo8 | |
633 | repo: repo9 |
|
637 | repo: repo9 | |
634 | repo: repo10 |
|
638 | repo: repo10 | |
635 |
|
639 | |||
636 | repo13 doesn't have any cached lfs files and its source never pushed its |
|
640 | repo13 doesn't have any cached lfs files and its source never pushed its | |
637 | files. Therefore, the files don't exist in the remote store. Use the files in |
|
641 | files. Therefore, the files don't exist in the remote store. Use the files in | |
638 | the user cache. |
|
642 | the user cache. | |
639 |
|
643 | |||
640 | $ test -d $TESTTMP/repo13/.hg/store/lfs/objects |
|
644 | $ test -d $TESTTMP/repo13/.hg/store/lfs/objects | |
641 | [1] |
|
645 | [1] | |
642 |
|
646 | |||
643 | $ hg --config extensions.share= share repo13 repo14 |
|
647 | $ hg --config extensions.share= share repo13 repo14 | |
644 | updating working directory |
|
648 | updating working directory | |
645 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
649 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
646 | $ hg -R repo14 -q verify |
|
650 | $ hg -R repo14 -q verify | |
647 |
|
651 | |||
648 | $ hg clone repo13 repo15 |
|
652 | $ hg clone repo13 repo15 | |
649 | updating to branch default |
|
653 | updating to branch default | |
650 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
654 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
651 | $ hg -R repo15 -q verify |
|
655 | $ hg -R repo15 -q verify | |
652 |
|
656 | |||
653 | If the source repo doesn't have the blob (maybe it was pulled or cloned with |
|
657 | If the source repo doesn't have the blob (maybe it was pulled or cloned with | |
654 | --noupdate), the blob is still accessible via the global cache to send to the |
|
658 | --noupdate), the blob is still accessible via the global cache to send to the | |
655 | remote store. |
|
659 | remote store. | |
656 |
|
660 | |||
657 | $ rm -rf $TESTTMP/repo15/.hg/store/lfs |
|
661 | $ rm -rf $TESTTMP/repo15/.hg/store/lfs | |
658 | $ hg init repo16 |
|
662 | $ hg init repo16 | |
659 | $ hg -R repo15 push repo16 |
|
663 | $ hg -R repo15 push repo16 | |
660 | pushing to repo16 |
|
664 | pushing to repo16 | |
661 | searching for changes |
|
665 | searching for changes | |
662 | adding changesets |
|
666 | adding changesets | |
663 | adding manifests |
|
667 | adding manifests | |
664 | adding file changes |
|
668 | adding file changes | |
665 | added 3 changesets with 2 changes to 1 files |
|
669 | added 3 changesets with 2 changes to 1 files | |
666 | $ hg -R repo15 -q verify |
|
670 | $ hg -R repo15 -q verify | |
667 |
|
671 | |||
668 | Test damaged file scenarios. (This also damages the usercache because of the |
|
672 | Test damaged file scenarios. (This also damages the usercache because of the | |
669 | hardlinks.) |
|
673 | hardlinks.) | |
670 |
|
674 | |||
671 | $ echo 'damage' >> repo5/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
675 | $ echo 'damage' >> repo5/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
672 |
|
676 | |||
673 | Repo with damaged lfs objects in any revision will fail verification. |
|
677 | Repo with damaged lfs objects in any revision will fail verification. | |
674 |
|
678 | |||
675 | $ hg -R repo5 verify |
|
679 | $ hg -R repo5 verify | |
676 | checking changesets |
|
680 | checking changesets | |
677 | checking manifests |
|
681 | checking manifests | |
678 | crosschecking files in changesets and manifests |
|
682 | crosschecking files in changesets and manifests | |
679 | checking files |
|
683 | checking files | |
680 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 |
|
684 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 | |
681 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 |
|
685 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 | |
682 | 4 files, 5 changesets, 10 total revisions |
|
686 | 4 files, 5 changesets, 10 total revisions | |
683 | 2 integrity errors encountered! |
|
687 | 2 integrity errors encountered! | |
684 | (first damaged changeset appears to be 0) |
|
688 | (first damaged changeset appears to be 0) | |
685 | [1] |
|
689 | [1] | |
686 |
|
690 | |||
687 | Updates work after cloning a damaged repo, if the damaged lfs objects aren't in |
|
691 | Updates work after cloning a damaged repo, if the damaged lfs objects aren't in | |
688 | the update destination. Those objects won't be added to the new repo's store |
|
692 | the update destination. Those objects won't be added to the new repo's store | |
689 | because they aren't accessed. |
|
693 | because they aren't accessed. | |
690 |
|
694 | |||
691 | $ hg clone -v repo5 fromcorrupt |
|
695 | $ hg clone -v repo5 fromcorrupt | |
692 | updating to branch default |
|
696 | updating to branch default | |
693 | resolving manifests |
|
697 | resolving manifests | |
694 | getting l |
|
698 | getting l | |
695 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the usercache |
|
699 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the usercache | |
696 | getting s |
|
700 | getting s | |
697 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
701 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
698 | $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
702 | $ test -f fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
699 | [1] |
|
703 | [1] | |
700 |
|
704 | |||
701 | Verify will copy/link all lfs objects into the local store that aren't already |
|
705 | Verify will copy/link all lfs objects into the local store that aren't already | |
702 | present. Bypass the corrupted usercache to show that verify works when fed by |
|
706 | present. Bypass the corrupted usercache to show that verify works when fed by | |
703 | the (uncorrupted) remote store. |
|
707 | the (uncorrupted) remote store. | |
704 |
|
708 | |||
705 | $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v |
|
709 | $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v | |
706 | repository uses revlog format 1 |
|
710 | repository uses revlog format 1 | |
707 | checking changesets |
|
711 | checking changesets | |
708 | checking manifests |
|
712 | checking manifests | |
709 | crosschecking files in changesets and manifests |
|
713 | crosschecking files in changesets and manifests | |
710 | checking files |
|
714 | checking files | |
711 | lfs: adding 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e to the usercache |
|
715 | lfs: adding 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e to the usercache | |
712 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store |
|
716 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store | |
713 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
717 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store | |
714 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store |
|
718 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store | |
715 | lfs: adding 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 to the usercache |
|
719 | lfs: adding 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 to the usercache | |
716 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store |
|
720 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store | |
717 | lfs: adding b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c to the usercache |
|
721 | lfs: adding b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c to the usercache | |
718 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store |
|
722 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store | |
719 | 4 files, 5 changesets, 10 total revisions |
|
723 | 4 files, 5 changesets, 10 total revisions | |
720 |
|
724 | |||
721 | Verify will not copy/link a corrupted file from the usercache into the local |
|
725 | Verify will not copy/link a corrupted file from the usercache into the local | |
722 | store, and poison it. (The verify with a good remote now works.) |
|
726 | store, and poison it. (The verify with a good remote now works.) | |
723 |
|
727 | |||
724 | $ rm -r fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
728 | $ rm -r fromcorrupt/.hg/store/lfs/objects/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
725 | $ hg -R fromcorrupt verify -v |
|
729 | $ hg -R fromcorrupt verify -v | |
726 | repository uses revlog format 1 |
|
730 | repository uses revlog format 1 | |
727 | checking changesets |
|
731 | checking changesets | |
728 | checking manifests |
|
732 | checking manifests | |
729 | crosschecking files in changesets and manifests |
|
733 | crosschecking files in changesets and manifests | |
730 | checking files |
|
734 | checking files | |
731 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 |
|
735 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 | |
732 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
736 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store | |
733 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 |
|
737 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 | |
734 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store |
|
738 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store | |
735 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store |
|
739 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store | |
736 | 4 files, 5 changesets, 10 total revisions |
|
740 | 4 files, 5 changesets, 10 total revisions | |
737 | 2 integrity errors encountered! |
|
741 | 2 integrity errors encountered! | |
738 | (first damaged changeset appears to be 0) |
|
742 | (first damaged changeset appears to be 0) | |
739 | [1] |
|
743 | [1] | |
740 | $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v |
|
744 | $ hg -R fromcorrupt --config lfs.usercache=emptycache verify -v | |
741 | repository uses revlog format 1 |
|
745 | repository uses revlog format 1 | |
742 | checking changesets |
|
746 | checking changesets | |
743 | checking manifests |
|
747 | checking manifests | |
744 | crosschecking files in changesets and manifests |
|
748 | crosschecking files in changesets and manifests | |
745 | checking files |
|
749 | checking files | |
746 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the usercache |
|
750 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the usercache | |
747 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
751 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store | |
748 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store |
|
752 | lfs: found 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e in the local lfs store | |
749 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store |
|
753 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store | |
750 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store |
|
754 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store | |
751 | 4 files, 5 changesets, 10 total revisions |
|
755 | 4 files, 5 changesets, 10 total revisions | |
752 |
|
756 | |||
753 | Damaging a file required by the update destination fails the update. |
|
757 | Damaging a file required by the update destination fails the update. | |
754 |
|
758 | |||
755 | $ echo 'damage' >> $TESTTMP/dummy-remote/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
759 | $ echo 'damage' >> $TESTTMP/dummy-remote/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
756 | $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2 |
|
760 | $ hg --config lfs.usercache=emptycache clone -v repo5 fromcorrupt2 | |
757 | updating to branch default |
|
761 | updating to branch default | |
758 | resolving manifests |
|
762 | resolving manifests | |
759 | getting l |
|
763 | getting l | |
760 | abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
764 | abort: corrupt remote lfs object: 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
761 | [255] |
|
765 | [255] | |
762 |
|
766 | |||
763 | A corrupted lfs blob is not transferred from a file://remotestore to the |
|
767 | A corrupted lfs blob is not transferred from a file://remotestore to the | |
764 | usercache or local store. |
|
768 | usercache or local store. | |
765 |
|
769 | |||
766 | $ test -f emptycache/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
770 | $ test -f emptycache/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
767 | [1] |
|
771 | [1] | |
768 | $ test -f fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
772 | $ test -f fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
769 | [1] |
|
773 | [1] | |
770 |
|
774 | |||
771 | $ hg -R fromcorrupt2 verify |
|
775 | $ hg -R fromcorrupt2 verify | |
772 | checking changesets |
|
776 | checking changesets | |
773 | checking manifests |
|
777 | checking manifests | |
774 | crosschecking files in changesets and manifests |
|
778 | crosschecking files in changesets and manifests | |
775 | checking files |
|
779 | checking files | |
776 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 |
|
780 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 | |
777 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 |
|
781 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 | |
778 | 4 files, 5 changesets, 10 total revisions |
|
782 | 4 files, 5 changesets, 10 total revisions | |
779 | 2 integrity errors encountered! |
|
783 | 2 integrity errors encountered! | |
780 | (first damaged changeset appears to be 0) |
|
784 | (first damaged changeset appears to be 0) | |
781 | [1] |
|
785 | [1] | |
782 |
|
786 | |||
783 | Corrupt local files are not sent upstream. (The alternate dummy remote |
|
787 | Corrupt local files are not sent upstream. (The alternate dummy remote | |
784 | avoids the corrupt lfs object in the original remote.) |
|
788 | avoids the corrupt lfs object in the original remote.) | |
785 |
|
789 | |||
786 | $ mkdir $TESTTMP/dummy-remote2 |
|
790 | $ mkdir $TESTTMP/dummy-remote2 | |
787 | $ hg init dest |
|
791 | $ hg init dest | |
788 | $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 push -v dest |
|
792 | $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 push -v dest | |
789 | pushing to dest |
|
793 | pushing to dest | |
790 | searching for changes |
|
794 | searching for changes | |
791 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
795 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store | |
792 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store |
|
796 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store | |
793 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store |
|
797 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store | |
794 | abort: detected corrupt lfs object: 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
798 | abort: detected corrupt lfs object: 66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
795 | (run hg verify) |
|
799 | (run hg verify) | |
796 | [255] |
|
800 | [255] | |
797 |
|
801 | |||
798 | $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 verify -v |
|
802 | $ hg -R fromcorrupt2 --config lfs.url=file:///$TESTTMP/dummy-remote2 verify -v | |
799 | repository uses revlog format 1 |
|
803 | repository uses revlog format 1 | |
800 | checking changesets |
|
804 | checking changesets | |
801 | checking manifests |
|
805 | checking manifests | |
802 | crosschecking files in changesets and manifests |
|
806 | crosschecking files in changesets and manifests | |
803 | checking files |
|
807 | checking files | |
804 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 |
|
808 | l@1: unpacking 46a2f24864bc: integrity check failed on data/l.i:0 | |
805 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store |
|
809 | lfs: found 22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b in the local lfs store | |
806 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 |
|
810 | large@0: unpacking 2c531e0992ff: integrity check failed on data/large.i:0 | |
807 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store |
|
811 | lfs: found 89b6070915a3d573ff3599d1cda305bc5e38549b15c4847ab034169da66e1ca8 in the local lfs store | |
808 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store |
|
812 | lfs: found b1a6ea88da0017a0e77db139a54618986e9a2489bee24af9fe596de9daac498c in the local lfs store | |
809 | 4 files, 5 changesets, 10 total revisions |
|
813 | 4 files, 5 changesets, 10 total revisions | |
810 | 2 integrity errors encountered! |
|
814 | 2 integrity errors encountered! | |
811 | (first damaged changeset appears to be 0) |
|
815 | (first damaged changeset appears to be 0) | |
812 | [1] |
|
816 | [1] | |
813 |
|
817 | |||
814 | $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256 |
|
818 | $ cat $TESTTMP/dummy-remote2/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256 | |
815 | sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
819 | sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
816 | $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256 |
|
820 | $ cat fromcorrupt2/.hg/store/lfs/objects/22/f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | $TESTDIR/f --sha256 | |
817 | sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b |
|
821 | sha256=22f66a3fc0b9bf3f012c814303995ec07099b3a9ce02a7af84b5970811074a3b | |
818 | $ test -f $TESTTMP/dummy-remote2/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
822 | $ test -f $TESTTMP/dummy-remote2/66/100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
819 | [1] |
|
823 | [1] | |
820 |
|
824 | |||
821 | Accessing a corrupt file will complain |
|
825 | Accessing a corrupt file will complain | |
822 |
|
826 | |||
823 | $ hg --cwd fromcorrupt2 cat -r 0 large |
|
827 | $ hg --cwd fromcorrupt2 cat -r 0 large | |
824 | abort: integrity check failed on data/large.i:0! |
|
828 | abort: integrity check failed on data/large.i:0! | |
825 | [255] |
|
829 | [255] | |
826 |
|
830 | |||
827 | lfs -> normal -> lfs round trip conversions are possible. The 'none()' |
|
831 | lfs -> normal -> lfs round trip conversions are possible. The 'none()' | |
828 | predicate on the command line will override whatever is configured globally and |
|
832 | predicate on the command line will override whatever is configured globally and | |
829 | locally, and ensures everything converts to a regular file. For lfs -> normal, |
|
833 | locally, and ensures everything converts to a regular file. For lfs -> normal, | |
830 | there's no 'lfs' destination repo requirement. For normal -> lfs, there is. |
|
834 | there's no 'lfs' destination repo requirement. For normal -> lfs, there is. | |
831 |
|
835 | |||
832 | $ hg --config extensions.convert= --config 'lfs.track=none()' \ |
|
836 | $ hg --config extensions.convert= --config 'lfs.track=none()' \ | |
833 | > convert repo8 convert_normal |
|
837 | > convert repo8 convert_normal | |
834 | initializing destination convert_normal repository |
|
838 | initializing destination convert_normal repository | |
835 | scanning source... |
|
839 | scanning source... | |
836 | sorting... |
|
840 | sorting... | |
837 | converting... |
|
841 | converting... | |
838 | 2 a |
|
842 | 2 a | |
839 | 1 b |
|
843 | 1 b | |
840 | 0 meta |
|
844 | 0 meta | |
841 | $ grep 'lfs' convert_normal/.hg/requires |
|
845 | $ grep 'lfs' convert_normal/.hg/requires | |
842 | [1] |
|
846 | [1] | |
843 | $ hg --cwd convert_normal cat a1 -r 0 -T '{rawdata}' |
|
847 | $ hg --cwd convert_normal cat a1 -r 0 -T '{rawdata}' | |
844 | THIS-IS-LFS-BECAUSE-10-BYTES |
|
848 | THIS-IS-LFS-BECAUSE-10-BYTES | |
845 |
|
849 | |||
846 | $ hg --config extensions.convert= --config lfs.threshold=10B \ |
|
850 | $ hg --config extensions.convert= --config lfs.threshold=10B \ | |
847 | > convert convert_normal convert_lfs |
|
851 | > convert convert_normal convert_lfs | |
848 | initializing destination convert_lfs repository |
|
852 | initializing destination convert_lfs repository | |
849 | scanning source... |
|
853 | scanning source... | |
850 | sorting... |
|
854 | sorting... | |
851 | converting... |
|
855 | converting... | |
852 | 2 a |
|
856 | 2 a | |
853 | 1 b |
|
857 | 1 b | |
854 | 0 meta |
|
858 | 0 meta | |
855 |
|
859 | |||
856 | $ hg --cwd convert_lfs cat -r 0 a1 -T '{rawdata}' |
|
860 | $ hg --cwd convert_lfs cat -r 0 a1 -T '{rawdata}' | |
857 | version https://git-lfs.github.com/spec/v1 |
|
861 | version https://git-lfs.github.com/spec/v1 | |
858 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
862 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
859 | size 29 |
|
863 | size 29 | |
860 | x-is-binary 0 |
|
864 | x-is-binary 0 | |
861 | $ hg --cwd convert_lfs debugdata a1 0 |
|
865 | $ hg --cwd convert_lfs debugdata a1 0 | |
862 | version https://git-lfs.github.com/spec/v1 |
|
866 | version https://git-lfs.github.com/spec/v1 | |
863 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
867 | oid sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
864 | size 29 |
|
868 | size 29 | |
865 | x-is-binary 0 |
|
869 | x-is-binary 0 | |
866 | $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfspointer % '{key}={value}\n'}'}" |
|
870 | $ hg --cwd convert_lfs log -r 0 -T "{lfs_files % '{lfspointer % '{key}={value}\n'}'}" | |
867 | version=https://git-lfs.github.com/spec/v1 |
|
871 | version=https://git-lfs.github.com/spec/v1 | |
868 | oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
872 | oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
869 | size=29 |
|
873 | size=29 | |
870 | x-is-binary=0 |
|
874 | x-is-binary=0 | |
871 | $ hg --cwd convert_lfs log -r 0 \ |
|
875 | $ hg --cwd convert_lfs log -r 0 \ | |
872 | > -T '{lfs_files % "{get(lfspointer, "oid")}\n"}{lfs_files % "{lfspointer.oid}\n"}' |
|
876 | > -T '{lfs_files % "{get(lfspointer, "oid")}\n"}{lfs_files % "{lfspointer.oid}\n"}' | |
873 | sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
877 | sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
874 | sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
878 | sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
875 | $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfspointer}\n"}' |
|
879 | $ hg --cwd convert_lfs log -r 0 -T '{lfs_files % "{lfspointer}\n"}' | |
876 | version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0 |
|
880 | version=https://git-lfs.github.com/spec/v1 oid=sha256:5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 size=29 x-is-binary=0 | |
877 | $ hg --cwd convert_lfs \ |
|
881 | $ hg --cwd convert_lfs \ | |
878 | > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}' |
|
882 | > log -r 'all()' -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}' | |
879 | 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
883 | 0: a1: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
880 | 1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 |
|
884 | 1: a2: 5bb8341bee63b3649f222b2215bde37322bea075a30575aa685d8f8d21c77024 | |
881 | 2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943 |
|
885 | 2: a2: 876dadc86a8542f9798048f2c47f51dbf8e4359aed883e8ec80c5db825f0d943 | |
882 |
|
886 | |||
883 | $ grep 'lfs' convert_lfs/.hg/requires |
|
887 | $ grep 'lfs' convert_lfs/.hg/requires | |
884 | lfs |
|
888 | lfs | |
885 |
|
889 | |||
886 | The hashes in all stages of the conversion are unchanged. |
|
890 | The hashes in all stages of the conversion are unchanged. | |
887 |
|
891 | |||
888 | $ hg -R repo8 log -T '{node|short}\n' |
|
892 | $ hg -R repo8 log -T '{node|short}\n' | |
889 | 0fae949de7fa |
|
893 | 0fae949de7fa | |
890 | 9cd6bdffdac0 |
|
894 | 9cd6bdffdac0 | |
891 | 7f96794915f7 |
|
895 | 7f96794915f7 | |
892 | $ hg -R convert_normal log -T '{node|short}\n' |
|
896 | $ hg -R convert_normal log -T '{node|short}\n' | |
893 | 0fae949de7fa |
|
897 | 0fae949de7fa | |
894 | 9cd6bdffdac0 |
|
898 | 9cd6bdffdac0 | |
895 | 7f96794915f7 |
|
899 | 7f96794915f7 | |
896 | $ hg -R convert_lfs log -T '{node|short}\n' |
|
900 | $ hg -R convert_lfs log -T '{node|short}\n' | |
897 | 0fae949de7fa |
|
901 | 0fae949de7fa | |
898 | 9cd6bdffdac0 |
|
902 | 9cd6bdffdac0 | |
899 | 7f96794915f7 |
|
903 | 7f96794915f7 | |
900 |
|
904 | |||
901 | This convert is trickier, because it contains deleted files (via `hg mv`) |
|
905 | This convert is trickier, because it contains deleted files (via `hg mv`) | |
902 |
|
906 | |||
903 | $ hg --config extensions.convert= --config lfs.threshold=1000M \ |
|
907 | $ hg --config extensions.convert= --config lfs.threshold=1000M \ | |
904 | > convert repo3 convert_normal2 |
|
908 | > convert repo3 convert_normal2 | |
905 | initializing destination convert_normal2 repository |
|
909 | initializing destination convert_normal2 repository | |
906 | scanning source... |
|
910 | scanning source... | |
907 | sorting... |
|
911 | sorting... | |
908 | converting... |
|
912 | converting... | |
909 | 4 commit with lfs content |
|
913 | 4 commit with lfs content | |
910 | 3 renames |
|
914 | 3 renames | |
911 | 2 large to small, small to large |
|
915 | 2 large to small, small to large | |
912 | 1 random modifications |
|
916 | 1 random modifications | |
913 | 0 switch large and small again |
|
917 | 0 switch large and small again | |
914 | $ grep 'lfs' convert_normal2/.hg/requires |
|
918 | $ grep 'lfs' convert_normal2/.hg/requires | |
915 | [1] |
|
919 | [1] | |
916 | $ hg --cwd convert_normal2 debugdata large 0 |
|
920 | $ hg --cwd convert_normal2 debugdata large 0 | |
917 | LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS |
|
921 | LONGER-THAN-TEN-BYTES-WILL-TRIGGER-LFS | |
918 |
|
922 | |||
919 | $ hg --config extensions.convert= --config lfs.threshold=10B \ |
|
923 | $ hg --config extensions.convert= --config lfs.threshold=10B \ | |
920 | > convert convert_normal2 convert_lfs2 |
|
924 | > convert convert_normal2 convert_lfs2 | |
921 | initializing destination convert_lfs2 repository |
|
925 | initializing destination convert_lfs2 repository | |
922 | scanning source... |
|
926 | scanning source... | |
923 | sorting... |
|
927 | sorting... | |
924 | converting... |
|
928 | converting... | |
925 | 4 commit with lfs content |
|
929 | 4 commit with lfs content | |
926 | 3 renames |
|
930 | 3 renames | |
927 | 2 large to small, small to large |
|
931 | 2 large to small, small to large | |
928 | 1 random modifications |
|
932 | 1 random modifications | |
929 | 0 switch large and small again |
|
933 | 0 switch large and small again | |
930 | $ grep 'lfs' convert_lfs2/.hg/requires |
|
934 | $ grep 'lfs' convert_lfs2/.hg/requires | |
931 | lfs |
|
935 | lfs | |
932 | $ hg --cwd convert_lfs2 debugdata large 0 |
|
936 | $ hg --cwd convert_lfs2 debugdata large 0 | |
933 | version https://git-lfs.github.com/spec/v1 |
|
937 | version https://git-lfs.github.com/spec/v1 | |
934 | oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e |
|
938 | oid sha256:66100b384bf761271b407d79fc30cdd0554f3b2c5d944836e936d584b88ce88e | |
935 | size 39 |
|
939 | size 39 | |
936 | x-is-binary 0 |
|
940 | x-is-binary 0 | |
937 |
|
941 | |||
938 | $ hg -R convert_lfs2 config --debug extensions | grep lfs |
|
942 | $ hg -R convert_lfs2 config --debug extensions | grep lfs | |
939 | $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob) |
|
943 | $TESTTMP/convert_lfs2/.hg/hgrc:*: extensions.lfs= (glob) | |
940 |
|
944 | |||
941 | Committing deleted files works: |
|
945 | Committing deleted files works: | |
942 |
|
946 | |||
943 | $ hg init $TESTTMP/repo-del |
|
947 | $ hg init $TESTTMP/repo-del | |
944 | $ cd $TESTTMP/repo-del |
|
948 | $ cd $TESTTMP/repo-del | |
945 | $ echo 1 > A |
|
949 | $ echo 1 > A | |
946 | $ hg commit -m 'add A' -A A |
|
950 | $ hg commit -m 'add A' -A A | |
947 | $ hg rm A |
|
951 | $ hg rm A | |
948 | $ hg commit -m 'rm A' |
|
952 | $ hg commit -m 'rm A' | |
949 |
|
953 | |||
950 | Bad .hglfs files will block the commit with a useful message |
|
954 | Bad .hglfs files will block the commit with a useful message | |
951 |
|
955 | |||
952 | $ cat > .hglfs << EOF |
|
956 | $ cat > .hglfs << EOF | |
953 | > [track] |
|
957 | > [track] | |
954 | > **.test = size(">5B") |
|
958 | > **.test = size(">5B") | |
955 | > bad file ... no commit |
|
959 | > bad file ... no commit | |
956 | > EOF |
|
960 | > EOF | |
957 |
|
961 | |||
958 | $ echo x > file.txt |
|
962 | $ echo x > file.txt | |
959 | $ hg ci -Aqm 'should fail' |
|
963 | $ hg ci -Aqm 'should fail' | |
960 | hg: parse error at .hglfs:3: bad file ... no commit |
|
964 | hg: parse error at .hglfs:3: bad file ... no commit | |
961 | [255] |
|
965 | [255] | |
962 |
|
966 | |||
963 | $ cat > .hglfs << EOF |
|
967 | $ cat > .hglfs << EOF | |
964 | > [track] |
|
968 | > [track] | |
965 | > **.test = size(">5B") |
|
969 | > **.test = size(">5B") | |
966 | > ** = nonexistent() |
|
970 | > ** = nonexistent() | |
967 | > EOF |
|
971 | > EOF | |
968 |
|
972 | |||
969 | $ hg ci -Aqm 'should fail' |
|
973 | $ hg ci -Aqm 'should fail' | |
970 | abort: parse error in .hglfs: unknown identifier: nonexistent |
|
974 | abort: parse error in .hglfs: unknown identifier: nonexistent | |
971 | [255] |
|
975 | [255] | |
972 |
|
976 | |||
973 | '**' works out to mean all files. |
|
977 | '**' works out to mean all files. | |
974 |
|
978 | |||
975 | $ cat > .hglfs << EOF |
|
979 | $ cat > .hglfs << EOF | |
976 | > [track] |
|
980 | > [track] | |
977 | > path:.hglfs = none() |
|
981 | > path:.hglfs = none() | |
978 | > **.test = size(">5B") |
|
982 | > **.test = size(">5B") | |
979 | > **.exclude = none() |
|
983 | > **.exclude = none() | |
980 | > ** = size(">10B") |
|
984 | > ** = size(">10B") | |
981 | > EOF |
|
985 | > EOF | |
982 |
|
986 | |||
983 | The LFS policy takes effect as the .hglfs file is committed |
|
987 | The LFS policy takes effect as the .hglfs file is committed | |
984 |
|
988 | |||
985 | $ echo 'largefile' > lfs.test |
|
989 | $ echo 'largefile' > lfs.test | |
986 | $ echo '012345678901234567890' > nolfs.exclude |
|
990 | $ echo '012345678901234567890' > nolfs.exclude | |
987 | $ echo '01234567890123456' > lfs.catchall |
|
991 | $ echo '01234567890123456' > lfs.catchall | |
988 | $ hg ci -Aqm 'added .hglfs' |
|
992 | $ hg ci -Aqm 'added .hglfs' | |
989 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' |
|
993 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' | |
990 | 2: lfs.catchall: d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9 |
|
994 | 2: lfs.catchall: d4ec46c2869ba22eceb42a729377432052d9dd75d82fc40390ebaadecee87ee9 | |
991 | lfs.test: 5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c |
|
995 | lfs.test: 5489e6ced8c36a7b267292bde9fd5242a5f80a7482e8f23fa0477393dfaa4d6c | |
992 |
|
996 | |||
993 | The existing .hglfs file is used even when it is not in the 'A' or 'M' states |
|
997 | The existing .hglfs file is used even when it is not in the 'A' or 'M' states | |
994 |
|
998 | |||
995 | $ echo 'largefile2' > lfs.test |
|
999 | $ echo 'largefile2' > lfs.test | |
996 | $ echo '012345678901234567890a' > nolfs.exclude |
|
1000 | $ echo '012345678901234567890a' > nolfs.exclude | |
997 | $ echo '01234567890123456a' > lfs.catchall |
|
1001 | $ echo '01234567890123456a' > lfs.catchall | |
998 | $ hg ci -qm 'unmodified .hglfs' |
|
1002 | $ hg ci -qm 'unmodified .hglfs' | |
999 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' |
|
1003 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' | |
1000 | 3: lfs.catchall: 31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573 |
|
1004 | 3: lfs.catchall: 31f43b9c62b540126b0ad5884dc013d21a61c9329b77de1fceeae2fc58511573 | |
1001 | lfs.test: 8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6 |
|
1005 | lfs.test: 8acd23467967bc7b8cc5a280056589b0ba0b17ff21dbd88a7b6474d6290378a6 | |
1002 |
|
1006 | |||
1003 | Excluding the .hglfs file from the commit postpones the policy change |
|
1007 | Excluding the .hglfs file from the commit postpones the policy change | |
1004 |
|
1008 | |||
1005 | $ hg rm .hglfs |
|
1009 | $ hg rm .hglfs | |
1006 | $ echo 'largefile3' > lfs.test |
|
1010 | $ echo 'largefile3' > lfs.test | |
1007 | $ echo '012345678901234567890abc' > nolfs.exclude |
|
1011 | $ echo '012345678901234567890abc' > nolfs.exclude | |
1008 | $ echo '01234567890123456abc' > lfs.catchall |
|
1012 | $ echo '01234567890123456abc' > lfs.catchall | |
1009 | $ hg ci -qm 'file test' -X .hglfs |
|
1013 | $ hg ci -qm 'file test' -X .hglfs | |
1010 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' |
|
1014 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' | |
1011 | 4: lfs.catchall: 6747cfb1b83965b4a884e7a6061813ae31e4122028bc6a88d2ac5e5f9e05c5af |
|
1015 | 4: lfs.catchall: 6747cfb1b83965b4a884e7a6061813ae31e4122028bc6a88d2ac5e5f9e05c5af | |
1012 | lfs.test: 3f40b70c2294e91e0fa789ebcf73c5a1d1c7aef270f83e477e40cb0513237e8c |
|
1016 | lfs.test: 3f40b70c2294e91e0fa789ebcf73c5a1d1c7aef270f83e477e40cb0513237e8c | |
1013 |
|
1017 | |||
1014 | The policy change takes effect when the .hglfs is committed |
|
1018 | The policy change takes effect when the .hglfs is committed | |
1015 |
|
1019 | |||
1016 | $ echo 'largefile4' > lfs.test |
|
1020 | $ echo 'largefile4' > lfs.test | |
1017 | $ echo '012345678901234567890abcdef' > nolfs.exclude |
|
1021 | $ echo '012345678901234567890abcdef' > nolfs.exclude | |
1018 | $ echo '01234567890123456abcdef' > lfs.catchall |
|
1022 | $ echo '01234567890123456abcdef' > lfs.catchall | |
1019 | $ hg ci -qm 'file test' |
|
1023 | $ hg ci -qm 'file test' | |
1020 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' |
|
1024 | $ hg log -r . -T '{rev}: {lfs_files % "{file}: {lfsoid}\n"}\n' | |
1021 | 5: |
|
1025 | 5: | |
1022 |
|
1026 | |||
1023 | $ cd .. |
|
1027 | $ cd .. | |
1024 |
|
1028 | |||
1025 | Unbundling adds a requirement to a non-lfs repo, if necessary. |
|
1029 | Unbundling adds a requirement to a non-lfs repo, if necessary. | |
1026 |
|
1030 | |||
1027 | $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg |
|
1031 | $ hg bundle -R $TESTTMP/repo-del -qr 0 --base null nolfs.hg | |
1028 | $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg |
|
1032 | $ hg bundle -R convert_lfs2 -qr tip --base null lfs.hg | |
1029 | $ hg init unbundle |
|
1033 | $ hg init unbundle | |
1030 | $ hg pull -R unbundle -q nolfs.hg |
|
1034 | $ hg pull -R unbundle -q nolfs.hg | |
1031 | $ grep lfs unbundle/.hg/requires |
|
1035 | $ grep lfs unbundle/.hg/requires | |
1032 | [1] |
|
1036 | [1] | |
1033 | $ hg pull -R unbundle -q lfs.hg |
|
1037 | $ hg pull -R unbundle -q lfs.hg | |
1034 | $ grep lfs unbundle/.hg/requires |
|
1038 | $ grep lfs unbundle/.hg/requires | |
1035 | lfs |
|
1039 | lfs | |
1036 |
|
1040 | |||
1037 | $ hg init no_lfs |
|
1041 | $ hg init no_lfs | |
1038 | $ cat >> no_lfs/.hg/hgrc <<EOF |
|
1042 | $ cat >> no_lfs/.hg/hgrc <<EOF | |
1039 | > [experimental] |
|
1043 | > [experimental] | |
1040 | > changegroup3 = True |
|
1044 | > changegroup3 = True | |
1041 | > [extensions] |
|
1045 | > [extensions] | |
1042 | > lfs=! |
|
1046 | > lfs=! | |
1043 | > EOF |
|
1047 | > EOF | |
1044 | $ cp -R no_lfs no_lfs2 |
|
1048 | $ cp -R no_lfs no_lfs2 | |
1045 |
|
1049 | |||
1046 | Pushing from a local lfs repo to a local repo without an lfs requirement and |
|
1050 | Pushing from a local lfs repo to a local repo without an lfs requirement and | |
1047 | with lfs disabled, fails. |
|
1051 | with lfs disabled, fails. | |
1048 |
|
1052 | |||
1049 | $ hg push -R convert_lfs2 no_lfs |
|
1053 | $ hg push -R convert_lfs2 no_lfs | |
1050 | pushing to no_lfs |
|
1054 | pushing to no_lfs | |
1051 | abort: required features are not supported in the destination: lfs |
|
1055 | abort: required features are not supported in the destination: lfs | |
1052 | [255] |
|
1056 | [255] | |
1053 | $ grep lfs no_lfs/.hg/requires |
|
1057 | $ grep lfs no_lfs/.hg/requires | |
1054 | [1] |
|
1058 | [1] | |
1055 |
|
1059 | |||
1056 | Pulling from a local lfs repo to a local repo without an lfs requirement and |
|
1060 | Pulling from a local lfs repo to a local repo without an lfs requirement and | |
1057 | with lfs disabled, fails. |
|
1061 | with lfs disabled, fails. | |
1058 |
|
1062 | |||
1059 | $ hg pull -R no_lfs2 convert_lfs2 |
|
1063 | $ hg pull -R no_lfs2 convert_lfs2 | |
1060 | pulling from convert_lfs2 |
|
1064 | pulling from convert_lfs2 | |
1061 | abort: required features are not supported in the destination: lfs |
|
1065 | abort: required features are not supported in the destination: lfs | |
1062 | [255] |
|
1066 | [255] | |
1063 | $ grep lfs no_lfs2/.hg/requires |
|
1067 | $ grep lfs no_lfs2/.hg/requires | |
1064 | [1] |
|
1068 | [1] |
General Comments 0
You need to be logged in to leave comments.
Login now