##// END OF EJS Templates
copies: do not track backward copies, only renames (issue3739)...
Siddharth Agarwal -
r18136:f23dea2b default
parent child Browse files
Show More
@@ -145,12 +145,16 b' def _forwardcopies(a, b):'
145 145
146 146 return cm
147 147
148 def _backwardcopies(a, b):
149 # because the forward mapping is 1:n, we can lose renames here
150 # in particular, we find renames better than copies
148 def _backwardrenames(a, b):
149 # Even though we're not taking copies into account, 1:n rename situations
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 152 f = _forwardcopies(b, a)
152 153 r = {}
153 154 for k, v in f.iteritems():
155 # remove copies
156 if v in a:
157 continue
154 158 r[v] = k
155 159 return r
156 160
@@ -162,8 +166,8 b' def pathcopies(x, y):'
162 166 if a == x:
163 167 return _forwardcopies(x, y)
164 168 if a == y:
165 return _backwardcopies(x, y)
166 return _chain(x, y, _backwardcopies(x, a), _forwardcopies(a, y))
169 return _backwardrenames(x, y)
170 return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y))
167 171
168 172 def mergecopies(repo, c1, c2, ca):
169 173 """
@@ -670,7 +670,6 b' single copy'
670 670
671 671 % hg st -C --rev . --rev 0
672 672 M a
673 b
674 673 R b
675 674
676 675 % hg diff --git --rev . --rev 0
@@ -728,7 +727,6 b' single copy'
728 727
729 728 % hg st -C --rev . --rev 2
730 729 M a
731 b
732 730 A x/y
733 731 R b
734 732
@@ -1072,7 +1070,6 b' copy chain'
1072 1070
1073 1071 % hg st -C --rev . --rev 0
1074 1072 M a
1075 b
1076 1073 R b
1077 1074 R c
1078 1075
@@ -1148,7 +1145,6 b' copy chain'
1148 1145
1149 1146 % hg st -C --rev . --rev 2
1150 1147 M a
1151 b
1152 1148 A x/y
1153 1149 R b
1154 1150 R c
@@ -20,7 +20,10 b''
20 20 $ hg ci -Am B
21 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 28 $ hg mv a a-renamed
26 29
@@ -28,28 +31,32 b''
28 31 created new head
29 32
30 33 $ hg tglog
31 @ 2: 'rename A'
34 @ 3: 'rename A'
32 35 |
33 | o 1: 'B'
36 | o 2: 'rename B'
34 37 |/
38 o 1: 'B'
39 |
35 40 o 0: 'A'
36 41
37 42
38 43 Rename is tracked:
39 44
40 45 $ hg tlog -p --git -r tip
41 2: 'rename A'
46 3: 'rename A'
42 47 diff --git a/a b/a-renamed
43 48 rename from a
44 49 rename to a-renamed
45 50
46 51 Rebase the revision containing the rename:
47 52
48 $ hg rebase -s 2 -d 1
53 $ hg rebase -s 3 -d 2
49 54 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
50 55
51 56 $ hg tglog
52 @ 2: 'rename A'
57 @ 3: 'rename A'
58 |
59 o 2: 'rename B'
53 60 |
54 61 o 1: 'B'
55 62 |
@@ -59,11 +66,32 b' Rebase the revision containing the renam'
59 66 Rename is not lost:
60 67
61 68 $ hg tlog -p --git -r tip
62 2: 'rename A'
69 3: 'rename A'
63 70 diff --git a/a b/a-renamed
64 71 rename from a
65 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 95 $ cd ..
68 96
69 97
@@ -78,47 +106,75 b' Rename is not lost:'
78 106 $ hg ci -Am B
79 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 114 $ hg cp a a-copied
84 115 $ hg ci -m 'copy A'
85 116 created new head
86 117
87 118 $ hg tglog
88 @ 2: 'copy A'
119 @ 3: 'copy A'
89 120 |
90 | o 1: 'B'
121 | o 2: 'copy B'
91 122 |/
123 o 1: 'B'
124 |
92 125 o 0: 'A'
93 126
94 127 Copy is tracked:
95 128
96 129 $ hg tlog -p --git -r tip
97 2: 'copy A'
130 3: 'copy A'
98 131 diff --git a/a b/a-copied
99 132 copy from a
100 133 copy to a-copied
101 134
102 135 Rebase the revision containing the copy:
103 136
104 $ hg rebase -s 2 -d 1
137 $ hg rebase -s 3 -d 2
105 138 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
106 139
107 140 $ hg tglog
108 @ 2: 'copy A'
141 @ 3: 'copy A'
142 |
143 o 2: 'copy B'
109 144 |
110 145 o 1: 'B'
111 146 |
112 147 o 0: 'A'
113 148
149
114 150 Copy is not lost:
115 151
116 152 $ hg tlog -p --git -r tip
117 2: 'copy A'
153 3: 'copy A'
118 154 diff --git a/a b/a-copied
119 155 copy from a
120 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 178 $ cd ..
123 179
124 180
General Comments 0
You need to be logged in to leave comments. Login now