Show More
@@ -27,6 +27,8 b' from .utils import (' | |||||
27 | stringutil, |
|
27 | stringutil, | |
28 | ) |
|
28 | ) | |
29 |
|
29 | |||
|
30 | from .revlogutils import sidedata as sidedatamod | |||
|
31 | ||||
30 | _defaultextra = {b'branch': b'default'} |
|
32 | _defaultextra = {b'branch': b'default'} | |
31 |
|
33 | |||
32 |
|
34 | |||
@@ -676,6 +678,7 b' class changelog(revlog.revlog):' | |||||
676 | _(b'the name \'%s\' is reserved') % branch |
|
678 | _(b'the name \'%s\' is reserved') % branch | |
677 | ) |
|
679 | ) | |
678 | sortedfiles = sorted(files) |
|
680 | sortedfiles = sorted(files) | |
|
681 | sidedata = None | |||
679 | if extra is not None: |
|
682 | if extra is not None: | |
680 | for name in ( |
|
683 | for name in ( | |
681 | b'p1copies', |
|
684 | b'p1copies', | |
@@ -704,13 +707,25 b' class changelog(revlog.revlog):' | |||||
704 | extra[b'filesadded'] = filesadded |
|
707 | extra[b'filesadded'] = filesadded | |
705 | if filesremoved is not None: |
|
708 | if filesremoved is not None: | |
706 | extra[b'filesremoved'] = filesremoved |
|
709 | extra[b'filesremoved'] = filesremoved | |
|
710 | elif self._copiesstorage == b'changeset-sidedata': | |||
|
711 | sidedata = {} | |||
|
712 | if p1copies is not None: | |||
|
713 | sidedata[sidedatamod.SD_P1COPIES] = p1copies | |||
|
714 | if p2copies is not None: | |||
|
715 | sidedata[sidedatamod.SD_P2COPIES] = p2copies | |||
|
716 | if filesadded is not None: | |||
|
717 | sidedata[sidedatamod.SD_FILESADDED] = filesadded | |||
|
718 | if filesremoved is not None: | |||
|
719 | sidedata[sidedatamod.SD_FILESREMOVED] = filesremoved | |||
707 |
|
720 | |||
708 | if extra: |
|
721 | if extra: | |
709 | extra = encodeextra(extra) |
|
722 | extra = encodeextra(extra) | |
710 | parseddate = b"%s %s" % (parseddate, extra) |
|
723 | parseddate = b"%s %s" % (parseddate, extra) | |
711 | l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc] |
|
724 | l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc] | |
712 | text = b"\n".join(l) |
|
725 | text = b"\n".join(l) | |
713 |
return self.addrevision( |
|
726 | return self.addrevision( | |
|
727 | text, transaction, len(self), p1, p2, sidedata=sidedata | |||
|
728 | ) | |||
714 |
|
729 | |||
715 | def branchinfo(self, rev): |
|
730 | def branchinfo(self, rev): | |
716 | """return the branch name and open/close state of a revision |
|
731 | """return the branch name and open/close state of a revision |
@@ -1547,6 +1547,10 b' class ilocalrepositorymain(interfaceutil' | |||||
1547 |
|
1547 | |||
1548 | names = interfaceutil.Attribute("""A ``namespaces`` instance.""") |
|
1548 | names = interfaceutil.Attribute("""A ``namespaces`` instance.""") | |
1549 |
|
1549 | |||
|
1550 | filecopiesmode = interfaceutil.Attribute( | |||
|
1551 | """The way files copies should be dealt with in this repo.""" | |||
|
1552 | ) | |||
|
1553 | ||||
1550 | def close(): |
|
1554 | def close(): | |
1551 | """Close the handle on this repository.""" |
|
1555 | """Close the handle on this repository.""" | |
1552 |
|
1556 |
@@ -825,10 +825,13 b' def resolvestorevfsoptions(ui, requireme' | |||||
825 | else: # explicitly mark repo as using revlogv0 |
|
825 | else: # explicitly mark repo as using revlogv0 | |
826 | options[b'revlogv0'] = True |
|
826 | options[b'revlogv0'] = True | |
827 |
|
827 | |||
828 | writecopiesto = ui.config(b'experimental', b'copies.write-to') |
|
828 | if COPIESSDC_REQUIREMENT in requirements: | |
829 | copiesextramode = (b'changeset-only', b'compatibility') |
|
829 | options[b'copies-storage'] = b'changeset-sidedata' | |
830 | if writecopiesto in copiesextramode: |
|
830 | else: | |
831 | options[b'copies-storage'] = b'extra' |
|
831 | writecopiesto = ui.config(b'experimental', b'copies.write-to') | |
|
832 | copiesextramode = (b'changeset-only', b'compatibility') | |||
|
833 | if writecopiesto in copiesextramode: | |||
|
834 | options[b'copies-storage'] = b'extra' | |||
832 |
|
835 | |||
833 | return options |
|
836 | return options | |
834 |
|
837 | |||
@@ -1182,6 +1185,10 b' class localrepository(object):' | |||||
1182 |
|
1185 | |||
1183 | self._extrafilterid = repoview.extrafilter(ui) |
|
1186 | self._extrafilterid = repoview.extrafilter(ui) | |
1184 |
|
1187 | |||
|
1188 | self.filecopiesmode = None | |||
|
1189 | if COPIESSDC_REQUIREMENT in self.requirements: | |||
|
1190 | self.filecopiesmode = b'changeset-sidedata' | |||
|
1191 | ||||
1185 | def _getvfsward(self, origfunc): |
|
1192 | def _getvfsward(self, origfunc): | |
1186 | """build a ward for self.vfs""" |
|
1193 | """build a ward for self.vfs""" | |
1187 | rref = weakref.ref(self) |
|
1194 | rref = weakref.ref(self) | |
@@ -2949,12 +2956,17 b' class localrepository(object):' | |||||
2949 | p1, p2 = ctx.p1(), ctx.p2() |
|
2956 | p1, p2 = ctx.p1(), ctx.p2() | |
2950 | user = ctx.user() |
|
2957 | user = ctx.user() | |
2951 |
|
2958 | |||
2952 | writecopiesto = self.ui.config(b'experimental', b'copies.write-to') |
|
2959 | if self.filecopiesmode == b'changeset-sidedata': | |
2953 | writefilecopymeta = writecopiesto != b'changeset-only' |
|
2960 | writechangesetcopy = True | |
2954 | writechangesetcopy = writecopiesto in ( |
|
2961 | writefilecopymeta = True | |
2955 | b'changeset-only', |
|
2962 | writecopiesto = None | |
2956 | b'compatibility', |
|
2963 | else: | |
2957 | ) |
|
2964 | writecopiesto = self.ui.config(b'experimental', b'copies.write-to') | |
|
2965 | writefilecopymeta = writecopiesto != b'changeset-only' | |||
|
2966 | writechangesetcopy = writecopiesto in ( | |||
|
2967 | b'changeset-only', | |||
|
2968 | b'compatibility', | |||
|
2969 | ) | |||
2958 | p1copies, p2copies = None, None |
|
2970 | p1copies, p2copies = None, None | |
2959 | if writechangesetcopy: |
|
2971 | if writechangesetcopy: | |
2960 | p1copies = ctx.p1copies() |
|
2972 | p1copies = ctx.p1copies() |
@@ -48,6 +48,12 b' SD_TEST5 = 5' | |||||
48 | SD_TEST6 = 6 |
|
48 | SD_TEST6 = 6 | |
49 | SD_TEST7 = 7 |
|
49 | SD_TEST7 = 7 | |
50 |
|
50 | |||
|
51 | # key to store copies related information | |||
|
52 | SD_P1COPIES = 8 | |||
|
53 | SD_P2COPIES = 9 | |||
|
54 | SD_FILESADDED = 10 | |||
|
55 | SD_FILESREMOVED = 11 | |||
|
56 | ||||
51 | # internal format constant |
|
57 | # internal format constant | |
52 | SIDEDATA_HEADER = struct.Struct(r'>H') |
|
58 | SIDEDATA_HEADER = struct.Struct(r'>H') | |
53 | SIDEDATA_ENTRY = struct.Struct(r'>HL20s') |
|
59 | SIDEDATA_ENTRY = struct.Struct(r'>HL20s') |
@@ -75,7 +75,17 b' Check that copies are recorded correctly' | |||||
75 | p1copies: 0\x00a (esc) |
|
75 | p1copies: 0\x00a (esc) | |
76 | 1\x00a (esc) |
|
76 | 1\x00a (esc) | |
77 | 2\x00a (esc) |
|
77 | 2\x00a (esc) | |
78 |
|
78 | #else | ||
|
79 | $ hg debugsidedata -c -v -- -1 | |||
|
80 | 4 sidedata entries | |||
|
81 | entry-0010 size 11 | |||
|
82 | '0\x00a\n1\x00a\n2\x00a' | |||
|
83 | entry-0011 size 0 | |||
|
84 | '' | |||
|
85 | entry-0012 size 5 | |||
|
86 | '0\n1\n2' | |||
|
87 | entry-0013 size 0 | |||
|
88 | '' | |||
79 | #endif |
|
89 | #endif | |
80 |
|
90 | |||
81 | $ hg showcopies |
|
91 | $ hg showcopies | |
@@ -107,6 +117,17 b' Check that renames are recorded correctl' | |||||
107 |
|
117 | |||
108 | p1copies: 1\x00b (esc) |
|
118 | p1copies: 1\x00b (esc) | |
109 |
|
119 | |||
|
120 | #else | |||
|
121 | $ hg debugsidedata -c -v -- -1 | |||
|
122 | 4 sidedata entries | |||
|
123 | entry-0010 size 3 | |||
|
124 | '1\x00b' | |||
|
125 | entry-0011 size 0 | |||
|
126 | '' | |||
|
127 | entry-0012 size 1 | |||
|
128 | '1' | |||
|
129 | entry-0013 size 1 | |||
|
130 | '0' | |||
110 | #endif |
|
131 | #endif | |
111 |
|
132 | |||
112 | $ hg showcopies |
|
133 | $ hg showcopies | |
@@ -145,6 +166,17 b' even though there is no filelog entry.' | |||||
145 |
|
166 | |||
146 | p1copies: 0\x00b2 (esc) |
|
167 | p1copies: 0\x00b2 (esc) | |
147 |
|
168 | |||
|
169 | #else | |||
|
170 | $ hg debugsidedata -c -v -- -1 | |||
|
171 | 4 sidedata entries | |||
|
172 | entry-0010 size 4 | |||
|
173 | '0\x00b2' | |||
|
174 | entry-0011 size 0 | |||
|
175 | '' | |||
|
176 | entry-0012 size 0 | |||
|
177 | '' | |||
|
178 | entry-0013 size 0 | |||
|
179 | '' | |||
148 | #endif |
|
180 | #endif | |
149 |
|
181 | |||
150 | $ hg showcopies |
|
182 | $ hg showcopies | |
@@ -197,6 +229,17 b" File 'f' exists only in p1, so 'i' shoul" | |||||
197 | 2\x00f (esc) |
|
229 | 2\x00f (esc) | |
198 | p2copies: 1\x00d (esc) |
|
230 | p2copies: 1\x00d (esc) | |
199 |
|
231 | |||
|
232 | #else | |||
|
233 | $ hg debugsidedata -c -v -- -1 | |||
|
234 | 4 sidedata entries | |||
|
235 | entry-0010 size 7 | |||
|
236 | '0\x00a\n2\x00f' | |||
|
237 | entry-0011 size 3 | |||
|
238 | '1\x00d' | |||
|
239 | entry-0012 size 5 | |||
|
240 | '0\n1\n2' | |||
|
241 | entry-0013 size 0 | |||
|
242 | '' | |||
200 | #endif |
|
243 | #endif | |
201 |
|
244 | |||
202 | $ hg showcopies |
|
245 | $ hg showcopies | |
@@ -218,6 +261,16 b' Test writing to both changeset and filel' | |||||
218 | p2copies: |
|
261 | p2copies: | |
219 | #else |
|
262 | #else | |
220 | $ hg ci -m 'copy a to j' |
|
263 | $ hg ci -m 'copy a to j' | |
|
264 | $ hg debugsidedata -c -v -- -1 | |||
|
265 | 4 sidedata entries | |||
|
266 | entry-0010 size 3 | |||
|
267 | '0\x00a' | |||
|
268 | entry-0011 size 0 | |||
|
269 | '' | |||
|
270 | entry-0012 size 1 | |||
|
271 | '0' | |||
|
272 | entry-0013 size 0 | |||
|
273 | '' | |||
221 | #endif |
|
274 | #endif | |
222 | $ hg debugdata j 0 |
|
275 | $ hg debugdata j 0 | |
223 | \x01 (esc) |
|
276 | \x01 (esc) | |
@@ -243,6 +296,16 b' copy information on to the filelog' | |||||
243 | #else |
|
296 | #else | |
244 | $ hg ci --amend -m 'copy a to j, v2' |
|
297 | $ hg ci --amend -m 'copy a to j, v2' | |
245 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob) |
|
298 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob) | |
|
299 | $ hg debugsidedata -c -v -- -1 | |||
|
300 | 4 sidedata entries | |||
|
301 | entry-0010 size 3 | |||
|
302 | '0\x00a' | |||
|
303 | entry-0011 size 0 | |||
|
304 | '' | |||
|
305 | entry-0012 size 1 | |||
|
306 | '0' | |||
|
307 | entry-0013 size 0 | |||
|
308 | '' | |||
246 | #endif |
|
309 | #endif | |
247 | $ hg showcopies --config experimental.copies.read-from=filelog-only |
|
310 | $ hg showcopies --config experimental.copies.read-from=filelog-only | |
248 | a -> j |
|
311 | a -> j | |
@@ -260,6 +323,16 b" won't have to fall back to reading from " | |||||
260 | p2copies: |
|
323 | p2copies: | |
261 | #else |
|
324 | #else | |
262 | $ hg ci -m 'modify j' |
|
325 | $ hg ci -m 'modify j' | |
|
326 | $ hg debugsidedata -c -v -- -1 | |||
|
327 | 4 sidedata entries | |||
|
328 | entry-0010 size 0 | |||
|
329 | '' | |||
|
330 | entry-0011 size 0 | |||
|
331 | '' | |||
|
332 | entry-0012 size 0 | |||
|
333 | '' | |||
|
334 | entry-0013 size 0 | |||
|
335 | '' | |||
263 | #endif |
|
336 | #endif | |
264 |
|
337 | |||
265 | Test writing only to filelog |
|
338 | Test writing only to filelog | |
@@ -273,6 +346,16 b' Test writing only to filelog' | |||||
273 |
|
346 | |||
274 | #else |
|
347 | #else | |
275 | $ hg ci -m 'copy a to k' |
|
348 | $ hg ci -m 'copy a to k' | |
|
349 | $ hg debugsidedata -c -v -- -1 | |||
|
350 | 4 sidedata entries | |||
|
351 | entry-0010 size 3 | |||
|
352 | '0\x00a' | |||
|
353 | entry-0011 size 0 | |||
|
354 | '' | |||
|
355 | entry-0012 size 1 | |||
|
356 | '0' | |||
|
357 | entry-0013 size 0 | |||
|
358 | '' | |||
276 | #endif |
|
359 | #endif | |
277 |
|
360 | |||
278 | $ hg debugdata k 0 |
|
361 | $ hg debugdata k 0 |
General Comments 0
You need to be logged in to leave comments.
Login now