138 |
138 |
139 if writechangesetcopy: |
139 if writechangesetcopy: |
140 files.update_copies_from_p1(ctx.p1copies()) |
140 files.update_copies_from_p1(ctx.p1copies()) |
141 files.update_copies_from_p2(ctx.p2copies()) |
141 files.update_copies_from_p2(ctx.p2copies()) |
142 |
142 |
143 copy_sd = ctx.repo().filecopiesmode == b'changeset-sidedata' |
143 ms = mergestate.mergestate.read(repo) |
|
144 salvaged = _get_salvaged(ctx.repo(), ms, ctx) |
|
145 for s in salvaged: |
|
146 files.mark_salvaged(s) |
|
147 |
|
148 return mn, files |
|
149 |
|
150 |
|
151 def _get_salvaged(repo, ms, ctx): |
|
152 """ returns a list of salvaged files |
|
153 |
|
154 returns empty list if config option which process salvaged files are |
|
155 not enabled """ |
|
156 salvaged = [] |
|
157 copy_sd = repo.filecopiesmode == b'changeset-sidedata' |
144 if copy_sd and len(ctx.parents()) > 1: |
158 if copy_sd and len(ctx.parents()) > 1: |
145 # XXX this `mergestate.read` could be duplicated with a the merge state |
|
146 # reading in _process_files So we could refactor further to reuse it in |
|
147 # some cases. |
|
148 ms = mergestate.mergestate.read(repo) |
|
149 if ms.active(): |
159 if ms.active(): |
150 for fname in sorted(ms._stateextras.keys()): |
160 for fname in sorted(ms._stateextras.keys()): |
151 might_removed = ms.extras(fname).get(b'merge-removal-candidate') |
161 might_removed = ms.extras(fname).get(b'merge-removal-candidate') |
152 if might_removed == b'yes': |
162 if might_removed == b'yes': |
153 if fname in ctx: |
163 if fname in ctx: |
154 files.mark_salvaged(fname) |
164 salvaged.append(fname) |
155 |
165 return salvaged |
156 return mn, files |
|
157 |
166 |
158 |
167 |
159 def _process_files(tr, ctx, error=False): |
168 def _process_files(tr, ctx, error=False): |
160 repo = ctx.repo() |
169 repo = ctx.repo() |
161 p1 = ctx.p1() |
170 p1 = ctx.p1() |