Show More
@@ -0,0 +1,100 b'' | |||||
|
1 | In this test, we want to test LFS bundle application on both LFS and non-LFS | |||
|
2 | repos. | |||
|
3 | ||||
|
4 | To make it more interesting, the file revisions will contain hg filelog | |||
|
5 | metadata ('\1\n'). The bundle will have 1 file revision overlapping with the | |||
|
6 | destination repo. | |||
|
7 | ||||
|
8 | # rev 1 2 3 | |||
|
9 | # repo: yes yes no | |||
|
10 | # bundle: no (base) yes yes (deltabase: 2 if possible) | |||
|
11 | ||||
|
12 | It is interesting because rev 2 could have been stored as LFS in the repo, and | |||
|
13 | non-LFS in the bundle; or vice-versa. | |||
|
14 | ||||
|
15 | Init | |||
|
16 | ||||
|
17 | $ cat >> $HGRCPATH << EOF | |||
|
18 | > [extensions] | |||
|
19 | > lfs= | |||
|
20 | > drawdag=$TESTDIR/drawdag.py | |||
|
21 | > [lfs] | |||
|
22 | > url=file:$TESTTMP/lfs-remote | |||
|
23 | > EOF | |||
|
24 | ||||
|
25 | Helper functions | |||
|
26 | ||||
|
27 | $ commitxy() { | |||
|
28 | > hg debugdrawdag "$@" <<'EOS' | |||
|
29 | > Y # Y/X=\1\nAAAA\nE\nF | |||
|
30 | > | # Y/Y=\1\nAAAA\nG\nH | |||
|
31 | > X # X/X=\1\nAAAA\nC\n | |||
|
32 | > # X/Y=\1\nAAAA\nD\n | |||
|
33 | > EOS | |||
|
34 | > } | |||
|
35 | ||||
|
36 | $ commitz() { | |||
|
37 | > hg debugdrawdag "$@" <<'EOS' | |||
|
38 | > Z # Z/X=\1\nAAAA\nI\n | |||
|
39 | > | # Z/Y=\1\nAAAA\nJ\n | |||
|
40 | > | # Z/Z=\1\nZ | |||
|
41 | > Y | |||
|
42 | > EOS | |||
|
43 | > } | |||
|
44 | ||||
|
45 | $ enablelfs() { | |||
|
46 | > cat >> .hg/hgrc <<EOF | |||
|
47 | > [lfs] | |||
|
48 | > track=all() | |||
|
49 | > EOF | |||
|
50 | > } | |||
|
51 | ||||
|
52 | Generate bundles | |||
|
53 | ||||
|
54 | $ for i in normal lfs; do | |||
|
55 | > NAME=src-$i | |||
|
56 | > hg init $TESTTMP/$NAME | |||
|
57 | > cd $TESTTMP/$NAME | |||
|
58 | > [ $i = lfs ] && enablelfs | |||
|
59 | > commitxy | |||
|
60 | > commitz | |||
|
61 | > hg bundle -q --base X -r Y+Z $TESTTMP/$NAME.bundle | |||
|
62 | > SRCNAMES="$SRCNAMES $NAME" | |||
|
63 | > done | |||
|
64 | ||||
|
65 | Prepare destination repos | |||
|
66 | ||||
|
67 | $ for i in normal lfs; do | |||
|
68 | > NAME=dst-$i | |||
|
69 | > hg init $TESTTMP/$NAME | |||
|
70 | > cd $TESTTMP/$NAME | |||
|
71 | > [ $i = lfs ] && enablelfs | |||
|
72 | > commitxy | |||
|
73 | > DSTNAMES="$DSTNAMES $NAME" | |||
|
74 | > done | |||
|
75 | ||||
|
76 | Apply bundles | |||
|
77 | ||||
|
78 | $ for i in $SRCNAMES; do | |||
|
79 | > for j in $DSTNAMES; do | |||
|
80 | > echo ---- Applying $i.bundle to $j ---- | |||
|
81 | > cp -R $TESTTMP/$j $TESTTMP/tmp-$i-$j | |||
|
82 | > cd $TESTTMP/tmp-$i-$j | |||
|
83 | > if hg unbundle $TESTTMP/$i.bundle -q 2>/dev/null; then | |||
|
84 | > hg verify -q && echo OK | |||
|
85 | > else | |||
|
86 | > echo CRASHED | |||
|
87 | > fi | |||
|
88 | > done | |||
|
89 | > done | |||
|
90 | ---- Applying src-normal.bundle to dst-normal ---- | |||
|
91 | OK | |||
|
92 | ---- Applying src-normal.bundle to dst-lfs ---- | |||
|
93 | X@2: unpacking bcc7d23fa6b7: integrity check failed on data/X.i:2 | |||
|
94 | Y@2: unpacking 46017a6640e7: integrity check failed on data/Y.i:2 | |||
|
95 | 2 integrity errors encountered! | |||
|
96 | (first damaged changeset appears to be 2) | |||
|
97 | ---- Applying src-lfs.bundle to dst-normal ---- | |||
|
98 | CRASHED | |||
|
99 | ---- Applying src-lfs.bundle to dst-lfs ---- | |||
|
100 | OK |
@@ -371,7 +371,8 b' def debugdrawdag(ui, repo, **opts):' | |||||
371 | comments = list(_getcomments(text)) |
|
371 | comments = list(_getcomments(text)) | |
372 | filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M) |
|
372 | filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M) | |
373 | for name, path, content in filere.findall(b'\n'.join(comments)): |
|
373 | for name, path, content in filere.findall(b'\n'.join(comments)): | |
374 |
|
|
374 | content = content.replace(br'\n', b'\n').replace(br'\1', b'\1') | |
|
375 | files[name][path] = content | |||
375 |
|
376 | |||
376 | committed = {None: node.nullid} # {name: node} |
|
377 | committed = {None: node.nullid} # {name: node} | |
377 |
|
378 |
General Comments 0
You need to be logged in to leave comments.
Login now