Show More
@@ -145,12 +145,16 b' def _forwardcopies(a, b):' | |||||
145 |
|
145 | |||
146 | return cm |
|
146 | return cm | |
147 |
|
147 | |||
148 |
def _backward |
|
148 | def _backwardrenames(a, b): | |
149 | # because the forward mapping is 1:n, we can lose renames here |
|
149 | # Even though we're not taking copies into account, 1:n rename situations | |
150 | # in particular, we find renames better than copies |
|
150 | # can still exist (e.g. hg cp a b; hg mv a c). In those cases we | |
|
151 | # arbitrarily pick one of the renames. | |||
151 | f = _forwardcopies(b, a) |
|
152 | f = _forwardcopies(b, a) | |
152 | r = {} |
|
153 | r = {} | |
153 | for k, v in f.iteritems(): |
|
154 | for k, v in f.iteritems(): | |
|
155 | # remove copies | |||
|
156 | if v in a: | |||
|
157 | continue | |||
154 | r[v] = k |
|
158 | r[v] = k | |
155 | return r |
|
159 | return r | |
156 |
|
160 | |||
@@ -162,8 +166,8 b' def pathcopies(x, y):' | |||||
162 | if a == x: |
|
166 | if a == x: | |
163 | return _forwardcopies(x, y) |
|
167 | return _forwardcopies(x, y) | |
164 | if a == y: |
|
168 | if a == y: | |
165 |
return _backward |
|
169 | return _backwardrenames(x, y) | |
166 |
return _chain(x, y, _backward |
|
170 | return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y)) | |
167 |
|
171 | |||
168 | def mergecopies(repo, c1, c2, ca): |
|
172 | def mergecopies(repo, c1, c2, ca): | |
169 | """ |
|
173 | """ |
@@ -670,7 +670,6 b' single copy' | |||||
670 |
|
670 | |||
671 | % hg st -C --rev . --rev 0 |
|
671 | % hg st -C --rev . --rev 0 | |
672 | M a |
|
672 | M a | |
673 | b |
|
|||
674 | R b |
|
673 | R b | |
675 |
|
674 | |||
676 | % hg diff --git --rev . --rev 0 |
|
675 | % hg diff --git --rev . --rev 0 | |
@@ -728,7 +727,6 b' single copy' | |||||
728 |
|
727 | |||
729 | % hg st -C --rev . --rev 2 |
|
728 | % hg st -C --rev . --rev 2 | |
730 | M a |
|
729 | M a | |
731 | b |
|
|||
732 | A x/y |
|
730 | A x/y | |
733 | R b |
|
731 | R b | |
734 |
|
732 | |||
@@ -1072,7 +1070,6 b' copy chain' | |||||
1072 |
|
1070 | |||
1073 | % hg st -C --rev . --rev 0 |
|
1071 | % hg st -C --rev . --rev 0 | |
1074 | M a |
|
1072 | M a | |
1075 | b |
|
|||
1076 | R b |
|
1073 | R b | |
1077 | R c |
|
1074 | R c | |
1078 |
|
1075 | |||
@@ -1148,7 +1145,6 b' copy chain' | |||||
1148 |
|
1145 | |||
1149 | % hg st -C --rev . --rev 2 |
|
1146 | % hg st -C --rev . --rev 2 | |
1150 | M a |
|
1147 | M a | |
1151 | b |
|
|||
1152 | A x/y |
|
1148 | A x/y | |
1153 | R b |
|
1149 | R b | |
1154 | R c |
|
1150 | R c |
@@ -20,7 +20,10 b'' | |||||
20 | $ hg ci -Am B |
|
20 | $ hg ci -Am B | |
21 | adding b |
|
21 | adding b | |
22 |
|
22 | |||
23 | $ hg up -q -C 0 |
|
23 | $ hg mv b b-renamed | |
|
24 | $ hg ci -m 'rename B' | |||
|
25 | ||||
|
26 | $ hg up -q -C 1 | |||
24 |
|
27 | |||
25 | $ hg mv a a-renamed |
|
28 | $ hg mv a a-renamed | |
26 |
|
29 | |||
@@ -28,28 +31,32 b'' | |||||
28 | created new head |
|
31 | created new head | |
29 |
|
32 | |||
30 | $ hg tglog |
|
33 | $ hg tglog | |
31 |
@ |
|
34 | @ 3: 'rename A' | |
32 | | |
|
35 | | | |
33 |
| o |
|
36 | | o 2: 'rename B' | |
34 | |/ |
|
37 | |/ | |
|
38 | o 1: 'B' | |||
|
39 | | | |||
35 | o 0: 'A' |
|
40 | o 0: 'A' | |
36 |
|
41 | |||
37 |
|
42 | |||
38 | Rename is tracked: |
|
43 | Rename is tracked: | |
39 |
|
44 | |||
40 | $ hg tlog -p --git -r tip |
|
45 | $ hg tlog -p --git -r tip | |
41 |
|
|
46 | 3: 'rename A' | |
42 | diff --git a/a b/a-renamed |
|
47 | diff --git a/a b/a-renamed | |
43 | rename from a |
|
48 | rename from a | |
44 | rename to a-renamed |
|
49 | rename to a-renamed | |
45 |
|
50 | |||
46 | Rebase the revision containing the rename: |
|
51 | Rebase the revision containing the rename: | |
47 |
|
52 | |||
48 |
$ hg rebase -s |
|
53 | $ hg rebase -s 3 -d 2 | |
49 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) |
|
54 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob) | |
50 |
|
55 | |||
51 | $ hg tglog |
|
56 | $ hg tglog | |
52 |
@ |
|
57 | @ 3: 'rename A' | |
|
58 | | | |||
|
59 | o 2: 'rename B' | |||
53 | | |
|
60 | | | |
54 | o 1: 'B' |
|
61 | o 1: 'B' | |
55 | | |
|
62 | | | |
@@ -59,11 +66,32 b' Rebase the revision containing the renam' | |||||
59 | Rename is not lost: |
|
66 | Rename is not lost: | |
60 |
|
67 | |||
61 | $ hg tlog -p --git -r tip |
|
68 | $ hg tlog -p --git -r tip | |
62 |
|
|
69 | 3: 'rename A' | |
63 | diff --git a/a b/a-renamed |
|
70 | diff --git a/a b/a-renamed | |
64 | rename from a |
|
71 | rename from a | |
65 | rename to a-renamed |
|
72 | rename to a-renamed | |
66 |
|
73 | |||
|
74 | ||||
|
75 | Rebased revision does not contain information about b (issue3739) | |||
|
76 | ||||
|
77 | $ hg log -r 3 --debug | |||
|
78 | changeset: 3:3b905b1064f14ace3ad02353b79dd42d32981655 | |||
|
79 | tag: tip | |||
|
80 | phase: draft | |||
|
81 | parent: 2:920a371a5635af23a26a011ca346cecd1cfcb942 | |||
|
82 | parent: -1:0000000000000000000000000000000000000000 | |||
|
83 | manifest: 3:c4a62b2b64593c8fe0523d4c1ba2e243a8bd4dce | |||
|
84 | user: test | |||
|
85 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
86 | files+: a-renamed | |||
|
87 | files-: a | |||
|
88 | extra: branch=default | |||
|
89 | extra: rebase_source=89af05cb38a281f891c6f5581dd027092da29166 | |||
|
90 | description: | |||
|
91 | rename A | |||
|
92 | ||||
|
93 | ||||
|
94 | ||||
67 | $ cd .. |
|
95 | $ cd .. | |
68 |
|
96 | |||
69 |
|
97 | |||
@@ -78,47 +106,75 b' Rename is not lost:' | |||||
78 | $ hg ci -Am B |
|
106 | $ hg ci -Am B | |
79 | adding b |
|
107 | adding b | |
80 |
|
108 | |||
81 | $ hg up -q -C 0 |
|
109 | $ hg cp b b-copied | |
|
110 | $ hg ci -Am 'copy B' | |||
|
111 | ||||
|
112 | $ hg up -q -C 1 | |||
82 |
|
113 | |||
83 | $ hg cp a a-copied |
|
114 | $ hg cp a a-copied | |
84 | $ hg ci -m 'copy A' |
|
115 | $ hg ci -m 'copy A' | |
85 | created new head |
|
116 | created new head | |
86 |
|
117 | |||
87 | $ hg tglog |
|
118 | $ hg tglog | |
88 |
@ |
|
119 | @ 3: 'copy A' | |
89 | | |
|
120 | | | |
90 |
| o |
|
121 | | o 2: 'copy B' | |
91 | |/ |
|
122 | |/ | |
|
123 | o 1: 'B' | |||
|
124 | | | |||
92 | o 0: 'A' |
|
125 | o 0: 'A' | |
93 |
|
126 | |||
94 | Copy is tracked: |
|
127 | Copy is tracked: | |
95 |
|
128 | |||
96 | $ hg tlog -p --git -r tip |
|
129 | $ hg tlog -p --git -r tip | |
97 |
|
|
130 | 3: 'copy A' | |
98 | diff --git a/a b/a-copied |
|
131 | diff --git a/a b/a-copied | |
99 | copy from a |
|
132 | copy from a | |
100 | copy to a-copied |
|
133 | copy to a-copied | |
101 |
|
134 | |||
102 | Rebase the revision containing the copy: |
|
135 | Rebase the revision containing the copy: | |
103 |
|
136 | |||
104 |
$ hg rebase -s |
|
137 | $ hg rebase -s 3 -d 2 | |
105 | saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob) |
|
138 | saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob) | |
106 |
|
139 | |||
107 | $ hg tglog |
|
140 | $ hg tglog | |
108 |
@ |
|
141 | @ 3: 'copy A' | |
|
142 | | | |||
|
143 | o 2: 'copy B' | |||
109 | | |
|
144 | | | |
110 | o 1: 'B' |
|
145 | o 1: 'B' | |
111 | | |
|
146 | | | |
112 | o 0: 'A' |
|
147 | o 0: 'A' | |
113 |
|
148 | |||
|
149 | ||||
114 | Copy is not lost: |
|
150 | Copy is not lost: | |
115 |
|
151 | |||
116 | $ hg tlog -p --git -r tip |
|
152 | $ hg tlog -p --git -r tip | |
117 |
|
|
153 | 3: 'copy A' | |
118 | diff --git a/a b/a-copied |
|
154 | diff --git a/a b/a-copied | |
119 | copy from a |
|
155 | copy from a | |
120 | copy to a-copied |
|
156 | copy to a-copied | |
121 |
|
157 | |||
|
158 | ||||
|
159 | Rebased revision does not contain information about b (issue3739) | |||
|
160 | ||||
|
161 | $ hg log -r 3 --debug | |||
|
162 | changeset: 3:98f6e6dbf45ab54079c2237fbd11066a5c41a11d | |||
|
163 | tag: tip | |||
|
164 | phase: draft | |||
|
165 | parent: 2:39e588434882ff77d01229d169cdc77f29e8855e | |||
|
166 | parent: -1:0000000000000000000000000000000000000000 | |||
|
167 | manifest: 3:2232f329d66fffe3930d43479ae624f66322b04d | |||
|
168 | user: test | |||
|
169 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
170 | files+: a-copied | |||
|
171 | extra: branch=default | |||
|
172 | extra: rebase_source=0a8162ff18a8900df8df8ef7ac0046955205613e | |||
|
173 | description: | |||
|
174 | copy A | |||
|
175 | ||||
|
176 | ||||
|
177 | ||||
122 | $ cd .. |
|
178 | $ cd .. | |
123 |
|
179 | |||
124 |
|
180 |
General Comments 0
You need to be logged in to leave comments.
Login now