3143 removed = [f for f in removed if f in m1 or f in m2] |
3144 removed = [f for f in removed if f in m1 or f in m2] |
3144 drop = sorted([f for f in removed if f in m]) |
3145 drop = sorted([f for f in removed if f in m]) |
3145 for f in drop: |
3146 for f in drop: |
3146 del m[f] |
3147 del m[f] |
3147 if p2.rev() != nullrev: |
3148 if p2.rev() != nullrev: |
3148 |
3149 rf = metadata.get_removal_filter(ctx, (p1, p2, m1, m2)) |
3149 @util.cachefunc |
3150 removed = [f for f in removed if not rf(f)] |
3150 def mas(): |
|
3151 p1n = p1.node() |
|
3152 p2n = p2.node() |
|
3153 cahs = self.changelog.commonancestorsheads(p1n, p2n) |
|
3154 if not cahs: |
|
3155 cahs = [nullrev] |
|
3156 return [self[r].manifest() for r in cahs] |
|
3157 |
|
3158 def deletionfromparent(f): |
|
3159 # When a file is removed relative to p1 in a merge, this |
|
3160 # function determines whether the absence is due to a |
|
3161 # deletion from a parent, or whether the merge commit |
|
3162 # itself deletes the file. We decide this by doing a |
|
3163 # simplified three way merge of the manifest entry for |
|
3164 # the file. There are two ways we decide the merge |
|
3165 # itself didn't delete a file: |
|
3166 # - neither parent (nor the merge) contain the file |
|
3167 # - exactly one parent contains the file, and that |
|
3168 # parent has the same filelog entry as the merge |
|
3169 # ancestor (or all of them if there two). In other |
|
3170 # words, that parent left the file unchanged while the |
|
3171 # other one deleted it. |
|
3172 # One way to think about this is that deleting a file is |
|
3173 # similar to emptying it, so the list of changed files |
|
3174 # should be similar either way. The computation |
|
3175 # described above is not done directly in _filecommit |
|
3176 # when creating the list of changed files, however |
|
3177 # it does something very similar by comparing filelog |
|
3178 # nodes. |
|
3179 if f in m1: |
|
3180 return f not in m2 and all( |
|
3181 f in ma and ma.find(f) == m1.find(f) |
|
3182 for ma in mas() |
|
3183 ) |
|
3184 elif f in m2: |
|
3185 return all( |
|
3186 f in ma and ma.find(f) == m2.find(f) |
|
3187 for ma in mas() |
|
3188 ) |
|
3189 else: |
|
3190 return True |
|
3191 |
|
3192 removed = [f for f in removed if not deletionfromparent(f)] |
|
3193 |
3151 |
3194 files = changed + removed |
3152 files = changed + removed |
3195 md = None |
3153 md = None |
3196 if not files: |
3154 if not files: |
3197 # if no "files" actually changed in terms of the changelog, |
3155 # if no "files" actually changed in terms of the changelog, |