annotate tests/test-convert-svn-branches.t @ 17616:9535a0dc41f2

store: implement fncache basic path encoding in C (This is not yet enabled; it will be turned on in a followup patch.) The path encoding performed by fncache is complex and (perhaps surprisingly) slow enough to negatively affect the overall performance of Mercurial. For a short path (< 120 bytes), the Python code can be reduced to a fairly tractable state machine that either determines that nothing needs to be done in a single pass, or performs the encoding in a second pass. For longer paths, we avoid the more complicated hashed encoding scheme for now, and fall back to Python. Raw performance: I measured in a repo containing 150,000 files in its tip manifest, with a median path name length of 57 bytes, and 95th percentile of 96 bytes. In this repo, the Python code takes 3.1 seconds to encode all path names, while the hybrid C-and-Python code (called from Python) takes 0.21 seconds, for a speedup of about 14. Across several other large repositories, I've measured the speedup from the C code at between 26x and 40x. For path names above 120 bytes where we must fall back to Python for hashed encoding, the speedup is about 1.7x. Thus absolute performance will depend strongly on the characteristics of a particular repository.
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 18 Sep 2012 15:42:19 -0700
parents 29c100b42f5b
children aa9385f983fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
1
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
2 $ "$TESTDIR/hghave" svn svn-bindings || exit 80
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3
13519
43b3b761d9d1 tests: don't overwrite HGRCPATH
Martin Geisler <mg@aragost.com>
parents: 12377
diff changeset
4 $ cat >> $HGRCPATH <<EOF
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
5 > [extensions]
17347
2da47de36b6f check-code: fix check for trailing whitespace on continued lines too
Mads Kiilerich <mads@kiilerich.com>
parents: 16190
diff changeset
6 > convert =
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
7 > graphlog =
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
8 > EOF
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
9
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
10 $ svnadmin create svn-repo
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
11 $ svnadmin load -q svn-repo < "$TESTDIR/svn/branches.svndump"
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
12
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
13 Convert trunk and branches
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
15 $ cat > branchmap <<EOF
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
16 > old3 newbranch
17347
2da47de36b6f check-code: fix check for trailing whitespace on continued lines too
Mads Kiilerich <mads@kiilerich.com>
parents: 16190
diff changeset
17 >
16190
9479c28a22bf convert: ignore blank lines in mapfiles (issue3286)
Patrick Mezard <patrick@mezard.eu>
parents: 14162
diff changeset
18 >
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
19 > EOF
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
20 $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo A-hg
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
21 initializing destination A-hg repository
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
22 scanning source...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
23 sorting...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
24 converting...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
25 10 init projA
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
26 9 hello
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
27 8 branch trunk, remove c and dir
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
28 7 change a
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
29 6 change b
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
30 5 move and update c
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
31 4 move and update c
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
32 3 change b again
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
33 2 move to old2
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
34 1 move back to old
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
35 0 last change to a
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36
13691
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
37 Test template keywords
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
38
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
39 $ hg -R A-hg log --template '{rev} {svnuuid}{svnpath}@{svnrev}\n'
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
40 10 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@10
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
41 9 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@9
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
42 8 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old2@8
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
43 7 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@7
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
44 6 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@6
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
45 5 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@6
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
46 4 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@5
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
47 3 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@4
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
48 2 644ede6c-2b81-4367-9dc8-d786514f2cde/branches/old@3
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
49 1 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@2
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
50 0 644ede6c-2b81-4367-9dc8-d786514f2cde/trunk@1
ad02eba55459 convert: add svnrev, svnpath and svnuuid template keywords
Patrick Mezard <pmezard@gmail.com>
parents: 13519
diff changeset
51
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
52 Convert again
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
53
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
54 $ hg convert --branchmap=branchmap --datesort svn-repo A-hg
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
55 scanning source...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
56 sorting...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
57 converting...
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
58 0 branch trunk@1 into old3
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
59
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
60 $ cd A-hg
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
61 $ hg glog --template 'branch={branches} {rev} {desc|firstline} files: {files}\n'
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
62 o branch=newbranch 11 branch trunk@1 into old3 files:
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
63 |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
64 | o branch= 10 last change to a files: a
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
65 | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
66 | | o branch=old 9 move back to old files:
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
67 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
68 | | o branch=old2 8 move to old2 files:
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
69 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
70 | | o branch=old 7 change b again files: b
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
71 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
72 | o | branch= 6 move and update c files: b
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
73 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
74 | | o branch=old 5 move and update c files: c
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
75 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
76 | | o branch=old 4 change b files: b
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
77 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
78 | o | branch= 3 change a files: a
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
79 | | |
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
80 | | o branch=old 2 branch trunk, remove c and dir files: c
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
81 | |/
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
82 | o branch= 1 hello files: a b c dir/e
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
83 |/
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
84 o branch= 0 init projA files:
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
85
5874
866aa7ae2612 Test subversion branches conversion
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
86
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
87 $ hg branches
14162
301725c3df9a localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 13691
diff changeset
88 newbranch 11:a6d7cc050ad1
301725c3df9a localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 13691
diff changeset
89 default 10:6e2b33404495
301725c3df9a localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 13691
diff changeset
90 old 9:93c4b0f99529
301725c3df9a localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 13691
diff changeset
91 old2 8:b52884d7bead (inactive)
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
92 $ hg tags -q
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
93 tip
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
94 $ cd ..
9587
d80a251baf9a convert/svn: better error when hg cannot call itself (issue1838)
Patrick Mezard <pmezard@gmail.com>
parents: 8765
diff changeset
95
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
96 Test hg failing to call itself
9587
d80a251baf9a convert/svn: better error when hg cannot call itself (issue1838)
Patrick Mezard <pmezard@gmail.com>
parents: 8765
diff changeset
97
17447
29c100b42f5b test-convert-svn-branches.t: fix self call failure on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 17347
diff changeset
98 $ HG=foobar hg convert svn-repo B-hg 2>&1 | grep abort
12370
f98010f57a5e tests: unify test-convert-svn-*
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10205
diff changeset
99 abort: Mercurial failed to run itself, check hg executable is in PATH