Show More
@@ -80,21 +80,25 b' def encodeextra(d):' | |||||
80 | ] |
|
80 | ] | |
81 | return "\0".join(items) |
|
81 | return "\0".join(items) | |
82 |
|
82 | |||
83 | def encodecopies(copies): |
|
83 | def encodecopies(files, copies): | |
84 | items = [ |
|
84 | items = [] | |
85 | '%s\0%s' % (k, copies[k]) |
|
85 | for i, dst in enumerate(files): | |
86 |
f |
|
86 | if dst in copies: | |
87 | ] |
|
87 | items.append('%d\0%s' % (i, copies[dst])) | |
|
88 | if len(items) != len(copies): | |||
|
89 | raise error.ProgrammingError('some copy targets missing from file list') | |||
88 | return "\n".join(items) |
|
90 | return "\n".join(items) | |
89 |
|
91 | |||
90 | def decodecopies(data): |
|
92 | def decodecopies(files, data): | |
91 | try: |
|
93 | try: | |
92 | copies = {} |
|
94 | copies = {} | |
93 | for l in data.split('\n'): |
|
95 | for l in data.split('\n'): | |
94 |
|
|
96 | strindex, src = l.split('\0') | |
95 | copies[k] = v |
|
97 | i = int(strindex) | |
|
98 | dst = files[i] | |||
|
99 | copies[dst] = src | |||
96 | return copies |
|
100 | return copies | |
97 | except ValueError: |
|
101 | except (ValueError, IndexError): | |
98 | # Perhaps someone had chosen the same key name (e.g. "p1copies") and |
|
102 | # Perhaps someone had chosen the same key name (e.g. "p1copies") and | |
99 | # used different syntax for the value. |
|
103 | # used different syntax for the value. | |
100 | return None |
|
104 | return None | |
@@ -336,12 +340,12 b' class changelogrevision(object):' | |||||
336 | @property |
|
340 | @property | |
337 | def p1copies(self): |
|
341 | def p1copies(self): | |
338 | rawcopies = self.extra.get('p1copies') |
|
342 | rawcopies = self.extra.get('p1copies') | |
339 | return rawcopies and decodecopies(rawcopies) |
|
343 | return rawcopies and decodecopies(self.files, rawcopies) | |
340 |
|
344 | |||
341 | @property |
|
345 | @property | |
342 | def p2copies(self): |
|
346 | def p2copies(self): | |
343 | rawcopies = self.extra.get('p2copies') |
|
347 | rawcopies = self.extra.get('p2copies') | |
344 | return rawcopies and decodecopies(rawcopies) |
|
348 | return rawcopies and decodecopies(self.files, rawcopies) | |
345 |
|
349 | |||
346 | @property |
|
350 | @property | |
347 | def description(self): |
|
351 | def description(self): | |
@@ -631,11 +635,11 b' class changelog(revlog.revlog):' | |||||
631 | extrasentries = p1copies, p2copies, filesadded, filesremoved |
|
635 | extrasentries = p1copies, p2copies, filesadded, filesremoved | |
632 | if extra is None and any(x is not None for x in extrasentries): |
|
636 | if extra is None and any(x is not None for x in extrasentries): | |
633 | extra = {} |
|
637 | extra = {} | |
|
638 | sortedfiles = sorted(files) | |||
634 | if p1copies is not None: |
|
639 | if p1copies is not None: | |
635 | extra['p1copies'] = encodecopies(p1copies) |
|
640 | extra['p1copies'] = encodecopies(sortedfiles, p1copies) | |
636 | if p2copies is not None: |
|
641 | if p2copies is not None: | |
637 | extra['p2copies'] = encodecopies(p2copies) |
|
642 | extra['p2copies'] = encodecopies(sortedfiles, p2copies) | |
638 | sortedfiles = sorted(files) |
|
|||
639 | if filesadded is not None: |
|
643 | if filesadded is not None: | |
640 | extra['filesadded'] = encodefileindices(sortedfiles, filesadded) |
|
644 | extra['filesadded'] = encodefileindices(sortedfiles, filesadded) | |
641 | if filesremoved is not None: |
|
645 | if filesremoved is not None: |
@@ -27,9 +27,9 b' Check that copies are recorded correctly' | |||||
27 | files: b c d |
|
27 | files: b c d | |
28 | filesadded: 0\x001\x002 (esc) |
|
28 | filesadded: 0\x001\x002 (esc) | |
29 |
|
29 | |||
30 |
p1copies: |
|
30 | p1copies: 0\x00a (esc) | |
31 |
|
|
31 | 1\x00a (esc) | |
32 |
|
|
32 | 2\x00a (esc) | |
33 | $ hg showcopies |
|
33 | $ hg showcopies | |
34 | a -> b |
|
34 | a -> b | |
35 | a -> c |
|
35 | a -> c | |
@@ -49,7 +49,7 b' Check that renames are recorded correctl' | |||||
49 | filesadded: 1 |
|
49 | filesadded: 1 | |
50 | filesremoved: 0 |
|
50 | filesremoved: 0 | |
51 |
|
51 | |||
52 |
p1copies: |
|
52 | p1copies: 1\x00b (esc) | |
53 | $ hg showcopies |
|
53 | $ hg showcopies | |
54 | b -> b2 |
|
54 | b -> b2 | |
55 |
|
55 | |||
@@ -67,7 +67,7 b' even though there is no filelog entry.' | |||||
67 | $ hg changesetcopies |
|
67 | $ hg changesetcopies | |
68 | files: c |
|
68 | files: c | |
69 |
|
69 | |||
70 |
p1copies: |
|
70 | p1copies: 0\x00b2 (esc) | |
71 | $ hg showcopies |
|
71 | $ hg showcopies | |
72 | b2 -> c |
|
72 | b2 -> c | |
73 | $ hg debugindex c |
|
73 | $ hg debugindex c | |
@@ -97,9 +97,9 b" File 'f' exists only in p1, so 'i' shoul" | |||||
97 | files: g h i |
|
97 | files: g h i | |
98 | filesadded: 0\x001\x002 (esc) |
|
98 | filesadded: 0\x001\x002 (esc) | |
99 |
|
99 | |||
100 |
p1copies: |
|
100 | p1copies: 0\x00a (esc) | |
101 |
|
|
101 | 2\x00f (esc) | |
102 |
p2copies: |
|
102 | p2copies: 1\x00d (esc) | |
103 | $ hg showcopies |
|
103 | $ hg showcopies | |
104 | a -> g |
|
104 | a -> g | |
105 | d -> h |
|
105 | d -> h | |
@@ -114,7 +114,7 b' Test writing to both changeset and filel' | |||||
114 | filesadded: 0 |
|
114 | filesadded: 0 | |
115 | filesremoved: |
|
115 | filesremoved: | |
116 |
|
116 | |||
117 |
p1copies: |
|
117 | p1copies: 0\x00a (esc) | |
118 | p2copies: |
|
118 | p2copies: | |
119 | $ hg debugdata j 0 |
|
119 | $ hg debugdata j 0 | |
120 | \x01 (esc) |
|
120 | \x01 (esc) | |
@@ -173,9 +173,9 b' Test rebasing a commit with copy informa' | |||||
173 | $ hg mv a b |
|
173 | $ hg mv a b | |
174 | $ hg ci -qm 'rename a to b' |
|
174 | $ hg ci -qm 'rename a to b' | |
175 | $ hg rebase -d 1 --config rebase.experimental.inmemory=yes |
|
175 | $ hg rebase -d 1 --config rebase.experimental.inmemory=yes | |
176 |
rebasing 2: |
|
176 | rebasing 2:fc7287ac5b9b "rename a to b" (tip) | |
177 | merging a and b to b |
|
177 | merging a and b to b | |
178 |
saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/ |
|
178 | saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg | |
179 | $ hg st --change . --copies |
|
179 | $ hg st --change . --copies | |
180 | A b |
|
180 | A b | |
181 | a |
|
181 | a |
@@ -559,7 +559,7 b' Grafting revision 4 on top of revision 2' | |||||
559 | @ 5 added d, modified b |
|
559 | @ 5 added d, modified b | |
560 | | b1 |
|
560 | | b1 | |
561 | ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !) |
|
561 | ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !) | |
562 |
~ diff -r |
|
562 | ~ diff -r 0a0ed3b3251c -r d544fb655520 b1 (changeset !) | |
563 | --- a/b1 Thu Jan 01 00:00:00 1970 +0000 |
|
563 | --- a/b1 Thu Jan 01 00:00:00 1970 +0000 | |
564 | +++ b/b1 Thu Jan 01 00:00:00 1970 +0000 |
|
564 | +++ b/b1 Thu Jan 01 00:00:00 1970 +0000 | |
565 | @@ -1,1 +1,2 @@ |
|
565 | @@ -1,1 +1,2 @@ |
General Comments 0
You need to be logged in to leave comments.
Login now