##// END OF EJS Templates
commit: refactor salvage calculation to a different function...
Pulkit Goyal -
r46297:61454026 default
parent child Browse files
Show More
@@ -140,20 +140,29 b' def _prepare_files(tr, ctx, error=False,'
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):
General Comments 0
You need to be logged in to leave comments. Login now