Mercurial > hgsubversion
annotate tests/fixtures/externals.sh @ 890:78db88de9622
Partial metadata rebuilding
For highly active subversion repositories, it can be excruciatingly
slow to pull updates one at a time from subversion. One way around
this is to setup another mercurial repo that pulls new commits from
svn periodicly (say every 5 minutes). When you want to update your
repository, you can pull commits from this mercurial repository via
native mercurial protocols, which will be much faster than pulling
directly from svn.
Unfortunately, your metadata will be out of date after doing so.
Highly active repositories also tend to be very large, which means
that it takes a long time to rebuild your metadata from scratch. To
address this, this adds support to do a partial rebuild on the
metadata by processing only revisions that have been added to the
repository after the last revision we processed.
With the rev map 1k revisions (~2 days) behind tip updatemeta is
dramatically faster than rebuild meta:
$ hg --time svn updatemeta
Time: real 0.570 secs (user 0.480+0.000 sys 0.060+0.000)
$ hg --time svn rebuildmeta
Time: real 129.160 secs (user 128.570+0.000 sys 0.320+0.000)
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Sat, 12 May 2012 07:28:23 -0700 |
parents | a5be5ca638de |
children |
rev | line source |
---|---|
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 # |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 # Generate externals.svndump |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 # |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 mkdir temp |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 cd temp |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 mkdir project-orig |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 cd project-orig |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 mkdir trunk |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 mkdir branches |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 mkdir externals |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 cd .. |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 svnadmin create testrepo |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 svnurl=file://`pwd`/testrepo |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 svn import project-orig $svnurl -m "init project" |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 svn co $svnurl project |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
21 cd project/externals |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 mkdir project1 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 echo a > project1/a |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 svn add project1 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 mkdir project2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 echo a > project2/b |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 svn add project2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 svn ci -m "configure externals projects" |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
29 cd ../trunk |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 # Add an external reference |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 echo a > a |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 svn add a |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 cat > externals <<EOF |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
34 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 EOF |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 svn propset -F externals svn:externals . |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 svn ci -m "set externals on ." |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 # Add another one |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 cat > externals <<EOF |
789
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
315
diff
changeset
|
40 # A comment, then an empty line, then a blank line |
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
315
diff
changeset
|
41 |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
42 ^/externals/project1 deps/project1 |
789
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
315
diff
changeset
|
43 |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
44 -r2 ^/externals/project2@2 deps/project2 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 EOF |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 svn propset -F externals svn:externals . |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 svn ci -m "update externals on ." |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 # Suppress an external and add one on a subdir |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 cat > externals <<EOF |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
50 -r2 ^/externals/project2@2 deps/project2 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 EOF |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 svn propset -F externals svn:externals . |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 mkdir subdir |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 mkdir subdir2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 svn add subdir subdir2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 cat > externals <<EOF |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
57 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 EOF |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 svn propset -F externals svn:externals subdir subdir2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 svn ci -m "add on subdir" |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
61 # Test branch with externals |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
62 svn up |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
63 cd ../branches |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
64 svn copy ../trunk branch1 |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
65 svn propdel svn:externals branch1/subdir2 |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
66 svn ci -m 'externals in subtree' |
184
d3ea6c98a086
Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents:
183
diff
changeset
|
67 # Test branch with externals, removing on copy root |
d3ea6c98a086
Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents:
183
diff
changeset
|
68 svn copy ../trunk branch2 |
d3ea6c98a086
Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents:
183
diff
changeset
|
69 svn propdel svn:externals branch2 branch2/subdir2 |
d3ea6c98a086
Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents:
183
diff
changeset
|
70 svn ci -m 'externals in subtree, removed on root' |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
71 cd ../trunk |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
72 # Suppress the subdirectory |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
73 svn rm --force subdir |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
74 svn ci -m 'remove externals subdir' |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
75 # Remove the property on subdir2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
76 svn propdel svn:externals subdir2 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
77 svn ci -m 'remove externals subdir2' |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
78 # Kill project2 externals, peg revision should preserve it |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
79 cd .. |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
80 svn up |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
81 svn rm externals/project2 |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
82 svn ci -m 'remove externals project2' |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
83 cd trunk |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
84 echo a >> a |
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
184
diff
changeset
|
85 svn ci -m 'change a' |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
86 cd ../.. |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
87 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
88 svnadmin dump testrepo > ../externals.svndump |