Mercurial > hg
comparison tests/test-copy-move-merge.t @ 26013:38f92d12357c
copy: add flag for disabling copy tracing
Copy tracing can be up to 80% of rebase time when rebasing stacks of commits in
large repos (hundreds of thousands of files). This provides the option of
turning off the majority of copy tracing. It does not turn off _forwardcopies()
since that is used to carry copy information inside a commit across a rebase.
This will affect the situation where a user edits a file, then rebases on top of
commits that have moved that file. The move will not be detected and the user
will have to manually resolve the issue (possibly by redoing the rebase with
this flag off).
The reason to have a flag instead of trying to fix the actual copy tracing
performance is that copy tracing is fundamentally an O(number of files in the
repo) operation. In order to know if file X in the rebase source was copied
anywhere, we have to walk the filelog for every new file that exists in the
rebase destination (i.e. a file in the destination that is not in the common
ancestor). Without an index that lets us trace forward (i.e. from file Y in the
common ancestor forward to the rebase destination), it will never be an O(number
of changes in my branch) operation.
In mozilla-central, rebasing a 3 commit stack across 20,000 revs goes from 39s
to 11s.
author | Durham Goode <durham@fb.com> |
---|---|
date | Tue, 27 Jan 2015 11:26:27 -0800 |
parents | bd625cd4e5e7 |
children | d8463a743d7d |
comparison
equal
deleted
inserted
replaced
26011:ce77436162a5 | 26013:38f92d12357c |
---|---|
57 $ cat c | 57 $ cat c |
58 0 | 58 0 |
59 1 | 59 1 |
60 2 | 60 2 |
61 | 61 |
62 Test disabling copy tracing | |
63 | |
64 - first verify copy metadata was kept | |
65 | |
66 $ hg up -qC 2 | |
67 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= | |
68 rebasing 2:add3f11052fa "other" (tip) | |
69 merging b and a to b | |
70 merging c and a to c | |
71 | |
72 $ cat b | |
73 0 | |
74 1 | |
75 2 | |
76 | |
77 - next verify copy metadata is lost when disabled | |
78 | |
79 $ hg strip -r . --config extensions.strip= | |
80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
81 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg (glob) | |
82 $ hg up -qC 2 | |
83 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.disablecopytrace=True | |
84 rebasing 2:add3f11052fa "other" (tip) | |
85 remote changed a which local deleted | |
86 use (c)hanged version or leave (d)eleted? c | |
87 | |
88 $ cat b | |
89 1 | |
90 2 | |
91 | |
62 $ cd .. | 92 $ cd .. |
93 | |
94 Verify disabling copy tracing still keeps copies from rebase source | |
95 | |
96 $ hg init copydisable | |
97 $ cd copydisable | |
98 $ touch a | |
99 $ hg ci -Aqm 'add a' | |
100 $ touch b | |
101 $ hg ci -Aqm 'add b, c' | |
102 $ hg cp b x | |
103 $ echo x >> x | |
104 $ hg ci -qm 'copy b->x' | |
105 $ hg up -q 1 | |
106 $ touch z | |
107 $ hg ci -Aqm 'add z' | |
108 $ hg log -G -T '{rev} {desc}\n' | |
109 @ 3 add z | |
110 | | |
111 | o 2 copy b->x | |
112 |/ | |
113 o 1 add b, c | |
114 | | |
115 o 0 add a | |
116 | |
117 $ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.disablecopytrace=True | |
118 rebasing 2:6adcf8c12e7d "copy b->x" | |
119 saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-backup.hg (glob) | |
120 $ hg up -q 3 | |
121 $ hg log -f x -T '{rev} {desc}\n' | |
122 3 copy b->x | |
123 1 add b, c | |
124 | |
125 $ cd ../ | |
126 | |
127 Verify we duplicate existing copies, instead of detecting them | |
128 | |
129 $ hg init copydisable3 | |
130 $ cd copydisable3 | |
131 $ touch a | |
132 $ hg ci -Aqm 'add a' | |
133 $ hg cp a b | |
134 $ hg ci -Aqm 'copy a->b' | |
135 $ hg mv b c | |
136 $ hg ci -Aqm 'move b->c' | |
137 $ hg up -q 0 | |
138 $ hg cp a b | |
139 $ echo b >> b | |
140 $ hg ci -Aqm 'copy a->b (2)' | |
141 $ hg log -G -T '{rev} {desc}\n' | |
142 @ 3 copy a->b (2) | |
143 | | |
144 | o 2 move b->c | |
145 | | | |
146 | o 1 copy a->b | |
147 |/ | |
148 o 0 add a | |
149 | |
150 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.disablecopytrace=True | |
151 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip) | |
152 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-backup.hg (glob) | |
153 | |
154 $ hg log -G -f b | |
155 @ changeset: 3:76024fb4b05b | |
156 | tag: tip | |
157 | user: test | |
158 | date: Thu Jan 01 00:00:00 1970 +0000 | |
159 | summary: copy a->b (2) | |
160 | | |
161 o changeset: 0:ac82d8b1f7c4 | |
162 user: test | |
163 date: Thu Jan 01 00:00:00 1970 +0000 | |
164 summary: add a | |
165 |